Skip to content

Commit 1a533dd

Browse files
committed
Fix wrong return value in LLVMScope.readMember.
1 parent e7e0593 commit 1a533dd

File tree

1 file changed

+4
-6
lines changed
  • sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime

1 file changed

+4
-6
lines changed

sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/LLVMScope.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import com.oracle.truffle.llvm.runtime.except.LLVMIllegalSymbolIndexException;
4949
import com.oracle.truffle.llvm.runtime.except.LLVMLinkerException;
5050
import com.oracle.truffle.llvm.runtime.global.LLVMGlobal;
51-
import com.oracle.truffle.llvm.runtime.pointer.LLVMManagedPointer;
51+
import com.oracle.truffle.llvm.runtime.interop.LLVMDataEscapeNode.LLVMPointerDataEscapeNode;
5252
import com.oracle.truffle.llvm.runtime.pointer.LLVMPointer;
5353

5454
@ExportLibrary(InteropLibrary.class)
@@ -259,23 +259,21 @@ boolean isMemberReadable(@SuppressWarnings("unused") String name) {
259259
@ExportMessage
260260
Object readMember(String globalName,
261261
@Cached BranchProfile exception,
262+
@Cached LLVMPointerDataEscapeNode escape,
262263
@CachedLibrary("this") InteropLibrary self) throws UnknownIdentifierException {
263264

264265
if (contains(globalName)) {
265266
LLVMSymbol symbol = get(globalName);
266-
if (symbol != null && symbol.isFunction()) {
267+
if (symbol != null) {
267268
try {
268269
LLVMPointer value = LLVMContext.get(self).getSymbol(symbol);
269270
if (value != null) {
270-
return LLVMManagedPointer.cast(value).getObject();
271+
return escape.executeWithTarget(value);
271272
}
272273
} catch (LLVMLinkerException | LLVMIllegalSymbolIndexException e) {
273274
// fallthrough
274275
}
275-
exception.enter();
276-
throw UnknownIdentifierException.create(globalName);
277276
}
278-
return symbol;
279277
}
280278
exception.enter();
281279
throw UnknownIdentifierException.create(globalName);

0 commit comments

Comments
 (0)