In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/eeb6b84165f37835a92b974fba01c7e4bbf9fe3f?hp=7c509e8a1cdc2eb305c87d3b26dce38c106b3ae2>
- Log ----------------------------------------------------------------- commit eeb6b84165f37835a92b974fba01c7e4bbf9fe3f Author: Nicholas Clark <[email protected]> Date: Mon May 2 21:22:08 2011 +0100 Re-order perlvars.h to group related variables, and spread mutexes out. Move variables smaller than pointers into groups, to avoid holes in the structure for PERL_GLOBAL_STRUCT. Spreading the mutexes out tries to keep them off the same cache lines, which may help slightly on multi-processor machines. M perlvars.h commit fdad75c9cae2c7f7e25668fd30cd60ca14d5a32c Author: Nicholas Clark <[email protected]> Date: Mon May 2 20:24:25 2011 +0100 PL_perlio_mutex is only needed with USE_UIHREADS && USE_PERLIO (Not that Configure will let you configure with ithreads but without perlio) M perlvars.h commit 8bf206230526c0a7639d6ffe1a763ac4e70153a0 Author: Nicholas Clark <[email protected]> Date: Mon May 2 17:51:11 2011 +0100 Change PL_use_safe_putenv from int to bool. It is only ever checked for truth/falsehood, and all assignments to it (in core and on CPAN) are either 0 or 1. M miniperlmain.c M perlvars.h commit af2f0da9b8621f5cc241f5664bcecd0fbd8865b2 Author: Nicholas Clark <[email protected]> Date: Mon May 2 15:02:57 2011 +0100 Move PL_runops_{std,dbg} to perl.h, and make them const. They exist solely to ensure that Perl_runops_standard and Perl_runops_debug are linked in - nothing assigns to either variable, and nothing reads them. M embedvar.h M globvar.sym M perl.h M perlapi.h M perlvars.h commit 724cf8d623675450a9b7be794b6b3917972e83f8 Author: Nicholas Clark <[email protected]> Date: Sun May 1 22:12:15 2011 +0100 Move PL_global_struct_size, PL_interp_size{,_5_16_0} to perl.h Make them const U16 - they should have been const from the start. M embedvar.h M globvar.sym M perl.h M perlapi.h M perlvars.h commit 9e08d3a49aaebdf17eb8671b022395f689827205 Author: Nicholas Clark <[email protected]> Date: Sun May 1 21:13:01 2011 +0100 In perlvar.h, move the always-present globals above those conditionally compiled Rename PL_interp_size_5_10_0 to PL_interp_size_5_16_0, as it is only intended to track interpreter size within (forwards) binary compatible maintenance branches. M embedvar.h M intrpvar.h M makedef.pl M perlapi.h M perlvars.h commit 457c538539eca0f3c596861d7d14ab0c0e9ee438 Author: Nicholas Clark <[email protected]> Date: Sun May 1 14:39:31 2011 +0100 Move PL_{revision,version,subversion} to perl.h, making them const U8. To get the initialisation to work, the location of #include patchlevel.h needs to be moved. M embedvar.h M globvar.sym M perl.h M perlapi.h M perlvars.h commit 0447859b8a048144ae0ece76a2f7595840942fcb Author: Nicholas Clark <[email protected]> Date: Sun May 1 12:25:58 2011 +0100 Move PL_sh_path to perl.h (except for OS/2), as it's const char[] On OS/2, keep it in perlvars.h, as it's not const there. makedef.pl doesn't pay attention to C pre-processor symbols, so it will always see the declaration in perlvars.h, and add the symbol to the linker file, so no need to mention sh_path in globvar.sym. Add special case logic in regen/embed.pl to make the embedvar.h macros for PL_sh_path defined only on OS/2. M embedvar.h M perl.h M perlvars.h M regen/embed.pl commit 58f645e20791a7788fcb38189895a712d5c53419 Author: Nicholas Clark <[email protected]> Date: Sat Apr 30 23:01:07 2011 +0100 Move PL_{No,Yes,hexdigit} from perlvars.h to perl.h, as all are const char[] They were converted in perl.h from const char[] to #define in 31fb120917c4f65d, then re-instated as const char[], but in perlvars.h, in 3fe35a814d0a98f4. There's no need for compile-time constants to jump through the hoops of perlvars.h, even for Symbian, as the various "EXTCONST" variables already in perl.h demonstrate. These were the only 3 users of the the PERLVARISC macro, so eliminate that, and all related code. M embedvar.h M globvar.sym M perl.h M perlapi.c M perlapi.h M perlvars.h M regen/embed.pl M util.c commit 8790f825d5f6ff0beed9873a34e145cf35e3ce5c Author: Nicholas Clark <[email protected]> Date: Sat Apr 30 21:49:03 2011 +0100 Eliminate PL_patleave, unused since perl 5.0 alpha 2. patleave was added in perl 3.0 patch #35 patch #29 -- 395c379347344a50, used in scanpat(). scanpat() was refactored and renamed to scan_pat() in 5.0 alpha 2, "commented" out with the C pre-processor in 5.000, and removed in 5.001. M embedvar.h M perlapi.h M perlvars.h commit 8c1cc0174d3700e1f36bbe55f4021b04bf11aa77 Author: Nicholas Clark <[email protected]> Date: Sat Apr 30 16:10:20 2011 +0100 Move the temporary definitions for PERLVAR* macros inside #ifdef MULTIPLICITY Under MULTIPLICITY, intrpvar.h is included "early", as: struct interpreter { # include "intrpvar.h" }; with local definitions of PERLVAR{,A,I,IS,ISC} that generate output text for the "variables" as structure members. Additionally, under PERL_GLOBAL_STRUCT "perlvars.h" is included within struct perl_vars { ... }. Move the definition/undefining of these 5 macros to within the #ifdef MULTIPLICITY block, to clarify the limited intent of their scope. Move some additional related PERL_GLOBAL_STRUCT setup to within the block. M perl.h ----------------------------------------------------------------------- Summary of changes: embedvar.h | 40 ++-------------- globvar.sym | 11 ++++ intrpvar.h | 47 +++++++++--------- makedef.pl | 2 +- miniperlmain.c | 2 +- perl.h | 148 ++++++++++++++++++++++++++++++++++++++------------------ perlapi.c | 4 -- perlapi.h | 30 ----------- perlvars.h | 130 +++++++++++++++--------------------------------- regen/embed.pl | 16 ++---- util.c | 3 - 11 files changed, 186 insertions(+), 247 deletions(-) diff --git a/embedvar.h b/embedvar.h index 85d7af5..a540fd6 100644 --- a/embedvar.h +++ b/embedvar.h @@ -709,10 +709,6 @@ #if defined(PERL_GLOBAL_STRUCT) -#define PL_No (my_vars->GNo) -#define PL_GNo (my_vars->GNo) -#define PL_Yes (my_vars->GYes) -#define PL_GYes (my_vars->GYes) #define PL_appctx (my_vars->Gappctx) #define PL_Gappctx (my_vars->Gappctx) #define PL_check (my_vars->Gcheck) @@ -727,16 +723,8 @@ #define PL_Gdollarzero_mutex (my_vars->Gdollarzero_mutex) #define PL_fold_locale (my_vars->Gfold_locale) #define PL_Gfold_locale (my_vars->Gfold_locale) -#define PL_global_struct_size (my_vars->Gglobal_struct_size) -#define PL_Gglobal_struct_size (my_vars->Gglobal_struct_size) -#define PL_hexdigit (my_vars->Ghexdigit) -#define PL_Ghexdigit (my_vars->Ghexdigit) #define PL_hints_mutex (my_vars->Ghints_mutex) #define PL_Ghints_mutex (my_vars->Ghints_mutex) -#define PL_interp_size (my_vars->Ginterp_size) -#define PL_Ginterp_size (my_vars->Ginterp_size) -#define PL_interp_size_5_10_0 (my_vars->Ginterp_size_5_10_0) -#define PL_Ginterp_size_5_10_0 (my_vars->Ginterp_size_5_10_0) #define PL_keyword_plugin (my_vars->Gkeyword_plugin) #define PL_Gkeyword_plugin (my_vars->Gkeyword_plugin) #define PL_malloc_mutex (my_vars->Gmalloc_mutex) @@ -753,8 +741,6 @@ #define PL_Gop_seq (my_vars->Gop_seq) #define PL_op_sequence (my_vars->Gop_sequence) #define PL_Gop_sequence (my_vars->Gop_sequence) -#define PL_patleave (my_vars->Gpatleave) -#define PL_Gpatleave (my_vars->Gpatleave) #define PL_perlio_debug_fd (my_vars->Gperlio_debug_fd) #define PL_Gperlio_debug_fd (my_vars->Gperlio_debug_fd) #define PL_perlio_fd_refcnt (my_vars->Gperlio_fd_refcnt) @@ -765,14 +751,10 @@ #define PL_Gperlio_mutex (my_vars->Gperlio_mutex) #define PL_ppaddr (my_vars->Gppaddr) #define PL_Gppaddr (my_vars->Gppaddr) -#define PL_revision (my_vars->Grevision) -#define PL_Grevision (my_vars->Grevision) -#define PL_runops_dbg (my_vars->Grunops_dbg) -#define PL_Grunops_dbg (my_vars->Grunops_dbg) -#define PL_runops_std (my_vars->Grunops_std) -#define PL_Grunops_std (my_vars->Grunops_std) +#ifdef OS2 #define PL_sh_path (my_vars->Gsh_path) #define PL_Gsh_path (my_vars->Gsh_path) +#endif #define PL_sig_defaulting (my_vars->Gsig_defaulting) #define PL_Gsig_defaulting (my_vars->Gsig_defaulting) #define PL_sig_handlers_initted (my_vars->Gsig_handlers_initted) @@ -783,8 +765,6 @@ #define PL_Gsig_trapped (my_vars->Gsig_trapped) #define PL_sigfpe_saved (my_vars->Gsigfpe_saved) #define PL_Gsigfpe_saved (my_vars->Gsigfpe_saved) -#define PL_subversion (my_vars->Gsubversion) -#define PL_Gsubversion (my_vars->Gsubversion) #define PL_sv_placeholder (my_vars->Gsv_placeholder) #define PL_Gsv_placeholder (my_vars->Gsv_placeholder) #define PL_thr_key (my_vars->Gthr_key) @@ -793,8 +773,6 @@ #define PL_Gtimesbase (my_vars->Gtimesbase) #define PL_use_safe_putenv (my_vars->Guse_safe_putenv) #define PL_Guse_safe_putenv (my_vars->Guse_safe_putenv) -#define PL_version (my_vars->Gversion) -#define PL_Gversion (my_vars->Gversion) #define PL_veto_cleanup (my_vars->Gveto_cleanup) #define PL_Gveto_cleanup (my_vars->Gveto_cleanup) #define PL_watch_pvx (my_vars->Gwatch_pvx) @@ -802,8 +780,6 @@ #else /* !PERL_GLOBAL_STRUCT */ -#define PL_GNo PL_No -#define PL_GYes PL_Yes #define PL_Gappctx PL_appctx #define PL_Gcheck PL_check #define PL_Gcsighandlerp PL_csighandlerp @@ -811,11 +787,7 @@ #define PL_Gdo_undump PL_do_undump #define PL_Gdollarzero_mutex PL_dollarzero_mutex #define PL_Gfold_locale PL_fold_locale -#define PL_Gglobal_struct_size PL_global_struct_size -#define PL_Ghexdigit PL_hexdigit #define PL_Ghints_mutex PL_hints_mutex -#define PL_Ginterp_size PL_interp_size -#define PL_Ginterp_size_5_10_0 PL_interp_size_5_10_0 #define PL_Gkeyword_plugin PL_keyword_plugin #define PL_Gmalloc_mutex PL_malloc_mutex #define PL_Gmmap_page_size PL_mmap_page_size @@ -824,27 +796,23 @@ #define PL_Gop_mutex PL_op_mutex #define PL_Gop_seq PL_op_seq #define PL_Gop_sequence PL_op_sequence -#define PL_Gpatleave PL_patleave #define PL_Gperlio_debug_fd PL_perlio_debug_fd #define PL_Gperlio_fd_refcnt PL_perlio_fd_refcnt #define PL_Gperlio_fd_refcnt_size PL_perlio_fd_refcnt_size #define PL_Gperlio_mutex PL_perlio_mutex #define PL_Gppaddr PL_ppaddr -#define PL_Grevision PL_revision -#define PL_Grunops_dbg PL_runops_dbg -#define PL_Grunops_std PL_runops_std +#ifdef OS2 #define PL_Gsh_path PL_sh_path +#endif #define PL_Gsig_defaulting PL_sig_defaulting #define PL_Gsig_handlers_initted PL_sig_handlers_initted #define PL_Gsig_ignoring PL_sig_ignoring #define PL_Gsig_trapped PL_sig_trapped #define PL_Gsigfpe_saved PL_sigfpe_saved -#define PL_Gsubversion PL_subversion #define PL_Gsv_placeholder PL_sv_placeholder #define PL_Gthr_key PL_thr_key #define PL_Gtimesbase PL_timesbase #define PL_Guse_safe_putenv PL_use_safe_putenv -#define PL_Gversion PL_version #define PL_Gveto_cleanup PL_veto_cleanup #define PL_Gwatch_pvx PL_watch_pvx diff --git a/globvar.sym b/globvar.sym index 9bec861..b6a36de 100644 --- a/globvar.sym +++ b/globvar.sym @@ -3,6 +3,8 @@ # *** Only structures/arrays with constant initializers should go here. # *** Usual globals initialized at runtime should be added in *var*.h. +No +Yes bincompat_options block_type charclass @@ -12,6 +14,10 @@ fold fold_latin1 fold_locale freq +global_struct_size +hexdigit +interp_size +interp_size_5_16_0 keyword_plugin magic_data magic_vtables @@ -38,14 +44,19 @@ ppaddr regkind reg_name reg_extflags_name +revision +runops_dbg +runops_std sig_name sig_num simple simple_bitmask +subversion utf8skip uuemap varies varies_bitmask +version warn_nl warn_nosemi warn_reserved diff --git a/intrpvar.h b/intrpvar.h index 824bf20..83b4fdc 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -708,6 +708,9 @@ PERLVARI(Iunlockhook, share_proc_t, PERL_UNLOCK_HOOK) PERLVARI(Ithreadhook, thrhook_proc_t, Perl_nothreadhook) +/* Can shared object be destroyed */ +PERLVARI(Idestroyhook, destroyable_proc_t, Perl_sv_destroyable) + #ifndef PERL_MICRO PERLVARI(Isignalhook, despatch_signals_proc_t, Perl_despatch_signals) #endif @@ -718,11 +721,30 @@ PERLVARI(Irehash_seed, UV, 0) /* 582 hash initializer */ PERLVARI(Iisarev, HV*, NULL) /* Reverse map of @ISA dependencies */ +/* Register of known Method Resolution Orders. + What this actually points to is an implementation detail (it may change to + a structure incorporating a reference count - use mro_get_from_name to + retrieve a C<struct mro_alg *> */ +PERLVAR(Iregistered_mros, HV *) + +/* Compile-time block start/end hooks */ +PERLVAR(Iblockhooks, AV *) + +/* Everything that folds to a given character, for case insensitivity regex + * matching */ +PERLVARI(Iutf8_foldclosures, HV *, NULL) + +/* List of characters that participate in folds (except marks, etc in + * multi-char folds) */ +PERLVARI(Iutf8_foldable, HV *, NULL) + +PERLVAR(Icustom_ops, HV *) /* custom op registrations */ + /* The last unconditional member of the interpreter structure when 5.10.0 was released. The offset of the end of this is baked into a global variable in any shared perl library which will allow a sanity test in future perl releases. */ -#define PERL_LAST_5_10_0_INTERP_MEMBER Iisarev +#define PERL_LAST_5_16_0_INTERP_MEMBER Icustom_ops #ifdef PERL_IMPLICIT_CONTEXT PERLVARI(Imy_cxt_size, int, 0) /* size of PL_my_cxt_list */ @@ -764,33 +786,10 @@ PERLVARI(Islabs, I32**, NULL) /* Array of slabs that have been allocated */ PERLVARI(Islab_count, U32, 0) /* Size of the array */ #endif -/* Can shared object be destroyed */ -PERLVARI(Idestroyhook, destroyable_proc_t, Perl_sv_destroyable) - #ifdef DEBUG_LEAKING_SCALARS PERLVARI(Isv_serial, U32, 0) /* SV serial number, used in sv.c */ #endif -/* Register of known Method Resolution Orders. - What this actually points to is an implementation detail (it may change to - a structure incorporating a reference count - use mro_get_from_name to - retrieve a C<struct mro_alg *> */ -PERLVAR(Iregistered_mros, HV *) - -/* Compile-time block start/end hooks */ -PERLVAR(Iblockhooks, AV *) - - -/* Everything that folds to a given character, for case insensitivity regex - * matching */ -PERLVARI(Iutf8_foldclosures, HV *, NULL) - -/* List of characters that participate in folds (except marks, etc in - * multi-char folds) */ -PERLVARI(Iutf8_foldable, HV *, NULL) - -PERLVAR(Icustom_ops, HV *) /* custom op registrations */ - /* If you are adding a U8 or U16, check to see if there are 'Space' comments * above on where there are gaps which currently will be structure padding. */ diff --git a/makedef.pl b/makedef.pl index 5b8265a..94a0e1a 100644 --- a/makedef.pl +++ b/makedef.pl @@ -901,7 +901,7 @@ if ($define{'PERL_MAD'}) { unless ($define{'MULTIPLICITY'}) { skip_symbols [qw( PL_interp_size - PL_interp_size_5_10_0 + PL_interp_size_5_16_0 )]; } diff --git a/miniperlmain.c b/miniperlmain.c index 401af10..260369e 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -78,7 +78,7 @@ main(int argc, char **argv, char **env) PERL_UNUSED_ARG(env); #endif #ifndef PERL_USE_SAFE_PUTENV - PL_use_safe_putenv = 0; + PL_use_safe_putenv = FALSE; #endif /* PERL_USE_SAFE_PUTENV */ /* if user wants control of gprof profiling off by default */ diff --git a/perl.h b/perl.h index fceb220..b96cdcd 100644 --- a/perl.h +++ b/perl.h @@ -4200,6 +4200,18 @@ extern char ** environ; /* environment variables supplied via exec */ # endif #endif +#define PERL_PATCHLEVEL_H_IMPLICIT +#include "patchlevel.h" +#undef PERL_PATCHLEVEL_H_IMPLICIT + +#define PERL_VERSION_STRING STRINGIFY(PERL_REVISION) "." \ + STRINGIFY(PERL_VERSION) "." \ + STRINGIFY(PERL_SUBVERSION) + +#define PERL_API_VERSION_STRING STRINGIFY(PERL_API_REVISION) "." \ + STRINGIFY(PERL_API_VERSION) "." \ + STRINGIFY(PERL_API_SUBVERSION) + START_EXTERN_C /* handy constants */ @@ -4244,12 +4256,36 @@ EXTCONST char PL_no_localize_ref[] EXTCONST char PL_memory_wrap[] INIT("panic: memory wrap"); +EXTCONST char PL_Yes[] + INIT("1"); +EXTCONST char PL_No[] + INIT(""); +EXTCONST char PL_hexdigit[] + INIT("0123456789abcdef0123456789ABCDEF"); + +/* This is constant on most architectures, a global on OS/2 */ +#ifndef OS2 +EXTCONST char PL_sh_path[] + INIT(SH_PATH); /* full path of shell */ +#endif + #ifdef CSH EXTCONST char PL_cshname[] INIT(CSH); # define PL_cshlen (sizeof(CSH "") - 1) #endif +/* These are baked at compile time into any shared perl library. + In future releases this will allow us in main() to sanity test the + library we're linking against. */ + +EXTCONST U8 PL_revision + INIT(PERL_REVISION); +EXTCONST U8 PL_version + INIT(PERL_VERSION); +EXTCONST U8 PL_subversion + INIT(PERL_SUBVERSION); + EXTCONST char PL_uuemap[65] INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"); @@ -4830,13 +4866,6 @@ typedef void (*XSINIT_t) (pTHX); typedef void (*ATEXIT_t) (pTHX_ void*); typedef void (*XSUBADDR_t) (pTHX_ CV *); -/* Set up PERLVAR macros for populating structs */ -#define PERLVAR(var,type) type var; -#define PERLVARA(var,n,type) type var[n]; -#define PERLVARI(var,type,init) type var; -#define PERLVARIC(var,type,init) type var; -#define PERLVARISC(var,init) const char var[sizeof(init)]; - typedef OP* (*Perl_ppaddr_t)(pTHX); typedef OP* (*Perl_check_t) (pTHX_ OP*); typedef void(*Perl_ophook_t)(pTHX_ OP*); @@ -4863,63 +4892,79 @@ typedef struct exitlistentry { # define FAKE_DEFAULT_SIGNAL_HANDLERS #endif -#define PERL_PATCHLEVEL_H_IMPLICIT -#include "patchlevel.h" -#undef PERL_PATCHLEVEL_H_IMPLICIT - -#define PERL_VERSION_STRING STRINGIFY(PERL_REVISION) "." \ - STRINGIFY(PERL_VERSION) "." \ - STRINGIFY(PERL_SUBVERSION) - -#define PERL_API_VERSION_STRING STRINGIFY(PERL_API_REVISION) "." \ - STRINGIFY(PERL_API_VERSION) "." \ - STRINGIFY(PERL_API_SUBVERSION) +#if !defined(MULTIPLICITY) -#ifdef PERL_GLOBAL_STRUCT -struct perl_vars { -# include "perlvars.h" +struct interpreter { + char broiled; }; -# ifdef PERL_CORE -# ifndef PERL_GLOBAL_STRUCT_PRIVATE -EXT struct perl_vars PL_Vars; -EXT struct perl_vars *PL_VarsPtr INIT(&PL_Vars); -# undef PERL_GET_VARS -# define PERL_GET_VARS() PL_VarsPtr -# endif /* !PERL_GLOBAL_STRUCT_PRIVATE */ -# else /* PERL_CORE */ -# if !defined(__GNUC__) || !defined(WIN32) -EXT -# endif /* WIN32 */ -struct perl_vars *PL_VarsPtr; -# define PL_Vars (*((PL_VarsPtr) \ - ? PL_VarsPtr : (PL_VarsPtr = Perl_GetVars(aTHX)))) -# endif /* PERL_CORE */ -#endif /* PERL_GLOBAL_STRUCT */ +#else -#if defined(MULTIPLICITY) /* If we have multiple interpreters define a struct holding variables which must be per-interpreter If we don't have threads anything that would have be per-thread is per-interpreter. */ +/* Set up PERLVAR macros for populating structs */ +# define PERLVAR(var,type) type var; +# define PERLVARA(var,n,type) type var[n]; +# define PERLVARI(var,type,init) type var; +# define PERLVARIC(var,type,init) type var; + struct interpreter { # include "intrpvar.h" }; -#else -struct interpreter { - char broiled; +EXTCONST U16 PL_interp_size + INIT(sizeof(struct interpreter)); + +# define PERL_INTERPRETER_SIZE_UPTO_MEMBER(member) \ + STRUCT_OFFSET(struct interpreter, member) + \ + sizeof(((struct interpreter*)0)->member) + +/* This will be useful for subsequent releases, because this has to be the + same in your libperl as in main(), else you have a mismatch and must abort. +*/ +EXTCONST U16 PL_interp_size_5_16_0 + INIT(PERL_INTERPRETER_SIZE_UPTO_MEMBER(PERL_LAST_5_16_0_INTERP_MEMBER)); + + +# ifdef PERL_GLOBAL_STRUCT +/* MULTIPLICITY is automatically defined when PERL_GLOBAL_STRUCT is defined, + hence it's safe and sane to nest this within #ifdef MULTIPLICITY */ + +struct perl_vars { +# include "perlvars.h" }; -#endif /* MULTIPLICITY */ + +EXTCONST U16 PL_global_struct_size + INIT(sizeof(struct perl_vars)); + +# ifdef PERL_CORE +# ifndef PERL_GLOBAL_STRUCT_PRIVATE +EXT struct perl_vars PL_Vars; +EXT struct perl_vars *PL_VarsPtr INIT(&PL_Vars); +# undef PERL_GET_VARS +# define PERL_GET_VARS() PL_VarsPtr +# endif /* !PERL_GLOBAL_STRUCT_PRIVATE */ +# else /* PERL_CORE */ +# if !defined(__GNUC__) || !defined(WIN32) +EXT +# endif /* WIN32 */ +struct perl_vars *PL_VarsPtr; +# define PL_Vars (*((PL_VarsPtr) \ + ? PL_VarsPtr : (PL_VarsPtr = Perl_GetVars(aTHX)))) +# endif /* PERL_CORE */ +# endif /* PERL_GLOBAL_STRUCT */ /* Done with PERLVAR macros for now ... */ -#undef PERLVAR -#undef PERLVARA -#undef PERLVARI -#undef PERLVARIC -#undef PERLVARISC +# undef PERLVAR +# undef PERLVARA +# undef PERLVARI +# undef PERLVARIC + +#endif /* MULTIPLICITY */ struct tempsym; /* defined in pp_pack.c */ @@ -4968,7 +5013,6 @@ struct tempsym; /* defined in pp_pack.c */ #define PERLVARA(var,n,type) EXT type PL_##var[n]; #define PERLVARI(var,type,init) EXT type PL_##var INIT(init); #define PERLVARIC(var,type,init) EXTCONST type PL_##var INIT(init); -#define PERLVARISC(var,init) EXTCONST char PL_##var[sizeof(init)] INIT(init); #if !defined(MULTIPLICITY) START_EXTERN_C @@ -5005,6 +5049,14 @@ END_EXTERN_C START_EXTERN_C +/* dummy variables that hold pointers to both runops functions, thus forcing + * them *both* to get linked in (useful for Peek.xs, debugging etc) */ + +EXTCONST runops_proc_t PL_runops_std + INIT(Perl_runops_standard); +EXTCONST runops_proc_t PL_runops_dbg + INIT(Perl_runops_debug); + /* PERL_GLOBAL_STRUCT_PRIVATE wants to keep global data like the * magic vtables const, but this is incompatible with SWIG which * does want to modify the vtables. */ diff --git a/perlapi.c b/perlapi.c index bd7c76e..6eab07c 100644 --- a/perlapi.c +++ b/perlapi.c @@ -43,19 +43,15 @@ START_EXTERN_C #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \ { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #undef PERLVARIC -#undef PERLVARISC #define PERLVARIC(v,t,i) \ const t* Perl_##v##_ptr(pTHX) \ { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); } -#define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #include "perlvars.h" #undef PERLVAR #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC END_EXTERN_C diff --git a/perlapi.h b/perlapi.h index ddbb120..a48abed 100644 --- a/perlapi.h +++ b/perlapi.h @@ -28,14 +28,11 @@ START_EXTERN_C #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC #define PERLVAR(v,t) EXTERN_C t* Perl_##v##_ptr(pTHX); #define PERLVARA(v,n,t) typedef t PL_##v##_t[n]; \ EXTERN_C PL_##v##_t* Perl_##v##_ptr(pTHX); #define PERLVARI(v,t,i) PERLVAR(v,t) #define PERLVARIC(v,t,i) PERLVAR(v, const t) -#define PERLVARISC(v,i) typedef const char PL_##v##_t[sizeof(i)]; \ - EXTERN_C PL_##v##_t* Perl_##v##_ptr(pTHX); #include "perlvars.h" @@ -43,7 +40,6 @@ START_EXTERN_C #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC END_EXTERN_C @@ -70,7 +66,6 @@ EXTCONST void * const PL_force_link_funcs[] = { #define PERLVARA(v,n,t) PERLVAR(v,t) #define PERLVARI(v,t,i) PERLVAR(v,t) #define PERLVARIC(v,t,i) PERLVAR(v,t) -#define PERLVARISC(v,i) PERLVAR(v,char) /* In Tru64 (__DEC && __osf__) the cc option -std1 causes that one * cannot cast between void pointers and function pointers without @@ -95,7 +90,6 @@ EXTCONST void * const PL_force_link_funcs[] = { #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC }; #endif /* DOINIT */ @@ -105,10 +99,6 @@ END_EXTERN_C #else /* !PERL_CORE */ -#undef PL_No -#define PL_No (*Perl_GNo_ptr(NULL)) -#undef PL_Yes -#define PL_Yes (*Perl_GYes_ptr(NULL)) #undef PL_appctx #define PL_appctx (*Perl_Gappctx_ptr(NULL)) #undef PL_check @@ -123,16 +113,8 @@ END_EXTERN_C #define PL_dollarzero_mutex (*Perl_Gdollarzero_mutex_ptr(NULL)) #undef PL_fold_locale #define PL_fold_locale (*Perl_Gfold_locale_ptr(NULL)) -#undef PL_global_struct_size -#define PL_global_struct_size (*Perl_Gglobal_struct_size_ptr(NULL)) -#undef PL_hexdigit -#define PL_hexdigit (*Perl_Ghexdigit_ptr(NULL)) #undef PL_hints_mutex #define PL_hints_mutex (*Perl_Ghints_mutex_ptr(NULL)) -#undef PL_interp_size -#define PL_interp_size (*Perl_Ginterp_size_ptr(NULL)) -#undef PL_interp_size_5_10_0 -#define PL_interp_size_5_10_0 (*Perl_Ginterp_size_5_10_0_ptr(NULL)) #undef PL_keyword_plugin #define PL_keyword_plugin (*Perl_Gkeyword_plugin_ptr(NULL)) #undef PL_malloc_mutex @@ -149,8 +131,6 @@ END_EXTERN_C #define PL_op_seq (*Perl_Gop_seq_ptr(NULL)) #undef PL_op_sequence #define PL_op_sequence (*Perl_Gop_sequence_ptr(NULL)) -#undef PL_patleave -#define PL_patleave (*Perl_Gpatleave_ptr(NULL)) #undef PL_perlio_debug_fd #define PL_perlio_debug_fd (*Perl_Gperlio_debug_fd_ptr(NULL)) #undef PL_perlio_fd_refcnt @@ -161,12 +141,6 @@ END_EXTERN_C #define PL_perlio_mutex (*Perl_Gperlio_mutex_ptr(NULL)) #undef PL_ppaddr #define PL_ppaddr (*Perl_Gppaddr_ptr(NULL)) -#undef PL_revision -#define PL_revision (*Perl_Grevision_ptr(NULL)) -#undef PL_runops_dbg -#define PL_runops_dbg (*Perl_Grunops_dbg_ptr(NULL)) -#undef PL_runops_std -#define PL_runops_std (*Perl_Grunops_std_ptr(NULL)) #undef PL_sh_path #define PL_sh_path (*Perl_Gsh_path_ptr(NULL)) #undef PL_sig_defaulting @@ -179,8 +153,6 @@ END_EXTERN_C #define PL_sig_trapped (*Perl_Gsig_trapped_ptr(NULL)) #undef PL_sigfpe_saved #define PL_sigfpe_saved (*Perl_Gsigfpe_saved_ptr(NULL)) -#undef PL_subversion -#define PL_subversion (*Perl_Gsubversion_ptr(NULL)) #undef PL_sv_placeholder #define PL_sv_placeholder (*Perl_Gsv_placeholder_ptr(NULL)) #undef PL_thr_key @@ -189,8 +161,6 @@ END_EXTERN_C #define PL_timesbase (*Perl_Gtimesbase_ptr(NULL)) #undef PL_use_safe_putenv #define PL_use_safe_putenv (*Perl_Guse_safe_putenv_ptr(NULL)) -#undef PL_version -#define PL_version (*Perl_Gversion_ptr(NULL)) #undef PL_veto_cleanup #define PL_veto_cleanup (*Perl_Gveto_cleanup_ptr(NULL)) #undef PL_watch_pvx diff --git a/perlvars.h b/perlvars.h index 87a0d8b..57bd5bd 100644 --- a/perlvars.h +++ b/perlvars.h @@ -24,6 +24,9 @@ * the appropriate export list for win32. */ /* global state */ +#if defined(USE_ITHREADS) +PERLVAR(Gop_mutex, perl_mutex) /* Mutex for op refcounting */ +#endif PERLVAR(Gcurinterp, PerlInterpreter *) /* currently running interpreter * (initial parent interpreter under @@ -32,57 +35,47 @@ PERLVAR(Gcurinterp, PerlInterpreter *) PERLVAR(Gthr_key, perl_key) /* key to retrieve per-thread struct */ #endif -/* constants (these are not literals to facilitate pointer comparisons) - * (PERLVARISC really does create variables, despite its looks) */ -PERLVARISC(GYes, "1") -PERLVARISC(GNo, "") -PERLVARISC(Ghexdigit, "0123456789abcdef0123456789ABCDEF") -PERLVARISC(Gpatleave, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}") - /* XXX does anyone even use this? */ PERLVARI(Gdo_undump, bool, FALSE) /* -u or dump seen? */ -#if defined(MYMALLOC) && defined(USE_ITHREADS) -PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */ +#ifndef PERL_USE_SAFE_PUTENV +PERLVARI(Guse_safe_putenv, bool, TRUE) #endif -#if defined(USE_ITHREADS) -PERLVAR(Gop_mutex, perl_mutex) /* Mutex for op refcounting */ +#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS) +PERLVARI(Gsig_handlers_initted, int, 0) #endif - -#ifdef USE_ITHREADS -PERLVAR(Gdollarzero_mutex, perl_mutex) /* Modifying $0 */ +#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS +PERLVARA(Gsig_ignoring, SIG_SIZE, int) /* which signals we are ignoring */ +#endif +#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS +PERLVARA(Gsig_defaulting, SIG_SIZE, int) #endif - -/* This is constant on most architectures, a global on OS/2 */ -#ifdef OS2 -# define PERL___C -#else -# define PERL___C const +/* XXX signals are process-wide anyway, so we + * ignore the implications of this for threading */ +#ifndef HAS_SIGACTION +PERLVARI(Gsig_trapped, int, 0) #endif -PERLVARI(Gsh_path, PERL___C char *, SH_PATH) /* full path of shell */ -#undef PERL___C #ifndef PERL_MICRO /* If Perl has to ignore SIGPFE, this is its saved state. * See perl.h macros PERL_FPU_INIT and PERL_FPU_{PRE,POST}_EXEC. */ PERLVAR(Gsigfpe_saved, Sighandler_t) -#endif - -/* Restricted hashes placeholder value. - * The contents are never used, only the address. */ -PERLVAR(Gsv_placeholder, SV) - -#ifndef PERL_MICRO PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler) /* Pointer to C-level sighandler */ #endif -#ifndef PERL_USE_SAFE_PUTENV -PERLVARI(Guse_safe_putenv, int, 1) +/* This is constant on most architectures, a global on OS/2 */ +#ifdef OS2 +PERLVARI(Gsh_path, char *, SH_PATH) /* full path of shell */ #endif #ifdef USE_PERLIO + +# if defined(USE_ITHREADS) +PERLVAR(Gperlio_mutex, perl_mutex) /* Mutex for perlio fd refcounts */ +# endif + PERLVARI(Gperlio_fd_refcnt, int*, 0) /* Pointer to array of fd refcounts. */ PERLVARI(Gperlio_fd_refcnt_size, int, 0) /* Size of the array */ PERLVARI(Gperlio_debug_fd, int, 0) /* the fd to write perlio debug into, 0 means not set yet */ @@ -92,20 +85,8 @@ PERLVARI(Gperlio_debug_fd, int, 0) /* the fd to write perlio debug into, 0 means PERLVARI(Gmmap_page_size, IV, 0) #endif -#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS) -PERLVARI(Gsig_handlers_initted, int, 0) -#endif -#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS -PERLVARA(Gsig_ignoring, SIG_SIZE, int) /* which signals we are ignoring */ -#endif -#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS -PERLVARA(Gsig_defaulting, SIG_SIZE, int) -#endif - -/* XXX signals are process-wide anyway, so we - * ignore the implications of this for threading */ -#ifndef HAS_SIGACTION -PERLVARI(Gsig_trapped, int, 0) +#if defined(USE_ITHREADS) +PERLVAR(Ghints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */ #endif #ifdef DEBUGGING @@ -122,9 +103,6 @@ PERLVARA(Gfold_locale, 256, unsigned char) /* or perl.h */ PERLVAR(Gappctx, void*) /* the application context */ #endif -PERLVAR(Gop_sequence, HV*) /* dump.c */ -PERLVARI(Gop_seq, UV, 0) /* dump.c */ - #if defined(HAS_TIMES) && defined(PERL_NEED_TIMESBASE) PERLVAR(Gtimesbase, struct tms) #endif @@ -138,51 +116,10 @@ PERLVAR(Gmy_ctx_mutex, perl_mutex) PERLVARI(Gmy_cxt_index, int, 0) #endif -#if defined(USE_ITHREADS) -PERLVAR(Ghints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */ -#endif - -#if defined(USE_ITHREADS) -PERLVAR(Gperlio_mutex, perl_mutex) /* Mutex for perlio fd refcounts */ -#endif - /* this is currently set without MUTEX protection, so keep it a type which * can be set atomically (ie not a bit field) */ PERLVARI(Gveto_cleanup, int, FALSE) /* exit without cleanup */ -/* dummy variables that hold pointers to both runops functions, thus forcing - * them *both* to get linked in (useful for Peek.xs, debugging etc) */ - -PERLVARI(Grunops_std, runops_proc_t, Perl_runops_standard) -PERLVARI(Grunops_dbg, runops_proc_t, Perl_runops_debug) - - -/* These are baked at compile time into any shared perl library. - In future 5.10.x releases this will allow us in main() to sanity test the - library we're linking against. */ - -PERLVARI(Grevision, U8, PERL_REVISION) -PERLVARI(Gversion, U8, PERL_VERSION) -PERLVARI(Gsubversion, U8, PERL_SUBVERSION) - -#if defined(MULTIPLICITY) -# define PERL_INTERPRETER_SIZE_UPTO_MEMBER(member) \ - STRUCT_OFFSET(struct interpreter, member) + \ - sizeof(((struct interpreter*)0)->member) - -/* These might be useful. */ -PERLVARI(Ginterp_size, U16, sizeof(struct interpreter)) -#if defined(PERL_GLOBAL_STRUCT) -PERLVARI(Gglobal_struct_size, U16, sizeof(struct perl_vars)) -#endif - -/* This will be useful for subsequent releases, because this has to be the - same in your libperl as in main(), else you have a mismatch and must abort. -*/ -PERLVARI(Ginterp_size_5_10_0, U16, - PERL_INTERPRETER_SIZE_UPTO_MEMBER(PERL_LAST_5_10_0_INTERP_MEMBER)) -#endif - /* =for apidoc AmUx|Perl_keyword_plugin_t|PL_keyword_plugin @@ -237,3 +174,18 @@ the Perl core) will normally return C<KEYWORD_PLUGIN_DECLINE>. */ PERLVARI(Gkeyword_plugin, Perl_keyword_plugin_t, Perl_keyword_plugin_standard) + +PERLVAR(Gop_sequence, HV*) /* dump.c */ +PERLVARI(Gop_seq, UV, 0) /* dump.c */ + +#ifdef USE_ITHREADS +PERLVAR(Gdollarzero_mutex, perl_mutex) /* Modifying $0 */ +#endif + +/* Restricted hashes placeholder value. + * The contents are never used, only the address. */ +PERLVAR(Gsv_placeholder, SV) + +#if defined(MYMALLOC) && defined(USE_ITHREADS) +PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */ +#endif diff --git a/regen/embed.pl b/regen/embed.pl index a72a0f7..dac4d45 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -367,7 +367,7 @@ sub readvars(\%$$@) { or die "embed.pl: Can't open $file: $!\n"; while (<FILE>) { s/[ \t]*#.*//; # Delete comments. - if (/PERLVARA?I?S?C?\($pre(\w+)/) { + if (/PERLVARA?I?C?\($pre(\w+)/) { my $sym = $1; $sym = $pre . $sym if $keep_pre; warn "duplicate symbol $sym while processing $file line $.\n" @@ -631,8 +631,10 @@ print $em <<'END'; END for $sym (sort keys %globvar) { + print $em "#ifdef OS2\n" if $sym eq 'sh_path'; print $em multon($sym, 'G','my_vars->'); print $em multon("G$sym",'', 'my_vars->'); + print $em "#endif\n" if $sym eq 'sh_path'; } print $em <<'END'; @@ -642,7 +644,9 @@ print $em <<'END'; END for $sym (sort keys %globvar) { + print $em "#ifdef OS2\n" if $sym eq 'sh_path'; print $em multoff($sym,'G'); + print $em "#endif\n" if $sym eq 'sh_path'; } print $em <<'END'; @@ -667,14 +671,11 @@ START_EXTERN_C #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC #define PERLVAR(v,t) EXTERN_C t* Perl_##v##_ptr(pTHX); #define PERLVARA(v,n,t) typedef t PL_##v##_t[n]; \ EXTERN_C PL_##v##_t* Perl_##v##_ptr(pTHX); #define PERLVARI(v,t,i) PERLVAR(v,t) #define PERLVARIC(v,t,i) PERLVAR(v, const t) -#define PERLVARISC(v,i) typedef const char PL_##v##_t[sizeof(i)]; \ - EXTERN_C PL_##v##_t* Perl_##v##_ptr(pTHX); #include "perlvars.h" @@ -682,7 +683,6 @@ START_EXTERN_C #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC END_EXTERN_C @@ -709,7 +709,6 @@ EXTCONST void * const PL_force_link_funcs[] = { #define PERLVARA(v,n,t) PERLVAR(v,t) #define PERLVARI(v,t,i) PERLVAR(v,t) #define PERLVARIC(v,t,i) PERLVAR(v,t) -#define PERLVARISC(v,i) PERLVAR(v,char) /* In Tru64 (__DEC && __osf__) the cc option -std1 causes that one * cannot cast between void pointers and function pointers without @@ -734,7 +733,6 @@ EXTCONST void * const PL_force_link_funcs[] = { #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC }; #endif /* DOINIT */ @@ -792,19 +790,15 @@ START_EXTERN_C #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \ { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #undef PERLVARIC -#undef PERLVARISC #define PERLVARIC(v,t,i) \ const t* Perl_##v##_ptr(pTHX) \ { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); } -#define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #include "perlvars.h" #undef PERLVAR #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#undef PERLVARISC END_EXTERN_C diff --git a/util.c b/util.c index 19fec65..318c965 100644 --- a/util.c +++ b/util.c @@ -5800,18 +5800,15 @@ Perl_init_global_struct(pTHX) # undef PERLVARA # undef PERLVARI # undef PERLVARIC -# undef PERLVARISC # define PERLVAR(var,type) /**/ # define PERLVARA(var,n,type) /**/ # define PERLVARI(var,type,init) plvarsp->var = init; # define PERLVARIC(var,type,init) plvarsp->var = init; -# define PERLVARISC(var,init) Copy(init, plvarsp->var, sizeof(init), char); # include "perlvars.h" # undef PERLVAR # undef PERLVARA # undef PERLVARI # undef PERLVARIC -# undef PERLVARISC # ifdef PERL_GLOBAL_STRUCT plvarsp->Gppaddr = (Perl_ppaddr_t*) -- Perl5 Master Repository
