# HG changeset patch # User Matthias Grimmer # Date 1382373631 -7200 # Node ID 04671d59e93b31bd92085fa87e09612ec67c5c10 # Parent 6975d14ff33f293b562a590621543ee2acc91766 Allow CodeCacheProvider to install default methods diff -r 6975d14ff33f -r 04671d59e93b graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Mon Oct 21 17:48:54 2013 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Mon Oct 21 18:40:31 2013 +0200 @@ -42,6 +42,16 @@ InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult); /** + * Adds the given compilation result as a default implementation of the given method. + * + * @param method a method to which the executable code is begin added + * @param compResult the compilation result to be added + * @return a reference to the compiled and ready-to-run code or null if the code installation + * failed + */ + InstalledCode addDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult); + + /** * Returns a disassembly of some compiled code. * * @param compResult some compiled code diff -r 6975d14ff33f -r 04671d59e93b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Mon Oct 21 17:48:54 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Mon Oct 21 18:40:31 2013 +0200 @@ -36,6 +36,7 @@ import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult; import com.oracle.graal.java.*; +import com.oracle.graal.nodes.*; import com.oracle.graal.printer.*; /** @@ -173,6 +174,11 @@ return code; } + public InstalledCode addDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult) { + HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method; + return installMethod(hotspotMethod, StructuredGraph.INVOCATION_ENTRY_BCI, compResult); + } + public InstalledCode addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult) { HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) method;