Grokbase
x

[PATCH] More consting, and putting stuff in embed.fnc

View TopicPrint | Flat  Thread  Threaded
1) Andy Lester I haven't synced up in a while, so here ya go. Most of it is the standard consting and localizing...
paperclip | +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
I haven't synced up in a while, so here ya go.  Most of it is the
standard consting and localizing that I always do.  A couple of notes:

* embed.fnc: Added some funcs that were declared static elsewhere.
These functions are now S_-prefixed.  make regen is necessary.

* pp_ctl.c: Fixed a #if/#else pair so that the variant part is
self-contained, and the parens match up.

* toke.c: Reduced a couple of calls to yyerror().  Also inlined a couple
of error message variables that were used only once each.

* utf8.c: In Perl_pv_uni_display(), removed an unnecessary check of a
flag, which was always true at the time of execution.

xoxo,
Andy



--
Andy Lester => [email protected: a...@petdance.com] => www.petdance.com => AIM:petdance

Attachment: cold-spell.patch
2) Vadim I have very small fu on internals, so I could be missing something obvious, and following I can't...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On Mon, 2005-12-05 at 22:46, Andy Lester wrote:
> I haven't synced up in a while, so here ya go. Most of it is the
> standard consting and localizing that I always do. A couple of notes:

I have very small fu on internals, so I could be missing something
obvious, and following I can't understand:

your patch contains many updates of kind

     UV      seq;
-    sequence(aTHX_ o);
+    sequence(o);

(so you get rid of aTHX_)

but then you do not get rid of pTHX at declarations of functions:

STATIC void
-sequence(pTHX_ register const OP *o)
+S_sequence(pTHX_ register const OP *o)
{
     dVAR;


??

Vadim.
3) Andy Lester That's correct. The definition of the function still needs that pTHX or pTHX_. xoxo, Andy
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On Mon, Dec 05, 2005 at 11:33:01PM +0300, Vadim Konovalov ([email protected: v...@vkonovalov.ru]) wrote:
> but then you do not get rid of pTHX at declarations of functions:
>
>  STATIC void
> -sequence(pTHX_ register const OP *o)
> +S_sequence(pTHX_ register const OP *o)

That's correct.  The definition of the function still needs that pTHX or
pTHX_.

xoxo,
Andy

--
Andy Lester => [email protected: a...@petdance.com] => www.petdance.com => AIM:petdance
4) Jim Cromie I note that this embe-definition is only available in dump.c .. @@ -1271,6 +1274,8 @@ Es |void...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Andy Lester wrote:

>On Mon, Dec 05, 2005 at 11:33:01PM +0300, Vadim Konovalov ([email protected: v...@vkonovalov.ru]) wrote:
>  
>
>>but then you do not get rid of pTHX at declarations of functions:
>>
>> STATIC void
>>-sequence(pTHX_ register const OP *o)
>>+S_sequence(pTHX_ register const OP *o)
>>    
>>
>
>That's correct. The definition of the function still needs that pTHX or
>pTHX_.
>
>xoxo,
>Andy
>
>  
>

I note that this embe-definition is only available in dump.c ..

@@ -1271,6 +1274,8 @@ Es |void |to_byte_substr |NN regexp * pr
#if defined(PERL_IN_DUMP_C) || defined(PERL_DECL_PROT)
s |CV* |deb_curcv |I32 ix
s |void |debprof |NN const OP *o
+s |void |sequence |NULLOK const OP *o
+s |UV |sequence_num |NULLOK const OP *o
#endif


Is this  *the way* to share small bits of interface between
parts of core ?   

In this case, the 'sharing' is pretty limited,
essentially an automatic/neatly-tucked-away macro definition thats
only available in the same file as the function being adapted.





Im looking for the right way of exposing, say,

union arena* get_arena(pTHX);

from sv.c, where its (to be) implemented, to hv.c, where it
would get used by S_more_he()

where
union arena {
double alignthis;
char data[PERL_MEM_SIZE];
};

would be defd in sv.c, and 'opaque' to hv.c,
but treated like the block of mem it is (ie carved into HEs).

NB. code above exists, but gets weird failures on some Smoke configs.


thx
jimc
5) Rafael Garcia-Suarez Thanks, applied as change #26281, except one chunk (!) that triggers a warning : --- hv.c +++ hv.c...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Andy Lester wrote:
> I haven't synced up in a while, so here ya go. Most of it is the
> standard consting and localizing that I always do.

Thanks, applied as change #26281, except one chunk (!) that
triggers a warning :

--- hv.c
+++ hv.c
@@ -1011,7 +1011,7 @@
  return Nullsv;

     if (is_utf8) {
- const char *keysave = key;
+ char * const keysave = key;
  key = (char*)bytes_from_utf8((U8*)key, &klen, &is_utf8);

         if (is_utf8)
spacer
View TopicPrint | Flat  Thread  Threaded
Home > Groups > Perl 5 Porters > [PATCH] More consting, and putting stuff in embed.fnc (5 posts)