From: Gurusamy Sarathy Date: Wed, 8 Dec 1999 02:22:31 +0000 (+0000) Subject: introduce save_I8() for saving byte values X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e8347627432a616ec1485de221b2cd8c9e311c8b;p=p5sagit%2Fp5-mst-13.2.git introduce save_I8() for saving byte values p4raw-id: //depot/perl@4665 --- diff --git a/embed.h b/embed.h index b5c1816..2250cc7 100644 --- a/embed.h +++ b/embed.h @@ -561,6 +561,7 @@ #define save_hptr Perl_save_hptr #define save_I16 Perl_save_I16 #define save_I32 Perl_save_I32 +#define save_I8 Perl_save_I8 #define save_int Perl_save_int #define save_item Perl_save_item #define save_iv Perl_save_iv @@ -1957,6 +1958,7 @@ #define save_hptr(a) Perl_save_hptr(aTHX_ a) #define save_I16(a) Perl_save_I16(aTHX_ a) #define save_I32(a) Perl_save_I32(aTHX_ a) +#define save_I8(a) Perl_save_I8(aTHX_ a) #define save_int(a) Perl_save_int(aTHX_ a) #define save_item(a) Perl_save_item(aTHX_ a) #define save_iv(a) Perl_save_iv(aTHX_ a) @@ -3834,6 +3836,8 @@ #define save_I16 Perl_save_I16 #define Perl_save_I32 CPerlObj::Perl_save_I32 #define save_I32 Perl_save_I32 +#define Perl_save_I8 CPerlObj::Perl_save_I8 +#define save_I8 Perl_save_I8 #define Perl_save_int CPerlObj::Perl_save_int #define save_int Perl_save_int #define Perl_save_item CPerlObj::Perl_save_item diff --git a/embed.pl b/embed.pl index ed29faa..3466cd1 100755 --- a/embed.pl +++ b/embed.pl @@ -1606,6 +1606,7 @@ p |void |save_hints p |void |save_hptr |HV** hptr p |void |save_I16 |I16* intp p |void |save_I32 |I32* intp +p |void |save_I8 |I8* bytep p |void |save_int |int* intp p |void |save_item |SV* item p |void |save_iv |IV* iv diff --git a/global.sym b/global.sym index 1eca0c1..2cb0e11 100644 --- a/global.sym +++ b/global.sym @@ -479,6 +479,7 @@ Perl_save_hints Perl_save_hptr Perl_save_I16 Perl_save_I32 +Perl_save_I8 Perl_save_int Perl_save_item Perl_save_iv diff --git a/objXSUB.h b/objXSUB.h index 6a7d171..e9e9114 100644 --- a/objXSUB.h +++ b/objXSUB.h @@ -2727,6 +2727,10 @@ #define Perl_save_I32 pPerl->Perl_save_I32 #undef save_I32 #define save_I32 Perl_save_I32 +#undef Perl_save_I8 +#define Perl_save_I8 pPerl->Perl_save_I8 +#undef save_I8 +#define save_I8 Perl_save_I8 #undef Perl_save_int #define Perl_save_int pPerl->Perl_save_int #undef save_int diff --git a/perlapi.c b/perlapi.c index 935085a..3f52e8f 100644 --- a/perlapi.c +++ b/perlapi.c @@ -3441,6 +3441,13 @@ Perl_save_I32(pTHXo_ I32* intp) ((CPerlObj*)pPerl)->Perl_save_I32(intp); } +#undef Perl_save_I8 +void +Perl_save_I8(pTHXo_ I8* bytep) +{ + ((CPerlObj*)pPerl)->Perl_save_I8(bytep); +} + #undef Perl_save_int void Perl_save_int(pTHXo_ int* intp) diff --git a/proto.h b/proto.h index f489870..c49e606 100644 --- a/proto.h +++ b/proto.h @@ -559,6 +559,7 @@ PERL_CALLCONV void Perl_save_hints(pTHX); PERL_CALLCONV void Perl_save_hptr(pTHX_ HV** hptr); PERL_CALLCONV void Perl_save_I16(pTHX_ I16* intp); PERL_CALLCONV void Perl_save_I32(pTHX_ I32* intp); +PERL_CALLCONV void Perl_save_I8(pTHX_ I8* bytep); PERL_CALLCONV void Perl_save_int(pTHX_ int* intp); PERL_CALLCONV void Perl_save_item(pTHX_ SV* item); PERL_CALLCONV void Perl_save_iv(pTHX_ IV* iv); diff --git a/regcomp.c b/regcomp.c index 0d6b581..0a76384 100644 --- a/regcomp.c +++ b/regcomp.c @@ -3518,7 +3518,7 @@ Perl_save_re_context(pTHX) SAVEVPTR(PL_regendp); /* Ditto for endp. */ SAVEVPTR(PL_reglastparen); /* Similarly for lastparen. */ SAVEPPTR(PL_regtill); /* How far we are required to go. */ - SAVEI32(PL_regprev); /* char before regbol, \n if none */ + SAVEI8(PL_regprev); /* char before regbol, \n if none */ SAVEVPTR(PL_reg_start_tmp); /* from regexec.c */ PL_reg_start_tmp = 0; SAVEFREEPV(PL_reg_start_tmp); diff --git a/regexec.c b/regexec.c index 333f842..cce1166 100644 --- a/regexec.c +++ b/regexec.c @@ -1632,12 +1632,12 @@ S_regtry(pTHX_ regexp *prog, char *startpos) PerlIO_printf(Perl_debug_log, " setting stack tmpbase at %"IVdf"\n", (IV)(PL_stack_sp - PL_stack_base)); )); - SAVEINT(cxstack[cxstack_ix].blk_oldsp); + SAVEI32(cxstack[cxstack_ix].blk_oldsp); cxstack[cxstack_ix].blk_oldsp = PL_stack_sp - PL_stack_base; /* Otherwise OP_NEXTSTATE will free whatever on stack now. */ SAVETMPS; /* Apparently this is not needed, judging by wantarray. */ - /* SAVEINT(cxstack[cxstack_ix].blk_gimme); + /* SAVEI8(cxstack[cxstack_ix].blk_gimme); cxstack[cxstack_ix].blk_gimme = G_SCALAR; */ if (PL_reg_sv) { diff --git a/scope.c b/scope.c index c0559da..7052282 100644 --- a/scope.c +++ b/scope.c @@ -405,6 +405,16 @@ Perl_save_I16(pTHX_ I16 *intp) } void +Perl_save_I8(pTHX_ I8 *bytep) +{ + dTHR; + SSCHECK(3); + SSPUSHINT(*bytep); + SSPUSHPTR(bytep); + SSPUSHINT(SAVEt_I8); +} + +void Perl_save_iv(pTHX_ IV *ivp) { dTHR; @@ -751,6 +761,10 @@ Perl_leave_scope(pTHX_ I32 base) ptr = SSPOPPTR; *(I16*)ptr = (I16)SSPOPINT; break; + case SAVEt_I8: /* I8 reference */ + ptr = SSPOPPTR; + *(I8*)ptr = (I8)SSPOPINT; + break; case SAVEt_IV: /* IV reference */ ptr = SSPOPPTR; *(IV*)ptr = (IV)SSPOPIV; diff --git a/scope.h b/scope.h index 330467f..6944630 100644 --- a/scope.h +++ b/scope.h @@ -30,6 +30,7 @@ #define SAVEt_GENERIC_SVREF 29 #define SAVEt_DESTRUCTOR_X 30 #define SAVEt_VPTR 31 +#define SAVEt_I8 32 #define SSCHECK(need) if (PL_savestack_ix + need > PL_savestack_max) savestack_grow() #define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i)) @@ -71,6 +72,7 @@ * Not using SOFT_CAST on SAVESPTR, SAVEGENERICSV and SAVEFREESV * because these are used for several kinds of pointer values */ +#define SAVEI8(i) save_I8(SOFT_CAST(I8*)&(i)) #define SAVEI16(i) save_I16(SOFT_CAST(I16*)&(i)) #define SAVEI32(i) save_I32(SOFT_CAST(I32*)&(i)) #define SAVEINT(i) save_int(SOFT_CAST(int*)&(i)) diff --git a/sv.c b/sv.c index fa32878..20aa1b0 100644 --- a/sv.c +++ b/sv.c @@ -6379,12 +6379,8 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl) TOPLONG(nss,ix) = longval; break; case SAVEt_I32: /* I32 reference */ - ptr = POPPTR(ss,ix); - TOPPTR(nss,ix) = any_dup(ptr, proto_perl); - i = POPINT(ss,ix); - TOPINT(nss,ix) = i; - break; case SAVEt_I16: /* I16 reference */ + case SAVEt_I8: /* I8 reference */ ptr = POPPTR(ss,ix); TOPPTR(nss,ix) = any_dup(ptr, proto_perl); i = POPINT(ss,ix);