From: Gurusamy Sarathy Date: Wed, 1 Dec 1999 03:45:13 +0000 (+0000) Subject: minor USE_ITHREADS tweaks X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=638eceb6656bf10acb1a6dc2a55880f5e1a6c8c4;p=p5sagit%2Fp5-mst-13.2.git minor USE_ITHREADS tweaks p4raw-id: //depot/perl@4603 --- diff --git a/doio.c b/doio.c index f023ebd..8c8a77b 100644 --- a/doio.c +++ b/doio.c @@ -1064,7 +1064,7 @@ Perl_my_stat(pTHX) if (PL_op->op_flags & OPf_REF) { EXTEND(SP,1); - tmpgv = cGVOP; + tmpgv = cGVOP_gv; do_fstat: io = GvIO(tmpgv); if (io && IoIFP(io)) { @@ -1117,7 +1117,7 @@ Perl_my_lstat(pTHX) STRLEN n_a; if (PL_op->op_flags & OPf_REF) { EXTEND(SP,1); - if (cGVOP == PL_defgv) { + if (cGVOP_gv == PL_defgv) { if (PL_laststype != OP_LSTAT) Perl_croak(aTHX_ "The stat preceding -l _ wasn't an lstat"); return PL_laststatval; diff --git a/op.c b/op.c index 7824c22..6cfc957 100644 --- a/op.c +++ b/op.c @@ -722,7 +722,7 @@ S_op_clear(pTHX_ OP *o) #ifdef USE_ITHREADS if (cPADOPo->op_padix > 0) { if (PL_curpad) { - GV *gv = cGVOPo; + GV *gv = cGVOPo_gv; pad_swipe(cPADOPo->op_padix); /* No GvIN_PAD_off(gv) here, because other references may still * exist on the pad */ @@ -1403,7 +1403,7 @@ Perl_mod(pTHX_ OP *o, I32 type) break; } - cv = GvCV(kGVOP); + cv = GvCV(kGVOP_gv); if (!cv) goto restore_2cv; if (CvLVALUE(cv)) @@ -2861,7 +2861,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, OP *repl) } #else if (curop->op_type == OP_GV) { - GV *gv = cGVOPx(curop); + GV *gv = cGVOPx_gv(curop); repl_has_vars = 1; if (strchr("&`'123456789+", *GvENAME(gv))) break; @@ -3209,7 +3209,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) { if (PL_opargs[curop->op_type] & OA_DANGEROUS) { if (curop->op_type == OP_GV) { - GV *gv = cGVOPx(curop); + GV *gv = cGVOPx_gv(curop); if (gv == PL_defgv || SvCUR(gv) == PL_generation) break; SvCUR(gv) = PL_generation; @@ -5114,7 +5114,7 @@ Perl_ck_rvconst(pTHX_ register OP *o) kid->op_type = OP_GV; SvREFCNT_dec(kid->op_sv); #ifdef USE_ITHREADS - /* XXXXXX hack: dependence on sizeof(PADOP) <= sizeof(SVOP) */ + /* XXX hack: dependence on sizeof(PADOP) <= sizeof(SVOP) */ kPADOP->op_padix = pad_alloc(OP_GV, SVs_PADTMP); GvIN_PAD_on(gv); PL_curpad[kPADOP->op_padix] = SvREFCNT_inc(gv); @@ -5826,7 +5826,7 @@ S_simplify_sort(pTHX_ OP *o) if (kUNOP->op_first->op_type != OP_GV) return; kid = kUNOP->op_first; /* get past rv2sv */ - gv = kGVOP; + gv = kGVOP_gv; if (GvSTASH(gv) != PL_curstash) return; if (strEQ(GvNAME(gv), "a")) @@ -5842,7 +5842,7 @@ S_simplify_sort(pTHX_ OP *o) if (kUNOP->op_first->op_type != OP_GV) return; kid = kUNOP->op_first; /* get past rv2sv */ - gv = kGVOP; + gv = kGVOP_gv; if (GvSTASH(gv) != PL_curstash || ( reversed ? strNE(GvNAME(gv), "a") @@ -5952,7 +5952,7 @@ Perl_ck_subr(pTHX_ OP *o) null(cvop); /* disable rv2cv */ tmpop = (SVOP*)((UNOP*)cvop)->op_first; if (tmpop->op_type == OP_GV && !(o->op_private & OPpENTERSUB_AMPER)) { - GV *gv = cGVOPx(tmpop); + GV *gv = cGVOPx_gv(tmpop); cv = GvCVu(gv); if (!cv) tmpop->op_private |= OPpEARLY_CV; @@ -6020,7 +6020,7 @@ Perl_ck_subr(pTHX_ OP *o) (gvop = ((UNOP*)gvop)->op_first) && gvop->op_type == OP_GV) { - GV *gv = cGVOPx(gvop); + GV *gv = cGVOPx_gv(gvop); OP *sibling = o2->op_sibling; SV *n = newSVpvn("",0); op_free(o2); @@ -6262,12 +6262,12 @@ Perl_peep(pTHX_ register OP *o) o->op_type = OP_AELEMFAST; o->op_ppaddr = PL_ppaddr[OP_AELEMFAST]; o->op_private = (U8)i; - gv = cGVOPo; + gv = cGVOPo_gv; GvAVn(gv); } } else if ((o->op_private & OPpEARLY_CV) && ckWARN(WARN_UNSAFE)) { - GV *gv = cGVOPo; + GV *gv = cGVOPo_gv; if (SvTYPE(gv) == SVt_PVGV && GvCV(gv) && SvPVX(GvCV(gv))) { /* XXX could check prototype here instead of just carping */ SV *sv = sv_newmortal(); @@ -6348,7 +6348,7 @@ Perl_peep(pTHX_ register OP *o) fields = (GV**)hv_fetch(SvSTASH(lexname), "FIELDS", 6, FALSE); if (!fields || !GvHV(*fields)) break; - svp = &cSVOPx_sv(((BINOP*)o)->op_last); + svp = cSVOPx_svp(((BINOP*)o)->op_last); key = SvPV(*svp, keylen); indsvp = hv_fetch(GvHV(*fields), key, keylen, FALSE); if (!indsvp) { diff --git a/op.h b/op.h index 454cbf7..5231a41 100644 --- a/op.h +++ b/op.h @@ -305,33 +305,27 @@ struct loop { #ifdef USE_ITHREADS -# define cGVOPx(o) ((GV*)PAD_SV(cPADOPx(o)->op_padix)) -# define cGVOP ((GV*)PAD_SV(cPADOP->op_padix)) -# define cGVOPo ((GV*)PAD_SV(cPADOPo->op_padix)) -# define kGVOP ((GV*)PAD_SV(kPADOP->op_padix)) -# define cGVOP_set(v) (PL_curpad[cPADOP->op_padix] = (SV*)(v)) -# define cGVOPo_set(v) (PL_curpad[cPADOPo->op_padix] = (SV*)(v)) -# define kGVOP_set(v) (PL_curpad[kPADOP->op_padix] = (SV*)(v)) +# define cGVOPx_gv(o) ((GV*)PL_curpad[cPADOPx(o)->op_padix]) # define IS_PADGV(v) (v && SvTYPE(v) == SVt_PVGV && GvIN_PAD(v)) # define IS_PADCONST(v) (v && SvREADONLY(v)) # define cSVOPx_sv(v) (cSVOPx(v)->op_sv \ ? cSVOPx(v)->op_sv : PL_curpad[(v)->op_targ]) +# define cSVOPx_svp(v) (cSVOPx(v)->op_sv \ + ? &cSVOPx(v)->op_sv : &PL_curpad[(v)->op_targ]) #else -# define cGVOPx(o) ((GV*)cSVOPx(o)->op_sv) -# define cGVOP ((GV*)cSVOP->op_sv) -# define cGVOPo ((GV*)cSVOPo->op_sv) -# define kGVOP ((GV*)kSVOP->op_sv) -# define cGVOP_set(v) (cPADOP->op_sv = (SV*)(v)) -# define cGVOPo_set(v) (cPADOPo->op_sv = (SV*)(v)) -# define kGVOP_set(v) (kPADOP->op_sv = (SV*)(v)) +# define cGVOPx_gv(o) ((GV*)cSVOPx(o)->op_sv) # define IS_PADGV(v) FALSE # define IS_PADCONST(v) FALSE # define cSVOPx_sv(v) (cSVOPx(v)->op_sv) +# define cSVOPx_svp(v) (&cSVOPx(v)->op_sv) #endif -#define cSVOP_sv cSVOPx_sv(PL_op) -#define cSVOPo_sv cSVOPx_sv(o) -#define kSVOP_sv cSVOPx_sv(kid) +#define cGVOP_gv cGVOPx_gv(PL_op) +#define cGVOPo_gv cGVOPx_gv(o) +#define kGVOP_gv cGVOPx_gv(kid) +#define cSVOP_sv cSVOPx_sv(PL_op) +#define cSVOPo_sv cSVOPx_sv(o) +#define kSVOP_sv cSVOPx_sv(kid) #define Nullop Null(OP*) diff --git a/pp_hot.c b/pp_hot.c index 690abea..8697d36 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -58,9 +58,9 @@ PP(pp_gvsv) djSP; EXTEND(SP,1); if (PL_op->op_private & OPpLVAL_INTRO) - PUSHs(save_scalar(cGVOP)); + PUSHs(save_scalar(cGVOP_gv)); else - PUSHs(GvSV(cGVOP)); + PUSHs(GvSV(cGVOP_gv)); RETURN; } @@ -95,7 +95,7 @@ PP(pp_stringify) PP(pp_gv) { djSP; - XPUSHs((SV*)cGVOP); + XPUSHs((SV*)cGVOP_gv); RETURN; } @@ -271,7 +271,7 @@ PP(pp_add) PP(pp_aelemfast) { djSP; - AV *av = GvAV(cGVOP); + AV *av = GvAV(cGVOP_gv); U32 lval = PL_op->op_flags & OPf_MOD; SV** svp = av_fetch(av, PL_op->op_private, lval); SV *sv = (svp ? *svp : &PL_sv_undef); diff --git a/pp_sys.c b/pp_sys.c index 48fb5e4..2f065ed 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -411,7 +411,7 @@ PP(pp_indread) PP(pp_rcatline) { - PL_last_in_gv = cGVOP; + PL_last_in_gv = cGVOP_gv; return do_readline(); } @@ -2437,7 +2437,7 @@ PP(pp_stat) STRLEN n_a; if (PL_op->op_flags & OPf_REF) { - tmpgv = cGVOP; + tmpgv = cGVOP_gv; do_fstat: if (tmpgv != PL_defgv) { PL_laststype = OP_STAT; @@ -2899,7 +2899,7 @@ PP(pp_fttty) STRLEN n_a; if (PL_op->op_flags & OPf_REF) - gv = cGVOP; + gv = cGVOP_gv; else if (isGV(TOPs)) gv = (GV*)POPs; else if (SvROK(TOPs) && isGV(SvRV(TOPs))) @@ -2941,7 +2941,7 @@ PP(pp_fttext) PerlIO *fp; if (PL_op->op_flags & OPf_REF) - gv = cGVOP; + gv = cGVOP_gv; else if (isGV(TOPs)) gv = (GV*)POPs; else if (SvROK(TOPs) && isGV(SvRV(TOPs))) @@ -2991,7 +2991,7 @@ PP(pp_fttext) } else { if (ckWARN(WARN_UNOPENED)) { - gv = cGVOP; + gv = cGVOP_gv; Perl_warner(aTHX_ WARN_UNOPENED, "Test on unopened file <%s>", GvENAME(gv)); } diff --git a/run.c b/run.c index 9878076..2491b93 100644 --- a/run.c +++ b/run.c @@ -75,9 +75,9 @@ Perl_debop(pTHX_ OP *o) break; case OP_GVSV: case OP_GV: - if (cGVOPo) { + if (cGVOPo_gv) { sv = NEWSV(0,0); - gv_fullname3(sv, cGVOPo, Nullch); + gv_fullname3(sv, cGVOPo_gv, Nullch); PerlIO_printf(Perl_debug_log, "(%s)", SvPV(sv, n_a)); SvREFCNT_dec(sv); } diff --git a/win32/Makefile b/win32/Makefile index fe38d99..e03bb2d 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -71,13 +71,13 @@ INST_ARCH = \$(ARCHNAME) # tests. This should be enabled to get the fork() emulation. Do not # enable unless you know what you're doing! # -USE_ITHREADS = define +#USE_ITHREADS = define # # uncomment to enable the implicit "host" layer for all system calls # made by perl. This is needed and auto-enabled by USE_OBJECT above. # -USE_IMP_SYS = define +#USE_IMP_SYS = define # # uncomment one of the following lines if you are using either diff --git a/win32/perllib.c b/win32/perllib.c index 717b902..1b8516c 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -281,7 +281,6 @@ perl_alloc(void) pHost->m_pHostperlSock, pHost->m_pHostperlProc); if (my_perl) { - CPerlObj* pPerl = (CPerlObj*)my_perl; w32_internal_host = pHost; } } diff --git a/win32/win32.h b/win32/win32.h index 856232a..28d582a 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -9,6 +9,8 @@ #ifndef _INC_WIN32_PERL5 #define _INC_WIN32_PERL5 +#define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */ + #if defined(PERL_OBJECT) || defined(PERL_IMPLICIT_SYS) || defined(PERL_CAPI) # define DYNAMIC_ENV_FETCH # define ENV_HV_NAME "___ENV_HV_NAME___"