Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit dff9c9c

Browse files
author
Reini Urban
committed
mderef_u: fix mderef_uoob_gvsv for threads
with threads use the targ instead.
1 parent 49445e6 commit dff9c9c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

op.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14743,7 +14743,12 @@ S_mderef_uoob_targ(OP* o, PADOFFSET targ)
1474314743
int action = actions & MDEREF_ACTION_MASK;
1474414744
assert(action);
1474514745
if ( (action == MDEREF_AV_padav_aelem
14746-
|| action == MDEREF_AV_padsv_vivify_rv2av_aelem)
14746+
|| action == MDEREF_AV_padsv_vivify_rv2av_aelem
14747+
#ifdef USE_ITHREADS
14748+
|| action == MDEREF_AV_gvav_aelem
14749+
|| action == MDEREF_AV_gvsv_vivify_rv2av_aelem
14750+
#endif
14751+
)
1474714752
&& ((actions & MDEREF_INDEX_MASK) == MDEREF_INDEX_padsv)
1474814753
&& items->pad_offset == targ)
1474914754
{
@@ -14753,11 +14758,12 @@ S_mderef_uoob_targ(OP* o, PADOFFSET targ)
1475314758
return FALSE;
1475414759
}
1475514760

14761+
#ifndef USE_ITHREADS
1475614762
/* check the key index sv of the first INDEX_gvsv of a MDEREF_AV,
1475714763
compare it with the given key,
1475814764
and set INDEX_uoob. */
1475914765
STATIC bool
14760-
S_mderef_uoob_gv(pTHX_ OP* o, SV* idx)
14766+
S_mderef_uoob_gvsv(pTHX_ OP* o, SV* idx)
1476114767
{
1476214768
UNOP_AUX_item *items = cUNOP_AUXx(o)->op_aux;
1476314769
UV actions = items->uv;
@@ -14774,6 +14780,7 @@ S_mderef_uoob_gv(pTHX_ OP* o, SV* idx)
1477414780
}
1477514781
return FALSE;
1477614782
}
14783+
#endif
1477714784

1477814785

1477914786
/* returns the next non-null op */
@@ -15294,13 +15301,16 @@ Perl_rpeep(pTHX_ OP *o)
1529415301
}
1529515302
} else if (type == OP_MULTIDEREF) {
1529615303
/* find this padsv item (the first) and set MDEREF_INDEX_uoob */
15304+
/* with threads we also check the targ here and not via gvsv */
1529715305
if (loop->op_targ && S_mderef_uoob_targ(o2, loop->op_targ)) {
1529815306
DEBUG_k(Perl_deb(aTHX_ "loop oob: multideref %s[my %s] => MDEREF_INDEX_uoob\n",
1529915307
aname, iname));
15308+
#ifndef USE_ITHREADS
1530015309
} else if (!loop->op_targ
15301-
&& S_mderef_uoob_gv(aTHX_ o2, idx)) {
15310+
&& S_mderef_uoob_gvsv(aTHX_ o2, idx)) {
1530215311
DEBUG_k(Perl_deb(aTHX_ "loop oob: multideref %s[$%s] => MDEREF_INDEX_uoob\n",
1530315312
aname, iname));
15313+
#endif
1530415314
}
1530515315
}
1530615316
#if 0

0 commit comments

Comments
 (0)