Created
April 20, 2016 11:32
-
-
Save peschwa/7fddd658584f9c89cf874521ae455596 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/vm/jvm/QAST/Compiler.nqp b/src/vm/jvm/QAST/Compiler.nqp | |
index 5a99933..1858261 100644 | |
--- a/src/vm/jvm/QAST/Compiler.nqp | |
+++ b/src/vm/jvm/QAST/Compiler.nqp | |
@@ -2463,8 +2463,8 @@ QAST::OperationsJAST.map_classlib_core_op('iterval', $TYPE_OPS, 'iterval', [$RT_ | |
(-> { | |
# object opcodes | |
-QAST::OperationsJAST.map_jvm_core_op('null', 'aconst_null', [], $RT_OBJ); | |
-QAST::OperationsJAST.map_jvm_core_op('null_s', 'aconst_null', [], $RT_STR); | |
+QAST::OperationsJAST.map_classlib_core_op('null', $TYPE_OPS, 'vmnull', [], $RT_OBJ, :tc); | |
+QAST::OperationsJAST.map_classlib_core_op('null_s', $TYPE_OPS, 'vmnull_s', [], $RT_STR, :tc); | |
QAST::OperationsJAST.map_classlib_core_op('what', $TYPE_OPS, 'what', [$RT_OBJ], $RT_OBJ, :tc); | |
QAST::OperationsJAST.map_classlib_core_op('how', $TYPE_OPS, 'how', [$RT_OBJ], $RT_OBJ, :tc); | |
QAST::OperationsJAST.map_classlib_core_op('who', $TYPE_OPS, 'who', [$RT_OBJ], $RT_OBJ, :tc); | |
diff --git a/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java b/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java | |
index af0bfbe..1429541 100644 | |
--- a/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java | |
+++ b/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java | |
@@ -6714,6 +6714,15 @@ public final class Ops { | |
return name; | |
} | |
+ public static String vmnull_s(ThreadContext tc) { | |
+ String foo = null; | |
+ return foo; | |
+ } | |
+ | |
+ public static SixModelObject vmnull(ThreadContext tc) { | |
+ return REPRRegistry.getByName("VMNull").type_object_for(tc, tc.gc.KnowHOW); | |
+ } | |
+ | |
public static String getuniprop_str(long codepoint, long property, ThreadContext tc) { | |
return ""; | |
} | |
diff --git a/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/REPRRegistry.java b/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/REPRRegistry.java | |
index 87957a9..328cf8a 100644 | |
--- a/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/REPRRegistry.java | |
+++ b/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/REPRRegistry.java | |
@@ -32,6 +32,7 @@ import org.perl6.nqp.sixmodel.reprs.VMArray; | |
import org.perl6.nqp.sixmodel.reprs.VMException; | |
import org.perl6.nqp.sixmodel.reprs.VMHash; | |
import org.perl6.nqp.sixmodel.reprs.VMIter; | |
+import org.perl6.nqp.sixmodel.reprs.VMNull; | |
import org.perl6.nqp.sixmodel.reprs.VMThread; | |
import org.perl6.nqp.sixmodel.reprs.ReentrantMutex; | |
import org.perl6.nqp.sixmodel.reprs.Semaphore; | |
@@ -104,5 +105,6 @@ public class REPRRegistry { | |
addREPR("AsyncTask", new AsyncTask()); | |
addREPR("NativeRef", new NativeRef()); | |
addREPR("MultiDimArray", new MultiDimArray()); | |
+ addREPR("VMNull", new VMNull()); | |
} | |
} | |
diff --git a/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/VMNull.java b/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/VMNull.java | |
new file mode 100644 | |
index 0000000..6cbdba7 | |
--- /dev/null | |
+++ b/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/VMNull.java | |
@@ -0,0 +1,38 @@ | |
+package org.perl6.nqp.sixmodel.reprs; | |
+ | |
+import org.perl6.nqp.sixmodel.REPR; | |
+import org.perl6.nqp.sixmodel.SerializationReader; | |
+import org.perl6.nqp.sixmodel.SixModelObject; | |
+import org.perl6.nqp.sixmodel.STable; | |
+import org.perl6.nqp.sixmodel.TypeObject; | |
+import org.perl6.nqp.sixmodel.reprs.P6OpaqueREPRData; | |
+import org.perl6.nqp.runtime.ExceptionHandling; | |
+import org.perl6.nqp.runtime.ThreadContext; | |
+ | |
+ | |
+public class VMNull extends REPR { | |
+ | |
+ public SixModelObject allocate(ThreadContext tc, STable st) { | |
+ throw ExceptionHandling.dieInternal(tc, "Cannot instantiate this REPR"); | |
+ } | |
+ | |
+ public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) { | |
+ STable st = new STable(this, HOW); | |
+ st.REPRData = new P6OpaqueREPRData(); | |
+ SixModelObject obj = new TypeObject(); | |
+ obj.st = st; | |
+ st.WHAT = obj; | |
+ return st.WHAT; | |
+ } | |
+ | |
+ public void compose(ThreadContext tc, STable st, SixModelObject repr_info) { | |
+ throw ExceptionHandling.dieInternal(tc, "Cannot compose this REPR"); | |
+ } | |
+ | |
+ public SixModelObject deserialize_stub(ThreadContext tc, STable st) { | |
+ throw ExceptionHandling.dieInternal(tc, "This REPR does not participate in serialization"); | |
+ } | |
+ public void deserialize_finish(ThreadContext tc, STable st, SerializationReader reader, SixModelObject obj) { | |
+ throw ExceptionHandling.dieInternal(tc, "This REPR does not participate in serialization"); | |
+ } | |
+} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment