summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-31 18:05:31 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-31 18:05:31 +0000
commita863c7d16499251f020c5d26d232aa865fa0b197 (patch)
tree9a4ae00010863431f84e1aa26d6e2cefe89dd514 /op.c
parent46930d8f1568c61dcd2ab37f6a2924dc79596ffc (diff)
downloadperl-a863c7d16499251f020c5d26d232aa865fa0b197.tar.gz
Half way through moving per-thread magicals into per-thread fields
and the associated new OP_SPECIFIC and find_thread_magical stuff. perl will compile but plenty of the magicals are still broken. p4raw-id: //depot/perl@195
Diffstat (limited to 'op.c')
-rw-r--r--op.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/op.c b/op.c
index e7d843dac8..71f6689885 100644
--- a/op.c
+++ b/op.c
@@ -247,7 +247,7 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)
warn("Variable \"%s\" will not stay shared", name);
}
}
- av_store(comppad, newoff, SvREFCNT_inc(oldsv));
+ av_store(comppad, newoff, oldsv ? SvREFCNT_inc(oldsv) : 0);
return newoff;
}
}
@@ -511,6 +511,33 @@ pad_reset()
pad_reset_pending = FALSE;
}
+#ifdef USE_THREADS
+PADOFFSET
+find_thread_magical(name)
+char *name;
+{
+ dTHR;
+ char *p;
+ PADOFFSET key;
+ /* We currently only handle single character magicals */
+ p = strchr(per_thread_magicals, *name);
+ if (!p)
+ return NOT_IN_PAD;
+ key = magical_keys[p - per_thread_magicals];
+ if (key == NOT_IN_PAD) {
+ SV *sv;
+ key = magical_keys[p - per_thread_magicals] = key_create();
+ sv = NEWSV(0, 0);
+ av_store(thr->specific, key, sv);
+ sv_magic(sv, 0, 0, name, 1);
+ DEBUG_L(PerlIO_printf(PerlIO_stderr(),
+ "find_thread_magical: key %d new SV %p for %d\n",
+ (int)key, sv, (int)*name));
+ }
+ return key;
+}
+#endif /* USE_THREADS */
+
/* Destructor */
void
@@ -1152,6 +1179,7 @@ I32 type;
goto nomod;
/* FALL THROUGH */
case OP_PADSV:
+ case OP_SPECIFIC:
modcount++;
if (!type)
croak("Can't localize lexical variable %s",
@@ -1314,6 +1342,10 @@ I32 type;
}
break;
+ case OP_SPECIFIC:
+ o->op_flags |= OPf_MOD; /* XXX ??? */
+ break;
+
case OP_RV2AV:
case OP_RV2HV:
o->op_flags |= OPf_REF;
@@ -2150,7 +2182,8 @@ OP *repl;
else if (curop->op_type == OP_PADSV ||
curop->op_type == OP_PADAV ||
curop->op_type == OP_PADHV ||
- curop->op_type == OP_PADANY) {
+ curop->op_type == OP_PADANY ||
+ curop->op_type == OP_SPECIFIC) {
/* is okay */
}
else
@@ -3410,8 +3443,8 @@ OP *block;
croak(not_safe);
else {
/* force display of errors found but not reported */
- sv_catpv(GvSV(errgv), not_safe);
- croak("%s", SvPVx(GvSV(errgv), na));
+ sv_catpv(errsv, not_safe);
+ croak("%s", SvPV(errsv, na));
}
}
}
@@ -3814,6 +3847,8 @@ OP *o;
o->op_ppaddr = ppaddr[OP_PADSV];
return o;
}
+ else if (o->op_type == OP_SPECIFIC)
+ return o;
return newUNOP(OP_RV2SV, 0, scalar(o));
}