@@ -863,12 +863,14 @@ Perl_op_clear(pTHX_ OP *o)
863
863
}
864
864
#endif
865
865
case OP_METHOD :
866
- SvREFCNT_dec (cMETHOPx (o )-> op_class_sv );
867
866
#ifdef USE_ITHREADS
868
867
if (cMETHOPx (o )-> op_class_targ ) {
869
868
pad_swipe (cMETHOPx (o )-> op_class_targ , 1 );
870
869
cMETHOPx (o )-> op_class_targ = 0 ;
871
870
}
871
+ #else
872
+ SvREFCNT_dec (cMETHOPx (o )-> op_class_sv );
873
+ cMETHOPx (o )-> op_class_sv = NULL ;
872
874
#endif
873
875
break ;
874
876
case OP_CONST :
@@ -2238,9 +2240,6 @@ S_finalize_op(pTHX_ OP* o)
2238
2240
/* Relocate all the METHOP's SVs to the pad for thread safety. */
2239
2241
case OP_METHOD_NAMED :
2240
2242
op_relocate_sv (& cMETHOPx (o )-> op_u .op_meth_sv , & o -> op_targ );
2241
- case OP_METHOD :
2242
- if (cMETHOPx (o )-> op_class_sv )
2243
- op_relocate_sv (& cMETHOPx (o )-> op_class_sv , & cMETHOPx (o )-> op_class_targ );
2244
2243
break ;
2245
2244
#endif
2246
2245
@@ -4693,8 +4692,11 @@ S_newMETHOP_internal(pTHX_ I32 type, I32 flags, OP* dynamic_meth, SV* const_meth
4693
4692
methop -> op_next = (OP * )methop ;
4694
4693
}
4695
4694
4696
- methop -> op_class_sv = NULL ;
4695
+ #ifdef USE_ITHREADS
4697
4696
methop -> op_class_targ = 0 ;
4697
+ #else
4698
+ methop -> op_class_sv = NULL ;
4699
+ #endif
4698
4700
CHANGE_TYPE (methop , type );
4699
4701
methop = (METHOP * ) CHECKOP (type , methop );
4700
4702
@@ -11627,10 +11629,18 @@ Perl_ck_subr(pTHX_ OP *o)
11627
11629
/* cache const class' name to speedup class method calls */
11628
11630
if (const_class ) {
11629
11631
STRLEN len ;
11632
+ SV * shared ;
11630
11633
const char * str = SvPV (const_class , len );
11631
- if (len ) cMETHOPx (cvop )-> op_class_sv = newSVpvn_share (
11632
- str , SvUTF8 (const_class ) ? - len : len , 0
11633
- );
11634
+ if (len ) {
11635
+ shared = newSVpvn_share (
11636
+ str , SvUTF8 (const_class ) ? - len : len , 0
11637
+ );
11638
+ #ifdef USE_ITHREADS
11639
+ op_relocate_sv (& shared , & cMETHOPx (cvop )-> op_class_targ );
11640
+ #else
11641
+ cMETHOPx (cvop )-> op_class_sv = shared ;
11642
+ #endif
11643
+ }
11634
11644
}
11635
11645
break ;
11636
11646
}
0 commit comments