From: Nicholas Clark Date: Tue, 24 Apr 2007 23:10:05 +0000 (+0000) Subject: Make PL_uudmap a constant global. Remove the run time initialisation X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9444d2138b6b5264fb9381e43188986db5564e80;p=p5sagit%2Fp5-mst-13.2.git Make PL_uudmap a constant global. Remove the run time initialisation code, and instead use it to generate a header at perl build time. By removing uudmap from the interpreter structure we save 256 bytes per child thread. p4raw-id: //depot/perl@31059 --- diff --git a/MANIFEST b/MANIFEST index d19974e..6c0959e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1270,6 +1270,7 @@ ext/XS/Typemap/Typemap.xs XS::Typemap extension fakesdio.h stdio in terms of PerlIO fakethr.h Fake threads header form.h Public declarations for formats +generate_uudmap.c Generate uudmap.h, the uuencode decoding map genpacksizetables.pl Generate the size tables for pack/unpack globals.c File to declare global symbols (for shared library) global.sym Symbols that need hiding when embedded diff --git a/Makefile.SH b/Makefile.SH index 5d51410..3d8cae0 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -483,6 +483,14 @@ opmini.c: op.c opmini\$(OBJ_EXT): opmini.c \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c +globals\$(OBJ_EXT): uudmap.h + +uudmap.h: generate_uudmap\$(EXE_EXT) + ./generate_uudmap\$(EXE_EXT) >uudmap.h + +generate_uudmap\$(EXE_EXT): generate_uudmap\$(OBJ_EXT) + \$(CC) -o generate_uudmap \$(LDFLAGS) generate_uudmap\$(OBJ_EXT) \$(libs) + !GROK!THIS! $spitshell >>Makefile <<'!NO!SUBS!' miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h @@ -1048,7 +1056,7 @@ veryclean: _verycleaner _mopup _clobber # Do not 'make _mopup' directly. _mopup: - rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c + rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c uudmap.h generate_uudmap$(EXE_EXT) -rmdir .depending -@test -f extra.pods && rm -f `cat extra.pods` -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod diff --git a/embedvar.h b/embedvar.h index 9c53978..e55941a 100644 --- a/embedvar.h +++ b/embedvar.h @@ -377,7 +377,6 @@ #define PL_utf8_xdigit (vTHX->Iutf8_xdigit) #define PL_utf8cache (vTHX->Iutf8cache) #define PL_utf8locale (vTHX->Iutf8locale) -#define PL_uudmap (vTHX->Iuudmap) #define PL_warnhook (vTHX->Iwarnhook) #define PL_xmlfp (vTHX->Ixmlfp) @@ -642,7 +641,6 @@ #define PL_Iutf8_xdigit PL_utf8_xdigit #define PL_Iutf8cache PL_utf8cache #define PL_Iutf8locale PL_utf8locale -#define PL_Iuudmap PL_uudmap #define PL_Iwarnhook PL_warnhook #define PL_Ixmlfp PL_xmlfp diff --git a/intrpvar.h b/intrpvar.h index 751784c..4c56f9b 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -391,7 +391,6 @@ PERLVARI(Iglob_index, int, 0) PERLVAR(Iparser, yy_parser *) /* current parser state */ -PERLVARA(Iuudmap,256, char) PERLVAR(Ibitcount, char *) PERLVAR(Ipsig_ptr, SV**) diff --git a/perl.h b/perl.h index b22a3f7..51155f0 100644 --- a/perl.h +++ b/perl.h @@ -4058,11 +4058,14 @@ EXTCONST char PL_memory_wrap[] EXTCONST char PL_uuemap[65] INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"); - #ifdef DOINIT +EXTCONST char PL_uudmap[256] = +#include "uudmap.h" +; EXTCONST char* const PL_sig_name[] = { SIG_NAME }; EXTCONST int PL_sig_num[] = { SIG_NUM }; #else +EXTCONST char PL_uudmap[256]; EXTCONST char* const PL_sig_name[]; EXTCONST int PL_sig_num[]; #endif diff --git a/perlapi.h b/perlapi.h index 11eabbc..177257a 100644 --- a/perlapi.h +++ b/perlapi.h @@ -632,8 +632,6 @@ END_EXTERN_C #define PL_utf8cache (*Perl_Iutf8cache_ptr(aTHX)) #undef PL_utf8locale #define PL_utf8locale (*Perl_Iutf8locale_ptr(aTHX)) -#undef PL_uudmap -#define PL_uudmap (*Perl_Iuudmap_ptr(aTHX)) #undef PL_warnhook #define PL_warnhook (*Perl_Iwarnhook_ptr(aTHX)) #undef PL_xmlfp diff --git a/pp_pack.c b/pp_pack.c index 8e49932..7aa95a9 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -2082,22 +2082,6 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c break; #endif case 'u': - /* MKS: - * Initialise the decode mapping. By using a table driven - * algorithm, the code will be character-set independent - * (and just as fast as doing character arithmetic) - */ - if (PL_uudmap[(U8)'M'] == 0) { - size_t i; - - for (i = 0; i < sizeof(PL_uuemap); ++i) - PL_uudmap[(U8)PL_uuemap[i]] = i; - /* - * Because ' ' and '`' map to the same value, - * we need to decode them both the same. - */ - PL_uudmap[(U8)' '] = 0; - } { const STRLEN l = (STRLEN) (strend - s) * 3 / 4; sv = sv_2mortal(newSV(l)); diff --git a/sv.c b/sv.c index c49f478..879aec9 100644 --- a/sv.c +++ b/sv.c @@ -11322,7 +11322,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, PL_glob_index = proto_perl->Iglob_index; PL_srand_called = proto_perl->Isrand_called; - PL_uudmap[(U32) 'M'] = 0; /* reinits on demand */ PL_bitcount = NULL; /* reinits on demand */ if (proto_perl->Ipsig_pend) { diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index ee831e6..2602bb9 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -464,6 +464,14 @@ $(DBG)perl$(E) : perlmain$(O), $(DBG)perlshr$(E), $(MINIPERL_EXE) $(DBG)perlshr$(E) : $(DBG)libperl$(OLB) $(extobj) $(DBG)perlshr_xtras.ts Link $(LINKFLAGS)/Share=$(MMS$TARGET) $(extobj) []$(DBG)perlshr_bld.opt/Option, perlshr_attr.opt/Option +globals$(O): uudmap.h + +uudmap.h: generate_uudmap.exe + MCR generate_uudmap.exe >uudmap.h + +generate_uudmap.exe: generate_uudmap$(O) + Link $(LINKFLAGS)/NoDebug/Trace/NoMap/NoFull/NoCross/Exe=$(MMS$TARGET) generate_uudmap$(O) $(CRTLOPTS) + # The following files are built in one go by gen_shrfls.pl: # perlshr_attr.opt, $(DBG)perlshr_bld.opt - VAX and AXP # perlshr_gbl*.mar, perlshr_gbl*$(O) - VAX only @@ -1748,6 +1756,9 @@ tidy : cleanlis - If F$Search("vmsish.h;-1").nes."" Then Purge/NoConfirm/Log vmsish.h - If F$Search("vms.c;-1") .nes."" Then Purge/NoConfirm/Log vms.c - If F$Search("perlmain.c;-1") .nes."" Then Purge/NoConfirm/Log perlmain.c + - If F$Search("uudmap.h;-1") .nes."" Then Purge/NoConfirm/Log uudmap.h + - If F$Search("generate_uudmap.exe;-1") .nes."" Then Purge/NoConfirm/Log generate_uudmap.exe + - If F$Search("generate_uudmap$(O);-1") .nes."" Then Purge/NoConfirm/Log generate_uudmap$(O) - If F$Search("Perlshr_Gbl*.Mar;-1") .nes."" Then Purge/NoConfirm/Log Perlshr_Gbl*.Mar - If F$Search("[.ext.DynaLoader]dl_vms$(O);-1").nes."" Then Purge/NoConfirm/Log [.ext.DynaLoader]dl_vms$(O) - If F$Search("[.ext.DynaLoader]dl_vms.c;-1").nes."" Then Purge/NoConfirm/Log [.ext.DynaLoader]dl_vms.c diff --git a/win32/Makefile b/win32/Makefile index d654fae..f189cc8 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -957,6 +957,15 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ) << $(EMBED_EXE_MANI) +globals$(o) : uudmap.h + +uudmap.h: generate_uudmap.exe + generate_uudmap >uudmap.h + +generate_uudmap.exe : generate_uudmap$(o) + $(LINK32) -subsystem:console -out:$@ @<< + $(LINK_FLAGS) $(LIBFILES) generate_uudmap$(o) + perlmain.c : runperl.c copy runperl.c perlmain.c @@ -1274,6 +1283,7 @@ _clean : -@$(DEL) $(PERLSTATICLIB) -@$(DEL) $(PERLDLL) -@$(DEL) $(CORE_OBJ) + -@$(DEL) generate_uudmap.exe generate_uudmap$(o) uudmap.h -if exist $(MINIDIR) rmdir /s /q $(MINIDIR) -if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1) -if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2) diff --git a/win32/makefile.mk b/win32/makefile.mk index d632b16..069e883 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1266,6 +1266,23 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ) $(EMBED_EXE_MANI) .ENDIF +globals$(o) : uudmap.h + +uudmap.h: generate_uudmap.exe + generate_uudmap >uudmap.h + +generate_uudmap.exe : generate_uudmap$(o) +.IF "$(CCTYPE)" == "BORLAND" + $(LINK32) -Tpe -ap $(BLINK_FLAGS) \ + @$(mktmp c0x32$(o) generate_uudmap$(o),$(@:s,\,$B,),,$(LIBFILES),) +.ELIF "$(CCTYPE)" == "GCC" + $(LINK32) -v -o $@ $(BLINK_FLAGS) \ + $(mktmp $(LKPRE) generate_uudmap$(o) $(LIBFILES) $(LKPOST)) +.ELSE + $(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) \ + @$(mktmp $(LIBFILES) generate_uudmap$(o)) +.ENDIF + perlmain.c : runperl.c copy runperl.c perlmain.c @@ -1605,6 +1622,7 @@ _clean : -@erase $(PERLSTATICLIB) -@erase $(PERLDLL) -@erase $(CORE_OBJ) + -@erase generate_uudmap.exe generate_uudmap$(o) uudmap.h -if exist $(MINIDIR) rmdir /s /q $(MINIDIR) -if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1) -if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2)