getting per-thread magicals. Fixed thr->errsv initialisation.
p4raw-id: //depot/perl@229
These ops are related to multi-threading.
- lock specific
+ lock threadsv
=item :default
o->op_targ = 0; /* Was holding hints. */
break;
#ifdef USE_THREADS
- case OP_SPECIFIC:
+ case OP_THREADSV:
o->op_targ = 0; /* Was holding index into thr->magicals AV. */
break;
#endif /* USE_THREADS */
break;
#ifdef USE_THREADS
- case OP_SPECIFIC:
+ case OP_THREADSV:
modcount++; /* XXX ??? */
-#if 0
- if (!type)
- croak("Can't localize thread-specific variable");
-#endif
break;
#endif /* USE_THREADS */
}
break;
- case OP_SPECIFIC:
+ case OP_THREADSV:
o->op_flags |= OPf_MOD; /* XXX ??? */
break;
if (o->op_type == OP_LIST) {
OP *o2;
#ifdef USE_THREADS
- o2 = newOP(OP_SPECIFIC, 0);
+ o2 = newOP(OP_THREADSV, 0);
o2->op_targ = find_thread_magical(";");
#else
o2 = newSVREF(newGVOP(OP_GV, 0, gv_fetchpv(";", TRUE, SVt_PV))),
if (pm->op_pmflags & PMf_EVAL)
curop = 0;
#ifdef USE_THREADS
- else if (repl->op_type == OP_SPECIFIC
+ else if (repl->op_type == OP_THREADSV
&& strchr("&`'123456789+",
per_thread_magicals[repl->op_targ]))
{
for (curop = LINKLIST(repl); curop!=repl; curop = LINKLIST(curop)) {
if (opargs[curop->op_type] & OA_DANGEROUS) {
#ifdef USE_THREADS
- if (curop->op_type == OP_SPECIFIC
+ if (curop->op_type == OP_THREADSV
&& strchr("&`'123456789+", curop->op_private)) {
break;
}
o->op_ppaddr = ppaddr[OP_PADSV];
return o;
}
- else if (o->op_type == OP_SPECIFIC)
+ else if (o->op_type == OP_THREADSV)
return o;
return newUNOP(OP_RV2SV, 0, scalar(o));
}
OP_GETLOGIN, /* 342 */
OP_SYSCALL, /* 343 */
OP_LOCK, /* 344 */
- OP_SPECIFIC, /* 345 */
+ OP_THREADSV, /* 345 */
OP_max
} opcode;
"getlogin",
"syscall",
"lock",
- "specific",
+ "threadsv",
};
#endif
"getlogin",
"syscall",
"lock",
- "thread-specific",
+ "per-thread variable",
};
#endif
OP * pp_getlogin _((ARGSproto));
OP * pp_syscall _((ARGSproto));
OP * pp_lock _((ARGSproto));
-OP * pp_specific _((ARGSproto));
+OP * pp_threadsv _((ARGSproto));
#ifndef DOINIT
EXT OP * (*ppaddr[])();
pp_getlogin,
pp_syscall,
pp_lock,
- pp_specific,
+ pp_threadsv,
};
#endif
ck_null, /* getlogin */
ck_fun, /* syscall */
ck_rfun, /* lock */
- ck_null, /* specific */
+ ck_null, /* threadsv */
};
#endif
0x0000000c, /* getlogin */
0x0002151d, /* syscall */
0x00001c04, /* lock */
- 0x00000044, /* specific */
+ 0x00000044, /* threadsv */
};
#endif
# For multi-threading
lock lock ck_rfun s% S
-specific thread-specific ck_null ds0
+threadsv per-thread variable ck_null ds0
char* name;
I32 create;
{
+ GV *gv;
#ifdef USE_THREADS
- PADOFFSET tmp;
- if (name[1] == '\0' && !isALPHA(name[0])
- && (tmp = find_thread_magical(name)) != NOT_IN_PAD) {
- return *av_fetch(thr->magicals, tmp, FALSE);
+ if (name[1] == '\0' && !isALPHA(name[0])) {
+ PADOFFSET tmp = find_thread_magical(name);
+ if (tmp != NOT_IN_PAD) {
+ dTHR;
+ return *av_fetch(thr->magicals, tmp, FALSE);
+ }
}
#endif /* USE_THREADS */
- GV* gv = gv_fetchpv(name, create, SVt_PV);
+ gv = gv_fetchpv(name, create, SVt_PV);
if (gv)
return GvSV(gv);
return Nullsv;
thr->cvcache = newHV();
thr->magicals = newAV();
thr->specific = newAV();
- thr->errsv = newSVpv("", 0);
thr->errhv = newHV();
thr->flags = THRf_R_JOINABLE;
MUTEX_INIT(&thr->mutex);
sv_upgrade(bodytarget, SVt_PVFM);
sv_setpvn(bodytarget, "", 0);
formtarget = bodytarget;
+ thr->errsv = newSVpv("", 0);
return thr;
}
#endif /* USE_THREADS */
RETURN;
}
-PP(pp_specific)
+PP(pp_threadsv)
{
dSP;
#ifdef USE_THREADS
SV **svp = av_fetch(thr->magicals, op->op_targ, FALSE);
if (!svp)
- croak("panic: pp_specific");
+ croak("panic: pp_threadsv");
EXTEND(sp, 1);
if (op->op_private & OPpLVAL_INTRO)
PUSHs(save_svref(svp));
else
PUSHs(*svp);
#else
- DIE("tried to access thread-specific data in non-threaded perl");
+ DIE("tried to access per-thread data in non-threaded perl");
#endif /* USE_THREADS */
RETURN;
}
sub sayok { print "ok @_\n" }
-$cpt->share(qw($foo %bar @baz *glob sayok $"));
+$cpt->share(qw($foo %bar @baz *glob sayok));
+$cpt->share('$"') unless $Config{archname} =~ /-thread$/;
$cpt->reval(q{
package other;
&& !isALPHA(tokenbuf[1]) /* Rule out obvious non-magicals */
&& (tmp = find_thread_magical(&tokenbuf[1])) != NOT_IN_PAD)
{
- yylval.opval = newOP(OP_SPECIFIC, 0);
+ yylval.opval = newOP(OP_THREADSV, 0);
yylval.opval->op_targ = tmp;
return PRIVATEREF;
}
nextval[nexttoke].ival = 0;
force_next(',');
#ifdef USE_THREADS
- nextval[nexttoke].opval = newOP(OP_SPECIFIC, 0);
+ nextval[nexttoke].opval = newOP(OP_THREADSV, 0);
nextval[nexttoke].opval->op_targ = find_thread_magical("\"");
force_next(PRIVATEREF);
#else