Skip to content

Commit a0d485b

Browse files
fangererqunaibit
authored andcommitted
Fix Truffle warning
1 parent f424807 commit a0d485b

File tree

1 file changed

+5
-4
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/transitions

1 file changed

+5
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/transitions/CApiTransitions.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,12 +1251,13 @@ protected boolean needsTransfer() {
12511251
}
12521252

12531253
@Specialization
1254-
Object doNative(PythonAbstractNativeObject obj,
1254+
static Object doNative(PythonAbstractNativeObject obj,
12551255
@Bind("this") Node inliningTarget,
1256+
@Bind("needsTransfer()") boolean needsTransfer,
12561257
@CachedLibrary(limit = "2") InteropLibrary lib,
12571258
@Cached InlinedBranchProfile inlinedBranchProfile,
1258-
@Cached UpdateRefNode updateRefNode) {
1259-
if (needsTransfer() && getContext().isNativeAccessAllowed()) {
1259+
@Exclusive @Cached UpdateRefNode updateRefNode) {
1260+
if (needsTransfer && PythonContext.get(inliningTarget).isNativeAccessAllowed()) {
12601261
long ptr = PythonUtils.coerceToLong(obj.getPtr(), lib);
12611262
long newRefcnt = CApiTransitions.addNativeRefCount(ptr, 1);
12621263
/*
@@ -1308,7 +1309,7 @@ static Object doOther(Object obj,
13081309
@Cached GetNativeWrapperNode getWrapper,
13091310
@Cached GetReplacementNode getReplacementNode,
13101311
@CachedLibrary(limit = "3") InteropLibrary lib,
1311-
@Cached UpdateRefNode updateRefNode) {
1312+
@Exclusive @Cached UpdateRefNode updateRefNode) {
13121313
CompilerAsserts.partialEvaluationConstant(needsTransfer);
13131314
assert PythonContext.get(inliningTarget).ownsGil();
13141315
pollReferenceQueue();

0 commit comments

Comments
 (0)