Java Code Examples for com.oracle.truffle.api.interop.InteropLibrary#invokeMember()
The following examples show how to use
com.oracle.truffle.api.interop.InteropLibrary#invokeMember() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassObject.java From trufflesqueak with MIT License | 5 votes |
private static void initializeObject(final Object[] arguments, final InteropLibrary initializer, final AbstractSqueakObjectWithHash newObject) throws UnsupportedTypeException { try { initializer.invokeMember(newObject, "initialize"); } catch (UnsupportedMessageException | ArityException | UnknownIdentifierException | UnsupportedTypeException e) { throw UnsupportedTypeException.create(arguments, "Failed to initialize new object"); } }
Example 2
Source File: AbstractOSProcessPlugin.java From trufflesqueak with MIT License | 5 votes |
protected final Object getSysCallObject() { assert supportsNFI; if (sysCallObject == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); final Object defaultLibrary = SqueakLanguage.getContext().env.parseInternal(Source.newBuilder("nfi", "default", "native").build()).call(); final InteropLibrary lib = InteropLibrary.getFactory().getUncached(); try { final Object symbol = lib.readMember(defaultLibrary, getFunctionName()); sysCallObject = lib.invokeMember(symbol, "bind", getFunctionSignature()); } catch (UnsupportedMessageException | UnknownIdentifierException | ArityException | UnsupportedTypeException e) { throw PrimitiveFailed.andTransferToInterpreterWithError(e); } } return sysCallObject; }
Example 3
Source File: SqueakFFIPrims.java From trufflesqueak with MIT License | 5 votes |
private static Object calloutToLib(final SqueakImageContext image, final String name, final Object[] argumentsConverted, final String nfiCode) throws UnsupportedMessageException, ArityException, UnknownIdentifierException, UnsupportedTypeException { final Source source = Source.newBuilder("nfi", nfiCode, "native").build(); final Object ffiTest = image.env.parseInternal(source).call(); final InteropLibrary interopLib = InteropLibrary.getFactory().getUncached(ffiTest); return interopLib.invokeMember(ffiTest, name, argumentsConverted); }