diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-12 05:10:50 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-12 05:10:50 +0000 |
commit | 5c0ca7990f0d90291b9a3d0b6c57bae560b23b52 (patch) | |
tree | 26fb0eee534215ebaa9caa2327d1ee6ac37d3bb7 | |
parent | 8b49bb9af6b73f5b844abedd87486b1c41fc6b01 (diff) | |
download | perl-5c0ca7990f0d90291b9a3d0b6c57bae560b23b52.tar.gz |
make RE engine threadsafe; -Dusethreads builds, tests on Solaris,
and runs regexes in 1000s of threads without crashing; also fixed
statcache not being thread-local
p4raw-id: //depot/perl@1448
-rw-r--r-- | embedvar.h | 357 | ||||
-rw-r--r-- | ext/Thread/Thread.xs | 7 | ||||
-rw-r--r-- | ext/re/re.xs | 2 | ||||
-rw-r--r-- | intrpvar.h | 68 | ||||
-rw-r--r-- | op.c | 1 | ||||
-rw-r--r-- | perl.c | 7 | ||||
-rw-r--r-- | pp_ctl.c | 1 | ||||
-rw-r--r-- | regcomp.c | 19 | ||||
-rw-r--r-- | regexec.c | 8 | ||||
-rw-r--r-- | sv.c | 1 | ||||
-rwxr-xr-x | t/lib/thread.t | 2 | ||||
-rw-r--r-- | thrdvar.h | 67 | ||||
-rw-r--r-- | util.c | 12 |
13 files changed, 330 insertions, 222 deletions
diff --git a/embedvar.h b/embedvar.h index 2f6997311b..6d2dbe412a 100644 --- a/embedvar.h +++ b/embedvar.h @@ -24,7 +24,10 @@ #define Xpv (curinterp->TXpv) #define av_fetch_sv (curinterp->Tav_fetch_sv) #define bodytarget (curinterp->Tbodytarget) +#define bostr (curinterp->Tbostr) #define chopset (curinterp->Tchopset) +#define colors (curinterp->Tcolors) +#define colorset (curinterp->Tcolorset) #define curcop (curinterp->Tcurcop) #define curpad (curinterp->Tcurpad) #define curpm (curinterp->Tcurpm) @@ -35,22 +38,59 @@ #define defstash (curinterp->Tdefstash) #define delaymagic (curinterp->Tdelaymagic) #define dirty (curinterp->Tdirty) +#define extralen (curinterp->Textralen) +#define firstgv (curinterp->Tfirstgv) #define formtarget (curinterp->Tformtarget) #define hv_fetch_ent_mh (curinterp->Thv_fetch_ent_mh) #define hv_fetch_sv (curinterp->Thv_fetch_sv) #define in_eval (curinterp->Tin_eval) #define last_in_gv (curinterp->Tlast_in_gv) +#define lastgotoprobe (curinterp->Tlastgotoprobe) +#define lastscream (curinterp->Tlastscream) #define localizing (curinterp->Tlocalizing) #define mainstack (curinterp->Tmainstack) #define markstack (curinterp->Tmarkstack) #define markstack_max (curinterp->Tmarkstack_max) #define markstack_ptr (curinterp->Tmarkstack_ptr) +#define maxscream (curinterp->Tmaxscream) #define modcount (curinterp->Tmodcount) #define nrs (curinterp->Tnrs) #define ofs (curinterp->Tofs) #define ofslen (curinterp->Tofslen) #define op (curinterp->Top) #define opsave (curinterp->Topsave) +#define reg_eval_set (curinterp->Treg_eval_set) +#define reg_flags (curinterp->Treg_flags) +#define reg_start_tmp (curinterp->Treg_start_tmp) +#define reg_start_tmpl (curinterp->Treg_start_tmpl) +#define regbol (curinterp->Tregbol) +#define regcc (curinterp->Tregcc) +#define regcode (curinterp->Tregcode) +#define regcomp_parse (curinterp->Tregcomp_parse) +#define regcomp_rx (curinterp->Tregcomp_rx) +#define regcompp (curinterp->Tregcompp) +#define regdata (curinterp->Tregdata) +#define regdummy (curinterp->Tregdummy) +#define regendp (curinterp->Tregendp) +#define regeol (curinterp->Tregeol) +#define regexecp (curinterp->Tregexecp) +#define regflags (curinterp->Tregflags) +#define regindent (curinterp->Tregindent) +#define reginput (curinterp->Treginput) +#define reginterp_cnt (curinterp->Treginterp_cnt) +#define reglastparen (curinterp->Treglastparen) +#define regnarrate (curinterp->Tregnarrate) +#define regnaughty (curinterp->Tregnaughty) +#define regnpar (curinterp->Tregnpar) +#define regprecomp (curinterp->Tregprecomp) +#define regprev (curinterp->Tregprev) +#define regprogram (curinterp->Tregprogram) +#define regsawback (curinterp->Tregsawback) +#define regseen (curinterp->Tregseen) +#define regsize (curinterp->Tregsize) +#define regstartp (curinterp->Tregstartp) +#define regtill (curinterp->Tregtill) +#define regxend (curinterp->Tregxend) #define restartop (curinterp->Trestartop) #define retstack (curinterp->Tretstack) #define retstack_ix (curinterp->Tretstack_ix) @@ -62,11 +102,22 @@ #define scopestack (curinterp->Tscopestack) #define scopestack_ix (curinterp->Tscopestack_ix) #define scopestack_max (curinterp->Tscopestack_max) +#define screamfirst (curinterp->Tscreamfirst) +#define screamnext (curinterp->Tscreamnext) +#define secondgv (curinterp->Tsecondgv) +#define seen_evals (curinterp->Tseen_evals) +#define seen_zerolen (curinterp->Tseen_zerolen) +#define sortcop (curinterp->Tsortcop) +#define sortcxix (curinterp->Tsortcxix) +#define sortstash (curinterp->Tsortstash) #define stack_base (curinterp->Tstack_base) #define stack_max (curinterp->Tstack_max) #define stack_sp (curinterp->Tstack_sp) #define start_env (curinterp->Tstart_env) #define statbuf (curinterp->Tstatbuf) +#define statcache (curinterp->Tstatcache) +#define statgv (curinterp->Tstatgv) +#define statname (curinterp->Tstatname) #define tainted (curinterp->Ttainted) #define timesbuf (curinterp->Ttimesbuf) #define tmps_floor (curinterp->Ttmps_floor) @@ -95,10 +146,7 @@ #define argvoutgv (curinterp->Iargvoutgv) #define basetime (curinterp->Ibasetime) #define beginav (curinterp->Ibeginav) -#define bostr (curinterp->Ibostr) #define cddir (curinterp->Icddir) -#define colors (curinterp->Icolors) -#define colorset (curinterp->Icolorset) #define compcv (curinterp->Icompcv) #define compiling (curinterp->Icompiling) #define comppad (curinterp->Icomppad) @@ -128,10 +176,8 @@ #define eval_start (curinterp->Ieval_start) #define exitlist (curinterp->Iexitlist) #define exitlistlen (curinterp->Iexitlistlen) -#define extralen (curinterp->Iextralen) #define fdpid (curinterp->Ifdpid) #define filemode (curinterp->Ifilemode) -#define firstgv (curinterp->Ifirstgv) #define forkprocess (curinterp->Iforkprocess) #define formfeed (curinterp->Iformfeed) #define generation (curinterp->Igeneration) @@ -145,8 +191,6 @@ #define inplace (curinterp->Iinplace) #define last_proto (curinterp->Ilast_proto) #define lastfd (curinterp->Ilastfd) -#define lastgotoprobe (curinterp->Ilastgotoprobe) -#define lastscream (curinterp->Ilastscream) #define lastsize (curinterp->Ilastsize) #define lastspbase (curinterp->Ilastspbase) #define laststatval (curinterp->Ilaststatval) @@ -158,7 +202,6 @@ #define main_cv (curinterp->Imain_cv) #define main_root (curinterp->Imain_root) #define main_start (curinterp->Imain_start) -#define maxscream (curinterp->Imaxscream) #define maxsysfd (curinterp->Imaxsysfd) #define mess_sv (curinterp->Imess_sv) #define minus_F (curinterp->Iminus_F) @@ -188,38 +231,6 @@ #define preambled (curinterp->Ipreambled) #define preprocess (curinterp->Ipreprocess) #define profiledata (curinterp->Iprofiledata) -#define reg_eval_set (curinterp->Ireg_eval_set) -#define reg_flags (curinterp->Ireg_flags) -#define reg_start_tmp (curinterp->Ireg_start_tmp) -#define reg_start_tmpl (curinterp->Ireg_start_tmpl) -#define regbol (curinterp->Iregbol) -#define regcc (curinterp->Iregcc) -#define regcode (curinterp->Iregcode) -#define regcomp_parse (curinterp->Iregcomp_parse) -#define regcomp_rx (curinterp->Iregcomp_rx) -#define regcompp (curinterp->Iregcompp) -#define regdata (curinterp->Iregdata) -#define regdummy (curinterp->Iregdummy) -#define regendp (curinterp->Iregendp) -#define regeol (curinterp->Iregeol) -#define regexecp (curinterp->Iregexecp) -#define regflags (curinterp->Iregflags) -#define regindent (curinterp->Iregindent) -#define reginput (curinterp->Ireginput) -#define reginterp_cnt (curinterp->Ireginterp_cnt) -#define reglastparen (curinterp->Ireglastparen) -#define regnarrate (curinterp->Iregnarrate) -#define regnaughty (curinterp->Iregnaughty) -#define regnpar (curinterp->Iregnpar) -#define regprecomp (curinterp->Iregprecomp) -#define regprev (curinterp->Iregprev) -#define regprogram (curinterp->Iregprogram) -#define regsawback (curinterp->Iregsawback) -#define regseen (curinterp->Iregseen) -#define regsize (curinterp->Iregsize) -#define regstartp (curinterp->Iregstartp) -#define regtill (curinterp->Iregtill) -#define regxend (curinterp->Iregxend) #define replgv (curinterp->Ireplgv) #define rightgv (curinterp->Irightgv) #define rsfp (curinterp->Irsfp) @@ -227,19 +238,8 @@ #define sawampersand (curinterp->Isawampersand) #define sawstudy (curinterp->Isawstudy) #define sawvec (curinterp->Isawvec) -#define screamfirst (curinterp->Iscreamfirst) -#define screamnext (curinterp->Iscreamnext) -#define secondgv (curinterp->Isecondgv) -#define seen_evals (curinterp->Iseen_evals) -#define seen_zerolen (curinterp->Iseen_zerolen) #define siggv (curinterp->Isiggv) -#define sortcop (curinterp->Isortcop) -#define sortcxix (curinterp->Isortcxix) -#define sortstash (curinterp->Isortstash) #define splitstr (curinterp->Isplitstr) -#define statcache (curinterp->Istatcache) -#define statgv (curinterp->Istatgv) -#define statname (curinterp->Istatname) #define statusvalue (curinterp->Istatusvalue) #define statusvalue_vms (curinterp->Istatusvalue_vms) #define stdingv (curinterp->Istdingv) @@ -275,10 +275,7 @@ #define Iargvoutgv argvoutgv #define Ibasetime basetime #define Ibeginav beginav -#define Ibostr bostr #define Icddir cddir -#define Icolors colors -#define Icolorset colorset #define Icompcv compcv #define Icompiling compiling #define Icomppad comppad @@ -308,10 +305,8 @@ #define Ieval_start eval_start #define Iexitlist exitlist #define Iexitlistlen exitlistlen -#define Iextralen extralen #define Ifdpid fdpid #define Ifilemode filemode -#define Ifirstgv firstgv #define Iforkprocess forkprocess #define Iformfeed formfeed #define Igeneration generation @@ -325,8 +320,6 @@ #define Iinplace inplace #define Ilast_proto last_proto #define Ilastfd lastfd -#define Ilastgotoprobe lastgotoprobe -#define Ilastscream lastscream #define Ilastsize lastsize #define Ilastspbase lastspbase #define Ilaststatval laststatval @@ -338,7 +331,6 @@ #define Imain_cv main_cv #define Imain_root main_root #define Imain_start main_start -#define Imaxscream maxscream #define Imaxsysfd maxsysfd #define Imess_sv mess_sv #define Iminus_F minus_F @@ -368,38 +360,6 @@ #define Ipreambled preambled #define Ipreprocess preprocess #define Iprofiledata profiledata -#define Ireg_eval_set reg_eval_set -#define Ireg_flags reg_flags -#define Ireg_start_tmp reg_start_tmp -#define Ireg_start_tmpl reg_start_tmpl -#define Iregbol regbol -#define Iregcc regcc -#define Iregcode regcode -#define Iregcomp_parse regcomp_parse -#define Iregcomp_rx regcomp_rx -#define Iregcompp regcompp -#define Iregdata regdata -#define Iregdummy regdummy -#define Iregendp regendp -#define Iregeol regeol -#define Iregexecp regexecp -#define Iregflags regflags -#define Iregindent regindent -#define Ireginput reginput -#define Ireginterp_cnt reginterp_cnt -#define Ireglastparen reglastparen -#define Iregnarrate regnarrate -#define Iregnaughty regnaughty -#define Iregnpar regnpar -#define Iregprecomp regprecomp -#define Iregprev regprev -#define Iregprogram regprogram -#define Iregsawback regsawback -#define Iregseen regseen -#define Iregsize regsize -#define Iregstartp regstartp -#define Iregtill regtill -#define Iregxend regxend #define Ireplgv replgv #define Irightgv rightgv #define Irsfp rsfp @@ -407,19 +367,8 @@ #define Isawampersand sawampersand #define Isawstudy sawstudy #define Isawvec sawvec -#define Iscreamfirst screamfirst -#define Iscreamnext screamnext -#define Isecondgv secondgv -#define Iseen_evals seen_evals -#define Iseen_zerolen seen_zerolen #define Isiggv siggv -#define Isortcop sortcop -#define Isortcxix sortcxix -#define Isortstash sortstash #define Isplitstr splitstr -#define Istatcache statcache -#define Istatgv statgv -#define Istatname statname #define Istatusvalue statusvalue #define Istatusvalue_vms statusvalue_vms #define Istdingv stdingv @@ -444,7 +393,10 @@ #define TXpv Xpv #define Tav_fetch_sv av_fetch_sv #define Tbodytarget bodytarget +#define Tbostr bostr #define Tchopset chopset +#define Tcolors colors +#define Tcolorset colorset #define Tcurcop curcop #define Tcurpad curpad #define Tcurpm curpm @@ -455,22 +407,59 @@ #define Tdefstash defstash #define Tdelaymagic delaymagic #define Tdirty dirty +#define Textralen extralen +#define Tfirstgv firstgv #define Tformtarget formtarget #define Thv_fetch_ent_mh hv_fetch_ent_mh #define Thv_fetch_sv hv_fetch_sv #define Tin_eval in_eval #define Tlast_in_gv last_in_gv +#define Tlastgotoprobe lastgotoprobe +#define Tlastscream lastscream #define Tlocalizing localizing #define Tmainstack mainstack #define Tmarkstack markstack #define Tmarkstack_max markstack_max #define Tmarkstack_ptr markstack_ptr +#define Tmaxscream maxscream #define Tmodcount modcount #define Tnrs nrs #define Tofs ofs #define Tofslen ofslen #define Top op #define Topsave opsave +#define Treg_eval_set reg_eval_set +#define Treg_flags reg_flags +#define Treg_start_tmp reg_start_tmp +#define Treg_start_tmpl reg_start_tmpl +#define Tregbol regbol +#define Tregcc regcc +#define Tregcode regcode +#define Tregcomp_parse regcomp_parse +#define Tregcomp_rx regcomp_rx +#define Tregcompp regcompp +#define Tregdata regdata +#define Tregdummy regdummy +#define Tregendp regendp +#define Tregeol regeol +#define Tregexecp regexecp +#define Tregflags regflags +#define Tregindent regindent +#define Treginput reginput +#define Treginterp_cnt reginterp_cnt +#define Treglastparen reglastparen +#define Tregnarrate regnarrate +#define Tregnaughty regnaughty +#define Tregnpar regnpar +#define Tregprecomp regprecomp +#define Tregprev regprev +#define Tregprogram regprogram +#define Tregsawback regsawback +#define Tregseen regseen +#define Tregsize regsize +#define Tregstartp regstartp +#define Tregtill regtill +#define Tregxend regxend #define Trestartop restartop #define Tretstack retstack #define Tretstack_ix retstack_ix @@ -482,11 +471,22 @@ #define Tscopestack scopestack #define Tscopestack_ix scopestack_ix #define Tscopestack_max scopestack_max +#define Tscreamfirst screamfirst +#define Tscreamnext screamnext +#define Tsecondgv secondgv +#define Tseen_evals seen_evals +#define Tseen_zerolen seen_zerolen +#define Tsortcop sortcop +#define Tsortcxix sortcxix +#define Tsortstash sortstash #define Tstack_base stack_base #define Tstack_max stack_max #define Tstack_sp stack_sp #define Tstart_env start_env #define Tstatbuf statbuf +#define Tstatcache statcache +#define Tstatgv statgv +#define Tstatname statname #define Ttainted tainted #define Ttimesbuf timesbuf #define Ttmps_floor tmps_floor @@ -517,10 +517,7 @@ #define argvoutgv Perl_argvoutgv #define basetime Perl_basetime #define beginav Perl_beginav -#define bostr Perl_bostr #define cddir Perl_cddir -#define colors Perl_colors -#define colorset Perl_colorset #define compcv Perl_compcv #define compiling Perl_compiling #define comppad Perl_comppad @@ -550,10 +547,8 @@ #define eval_start Perl_eval_start #define exitlist Perl_exitlist #define exitlistlen Perl_exitlistlen -#define extralen Perl_extralen #define fdpid Perl_fdpid #define filemode Perl_filemode -#define firstgv Perl_firstgv #define forkprocess Perl_forkprocess #define formfeed Perl_formfeed #define generation Perl_generation @@ -567,8 +562,6 @@ #define inplace Perl_inplace #define last_proto Perl_last_proto #define lastfd Perl_lastfd -#define lastgotoprobe Perl_lastgotoprobe -#define lastscream Perl_lastscream #define lastsize Perl_lastsize #define lastspbase Perl_lastspbase #define laststatval Perl_laststatval @@ -580,7 +573,6 @@ #define main_cv Perl_main_cv #define main_root Perl_main_root #define main_start Perl_main_start -#define maxscream Perl_maxscream #define maxsysfd Perl_maxsysfd #define mess_sv Perl_mess_sv #define minus_F Perl_minus_F @@ -610,38 +602,6 @@ #define preambled Perl_preambled #define preprocess Perl_preprocess #define profiledata Perl_profiledata -#define reg_eval_set Perl_reg_eval_set -#define reg_flags Perl_reg_flags -#define reg_start_tmp Perl_reg_start_tmp -#define reg_start_tmpl Perl_reg_start_tmpl -#define regbol Perl_regbol -#define regcc Perl_regcc -#define regcode Perl_regcode -#define regcomp_parse Perl_regcomp_parse -#define regcomp_rx Perl_regcomp_rx -#define regcompp Perl_regcompp -#define regdata Perl_regdata -#define regdummy Perl_regdummy -#define regendp Perl_regendp -#define regeol Perl_regeol -#define regexecp Perl_regexecp -#define regflags Perl_regflags -#define regindent Perl_regindent -#define reginput Perl_reginput -#define reginterp_cnt Perl_reginterp_cnt -#define reglastparen Perl_reglastparen -#define regnarrate Perl_regnarrate -#define regnaughty Perl_regnaughty -#define regnpar Perl_regnpar -#define regprecomp Perl_regprecomp -#define regprev Perl_regprev -#define regprogram Perl_regprogram -#define regsawback Perl_regsawback -#define regseen Perl_regseen -#define regsize Perl_regsize -#define regstartp Perl_regstartp -#define regtill Perl_regtill -#define regxend Perl_regxend #define replgv Perl_replgv #define rightgv Perl_rightgv #define rsfp Perl_rsfp @@ -649,19 +609,8 @@ #define sawampersand Perl_sawampersand #define sawstudy Perl_sawstudy #define sawvec Perl_sawvec -#define screamfirst Perl_screamfirst -#define screamnext Perl_screamnext -#define secondgv Perl_secondgv -#define seen_evals Perl_seen_evals -#define seen_zerolen Perl_seen_zerolen #define siggv Perl_siggv -#define sortcop Perl_sortcop -#define sortcxix Perl_sortcxix -#define sortstash Perl_sortstash #define splitstr Perl_splitstr -#define statcache Perl_statcache -#define statgv Perl_statgv -#define statname Perl_statname #define statusvalue Perl_statusvalue #define statusvalue_vms Perl_statusvalue_vms #define stdingv Perl_stdingv @@ -686,7 +635,10 @@ #define Xpv Perl_Xpv #define av_fetch_sv Perl_av_fetch_sv #define bodytarget Perl_bodytarget +#define bostr Perl_bostr #define chopset Perl_chopset +#define colors Perl_colors +#define colorset Perl_colorset #define curcop Perl_curcop #define curpad Perl_curpad #define curpm Perl_curpm @@ -697,22 +649,59 @@ #define defstash Perl_defstash #define delaymagic Perl_delaymagic #define dirty Perl_dirty +#define extralen Perl_extralen +#define firstgv Perl_firstgv #define formtarget Perl_formtarget #define hv_fetch_ent_mh Perl_hv_fetch_ent_mh #define hv_fetch_sv Perl_hv_fetch_sv #define in_eval Perl_in_eval #define last_in_gv Perl_last_in_gv +#define lastgotoprobe Perl_lastgotoprobe +#define lastscream Perl_lastscream #define localizing Perl_localizing #define mainstack Perl_mainstack #define markstack Perl_markstack #define markstack_max Perl_markstack_max #define markstack_ptr Perl_markstack_ptr +#define maxscream Perl_maxscream #define modcount Perl_modcount #define nrs Perl_nrs #define ofs Perl_ofs #define ofslen Perl_ofslen #define op Perl_op #define opsave Perl_opsave +#define reg_eval_set Perl_reg_eval_set +#define reg_flags Perl_reg_flags +#define reg_start_tmp Perl_reg_start_tmp +#define reg_start_tmpl Perl_reg_start_tmpl +#define regbol Perl_regbol +#define regcc Perl_regcc +#define regcode Perl_regcode +#define regcomp_parse Perl_regcomp_parse +#define regcomp_rx Perl_regcomp_rx +#define regcompp Perl_regcompp +#define regdata Perl_regdata +#define regdummy Perl_regdummy +#define regendp Perl_regendp +#define regeol Perl_regeol +#define regexecp Perl_regexecp +#define regflags Perl_regflags +#define regindent Perl_regindent +#define reginput Perl_reginput +#define reginterp_cnt Perl_reginterp_cnt +#define reglastparen Perl_reglastparen +#define regnarrate Perl_regnarrate +#define regnaughty Perl_regnaughty +#define regnpar Perl_regnpar +#define regprecomp Perl_regprecomp +#define regprev Perl_regprev +#define regprogram Perl_regprogram +#define regsawback Perl_regsawback +#define regseen Perl_regseen +#define regsize Perl_regsize +#define regstartp Perl_regstartp +#define regtill Perl_regtill +#define regxend Perl_regxend #define restartop Perl_restartop #define retstack Perl_retstack #define retstack_ix Perl_retstack_ix @@ -724,11 +713,22 @@ #define scopestack Perl_scopestack #define scopestack_ix Perl_scopestack_ix #define scopestack_max Perl_scopestack_max +#define screamfirst Perl_screamfirst +#define screamnext Perl_screamnext +#define secondgv Perl_secondgv +#define seen_evals Perl_seen_evals +#define seen_zerolen Perl_seen_zerolen +#define sortcop Perl_sortcop +#define sortcxix Perl_sortcxix +#define sortstash Perl_sortstash #define stack_base Perl_stack_base #define stack_max Perl_stack_max #define stack_sp Perl_stack_sp #define start_env Perl_start_env #define statbuf Perl_statbuf +#define statcache Perl_statcache +#define statgv Perl_statgv +#define statname Perl_statname #define tainted Perl_tainted #define timesbuf Perl_timesbuf #define tmps_floor Perl_tmps_floor @@ -750,7 +750,10 @@ #define Xpv (thr->TXpv) #define av_fetch_sv (thr->Tav_fetch_sv) #define bodytarget (thr->Tbodytarget) +#define bostr (thr->Tbostr) #define chopset (thr->Tchopset) +#define colors (thr->Tcolors) +#define colorset (thr->Tcolorset) #define curcop (thr->Tcurcop) #define curpad (thr->Tcurpad) #define curpm (thr->Tcurpm) @@ -761,22 +764,59 @@ #define defstash (thr->Tdefstash) #define delaymagic (thr->Tdelaymagic) #define dirty (thr->Tdirty) +#define extralen (thr->Textralen) +#define firstgv (thr->Tfirstgv) #define formtarget (thr->Tformtarget) #define hv_fetch_ent_mh (thr->Thv_fetch_ent_mh) #define hv_fetch_sv (thr->Thv_fetch_sv) #define in_eval (thr->Tin_eval) #define last_in_gv (thr->Tlast_in_gv) +#define lastgotoprobe (thr->Tlastgotoprobe) +#define lastscream (thr->Tlastscream) #define localizing (thr->Tlocalizing) #define mainstack (thr->Tmainstack) #define markstack (thr->Tmarkstack) #define markstack_max (thr->Tmarkstack_max) #define markstack_ptr (thr->Tmarkstack_ptr) +#define maxscream (thr->Tmaxscream) #define modcount (thr->Tmodcount) #define nrs (thr->Tnrs) #define ofs (thr->Tofs) #define ofslen (thr->Tofslen) #define op (thr->Top) #define opsave (thr->Topsave) +#define reg_eval_set (thr->Treg_eval_set) +#define reg_flags (thr->Treg_flags) +#define reg_start_tmp (thr->Treg_start_tmp) +#define reg_start_tmpl (thr->Treg_start_tmpl) +#define regbol (thr->Tregbol) +#define regcc (thr->Tregcc) +#define regcode (thr->Tregcode) +#define regcomp_parse (thr->Tregcomp_parse) +#define regcomp_rx (thr->Tregcomp_rx) +#define regcompp (thr->Tregcompp) +#define regdata (thr->Tregdata) +#define regdummy (thr->Tregdummy) +#define regendp (thr->Tregendp) +#define regeol (thr->Tregeol) +#define regexecp (thr->Tregexecp) +#define regflags (thr->Tregflags) +#define regindent (thr->Tregindent) +#define reginput (thr->Treginput) +#define reginterp_cnt (thr->Treginterp_cnt) +#define reglastparen (thr->Treglastparen) +#define regnarrate (thr->Tregnarrate) +#define regnaughty (thr->Tregnaughty) +#define regnpar (thr->Tregnpar) +#define regprecomp (thr->Tregprecomp) +#define regprev (thr->Tregprev) +#define regprogram (thr->Tregprogram) +#define regsawback (thr->Tregsawback) +#define regseen (thr->Tregseen) +#define regsize (thr->Tregsize) +#define regstartp (thr->Tregstartp) +#define regtill (thr->Tregtill) +#define regxend (thr->Tregxend) #define restartop (thr->Trestartop) #define retstack (thr->Tretstack) #define retstack_ix (thr->Tretstack_ix) @@ -788,11 +828,22 @@ #define scopestack (thr->Tscopestack) #define scopestack_ix (thr->Tscopestack_ix) #define scopestack_max (thr->Tscopestack_max) +#define screamfirst (thr->Tscreamfirst) +#define screamnext (thr->Tscreamnext) +#define secondgv (thr->Tsecondgv) +#define seen_evals (thr->Tseen_evals) +#define seen_zerolen (thr->Tseen_zerolen) +#define sortcop (thr->Tsortcop) +#define sortcxix (thr->Tsortcxix) +#define sortstash (thr->Tsortstash) #define stack_base (thr->Tstack_base) #define stack_max (thr->Tstack_max) #define stack_sp (thr->Tstack_sp) #define start_env (thr->Tstart_env) #define statbuf (thr->Tstatbuf) +#define statcache (thr->Tstatcache) +#define statgv (thr->Tstatgv) +#define statname (thr->Tstatname) #define tainted (thr->Ttainted) #define timesbuf (thr->Ttimesbuf) #define tmps_floor (thr->Ttmps_floor) diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index 28583a19bd..be1e7af560 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -149,6 +149,7 @@ threadstart(void *arg) SvREFCNT_dec(thr->specific); SvREFCNT_dec(thr->errsv); SvREFCNT_dec(thr->errhv); + Safefree(markstack); Safefree(scopestack); Safefree(savestack); @@ -157,6 +158,12 @@ threadstart(void *arg) Safefree(tmps_stack); Safefree(ofs); + SvREFCNT_dec(statname); + Safefree(screamfirst); + Safefree(screamnext); + Safefree(reg_start_tmp); + SvREFCNT_dec(lastscream); + MUTEX_LOCK(&thr->mutex); DEBUG_L(PerlIO_printf(PerlIO_stderr(), "%p: threadstart finishing: state is %u\n", diff --git a/ext/re/re.xs b/ext/re/re.xs index 7b9fb379cd..2d0f18700a 100644 --- a/ext/re/re.xs +++ b/ext/re/re.xs @@ -14,6 +14,7 @@ static int oldfl; static void deinstall(void) { + dTHR; regexecp = ®exec_flags; regcompp = &pregcomp; if (!oldfl) @@ -23,6 +24,7 @@ deinstall(void) static void install(void) { + dTHR; regexecp = &my_regexec; regcompp = &my_regcomp; oldfl = debug & R_DB; diff --git a/intrpvar.h b/intrpvar.h index 1239338cab..71fcda7e94 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -63,10 +63,6 @@ PERLVAR(Istatusvalue, I32) /* $? */ PERLVAR(Istatusvalue_vms,U32) #endif -PERLVAR(Istatcache, Stat_t) /* _ */ -PERLVAR(Istatgv, GV *) -PERLVARI(Istatname, SV *, Nullsv) - /* shortcuts to various I/O objects */ PERLVAR(Istdingv, GV *) PERLVAR(Idefgv, GV *) @@ -74,13 +70,13 @@ PERLVAR(Iargvgv, GV *) PERLVAR(Iargvoutgv, GV *) /* shortcuts to regexp stuff */ +/* XXX these three aren't used anywhere */ PERLVAR(Ileftgv, GV *) PERLVAR(Iampergv, GV *) PERLVAR(Irightgv, GV *) -PERLVAR(Iscreamfirst, I32 *) -PERLVAR(Iscreamnext, I32 *) -PERLVARI(Imaxscream, I32, -1) -PERLVAR(Ilastscream, SV *) + +/* this one needs to be moved to thrdvar.h and accessed via + * find_threadsv() when USE_THREADS */ PERLVAR(Ireplgv, GV *) /* shortcuts to misc objects */ @@ -149,10 +145,6 @@ PERLVAR(Ilastfd, int) /* what to preserve mode on */ PERLVAR(Ioldname, char *) /* what to preserve mode on */ PERLVAR(IArgv, char **) /* stuff to free from do_aexec, vfork safe */ PERLVAR(ICmd, char *) /* stuff to free from do_aexec, vfork safe */ -PERLVAR(Isortcop, OP *) /* user defined sort routine */ -PERLVAR(Isortstash, HV *) /* which is in some package or other */ -PERLVAR(Ifirstgv, GV *) /* $a */ -PERLVAR(Isecondgv, GV *) /* $b */ PERLVAR(Imystrk, SV *) /* temp key string for do_each() */ PERLVAR(Idumplvl, I32) /* indentation level on syntax tree dump */ PERLVAR(Ioldlastpm, PMOP *) /* for saving regexp context in debugger */ @@ -196,58 +188,6 @@ PERLVAR(Isys_intern, struct interp_intern) PERLVARI(Igeneration, int, 100) /* from op.c */ PERLVAR(IDBcv, CV *) /* from perl.c */ PERLVAR(Iarchpat_auto, char*) /* from perl.c */ -PERLVAR(Isortcxix, I32) /* from pp_ctl.c */ -PERLVAR(Ilastgotoprobe, OP*) /* from pp_ctl.c */ -PERLVAR(Iregdummy, regnode) /* from regcomp.c */ -PERLVAR(Iregcomp_parse, char*) /* Input-scan pointer. */ -PERLVAR(Iregxend, char*) /* End of input for compile */ -PERLVAR(Iregcode, regnode*) /* Code-emit pointer; ®dummy = don't */ -PERLVAR(Iregnaughty, I32) /* How bad is this pattern? */ -PERLVAR(Iregsawback, I32) /* Did we see \1, ...? */ - -/* This guys appear both in regcomp.c and regexec.c, */ -PERLVAR(Iregprecomp, char *) /* uncompiled string. */ -PERLVAR(Iregnpar, I32) /* () count. */ -PERLVAR(Iregsize, I32) /* Code size. */ -PERLVAR(Iregflags, U16) /* are we folding, multilining? */ - -PERLVAR(Iregseen, U32) /* from regcomp.c */ -PERLVAR(Iseen_zerolen, I32) /* from regcomp.c */ -PERLVAR(Iseen_evals, I32) /* from regcomp.c */ -PERLVAR(Iregcomp_rx, regexp *) /* from regcomp.c */ -PERLVAR(Iextralen, I32) /* from regcomp.c */ -PERLVAR(Icolorset, int) /* from regcomp.c */ -PERLVAR(Icolors[4], char *) /* from regcomp.c */ - -PERLVAR(Ireginput, char *) /* String-input pointer. */ -PERLVAR(Iregbol, char *) /* Beginning of input, for ^ check. */ -PERLVAR(Iregeol, char *) /* End of input, for $ check. */ -PERLVAR(Iregstartp, char **) /* Pointer to startp array. */ -PERLVAR(Iregendp, char **) /* Ditto for endp. */ -PERLVAR(Ireglastparen, U32 *) /* Similarly for lastparen. */ -PERLVAR(Iregtill, char *) /* How far we are required to go. */ -PERLVAR(Iregprev, char) /* char before regbol, \n if none */ - -PERLVAR(Ireg_start_tmp, char **) /* from regexec.c */ -PERLVAR(Ireg_start_tmpl,U32) /* from regexec.c */ -PERLVAR(Iregdata, struct reg_data *) - /* from regexec.c renamed was data */ -PERLVAR(Ibostr, char *) /* from regexec.c */ -PERLVAR(Ireg_flags, U32) /* from regexec.c */ -PERLVAR(Ireg_eval_set, I32) /* from regexec.c */ - -PERLVAR(Iregnarrate, I32) /* from regexec.c */ -PERLVAR(Iregprogram, regnode *) /* from regexec.c */ -PERLVARI(Iregindent, int, 0) /* from regexec.c */ - -PERLVAR(Iregcc, CURCUR *) /* from regexec.c */ - -PERLVARI(Iregcompp, regcomp_t, FUNC_NAME_TO_PTR(pregcomp)) - /* Pointer to RE compiler */ -PERLVARI(Iregexecp, regexec_t, FUNC_NAME_TO_PTR(regexec_flags)) - /* Pointer to RE executer */ -PERLVARI(Ireginterp_cnt, int, 0) /* Whether `Regexp' - was interpolated. */ PERLVARI(Iin_clean_objs,bool, FALSE) /* from sv.c */ PERLVARI(Iin_clean_all, bool, FALSE) /* from sv.c */ @@ -2121,6 +2121,7 @@ newPMOP(I32 type, I32 flags) OP * pmruntime(OP *o, OP *expr, OP *repl) { + dTHR; PMOP *pm; LOGOP *rcop; I32 repl_has_vars = 0; @@ -2776,6 +2776,13 @@ init_main_thread() formtarget = bodytarget; thr->errsv = newSVpv("", 0); (void) find_threadsv("@"); /* Ensure $@ is initialised early */ + + maxscream = -1; + regcompp = FUNC_NAME_TO_PTR(pregcomp); + regexecp = FUNC_NAME_TO_PTR(regexec_flags); + regindent = 0; + reginterp_cnt = 0; + return thr; } #endif /* USE_THREADS */ @@ -1728,6 +1728,7 @@ dofindlabel(OP *o, char *label, OP **opstack, OP **oplimit) } *ops = 0; if (o->op_flags & OPf_KIDS) { + dTHR; /* First try all the kids at this level, since that's likeliest. */ for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling) { if ((kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) && @@ -223,6 +223,7 @@ study_chunk(regnode **scanp, I32 *deltap, regnode *last, scan_data_t *data, U32 /* deltap: Write maxlen-minlen here. */ /* last: Stop before this one. */ { + dTHR; I32 min = 0, pars = 0, code; regnode *scan = *scanp, *next; I32 delta = 0; @@ -664,6 +665,7 @@ study_chunk(regnode **scanp, I32 *deltap, regnode *last, scan_data_t *data, U32 STATIC I32 add_data(I32 n, char *s) { + dTHR; if (regcomp_rx->data) { Renewc(regcomp_rx->data, sizeof(*regcomp_rx->data) + sizeof(void*) * (regcomp_rx->data->count + n - 1), @@ -698,6 +700,7 @@ add_data(I32 n, char *s) regexp * pregcomp(char *exp, char *xend, PMOP *pm) { + dTHR; register regexp *r; regnode *scan; SV **longest; @@ -979,6 +982,7 @@ STATIC regnode * reg(I32 paren, I32 *flagp) /* paren: Parenthesized? 0=top, 1=(, inside: changed to letter. */ { + dTHR; register regnode *ret; /* Will be the head of the group. */ register regnode *br; register regnode *lastbr; @@ -1276,6 +1280,7 @@ reg(I32 paren, I32 *flagp) STATIC regnode * regbranch(I32 *flagp, I32 first) { + dTHR; register regnode *ret; register regnode *chain = NULL; register regnode *latest; @@ -1340,6 +1345,7 @@ regbranch(I32 *flagp, I32 first) STATIC regnode * regpiece(I32 *flagp) { + dTHR; register regnode *ret; register char op; register char *next; @@ -1488,6 +1494,7 @@ regpiece(I32 *flagp) STATIC regnode * regatom(I32 *flagp) { + dTHR; register regnode *ret = 0; I32 flags; @@ -1839,6 +1846,7 @@ regwhite(char *p, char *e) STATIC regnode * regclass(void) { + dTHR; register char *opnd, *s; register I32 Class; register I32 lastclass = 1234; @@ -2043,6 +2051,7 @@ regclass(void) STATIC char* nextchar(void) { + dTHR; char* retval = regcomp_parse++; for (;;) { @@ -2075,6 +2084,7 @@ nextchar(void) STATIC regnode * /* Location. */ reg_node(U8 op) { + dTHR; register regnode *ret; register regnode *ptr; @@ -2099,6 +2109,7 @@ reg_node(U8 op) STATIC regnode * /* Location. */ reganode(U8 op, U32 arg) { + dTHR; register regnode *ret; register regnode *ptr; @@ -2123,6 +2134,7 @@ reganode(U8 op, U32 arg) STATIC void regc(U8 b, char* s) { + dTHR; if (!SIZE_ONLY) *s = b; } @@ -2135,6 +2147,7 @@ regc(U8 b, char* s) STATIC void reginsert(U8 op, regnode *opnd) { + dTHR; register regnode *src; register regnode *dst; register regnode *place; @@ -2165,6 +2178,7 @@ reginsert(U8 op, regnode *opnd) STATIC void regtail(regnode *p, regnode *val) { + dTHR; register regnode *scan; register regnode *temp; register I32 offset; @@ -2194,6 +2208,7 @@ regtail(regnode *p, regnode *val) STATIC void regoptail(regnode *p, regnode *val) { + dTHR; /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || SIZE_ONLY) return; @@ -2298,6 +2313,7 @@ void regdump(regexp *r) { #ifdef DEBUGGING + dTHR; SV *sv = sv_newmortal(); (void)dumpuntil(r->program, r->program + 1, NULL, sv, 0); @@ -2362,6 +2378,7 @@ void regprop(SV *sv, regnode *o) { #ifdef DEBUGGING + dTHR; register char *p = 0; sv_setpvn(sv, "", 0); @@ -2552,6 +2569,7 @@ regprop(SV *sv, regnode *o) void pregfree(struct regexp *r) { + dTHR; if (!r || (--r->refcnt > 0)) return; if (r->precomp) @@ -2598,6 +2616,7 @@ pregfree(struct regexp *r) regnode * regnext(register regnode *p) { + dTHR; register I32 offset; if (p == ®dummy) @@ -204,6 +204,7 @@ regexec_flags(register regexp *prog, char *stringarg, register char *strend, /* data: May be used for some additional optimizations. */ /* nosave: For optimizations. */ { + dTHR; register char *s; register regnode *c; register char *startpos = stringarg; @@ -1375,8 +1376,8 @@ regmatch(regnode *prog) ln = n; locinput = reginput; DEBUG_r( - PerlIO_printf(Perl_debug_log, "%*s matched %ld times, - len=%ld...\n", + PerlIO_printf(Perl_debug_log, + "%*s matched %ld times, len=%ld...\n", REPORT_CODE_OFF+regindent*2, "", n, l) ); if (n >= ln) { @@ -1634,6 +1635,7 @@ no: STATIC I32 regrepeat(regnode *p, I32 max) { + dTHR; register char *scan; register char *opnd; register I32 c; @@ -1746,6 +1748,7 @@ regrepeat(regnode *p, I32 max) STATIC I32 regrepeat_hard(regnode *p, I32 max, I32 *lp) { + dTHR; register char *scan; register char *start; register char *loceol = regeol; @@ -1777,6 +1780,7 @@ regrepeat_hard(regnode *p, I32 max, I32 *lp) STATIC bool reginclass(register char *p, register I32 c) { + dTHR; char flags = *p; bool match = FALSE; @@ -1706,6 +1706,7 @@ sv_2pv(register SV *sv, STRLEN *lp) == (SVs_OBJECT|SVs_RMG)) && strEQ(s=HvNAME(SvSTASH(sv)), "Regexp") && (mg = mg_find(sv, 'r'))) { + dTHR; regexp *re = (regexp *)mg->mg_obj; if (!mg->mg_ptr) { diff --git a/t/lib/thread.t b/t/lib/thread.t index b8e1b387ba..6d3fdde6ab 100755 --- a/t/lib/thread.t +++ b/t/lib/thread.t @@ -50,5 +50,5 @@ join $t; # test that sleep lets other thread run $t = new Thread \&islocked,"ok 8\n"; sleep 6; -print "ok 9"; +print "ok 9\n"; join $t; @@ -53,7 +53,12 @@ PERLVAR(Tretstack_max, I32) PERLVAR(TSv, SV *) /* used to hold temporary values */ PERLVAR(TXpv, XPV *) /* used to hold temporary values */ +/* stat stuff */ PERLVAR(Tstatbuf, Stat_t) +PERLVAR(Tstatcache, Stat_t) /* _ */ +PERLVAR(Tstatgv, GV *) +PERLVARI(Tstatname, SV *, Nullsv) + #ifdef HAS_TIMES PERLVAR(Ttimesbuf, struct tms) #endif @@ -96,8 +101,66 @@ PERLVAR(Thv_fetch_ent_mh, HE) /* owned by hv_fetch_ent() */ PERLVAR(Tmodcount, I32) /* how much mod()ification in assignment? */ -/* XXX Sort stuff, firstgv secongv and so on? */ -/* XXX What about regexp stuff? */ +PERLVAR(Tlastgotoprobe, OP*) /* from pp_ctl.c */ + +/* sort stuff */ +PERLVAR(Tsortcop, OP *) /* user defined sort routine */ +PERLVAR(Tsortstash, HV *) /* which is in some package or other */ +PERLVAR(Tfirstgv, GV *) /* $a */ +PERLVAR(Tsecondgv, GV *) /* $b */ +PERLVAR(Tsortcxix, I32) /* from pp_ctl.c */ + +/* regex stuff */ + +PERLVAR(Tscreamfirst, I32 *) +PERLVAR(Tscreamnext, I32 *) +PERLVARI(Tmaxscream, I32, -1) +PERLVAR(Tlastscream, SV *) + +PERLVAR(Tregdummy, regnode) /* from regcomp.c */ +PERLVAR(Tregcomp_parse, char*) /* Input-scan pointer. */ +PERLVAR(Tregxend, char*) /* End of input for compile */ +PERLVAR(Tregcode, regnode*) /* Code-emit pointer; ®dummy = don't */ +PERLVAR(Tregnaughty, I32) /* How bad is this pattern? */ +PERLVAR(Tregsawback, I32) /* Did we see \1, ...? */ +PERLVAR(Tregprecomp, char *) /* uncompiled string. */ +PERLVAR(Tregnpar, I32) /* () count. */ +PERLVAR(Tregsize, I32) /* Code size. */ +PERLVAR(Tregflags, U16) /* are we folding, multilining? */ +PERLVAR(Tregseen, U32) /* from regcomp.c */ +PERLVAR(Tseen_zerolen, I32) /* from regcomp.c */ +PERLVAR(Tseen_evals, I32) /* from regcomp.c */ +PERLVAR(Tregcomp_rx, regexp *) /* from regcomp.c */ +PERLVAR(Textralen, I32) /* from regcomp.c */ +PERLVAR(Tcolorset, int) /* from regcomp.c */ +PERLVAR(Tcolors[4], char *) /* from regcomp.c */ +PERLVAR(Treginput, char *) /* String-input pointer. */ +PERLVAR(Tregbol, char *) /* Beginning of input, for ^ check. */ +PERLVAR(Tregeol, char *) /* End of input, for $ check. */ +PERLVAR(Tregstartp, char **) /* Pointer to startp array. */ +PERLVAR(Tregendp, char **) /* Ditto for endp. */ +PERLVAR(Treglastparen, U32 *) /* Similarly for lastparen. */ +PERLVAR(Tregtill, char *) /* How far we are required to go. */ +PERLVAR(Tregprev, char) /* char before regbol, \n if none */ +PERLVAR(Treg_start_tmp, char **) /* from regexec.c */ +PERLVAR(Treg_start_tmpl,U32) /* from regexec.c */ +PERLVAR(Tregdata, struct reg_data *) + /* from regexec.c renamed was data */ +PERLVAR(Tbostr, char *) /* from regexec.c */ +PERLVAR(Treg_flags, U32) /* from regexec.c */ +PERLVAR(Treg_eval_set, I32) /* from regexec.c */ +PERLVAR(Tregnarrate, I32) /* from regexec.c */ +PERLVAR(Tregprogram, regnode *) /* from regexec.c */ +PERLVARI(Tregindent, int, 0) /* from regexec.c */ +PERLVAR(Tregcc, CURCUR *) /* from regexec.c */ + +PERLVARI(Tregcompp, regcomp_t, FUNC_NAME_TO_PTR(pregcomp)) + /* Pointer to RE compiler */ +PERLVARI(Tregexecp, regexec_t, FUNC_NAME_TO_PTR(regexec_flags)) + /* Pointer to RE executer */ +PERLVARI(Treginterp_cnt,int, 0) /* Whether `Regexp' + was interpolated. */ + /* Note that the variables below are all explicitly referenced in the code * as thr->whatever and therefore don't need the 'T' prefix. */ @@ -1062,6 +1062,7 @@ fbm_instr(unsigned char *big, register unsigned char *bigend, SV *littlestr, U32 char * screaminstr(SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift, I32 *old_posp, I32 last) { + dTHR; register unsigned char *s, *x; register unsigned char *big; register I32 pos; @@ -2791,6 +2792,17 @@ new_struct_thread(struct perl_thread *t) formtarget = newSVsv(t->Tformtarget); bodytarget = newSVsv(t->Tbodytarget); toptarget = newSVsv(t->Ttoptarget); + + statname = NEWSV(66,0); + maxscream = -1; + regcompp = FUNC_NAME_TO_PTR(pregcomp); + regexecp = FUNC_NAME_TO_PTR(regexec_flags); + regindent = 0; + reginterp_cnt = 0; + lastscream = Nullsv; + screamfirst = 0; + screamnext = 0; + reg_start_tmp = 0; /* Initialise all per-thread SVs that the template thread used */ svp = AvARRAY(t->threadsv); |