Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Stub in NativeRef REPR.
  • Loading branch information
jnthn committed Feb 26, 2015
1 parent 4f2e74a commit 57c6dce
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/sixmodel/REPRRegistry.java
Expand Up @@ -36,6 +36,7 @@
import org.perl6.nqp.sixmodel.reprs.ConcBlockingQueue;
import org.perl6.nqp.sixmodel.reprs.ConditionVariable;
import org.perl6.nqp.sixmodel.reprs.AsyncTask;
import org.perl6.nqp.sixmodel.reprs.NativeRef;

public class REPRRegistry {
private static HashMap<String, Integer> reprIdMap = new HashMap<String, Integer>();
Expand Down Expand Up @@ -96,5 +97,6 @@ private static void addREPR(String name, REPR REPR) {
addREPR("ConcBlockingQueue", new ConcBlockingQueue());
addREPR("ConditionVariable", new ConditionVariable());
addREPR("AsyncTask", new AsyncTask());
addREPR("NativeRef", new NativeRef());
}
}
34 changes: 34 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NativeRef.java
@@ -0,0 +1,34 @@
package org.perl6.nqp.sixmodel.reprs;

import org.perl6.nqp.runtime.ExceptionHandling;
import org.perl6.nqp.runtime.ThreadContext;
import org.perl6.nqp.sixmodel.REPR;
import org.perl6.nqp.sixmodel.STable;
import org.perl6.nqp.sixmodel.SerializationReader;
import org.perl6.nqp.sixmodel.SixModelObject;
import org.perl6.nqp.sixmodel.TypeObject;

public class NativeRef extends REPR {
public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) {
STable st = new STable(this, HOW);
SixModelObject obj = new TypeObject();
obj.st = st;
st.WHAT = obj;
return st.WHAT;
}

public SixModelObject allocate(ThreadContext tc, STable st) {
throw ExceptionHandling.dieInternal(tc, "NYI");
/*obj.st = st;
return obj;*/
}

public SixModelObject deserialize_stub(ThreadContext tc, STable st) {
throw ExceptionHandling.dieInternal(tc, "Cannot deserialize a native reference");
}

public void deserialize_finish(ThreadContext tc, STable st,
SerializationReader reader, SixModelObject obj) {
throw ExceptionHandling.dieInternal(tc, "Cannot deserialize a native reference");
}
}

0 comments on commit 57c6dce

Please sign in to comment.