# HG changeset patch # User Thomas Wuerthinger # Date 1339190185 -7200 # Node ID e624cded7986e472ca33d536c9b82857e4654c23 # Parent e0f7a49129f2f37e3ffde4d531cfc62d3e7a94f2 Moving methods from RiRuntime to MetaAccessProvider. diff -r e0f7a49129f2 -r e624cded7986 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RiRuntime.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RiRuntime.java Fri Jun 08 23:10:02 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RiRuntime.java Fri Jun 08 23:16:25 2012 +0200 @@ -22,15 +22,13 @@ */ package com.oracle.graal.api.code; -import java.lang.reflect.*; - import com.oracle.graal.api.meta.*; /** * Encapsulates the main functionality of the runtime for the compiler, including access * to constant pools, OSR frames, inlining requirements, and runtime calls such as checkcast. s */ -public interface RiRuntime { +public interface RiRuntime extends MetaAccessProvider { /** * Get the size in bytes for locking information on the stack. @@ -54,28 +52,6 @@ String disassemble(RiResolvedMethod method); /** - * Returns the RiType object representing the base type for the given kind. - */ - RiResolvedType asRiType(RiKind kind); - - /** - * Returns the type of the given constant object. - * - * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()} - */ - RiResolvedType getTypeOf(RiConstant constant); - - - RiResolvedType getType(Class clazz); - - /** - * Used by the canonicalizer to compare objects, since a given runtime might not want to expose the real objects to the compiler. - * - * @return true if the two parameters represent the same runtime object, false otherwise - */ - boolean areConstantObjectsEqual(RiConstant x, RiConstant y); - - /** * Gets the register configuration to use when compiling a given method. * * @param method the top level method of a compilation @@ -98,11 +74,6 @@ int getMinimumOutgoingSize(); /** - * Gets the length of the array that is wrapped in a CiConstant object. - */ - int getArrayLength(RiConstant array); - - /** * Performs any runtime-specific conversion on the object used to describe the target of a call. */ Object asCallTarget(Object target); @@ -114,11 +85,6 @@ long getMaxCallTargetOffset(CiRuntimeCall rtcall); /** - * Provides the {@link RiMethod} for a {@link Method} obtained via reflection. - */ - RiResolvedMethod getRiMethod(Method reflectionMethod); - - /** * Adds the given machine code as an implementation of the given method without making it the default implementation. * @param method a method to which the executable code is begin added * @param code the code to be added diff -r e0f7a49129f2 -r e624cded7986 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Fri Jun 08 23:10:02 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Fri Jun 08 23:16:25 2012 +0200 @@ -22,7 +22,41 @@ */ package com.oracle.graal.api.meta; +import java.lang.reflect.*; + public interface MetaAccessProvider { + + /** + * Returns the RiType object representing the base type for the given kind. + */ + RiResolvedType asRiType(RiKind kind); + + /** + * Returns the type of the given constant object. + * + * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()} + */ + RiResolvedType getTypeOf(RiConstant constant); + + + RiResolvedType getType(Class clazz); + + /** + * Used by the canonicalizer to compare objects, since a given runtime might not want to expose the real objects to the compiler. + * + * @return true if the two parameters represent the same runtime object, false otherwise + */ + boolean areConstantObjectsEqual(RiConstant x, RiConstant y); + + /** + * Provides the {@link RiMethod} for a {@link Method} obtained via reflection. + */ + RiResolvedMethod getRiMethod(Method reflectionMethod); + + /** + * Gets the length of the array that is wrapped in a CiConstant object. + */ + int getArrayLength(RiConstant array); }