diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-04-24 23:10:05 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-04-24 23:10:05 +0000 |
commit | 9444d2138b6b5264fb9381e43188986db5564e80 (patch) | |
tree | c56e68d0cadd5c59c7f243be82a7cef277d14b40 | |
parent | bdc0bf6fc8e477f7c30b05ea4c2ff791dd0f31af (diff) | |
download | perl-9444d2138b6b5264fb9381e43188986db5564e80.tar.gz |
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
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | Makefile.SH | 10 | ||||
-rw-r--r-- | embedvar.h | 2 | ||||
-rw-r--r-- | intrpvar.h | 1 | ||||
-rw-r--r-- | perl.h | 5 | ||||
-rw-r--r-- | perlapi.h | 2 | ||||
-rw-r--r-- | pp_pack.c | 16 | ||||
-rw-r--r-- | sv.c | 1 | ||||
-rw-r--r-- | vms/descrip_mms.template | 11 | ||||
-rw-r--r-- | win32/Makefile | 10 | ||||
-rw-r--r-- | win32/makefile.mk | 18 |
11 files changed, 53 insertions, 24 deletions
@@ -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 5d514104e7..3d8cae0ffc 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 9c539781ce..e55941a723 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 751784c4f3..4c56f9bf08 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**) @@ -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 @@ -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 @@ -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)); @@ -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 ee831e6c22..2602bb952d 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 d654faeebe..f189cc8db6 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 d632b16a7f..069e8834ff 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) |