Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a nqp::jvmisnull op.
  • Loading branch information
jnthn committed Aug 7, 2013
1 parent 0b93372 commit d23d885
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/vm/jvm/QAST/Compiler.nqp
Expand Up @@ -2426,6 +2426,7 @@ QAST::OperationsJAST.map_classlib_core_op('continuationinvoke', $TYPE_OPS, 'cont

# JVM interop ops
QAST::OperationsJAST.map_classlib_core_op('jvmeqaddr', $TYPE_OPS, 'jvmeqaddr', [$RT_OBJ, $RT_OBJ], $RT_INT, :tc);
QAST::OperationsJAST.map_classlib_core_op('jvmisnull', $TYPE_OPS, 'jvmisnull', [$RT_OBJ], $RT_INT, :tc);
QAST::OperationsJAST.map_classlib_core_op('jvmbootinterop', $TYPE_OPS, 'jvmbootinterop', [], $RT_OBJ, :tc);

class QAST::CompilerJAST {
Expand Down
10 changes: 9 additions & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -5019,13 +5019,21 @@ public static SixModelObject debugnoop(SixModelObject in, ThreadContext tc) {
return in;
}

public static long jvmeqaddr(SixModelObject a, SixModelObject b) {
public static long jvmeqaddr(SixModelObject a, SixModelObject b, ThreadContext tc) {
if (a instanceof TypeObject) {
return (b instanceof TypeObject) ? 1 : 0;
} else {
return (b instanceof TypeObject || ((JavaObjectWrapper)a).theObject != ((JavaObjectWrapper)b).theObject) ? 0 : 1;
}
}

public static long jvmisnull(SixModelObject a, ThreadContext tc) {
if (a instanceof TypeObject) {
return 1;
} else {
return ((JavaObjectWrapper)a).theObject == null ? 1 : 0;
}
}

public static SixModelObject jvmbootinterop(ThreadContext tc) {
return BootJavaInterop.RuntimeSupport.boxJava(tc.gc.bootInterop, tc.gc.bootInterop.getSTableForClass(BootJavaInterop.class));
Expand Down

0 comments on commit d23d885

Please sign in to comment.