# HG changeset patch # User Andreas Woess # Date 1414685056 -3600 # Node ID 890d284b2771f901642246f3381da31bdcc93d4a # Parent 4a8dd0fdcc38dcbb602710ac3019cf862ed2aebf Truffle: add TruffleRuntime#getCapability method diff -r 4a8dd0fdcc38 -r 890d284b2771 CHANGELOG.md --- a/CHANGELOG.md Thu Oct 30 16:32:31 2014 +0100 +++ b/CHANGELOG.md Thu Oct 30 17:04:16 2014 +0100 @@ -33,6 +33,7 @@ * New option, `-G:+/-TruffleCompilationExceptionsAreThrown`, that will throw an `OptimizationFailedException` for compiler errors. * Removed `FrameTypeConversion` interface and changed the corresponding `FrameDescriptor` constructor to have a default value parameter instead. * Removed `CompilerDirectives.unsafeFrameCast` (equivalent to a `(MaterializedFrame)` cast). +* Added `TruffleRuntime#getCapability` API method. ## Version 0.4 19-Aug-2014, [Repository Revision](http://hg.openjdk.java.net/graal/graal/shortlog/graal-0.4) diff -r 4a8dd0fdcc38 -r 890d284b2771 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Thu Oct 30 16:32:31 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Thu Oct 30 17:04:16 2014 +0100 @@ -172,6 +172,10 @@ return stackIntrospection.iterateFrames(callTargetMethod, callTargetMethod, 0, frame -> new GraalFrameInstance.CallTargetFrame(frame, true)); } + public T getCapability(Class capability) { + return null; + } + protected boolean acceptForCompilation(RootNode rootNode) { if (TruffleCompileOnly.getValue() != null) { if (includes == null) { diff -r 4a8dd0fdcc38 -r 890d284b2771 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java Thu Oct 30 16:32:31 2014 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java Thu Oct 30 17:04:16 2014 +0100 @@ -139,6 +139,14 @@ FrameInstance getCurrentFrame(); /** + * Requests a capability from the runtime. + * + * @param capability the type of the interface representing the capability + * @return an implementation of the capability or {@code null} if the runtime does not offer it + */ + T getCapability(Class capability); + + /** * Returns a list of all still referenced {@link RootCallTarget} instances that were created * using {@link #createCallTarget(RootNode)}. */ diff -r 4a8dd0fdcc38 -r 890d284b2771 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java Thu Oct 30 16:32:31 2014 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java Thu Oct 30 17:04:16 2014 +0100 @@ -144,6 +144,10 @@ return currentFrames.get(); } + public T getCapability(Class capability) { + return null; + } + public void notifyTransferToInterpreter() { }