Skip to content

Commit a5619aa

Browse files
committed
[JVM] Return VMNull from context introspection ops
This avoids explosions in S02-names/pseudo-6e.t (on the JVM backend) that seem to be related to the code in 'method ctx()' in src/core.e/PseudoStash.pm6. (Compare comments in the closed PR rakudo/rakudo#3130.)
1 parent 9f9e4bf commit a5619aa

File tree

1 file changed

+10
-10
lines changed
  • src/vm/jvm/runtime/org/perl6/nqp/runtime

1 file changed

+10
-10
lines changed

src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ public static SixModelObject getlex(String name, ThreadContext tc) {
14281428
return curFrame.oLex[found];
14291429
curFrame = curFrame.outer;
14301430
}
1431-
return null;
1431+
return createNull(tc);
14321432
}
14331433
public static long getlex_i(String name, ThreadContext tc) {
14341434
CallFrame curFrame = tc.curFrame;
@@ -1662,7 +1662,7 @@ public static SixModelObject getlexdyn(String name, ThreadContext tc) {
16621662
return curFrame.oLex[idx];
16631663
curFrame = curFrame.caller;
16641664
}
1665-
return null;
1665+
return createNull(tc);
16661666
}
16671667
public static SixModelObject getlexcaller(String name, ThreadContext tc) {
16681668
CallFrame curCallerFrame = tc.curFrame.caller;
@@ -1676,7 +1676,7 @@ public static SixModelObject getlexcaller(String name, ThreadContext tc) {
16761676
}
16771677
curCallerFrame = curCallerFrame.caller;
16781678
}
1679-
return null;
1679+
return createNull(tc);
16801680
}
16811681

16821682
/* Relative lexical lookups. */
@@ -1689,7 +1689,7 @@ public static SixModelObject getlexrel(SixModelObject ctx, String name, ThreadCo
16891689
return curFrame.oLex[found];
16901690
curFrame = curFrame.outer;
16911691
}
1692-
return null;
1692+
return createNull(tc);
16931693
}
16941694
else {
16951695
throw ExceptionHandling.dieInternal(tc, "getlexrel requires an operand with REPR ContextRef");
@@ -1704,7 +1704,7 @@ public static SixModelObject getlexreldyn(SixModelObject ctx, String name, Threa
17041704
return curFrame.oLex[idx];
17051705
curFrame = curFrame.caller;
17061706
}
1707-
return null;
1707+
return createNull(tc);
17081708
}
17091709
else {
17101710
throw ExceptionHandling.dieInternal(tc, "getlexreldyn requires an operand with REPR ContextRef");
@@ -1723,7 +1723,7 @@ public static SixModelObject getlexrelcaller(SixModelObject ctx, String name, Th
17231723
}
17241724
curCallerFrame = curCallerFrame.caller;
17251725
}
1726-
return null;
1726+
return createNull(tc);
17271727
}
17281728
else {
17291729
throw ExceptionHandling.dieInternal(tc, "getlexrelcaller requires an operand with REPR ContextRef");
@@ -1741,7 +1741,7 @@ public static SixModelObject ctxouter(SixModelObject ctx, ThreadContext tc) {
17411741
if (ctx instanceof ContextRefInstance) {
17421742
CallFrame outer = ((ContextRefInstance)ctx).context.outer;
17431743
if (outer == null)
1744-
return null;
1744+
return createNull(tc);
17451745

17461746
SixModelObject ContextRef = tc.gc.ContextRef;
17471747
SixModelObject wrap = ContextRef.st.REPR.allocate(tc, ContextRef.st);
@@ -1756,7 +1756,7 @@ public static SixModelObject ctxcaller(SixModelObject ctx, ThreadContext tc) {
17561756
if (ctx instanceof ContextRefInstance) {
17571757
CallFrame caller = ((ContextRefInstance)ctx).context.caller;
17581758
if (caller == null)
1759-
return null;
1759+
return createNull(tc);
17601760

17611761
SixModelObject ContextRef = tc.gc.ContextRef;
17621762
SixModelObject wrap = ContextRef.st.REPR.allocate(tc, ContextRef.st);
@@ -1779,7 +1779,7 @@ public static SixModelObject ctxouterskipthunks(SixModelObject ctx, ThreadContex
17791779
while (outer != null && outer.codeRef.staticInfo.isThunk)
17801780
outer = outer.outer;
17811781
if (outer == null)
1782-
return null;
1782+
return createNull(tc);
17831783

17841784
SixModelObject ContextRef = tc.gc.ContextRef;
17851785
SixModelObject wrap = ContextRef.st.REPR.allocate(tc, ContextRef.st);
@@ -1796,7 +1796,7 @@ public static SixModelObject ctxcallerskipthunks(SixModelObject ctx, ThreadConte
17961796
while (caller != null && caller.codeRef.staticInfo.isThunk)
17971797
caller = caller.caller;
17981798
if (caller == null)
1799-
return null;
1799+
return createNull(tc);
18001800

18011801
SixModelObject ContextRef = tc.gc.ContextRef;
18021802
SixModelObject wrap = ContextRef.st.REPR.allocate(tc, ContextRef.st);

0 commit comments

Comments
 (0)