Skip to content

Commit 962238c

Browse files
committed
Only use uncached instance of JNI helper node
1 parent 943f569 commit 962238c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/jni/GraalHPyJNICallHelperFunctionNode.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ final class GraalHPyJNICallHelperFunctionNode extends HPyCallHelperFunctionNode
5555

5656
static final GraalHPyJNICallHelperFunctionNode UNCACHED = new GraalHPyJNICallHelperFunctionNode();
5757

58+
private GraalHPyJNICallHelperFunctionNode() {
59+
}
60+
5861
@Override
5962
protected Object execute(GraalHPyContext context, GraalHPyNativeSymbol name, Object[] args) {
6063
assert context.getBackend() instanceof GraalHPyJNIContext;
@@ -67,11 +70,11 @@ protected Object execute(GraalHPyContext context, GraalHPyNativeSymbol name, Obj
6770

6871
@Override
6972
public NodeCost getCost() {
70-
return this == UNCACHED ? NodeCost.MEGAMORPHIC : NodeCost.NONE;
73+
return NodeCost.MONOMORPHIC;
7174
}
7275

7376
@Override
7477
public boolean isAdoptable() {
75-
return this != UNCACHED;
78+
return false;
7679
}
7780
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/jni/GraalHPyJNIContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ protected void setNativeCache(long cachePtr) {
487487

488488
@Override
489489
public HPyCallHelperFunctionNode createCallHelperFunctionNode() {
490-
return new GraalHPyJNICallHelperFunctionNode();
490+
return GraalHPyJNICallHelperFunctionNode.UNCACHED;
491491
}
492492

493493
@Override
@@ -497,7 +497,7 @@ public HPyCallHelperFunctionNode getUncachedCallHelperFunctionNode() {
497497

498498
@Override
499499
public HPyFromCharPointerNode createFromCharPointerNode() {
500-
throw CompilerDirectives.shouldNotReachHere("cached HPyJNIFromCharPointerNode is not available");
500+
return HPyJNIFromCharPointerNode.UNCACHED;
501501
}
502502

503503
@Override

0 commit comments

Comments
 (0)