Mercurial > hg > truffle
changeset 18220:890d284b2771
Truffle: add TruffleRuntime#getCapability method
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Thu, 30 Oct 2014 17:04:16 +0100 |
parents | 4a8dd0fdcc38 |
children | 2c68474cc893 |
files | CHANGELOG.md graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java |
diffstat | 4 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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> T getCapability(Class<T> capability) { + return null; + } + protected boolean acceptForCompilation(RootNode rootNode) { if (TruffleCompileOnly.getValue() != null) { if (includes == null) {
--- 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> T getCapability(Class<T> capability); + + /** * Returns a list of all still referenced {@link RootCallTarget} instances that were created * using {@link #createCallTarget(RootNode)}. */
--- 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> T getCapability(Class<T> capability) { + return null; + } + public void notifyTransferToInterpreter() { }