Skip to content

Commit a2deb14

Browse files
committed
Implement nqp::isrwcont on JVM backend.
1 parent 2f956fd commit a2deb14

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/vm/jvm/QAST/Compiler.nqp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,6 +2531,7 @@ QAST::OperationsJAST.map_classlib_core_op('iscont', $TYPE_OPS, 'iscont', [$RT_OB
25312531
QAST::OperationsJAST.map_classlib_core_op('iscont_i', $TYPE_OPS, 'iscont_i', [$RT_OBJ], $RT_INT);
25322532
QAST::OperationsJAST.map_classlib_core_op('iscont_n', $TYPE_OPS, 'iscont_n', [$RT_OBJ], $RT_INT);
25332533
QAST::OperationsJAST.map_classlib_core_op('iscont_s', $TYPE_OPS, 'iscont_s', [$RT_OBJ], $RT_INT);
2534+
QAST::OperationsJAST.map_classlib_core_op('isrwcont', $TYPE_OPS, 'isrwcont', [$RT_OBJ], $RT_INT, :tc);
25342535
QAST::OperationsJAST.map_classlib_core_op('decont', $TYPE_OPS, 'decont', [$RT_OBJ], $RT_OBJ, :tc);
25352536
QAST::OperationsJAST.map_classlib_core_op('decont_i', $TYPE_OPS, 'decont_i', [$RT_OBJ], $RT_INT, :tc);
25362537
QAST::OperationsJAST.map_classlib_core_op('decont_n', $TYPE_OPS, 'decont_n', [$RT_OBJ], $RT_NUM, :tc);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,6 +3277,14 @@ public static SixModelObject setcontspec(SixModelObject obj, String confname, Si
32773277
public static long iscont(SixModelObject obj) {
32783278
return obj == null || obj.st.ContainerSpec == null ? 0 : 1;
32793279
}
3280+
public static long isrwcont(SixModelObject obj, ThreadContext tc) {
3281+
if (obj != null) {
3282+
ContainerSpec cs = obj.st.ContainerSpec;
3283+
if (cs != null && cs.canStore(tc, obj))
3284+
return 1;
3285+
}
3286+
return 0;
3287+
}
32803288
private static short getContainerPrimitive(SixModelObject obj) {
32813289
if (obj != null && !(obj instanceof TypeObject)) {
32823290
ContainerSpec cs = obj.st.ContainerSpec;

src/vm/jvm/runtime/org/perl6/nqp/sixmodel/ContainerSpec.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,9 @@ public abstract class ContainerSpec {
3535

3636
/* Deserializes the container data, if any. */
3737
public abstract void deserialize(ThreadContext tc, STable st, SerializationReader reader);
38+
39+
/* Can the container store values. Usually yes, so default to true. */
40+
public boolean canStore(ThreadContext tc, SixModelObject cont) {
41+
return true;
42+
}
3843
}

0 commit comments

Comments
 (0)