# HG changeset patch # User Gilles Duboscq # Date 1381417631 -7200 # Node ID 7e5cf369559f9ced2448c809efecbc7a934ef25b # Parent a8819fceb5b5cecb7508b680469be52a4670ebeb# Parent 23ccaa863edad08ed2a0ed93fbafdb91fcfa9f41 Merge diff -r a8819fceb5b5 -r 7e5cf369559f 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 Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Thu Oct 10 17:07:11 2013 +0200 @@ -28,7 +28,7 @@ /** * Encapsulates the main functionality of the runtime for the compiler. */ -public interface CodeCacheProvider extends MetaAccessProvider { +public interface CodeCacheProvider { /** * Adds the given compilation result as an implementation of the given method without making it diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DelegatingCodeCacheProvider.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DelegatingCodeCacheProvider.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DelegatingCodeCacheProvider.java Thu Oct 10 17:07:11 2013 +0200 @@ -27,15 +27,16 @@ /** * A {@link CodeCacheProvider} that delegates to another {@link CodeCacheProvider}. */ -public class DelegatingCodeCacheProvider extends DelegatingMetaAccessProvider implements CodeCacheProvider { +public class DelegatingCodeCacheProvider implements CodeCacheProvider { + + private final CodeCacheProvider delegate; public DelegatingCodeCacheProvider(CodeCacheProvider delegate) { - super(delegate); + this.delegate = delegate; } - @Override protected CodeCacheProvider delegate() { - return (CodeCacheProvider) super.delegate(); + return delegate; } public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/MethodUniverse.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/MethodUniverse.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/MethodUniverse.java Thu Oct 10 17:07:11 2013 +0200 @@ -38,11 +38,11 @@ public MethodUniverse() { for (Class c : classes) { for (Method m : c.getDeclaredMethods()) { - ResolvedJavaMethod method = runtime.lookupJavaMethod(m); + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m); methods.put(m, method); } for (Constructor m : c.getDeclaredConstructors()) { - constructors.put(m, runtime.lookupJavaConstructor(m)); + constructors.put(m, metaAccess.lookupJavaConstructor(m)); } } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaMethod.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaMethod.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaMethod.java Thu Oct 10 17:07:11 2013 +0200 @@ -50,7 +50,7 @@ for (Map.Entry e : methods.entrySet()) { Class expected = e.getKey().getDeclaringClass(); ResolvedJavaType actual = e.getValue().getDeclaringClass(); - assertTrue(actual.equals(runtime.lookupJavaType(expected))); + assertTrue(actual.equals(metaAccess.lookupJavaType(expected))); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaType.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaType.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaType.java Thu Oct 10 17:07:11 2013 +0200 @@ -39,7 +39,7 @@ @Test public void getKindTest() { for (Class c : classes) { - JavaType type = runtime.lookupJavaType(c); + JavaType type = metaAccess.lookupJavaType(c); Kind expected = Kind.fromJavaClass(c); Kind actual = type.getKind(); assertEquals(expected, actual); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java Thu Oct 10 17:07:11 2013 +0200 @@ -39,7 +39,7 @@ @Test public void lookupJavaTypeTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); assertNotNull(type); assertEquals(c.getModifiers(), type.getModifiers()); if (!type.isArray()) { @@ -53,12 +53,12 @@ public void lookupJavaMethodTest() { for (Class c : classes) { for (Method reflect : c.getDeclaredMethods()) { - ResolvedJavaMethod method = runtime.lookupJavaMethod(reflect); + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(reflect); assertNotNull(method); int expected = reflect.getModifiers() & Modifier.methodModifiers(); int actual = method.getModifiers(); assertEquals(String.format("%s: 0x%x != 0x%x", reflect, expected, actual), expected, actual); - assertTrue(method.getDeclaringClass().equals(runtime.lookupJavaType(reflect.getDeclaringClass()))); + assertTrue(method.getDeclaringClass().equals(metaAccess.lookupJavaType(reflect.getDeclaringClass()))); } } } @@ -67,12 +67,12 @@ public void lookupJavaFieldTest() { for (Class c : classes) { for (Field reflect : c.getDeclaredFields()) { - ResolvedJavaField field = runtime.lookupJavaField(reflect); + ResolvedJavaField field = metaAccess.lookupJavaField(reflect); assertNotNull(field); int expected = reflect.getModifiers() & Modifier.fieldModifiers(); int actual = field.getModifiers(); assertEquals(String.format("%s: 0x%x != 0x%x", reflect, expected, actual), expected, actual); - assertTrue(field.getDeclaringClass().equals(runtime.lookupJavaType(reflect.getDeclaringClass()))); + assertTrue(field.getDeclaringClass().equals(metaAccess.lookupJavaType(reflect.getDeclaringClass()))); } } } @@ -82,11 +82,11 @@ for (Constant c : constants) { if (c.getKind() == Kind.Object && !c.isNull()) { Object o = c.asObject(); - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); assertNotNull(type); - assertTrue(type.equals(runtime.lookupJavaType(o.getClass()))); + assertTrue(type.equals(metaAccess.lookupJavaType(o.getClass()))); } else { - assertEquals(runtime.lookupJavaType(c), null); + assertEquals(metaAccess.lookupJavaType(c), null); } } } @@ -96,9 +96,9 @@ for (Constant c1 : constants) { for (Constant c2 : constants) { // test symmetry - assertEquals(runtime.constantEquals(c1, c2), runtime.constantEquals(c2, c1)); + assertEquals(metaAccess.constantEquals(c1, c2), metaAccess.constantEquals(c2, c1)); if (c1.getKind() != Kind.Object && c2.getKind() != Kind.Object) { - assertEquals(c1.equals(c2), runtime.constantEquals(c2, c1)); + assertEquals(c1.equals(c2), metaAccess.constantEquals(c2, c1)); } } } @@ -107,7 +107,7 @@ @Test public void lookupArrayLengthTest() { for (Constant c : constants) { - Integer actual = runtime.lookupArrayLength(c); + Integer actual = metaAccess.lookupArrayLength(c); if (c.getKind() != Kind.Object || c.isNull() || !c.asObject().getClass().isArray()) { assertNull(actual); } else { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaMethod.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaMethod.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaMethod.java Thu Oct 10 17:07:11 2013 +0200 @@ -174,13 +174,13 @@ @Test public void getExceptionHandlersTest() throws NoSuchMethodException { - ResolvedJavaMethod method = runtime.lookupJavaMethod(getClass().getDeclaredMethod("methodWithExceptionHandlers", String.class, Object.class)); + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithExceptionHandlers", String.class, Object.class)); ExceptionHandler[] handlers = method.getExceptionHandlers(); assertNotNull(handlers); assertEquals(handlers.length, 3); - handlers[0].getCatchType().equals(runtime.lookupJavaType(IndexOutOfBoundsException.class)); - handlers[1].getCatchType().equals(runtime.lookupJavaType(NullPointerException.class)); - handlers[2].getCatchType().equals(runtime.lookupJavaType(RuntimeException.class)); + handlers[0].getCatchType().equals(metaAccess.lookupJavaType(IndexOutOfBoundsException.class)); + handlers[1].getCatchType().equals(metaAccess.lookupJavaType(NullPointerException.class)); + handlers[2].getCatchType().equals(metaAccess.lookupJavaType(RuntimeException.class)); } private static String nullPointerExceptionOnFirstLine(Object o, String ignored) { @@ -194,7 +194,7 @@ Assert.fail("should not reach here"); } catch (NullPointerException e) { StackTraceElement expected = e.getStackTrace()[0]; - ResolvedJavaMethod method = runtime.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class)); + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class)); StackTraceElement actual = method.asStackTraceElement(0); assertEquals(expected, actual); } @@ -211,7 +211,7 @@ @Test(timeout = 1000L) public void getAnnotationTest() throws NoSuchMethodException { - ResolvedJavaMethod method = runtime.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationTest")); + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationTest")); Test annotation = method.getAnnotation(Test.class); assertNotNull(annotation); assertEquals(1000L, annotation.timeout()); @@ -231,7 +231,7 @@ @Test public void getParameterAnnotationsTest() throws NoSuchMethodException { - ResolvedJavaMethod method = runtime.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); Annotation[][] annotations = method.getParameterAnnotations(); assertEquals(2, annotations.length); assertEquals(1, annotations[0].length); @@ -243,7 +243,7 @@ @Test public void getGenericParameterTypesTest() throws NoSuchMethodException { - ResolvedJavaMethod method = runtime.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); Type[] genericParameterTypes = method.getGenericParameterTypes(); assertEquals(2, genericParameterTypes.length); assertEquals("java.util.HashMap", genericParameterTypes[0].toString()); @@ -252,8 +252,8 @@ @Test public void getMaxLocalsTest() throws NoSuchMethodException { - ResolvedJavaMethod method1 = runtime.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); - ResolvedJavaMethod method2 = runtime.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class)); + ResolvedJavaMethod method1 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); + ResolvedJavaMethod method2 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class)); assertEquals(0, method1.getMaxLocals()); assertEquals(2, method2.getMaxLocals()); @@ -261,8 +261,8 @@ @Test public void getMaxStackSizeTest() throws NoSuchMethodException { - ResolvedJavaMethod method1 = runtime.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); - ResolvedJavaMethod method2 = runtime.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class)); + ResolvedJavaMethod method1 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class)); + ResolvedJavaMethod method2 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class)); assertEquals(0, method1.getMaxStackSize()); // some versions of javac produce bytecode with a stacksize of 2 for this method // JSR 292 also sometimes need one more stack slot diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java Thu Oct 10 17:07:11 2013 +0200 @@ -48,7 +48,7 @@ @Test public void findInstanceFieldWithOffsetTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); Set reflectionFields = getInstanceFields(c, true); for (Field f : reflectionFields) { ResolvedJavaField rf = lookupField(type.getInstanceFields(true), f); @@ -64,7 +64,7 @@ @Test public void isInterfaceTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); boolean expected = c.isInterface(); boolean actual = type.isInterface(); assertEquals(expected, actual); @@ -74,7 +74,7 @@ @Test public void isInstanceClassTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); boolean expected = !c.isArray() && !c.isPrimitive() && !c.isInterface(); boolean actual = type.isInstanceClass(); assertEquals(expected, actual); @@ -84,7 +84,7 @@ @Test public void isArrayTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); boolean expected = c.isArray(); boolean actual = type.isArray(); assertEquals(expected, actual); @@ -94,7 +94,7 @@ @Test public void getModifiersTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); int expected = c.getModifiers(); int actual = type.getModifiers(); assertEquals(expected, actual); @@ -108,8 +108,8 @@ Class c1 = all[i]; for (int j = i; j < all.length; j++) { Class c2 = all[j]; - ResolvedJavaType t1 = runtime.lookupJavaType(c1); - ResolvedJavaType t2 = runtime.lookupJavaType(c2); + ResolvedJavaType t1 = metaAccess.lookupJavaType(c1); + ResolvedJavaType t2 = metaAccess.lookupJavaType(c2); boolean expected = c1.isAssignableFrom(c2); boolean actual = t1.isAssignableFrom(t2); assertEquals(expected, actual); @@ -127,7 +127,7 @@ Object o = c.asObject(); Class cls = o.getClass(); while (cls != null) { - ResolvedJavaType type = runtime.lookupJavaType(cls); + ResolvedJavaType type = metaAccess.lookupJavaType(cls); boolean expected = cls.isInstance(o); boolean actual = type.isInstance(c); assertEquals(expected, actual); @@ -153,14 +153,14 @@ @Test public void asExactTypeTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); ResolvedJavaType exactType = type.asExactType(); Class expected = asExactClass(c); if (expected == null) { assertTrue("exact(" + c.getName() + ") != null", exactType == null); } else { assertNotNull(exactType); - assertTrue(exactType.equals(runtime.lookupJavaType(expected))); + assertTrue(exactType.equals(metaAccess.lookupJavaType(expected))); } } } @@ -168,14 +168,14 @@ @Test public void getSuperclassTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); Class expected = c.getSuperclass(); ResolvedJavaType actual = type.getSuperclass(); if (expected == null) { assertTrue(actual == null); } else { assertNotNull(actual); - assertTrue(actual.equals(runtime.lookupJavaType(expected))); + assertTrue(actual.equals(metaAccess.lookupJavaType(expected))); } } } @@ -183,12 +183,12 @@ @Test public void getInterfacesTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); Class[] expected = c.getInterfaces(); ResolvedJavaType[] actual = type.getInterfaces(); assertEquals(expected.length, actual.length); for (int i = 0; i < expected.length; i++) { - assertTrue(actual[i].equals(runtime.lookupJavaType(expected[i]))); + assertTrue(actual[i].equals(metaAccess.lookupJavaType(expected[i]))); } } } @@ -234,15 +234,15 @@ Class c1 = all[i]; for (int j = i; j < all.length; j++) { Class c2 = all[j]; - ResolvedJavaType t1 = runtime.lookupJavaType(c1); - ResolvedJavaType t2 = runtime.lookupJavaType(c2); + ResolvedJavaType t1 = metaAccess.lookupJavaType(c1); + ResolvedJavaType t2 = metaAccess.lookupJavaType(c2); Class expected = findLeastCommonAncestor(c1, c2); ResolvedJavaType actual = t1.findLeastCommonAncestor(t2); if (expected == null) { assertTrue(actual == null); } else { assertNotNull(actual); - assertTrue(actual.equals(runtime.lookupJavaType(expected))); + assertTrue(actual.equals(metaAccess.lookupJavaType(expected))); } } } @@ -277,7 +277,7 @@ if (expected == null) { assertNull(subtype); } else { - assertTrue(subtype.equals(runtime.lookupJavaType(expected))); + assertTrue(subtype.equals(metaAccess.lookupJavaType(expected))); } } @@ -294,18 +294,18 @@ @Test public void findUniqueConcreteSubtypeTest() { - ResolvedJavaType base = runtime.lookupJavaType(Base.class); + ResolvedJavaType base = metaAccess.lookupJavaType(Base.class); checkConcreteSubtype(base, Base.class); - ResolvedJavaType a1 = runtime.lookupJavaType(Abstract1.class); - ResolvedJavaType c1 = runtime.lookupJavaType(Concrete1.class); + ResolvedJavaType a1 = metaAccess.lookupJavaType(Abstract1.class); + ResolvedJavaType c1 = metaAccess.lookupJavaType(Concrete1.class); checkConcreteSubtype(base, null); checkConcreteSubtype(a1, Concrete1.class); checkConcreteSubtype(c1, Concrete1.class); - ResolvedJavaType i1 = runtime.lookupJavaType(Interface1.class); - ResolvedJavaType c2 = runtime.lookupJavaType(Concrete2.class); + ResolvedJavaType i1 = metaAccess.lookupJavaType(Interface1.class); + ResolvedJavaType c2 = metaAccess.lookupJavaType(Concrete2.class); checkConcreteSubtype(base, null); checkConcreteSubtype(a1, null); @@ -313,11 +313,11 @@ checkConcreteSubtype(i1, Concrete2.class); checkConcreteSubtype(c2, Concrete2.class); - ResolvedJavaType c3 = runtime.lookupJavaType(Concrete3.class); + ResolvedJavaType c3 = metaAccess.lookupJavaType(Concrete3.class); checkConcreteSubtype(c2, null); checkConcreteSubtype(c3, Concrete3.class); - ResolvedJavaType a4 = runtime.lookupJavaType(Abstract4.class); + ResolvedJavaType a4 = metaAccess.lookupJavaType(Abstract4.class); checkConcreteSubtype(c3, null); checkConcreteSubtype(a4, null); } @@ -325,13 +325,13 @@ @Test public void getComponentTypeTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); Class expected = c.getComponentType(); ResolvedJavaType actual = type.getComponentType(); if (expected == null) { assertNull(actual); } else { - assertTrue(actual.equals(runtime.lookupJavaType(expected))); + assertTrue(actual.equals(metaAccess.lookupJavaType(expected))); } } } @@ -340,10 +340,10 @@ public void getArrayClassTest() { for (Class c : classes) { if (c != void.class) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); Class expected = getArrayClass(c); ResolvedJavaType actual = type.getArrayClass(); - assertTrue(actual.equals(runtime.lookupJavaType(expected))); + assertTrue(actual.equals(metaAccess.lookupJavaType(expected))); } } } @@ -441,24 +441,24 @@ public void resolveMethodTest() { for (Class c : classes) { if (c.isInterface() || c.isPrimitive()) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); for (Method m : c.getDeclaredMethods()) { - ResolvedJavaMethod impl = type.resolveMethod(runtime.lookupJavaMethod(m)); + ResolvedJavaMethod impl = type.resolveMethod(metaAccess.lookupJavaMethod(m)); assertEquals(m.toString(), null, impl); } } else { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); VTable vtable = getVTable(c); for (Method impl : vtable.methods.values()) { Set decls = findDeclarations(impl, c); for (Method decl : decls) { - ResolvedJavaMethod m = runtime.lookupJavaMethod(decl); - ResolvedJavaMethod i = runtime.lookupJavaMethod(impl); + ResolvedJavaMethod m = metaAccess.lookupJavaMethod(decl); + ResolvedJavaMethod i = metaAccess.lookupJavaMethod(impl); checkResolveMethod(type, m, i); } } for (Method m : c.getDeclaredMethods()) { - ResolvedJavaMethod impl = type.resolveMethod(runtime.lookupJavaMethod(m)); + ResolvedJavaMethod impl = type.resolveMethod(metaAccess.lookupJavaMethod(m)); ResolvedJavaMethod expected = isAbstract(m.getModifiers()) ? null : impl; assertEquals(type + " " + m.toString(), expected, impl); } @@ -468,8 +468,8 @@ @Test public void findUniqueConcreteMethodTest() throws NoSuchMethodException { - ResolvedJavaMethod thisMethod = runtime.lookupJavaMethod(getClass().getDeclaredMethod("findUniqueConcreteMethodTest")); - ResolvedJavaMethod ucm = runtime.lookupJavaType(getClass()).findUniqueConcreteMethod(thisMethod); + ResolvedJavaMethod thisMethod = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("findUniqueConcreteMethodTest")); + ResolvedJavaMethod ucm = metaAccess.lookupJavaType(getClass()).findUniqueConcreteMethod(thisMethod); assertEquals(thisMethod, ucm); } @@ -490,8 +490,8 @@ } public boolean fieldsEqual(Field f, ResolvedJavaField rjf) { - return rjf.getDeclaringClass().equals(runtime.lookupJavaType(f.getDeclaringClass())) && rjf.getName().equals(f.getName()) && - rjf.getType().resolve(rjf.getDeclaringClass()).equals(runtime.lookupJavaType(f.getType())); + return rjf.getDeclaringClass().equals(metaAccess.lookupJavaType(f.getDeclaringClass())) && rjf.getName().equals(f.getName()) && + rjf.getType().resolve(rjf.getDeclaringClass()).equals(metaAccess.lookupJavaType(f.getType())); } public ResolvedJavaField lookupField(ResolvedJavaField[] fields, Field key) { @@ -515,10 +515,10 @@ } private boolean isHiddenFromReflection(ResolvedJavaField f) { - if (f.getDeclaringClass().equals(runtime.lookupJavaType(Throwable.class)) && f.getName().equals("backtrace")) { + if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(Throwable.class)) && f.getName().equals("backtrace")) { return true; } - if (f.getDeclaringClass().equals(runtime.lookupJavaType(ConstantPool.class)) && f.getName().equals("constantPoolOop")) { + if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(ConstantPool.class)) && f.getName().equals("constantPoolOop")) { return true; } return false; @@ -527,7 +527,7 @@ @Test public void getInstanceFieldsTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); for (boolean includeSuperclasses : new boolean[]{true, false}) { Set expected = getInstanceFields(c, includeSuperclasses); ResolvedJavaField[] actual = type.getInstanceFields(includeSuperclasses); @@ -550,11 +550,11 @@ @Test public void getDeclaredMethodsTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); Method[] raw = c.getDeclaredMethods(); Set expected = new HashSet<>(); for (Method m : raw) { - ResolvedJavaMethod resolvedMethod = runtime.lookupJavaMethod(m); + ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(m); assertNotNull(resolvedMethod); expected.add(resolvedMethod); } @@ -582,18 +582,18 @@ @Test public void getClassInitializerTest() { - assertNotNull(runtime.lookupJavaType(A.class).getClassInitializer()); - assertNotNull(runtime.lookupJavaType(D.class).getClassInitializer()); - assertNull(runtime.lookupJavaType(B.class).getClassInitializer()); - assertNull(runtime.lookupJavaType(C.class).getClassInitializer()); - assertNull(runtime.lookupJavaType(int.class).getClassInitializer()); - assertNull(runtime.lookupJavaType(void.class).getClassInitializer()); + assertNotNull(metaAccess.lookupJavaType(A.class).getClassInitializer()); + assertNotNull(metaAccess.lookupJavaType(D.class).getClassInitializer()); + assertNull(metaAccess.lookupJavaType(B.class).getClassInitializer()); + assertNull(metaAccess.lookupJavaType(C.class).getClassInitializer()); + assertNull(metaAccess.lookupJavaType(int.class).getClassInitializer()); + assertNull(metaAccess.lookupJavaType(void.class).getClassInitializer()); } @Test public void getAnnotationTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); for (Annotation a : c.getAnnotations()) { assertEquals(a, type.getAnnotation(a.annotationType())); } @@ -603,14 +603,14 @@ @Test public void memberClassesTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); assertEquals(c.isLocalClass(), type.isLocal()); assertEquals(c.isMemberClass(), type.isMember()); Class enclc = c.getEnclosingClass(); ResolvedJavaType enclt = type.getEnclosingType(); assertFalse(enclc == null ^ enclt == null); if (enclc != null) { - assertEquals(enclt, runtime.lookupJavaType(enclc)); + assertEquals(enclt, metaAccess.lookupJavaType(enclc)); } } } @@ -618,7 +618,7 @@ @Test public void classFilePathTest() { for (Class c : classes) { - ResolvedJavaType type = runtime.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); URL path = type.getClassFilePath(); if (type.isPrimitive() || type.isArray()) { assertEquals(null, path); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TypeUniverse.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TypeUniverse.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TypeUniverse.java Thu Oct 10 17:07:11 2013 +0200 @@ -40,7 +40,7 @@ public class TypeUniverse { public final Unsafe unsafe; - public final MetaAccessProvider runtime = Graal.getRequiredCapability(MetaAccessProvider.class); + public final MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); public final Collection> classes = new HashSet<>(); public final Map, Class> arrayClasses = new HashMap<>(); public final List constants = new ArrayList<>(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java --- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -34,6 +34,7 @@ public abstract class AssemblerTest extends GraalTest { + private final MetaAccessProvider metaAccess; protected final CodeCacheProvider codeCache; public interface CodeGenTest { @@ -42,11 +43,16 @@ } public AssemblerTest() { + this.metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); this.codeCache = Graal.getRequiredCapability(CodeCacheProvider.class); } + public MetaAccessProvider getMetaAccess() { + return metaAccess; + } + protected InstalledCode assembleMethod(Method m, CodeGenTest test) { - ResolvedJavaMethod method = codeCache.lookupJavaMethod(m); + ResolvedJavaMethod method = getMetaAccess().lookupJavaMethod(m); RegisterConfig registerConfig = codeCache.lookupRegisterConfig(); CallingConvention cc = CodeUtil.getCallingConvention(codeCache, CallingConvention.Type.JavaCallee, method, false); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Oct 10 17:07:11 2013 +0200 @@ -86,8 +86,8 @@ } } - public AMD64LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, cc, lir); + public AMD64LIRGenerator(StructuredGraph graph, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, metaAccess, codeCache, target, frameMap, cc, lir); lir.spillMoveFactory = new AMD64SpillMoveFactory(); } @@ -96,7 +96,7 @@ // there is no immediate move of 64-bit constants on Intel switch (c.getKind()) { case Long: - return Util.isInt(c.asLong()) && !runtime.needsDataPatch(c); + return Util.isInt(c.asLong()) && !codeCache.needsDataPatch(c); case Double: return false; case Object: @@ -110,7 +110,7 @@ public boolean canInlineConstant(Constant c) { switch (c.getKind()) { case Long: - return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); + return NumUtil.isInt(c.asLong()) && !codeCache.needsDataPatch(c); case Object: return c.isNull(); default: @@ -147,7 +147,7 @@ if (isConstant(base)) { if (asConstant(base).isNull()) { baseRegister = Value.ILLEGAL; - } else if (asConstant(base).getKind() != Kind.Object && !runtime.needsDataPatch(asConstant(base))) { + } else if (asConstant(base).getKind() != Kind.Object && !codeCache.needsDataPatch(asConstant(base))) { finalDisp += asConstant(base).asLong(); baseRegister = Value.ILLEGAL; } else { @@ -881,7 +881,7 @@ public void visitBreakpointNode(BreakpointNode node) { JavaType[] sig = new JavaType[node.arguments().size()]; for (int i = 0; i < sig.length; i++) { - sig[i] = node.arguments().get(i).stamp().javaType(runtime); + sig[i] = node.arguments().get(i).stamp().javaType(metaAccess); } Value[] parameters = visitInvokeArguments(frameMap.registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, null, sig, target(), false), node.arguments()); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILBackend.java --- a/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILBackend.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILBackend.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,8 +51,8 @@ private Map paramTypeMap = new HashMap<>(); private Buffer codeBuffer; - public HSAILBackend(CodeCacheProvider runtime, TargetDescription target) { - super(runtime, target); + public HSAILBackend(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target) { + super(metaAccess, codeCache, target); paramTypeMap.put("HotSpotResolvedPrimitiveType", "s32"); paramTypeMap.put("HotSpotResolvedPrimitiveType", "f32"); paramTypeMap.put("HotSpotResolvedPrimitiveType", "f64"); @@ -74,7 +74,7 @@ @Override public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new HSAILLIRGenerator(graph, runtime(), target, frameMap, cc, lir); + return new HSAILLIRGenerator(graph, metaAccess(), runtime(), target, frameMap, cc, lir); } public String getPartialCodeString() { @@ -142,12 +142,12 @@ int pidx = 0; for (int i = 0; i < totalParamCount; i++) { if (i == 0 && !isStatic) { - paramtypes[i] = runtime().lookupJavaType(Object.class); + paramtypes[i] = metaAccess().lookupJavaType(Object.class); paramNames[i] = "%_this"; } else if (i < nonConstantParamCount) { if (isObjectLambda && (i == (nonConstantParamCount))) { // Set up the gid register mapping. - paramtypes[i] = runtime().lookupJavaType(int.class); + paramtypes[i] = metaAccess().lookupJavaType(int.class); paramNames[i] = "%_gid"; } else { paramtypes[i] = signature.getParameterType(pidx++, null); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILCompilationResult.java --- a/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILCompilationResult.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILCompilationResult.java Thu Oct 10 17:07:11 2013 +0200 @@ -31,7 +31,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.api.runtime.*; import com.oracle.graal.compiler.*; -import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.hsail.*; @@ -49,10 +48,6 @@ public class HSAILCompilationResult { private CompilationResult compResult; - protected static GraalCodeCacheProvider runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class); - protected static Replacements replacements = Graal.getRequiredCapability(Replacements.class); - protected static Backend backend = Graal.getRequiredCapability(Backend.class); - protected static SuitesProvider suitesProvider = Graal.getRequiredCapability(SuitesProvider.class); private static final String propPkgName = HSAILCompilationResult.class.getPackage().getName(); private static Level logLevel; private static ConsoleHandler consoleHandler; @@ -78,13 +73,15 @@ } public static HSAILCompilationResult getHSAILCompilationResult(Method meth) { - ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(meth); + MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); + ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(meth); return getHSAILCompilationResult(javaMethod); } public static HSAILCompilationResult getHSAILCompilationResult(ResolvedJavaMethod javaMethod) { + MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); StructuredGraph graph = new StructuredGraph(javaMethod); - new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); return getHSAILCompilationResult(graph); } @@ -118,16 +115,20 @@ public static HSAILCompilationResult getHSAILCompilationResult(StructuredGraph graph) { Debug.dump(graph, "Graph"); TargetDescription target = new TargetDescription(new HSAIL(), true, 8, 0, true); - HSAILBackend hsailBackend = new HSAILBackend(Graal.getRequiredCapability(GraalCodeCacheProvider.class), target); + MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); + GraalCodeCacheProvider codeCache = Graal.getRequiredCapability(GraalCodeCacheProvider.class); + HSAILBackend hsailBackend = new HSAILBackend(metaAccess, codeCache, target); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); phasePlan.addPhase(PhasePosition.AFTER_PARSING, new HSAILPhase()); new HSAILPhase().apply(graph); CallingConvention cc = getHSAILCallingConvention(Type.JavaCallee, target, graph.method(), false); + Replacements replacements = Graal.getRequiredCapability(Replacements.class); + SuitesProvider suitesProvider = Graal.getRequiredCapability(SuitesProvider.class); try { - CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, hsailBackend, target, null, phasePlan, OptimisticOptimizations.NONE, - new SpeculationLog(), suitesProvider.getDefaultSuites(), new CompilationResult()); + CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, graph.method(), metaAccess, codeCache, replacements, hsailBackend, target, null, phasePlan, + OptimisticOptimizations.NONE, new SpeculationLog(), suitesProvider.getDefaultSuites(), new CompilationResult()); return new HSAILCompilationResult(compResult); } catch (GraalInternalError e) { String partialCode = hsailBackend.getPartialCodeString(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java --- a/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java Thu Oct 10 17:07:11 2013 +0200 @@ -66,7 +66,7 @@ public class HSAILLIRGenerator extends LIRGenerator { private HotSpotRuntime runtime() { - return (HotSpotRuntime) runtime; + return (HotSpotRuntime) codeCache; } public static class HSAILSpillMoveFactory implements LIR.SpillMoveFactory { @@ -83,8 +83,8 @@ } } - public HSAILLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, cc, lir); + public HSAILLIRGenerator(StructuredGraph graph, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, metaAccess, codeCache, target, frameMap, cc, lir); lir.spillMoveFactory = new HSAILSpillMoveFactory(); } @@ -98,7 +98,7 @@ public boolean canInlineConstant(Constant c) { switch (c.getKind()) { case Long: - return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); + return NumUtil.isInt(c.asLong()) && !codeCache.needsDataPatch(c); case Object: return c.isNull(); default: diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Thu Oct 10 17:07:11 2013 +0200 @@ -25,31 +25,24 @@ import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; +import java.lang.annotation.*; +import java.lang.reflect.*; + import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.CallingConvention.*; -import com.oracle.graal.api.runtime.Graal; -import com.oracle.graal.compiler.GraalCompiler; -import com.oracle.graal.compiler.ptx.PTXBackend; -import com.oracle.graal.compiler.ptx.PTXTargetMethodAssembler; -import com.oracle.graal.compiler.test.GraalCompilerTest; -import com.oracle.graal.debug.Debug; -import com.oracle.graal.hotspot.meta.HotSpotNmethod; -import com.oracle.graal.hotspot.meta.HotSpotRuntime; -import com.oracle.graal.hotspot.meta.HotSpotResolvedJavaMethod; -import com.oracle.graal.hotspot.ptx.PTXHotSpotRuntime; -import com.oracle.graal.java.GraphBuilderConfiguration; -import com.oracle.graal.java.GraphBuilderPhase; -import com.oracle.graal.lir.ptx.ParallelOver; -import com.oracle.graal.nodes.StructuredGraph; -import com.oracle.graal.nodes.spi.GraalCodeCacheProvider; -import com.oracle.graal.phases.OptimisticOptimizations; -import com.oracle.graal.phases.PhasePlan; +import com.oracle.graal.api.code.CallingConvention.Type; +import com.oracle.graal.compiler.*; +import com.oracle.graal.compiler.ptx.*; +import com.oracle.graal.compiler.test.*; +import com.oracle.graal.debug.*; +import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.hotspot.ptx.*; +import com.oracle.graal.java.*; +import com.oracle.graal.lir.ptx.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.phases.tiers.*; -import com.oracle.graal.ptx.PTX; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Modifier; +import com.oracle.graal.ptx.*; public abstract class PTXTestBase extends GraalCompilerTest { @@ -63,32 +56,29 @@ } protected CompilationResult compile(String test) { - if (runtime instanceof PTXHotSpotRuntime) { + if (getCodeCache() instanceof PTXHotSpotRuntime) { StructuredGraph graph = parse(test); sg = graph; Debug.dump(graph, "Graph"); TargetDescription target = new TargetDescription(new PTX(), true, 1, 0, true); - PTXBackend ptxBackend = new PTXBackend(Graal.getRequiredCapability(GraalCodeCacheProvider.class), target); + PTXBackend ptxBackend = new PTXBackend(getMetaAccess(), getCodeCache(), target); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); phasePlan.addPhase(PhasePosition.AFTER_PARSING, new PTXPhase()); new PTXPhase().apply(graph); - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); + CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); /* * Use Suites.createDefaultSuites() instead of GraalCompilerTest.suites. The - * GraalCompilerTest.suites variable contains the Suites for the HotSpotRuntime. This code - * will not run on hotspot, so it should use the plain Graal default suites, without hotspot - * specific phases. - * - * Ultimately we might want to have both the kernel and the code natively compiled for GPU fallback to CPU in cases - * of ECC failure on kernel invocation. + * GraalCompilerTest.suites variable contains the Suites for the HotSpotRuntime. This + * code will not run on hotspot, so it should use the plain Graal default suites, + * without hotspot specific phases. + * + * Ultimately we might want to have both the kernel and the code natively compiled for + * GPU fallback to CPU in cases of ECC failure on kernel invocation. */ - CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, - graalRuntime().getReplacements(), ptxBackend, target, - null, phasePlan, - OptimisticOptimizations.NONE, new SpeculationLog(), - Suites.createDefaultSuites(), new ExternalCompilationResult()); + CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), getMetaAccess(), getCodeCache(), graalRuntime().getReplacements(), ptxBackend, target, null, phasePlan, + OptimisticOptimizations.NONE, new SpeculationLog(), Suites.createDefaultSuites(), new ExternalCompilationResult()); return result; } else { return null; @@ -113,7 +103,7 @@ HotSpotResolvedJavaMethod compiledMethod = (HotSpotResolvedJavaMethod) sg.method(); boolean isStatic = Modifier.isStatic(compiledMethod.getModifiers()); Object[] executeArgs = argsWithReceiver((isStatic ? null : this), args); - HotSpotRuntime hsr = (HotSpotRuntime) runtime; + HotSpotRuntime hsr = (HotSpotRuntime) getCodeCache(); InstalledCode installedCode = hsr.addExternalMethod(compiledMethod, result, sg); Annotation[][] params = compiledMethod.getParameterAnnotations(); @@ -147,7 +137,8 @@ Object r; if (dimensionX != 1 || dimensionY != 1 || dimensionZ != 1) { /* - * for now assert that the warp array block is no larger than the number of physical gpu cores. + * for now assert that the warp array block is no larger than the number of physical + * gpu cores. */ assert dimensionX * dimensionY * dimensionZ < PTXTargetMethodAssembler.getAvailableProcessors(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java Thu Oct 10 17:07:11 2013 +0200 @@ -48,8 +48,8 @@ */ public class PTXBackend extends Backend { - public PTXBackend(CodeCacheProvider runtime, TargetDescription target) { - super(runtime, target); + public PTXBackend(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target) { + super(metaAccess, codeCache, target); } @Override @@ -64,7 +64,7 @@ @Override public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new PTXLIRGenerator(graph, runtime(), target, frameMap, cc, lir); + return new PTXLIRGenerator(graph, metaAccess(), runtime(), target, frameMap, cc, lir); } class HotSpotFrameContext implements FrameContext { @@ -85,8 +85,7 @@ } @Override - public TargetMethodAssembler newAssembler(LIRGenerator lirGen, - CompilationResult compilationResult) { + public TargetMethodAssembler newAssembler(LIRGenerator lirGen, CompilationResult compilationResult) { // Omit the frame of the method: // - has no spill slots or other slots allocated during register allocation // - has no callee-saved registers @@ -100,9 +99,7 @@ return tasm; } - private static void emitKernelEntry(TargetMethodAssembler tasm, - LIRGenerator lirGen, - ResolvedJavaMethod codeCacheOwner) { + private static void emitKernelEntry(TargetMethodAssembler tasm, LIRGenerator lirGen, ResolvedJavaMethod codeCacheOwner) { // Emit PTX kernel entry text based on PTXParameterOp // instructions in the start block. Remove the instructions // once kernel entry text and directives are emitted to @@ -143,12 +140,9 @@ } // Emit .reg space declarations - private static void emitRegisterDecl(TargetMethodAssembler tasm, - LIRGenerator lirGen, - ResolvedJavaMethod codeCacheOwner) { + private static void emitRegisterDecl(TargetMethodAssembler tasm, LIRGenerator lirGen, ResolvedJavaMethod codeCacheOwner) { - assert codeCacheOwner != null : - lirGen.getGraph() + " is not associated with a method"; + assert codeCacheOwner != null : lirGen.getGraph() + " is not associated with a method"; Buffer codeBuffer = tasm.asm.codeBuffer; @@ -254,7 +248,7 @@ } catch (GraalInternalError e) { e.printStackTrace(); // TODO : Better error handling needs to be done once - // all types of parameters are handled. + // all types of parameters are handled. codeBuffer.setPosition(0); codeBuffer.close(false); return; @@ -265,7 +259,7 @@ } catch (GraalInternalError e) { e.printStackTrace(); // TODO : Better error handling needs to be done once - // all types of parameters are handled. + // all types of parameters are handled. codeBuffer.setPosition(0); codeBuffer.close(false); return; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Oct 10 17:07:11 2013 +0200 @@ -87,8 +87,8 @@ } } - public PTXLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, cc, lir); + public PTXLIRGenerator(StructuredGraph graph, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, metaAccess, codeCache, target, frameMap, cc, lir); lir.spillMoveFactory = new PTXSpillMoveFactory(); int callVariables = cc.getArgumentCount() + (cc.getReturn() == Value.ILLEGAL ? 0 : 1); lir.setFirstVariableNumber(callVariables); @@ -109,7 +109,7 @@ public boolean canInlineConstant(Constant c) { switch (c.getKind()) { case Long: - return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); + return NumUtil.isInt(c.asLong()) && !codeCache.needsDataPatch(c); case Object: return c.isNull(); default: @@ -216,7 +216,7 @@ if (isConstant(base)) { if (asConstant(base).isNull()) { baseRegister = Value.ILLEGAL; - } else if (asConstant(base).getKind() != Kind.Object && !runtime.needsDataPatch(asConstant(base))) { + } else if (asConstant(base).getKind() != Kind.Object && !codeCache.needsDataPatch(asConstant(base))) { finalDisp += asConstant(base).asLong(); baseRegister = Value.ILLEGAL; } else { @@ -328,8 +328,8 @@ @Override public void emitIntegerTestBranch(Value left, Value right, boolean negated, LabelRef label) { - /// emitIntegerTest(left, right); - // append(new BranchOp(negated ? Condition.NE : Condition.EQ, label)); + // / emitIntegerTest(left, right); + // append(new BranchOp(negated ? Condition.NE : Condition.EQ, label)); throw GraalInternalError.unimplemented("emitIntegerTestBranch()"); } @@ -403,24 +403,19 @@ } @Override - public Variable emitIntegerTestMove(Value left, Value right, - Value trueValue, Value falseValue) { + public Variable emitIntegerTestMove(Value left, Value right, Value trueValue, Value falseValue) { emitIntegerTest(left, right); Variable result = newVariable(trueValue.getKind()); - append(new CondMoveOp(result, Condition.EQ, - load(trueValue), loadNonConst(falseValue), - nextPredRegNum)); + append(new CondMoveOp(result, Condition.EQ, load(trueValue), loadNonConst(falseValue), nextPredRegNum)); nextPredRegNum++; return result; } - private void emitIntegerTest(Value a, Value b) { - assert a.getKind().getStackKind() == Kind.Int || - a.getKind() == Kind.Long; + assert a.getKind().getStackKind() == Kind.Int || a.getKind() == Kind.Long; if (LIRValueUtil.isVariable(b)) { append(new PTXTestOp(load(b), loadNonConst(a), nextPredRegNum)); @@ -900,19 +895,16 @@ throw GraalInternalError.unimplemented("PTXLIRGenerator.visitInfopointNode()"); } - public Variable emitLoadParam(Kind kind, Value address, - DeoptimizingNode deopting) { + public Variable emitLoadParam(Kind kind, Value address, DeoptimizingNode deopting) { PTXAddressValue loadAddress = asAddress(address); Variable result = newVariable(kind); - append(new LoadParamOp(kind, result, loadAddress, - deopting != null ? state(deopting) : null)); + append(new LoadParamOp(kind, result, loadAddress, deopting != null ? state(deopting) : null)); return result; } - public Variable emitLoadReturnAddress(Kind kind, Value address, - DeoptimizingNode deopting) { + public Variable emitLoadReturnAddress(Kind kind, Value address, DeoptimizingNode deopting) { PTXAddressValue loadAddress = asAddress(address); Variable result; @@ -927,19 +919,16 @@ result = newVariable(kind); } - append(new LoadReturnAddrOp(kind, result, loadAddress, - deopting != null ? state(deopting) : null)); + append(new LoadReturnAddrOp(kind, result, loadAddress, deopting != null ? state(deopting) : null)); return result; } - public void emitStoreReturnValue(Kind kind, Value address, Value inputVal, - DeoptimizingNode deopting) { + public void emitStoreReturnValue(Kind kind, Value address, Value inputVal, DeoptimizingNode deopting) { PTXAddressValue storeAddress = asAddress(address); Variable input = load(inputVal); - append(new StoreReturnValOp(kind, storeAddress, input, - deopting != null ? state(deopting) : null)); + append(new StoreReturnValOp(kind, storeAddress, input, deopting != null ? state(deopting) : null)); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXTargetMethodAssembler.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXTargetMethodAssembler.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXTargetMethodAssembler.java Thu Oct 10 17:07:11 2013 +0200 @@ -48,12 +48,12 @@ // detach ?? public PTXTargetMethodAssembler(TargetDescription target, - CodeCacheProvider runtime, + CodeCacheProvider codeCache, FrameMap frameMap, AbstractAssembler asm, FrameContext frameContext, CompilationResult compilationResult) { - super(target, runtime, frameMap, asm, frameContext, compilationResult); + super(target, codeCache, frameMap, asm, frameContext, compilationResult); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java --- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Oct 10 17:07:11 2013 +0200 @@ -77,8 +77,8 @@ } } - public SPARCLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, cc, lir); + public SPARCLIRGenerator(StructuredGraph graph, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, metaAccess, codeCache, target, frameMap, cc, lir); lir.spillMoveFactory = new SPARCSpillMoveFactory(); } @@ -98,9 +98,9 @@ public boolean canInlineConstant(Constant c) { switch (c.getKind()) { case Int: - return SPARCAssembler.isSimm13(c.asInt()) && !runtime.needsDataPatch(c); + return SPARCAssembler.isSimm13(c.asInt()) && !codeCache.needsDataPatch(c); case Long: - return SPARCAssembler.isSimm13(c.asLong()) && !runtime.needsDataPatch(c); + return SPARCAssembler.isSimm13(c.asLong()) && !codeCache.needsDataPatch(c); case Object: return c.isNull(); default: @@ -850,7 +850,7 @@ public void visitBreakpointNode(BreakpointNode node) { JavaType[] sig = new JavaType[node.arguments().size()]; for (int i = 0; i < sig.length; i++) { - sig[i] = node.arguments().get(i).stamp().javaType(runtime); + sig[i] = node.arguments().get(i).stamp().javaType(metaAccess); } Value[] parameters = visitInvokeArguments(frameMap.registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, null, sig, target(), false), node.arguments()); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -307,7 +307,7 @@ private void processMethod(final String snippet) { graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new PartialEscapePhase(false, new CanonicalizerPhase(true)).apply(graph, context); } @@ -324,7 +324,7 @@ graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); if (loopPeeling) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -36,7 +36,7 @@ private StructuredGraph getCanonicalizedGraph(String name) { StructuredGraph graph = parse(name); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); return graph; } @@ -54,7 +54,7 @@ assertEquals(referenceGraph, graph); } Assumptions assumptions = new Assumptions(false); - new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); for (int i = 1; i < 4; i++) { StructuredGraph graph = getCanonicalizedGraph("canonicalCompare" + i); assertEquals(referenceGraph, graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -141,8 +141,8 @@ test("testNullnessSnippet", new Object(), new Object()); StructuredGraph graph = parse("testNullnessSnippet"); - new ConditionalEliminationPhase(runtime()).apply(graph); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); for (ConstantNode constant : graph.getNodes().filter(ConstantNode.class)) { assertTrue("unexpected constant: " + constant, constant.asConstant().isNull() || constant.asConstant().asInt() > 0); } @@ -164,7 +164,7 @@ @Test public void testDisjunction() { StructuredGraph graph = parse("testDisjunctionSnippet"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); IfNode ifNode = (IfNode) graph.start().next(); InstanceOfNode instanceOf = (InstanceOfNode) ifNode.condition(); IsNullNode x = graph.unique(new IsNullNode(graph.getLocal(0))); @@ -172,9 +172,9 @@ ShortCircuitOrNode disjunction = graph.unique(new ShortCircuitOrNode(x, false, y, false, NOT_FREQUENT_PROBABILITY)); LogicNegationNode negation = graph.unique(new LogicNegationNode(disjunction)); ifNode.setCondition(negation); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); - new ConditionalEliminationPhase(runtime()).apply(graph); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); for (ConstantNode constant : graph.getNodes().filter(ConstantNode.class)) { assertTrue("unexpected constant: " + constant, constant.asConstant().isNull() || constant.asConstant().asInt() > 0); } @@ -192,8 +192,8 @@ public void testInvoke() { test("testInvokeSnippet", new Integer(16)); StructuredGraph graph = parse("testInvokeSnippet"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); - new ConditionalEliminationPhase(runtime()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); InvokeNode invoke = graph.getNodes().filter(InvokeNode.class).first(); assertEquals(InvokeKind.Special, ((MethodCallTargetNode) invoke.callTarget()).invokeKind()); @@ -222,9 +222,9 @@ @Test public void testTypeMerging() { StructuredGraph graph = parse("testTypeMergingSnippet"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); - new ConditionalEliminationPhase(runtime()).apply(graph); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); assertEquals(0, graph.getNodes().filter(StoreFieldNode.class).count()); } @@ -239,9 +239,9 @@ @Test public void testInstanceOfCheckCast() { StructuredGraph graph = parse("testInstanceOfCheckCastSnippet"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); - new ConditionalEliminationPhase(runtime()).apply(graph); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); assertEquals(0, graph.getNodes().filter(CheckCastNode.class).count()); } @@ -252,11 +252,11 @@ StructuredGraph graph = parse("testInstanceOfCheckCastSnippet"); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); - PhaseContext context = new PhaseContext(runtime(), null, replacements); + PhaseContext context = new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements); new LoweringPhase(canonicalizer).apply(graph, context); canonicalizer.apply(graph, context); - new ConditionalEliminationPhase(runtime()).apply(graph); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); canonicalizer.apply(graph, context); assertEquals(0, graph.getNodes().filter(GuardNode.class).count()); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -82,7 +82,7 @@ public void run() { StructuredGraph graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); Debug.dump(graph, "Graph"); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -114,7 +114,7 @@ public StructuredGraph call() throws Exception { Debug.dump(graph, "After parsing: " + snippet); Assert.assertEquals(checkcasts, graph.getNodes().filter(CheckCastNode.class).count()); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), new Assumptions(false), replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements)); Assert.assertEquals(afterCanon, graph.getNodes().filter(CheckCastNode.class).count()); return graph; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -63,12 +63,12 @@ private StructuredGraph parseAndProcess(Class cl, Assumptions assumptions) { Constructor[] constructors = cl.getConstructors(); Assert.assertTrue(constructors.length == 1); - final ResolvedJavaMethod javaMethod = runtime.lookupJavaConstructor(constructors[0]); + final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaConstructor(constructors[0]); StructuredGraph graph = new StructuredGraph(javaMethod); GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(); - new GraphBuilderPhase(runtime, conf, OptimisticOptimizations.ALL).apply(graph); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new GraphBuilderPhase(getMetaAccess(), conf, OptimisticOptimizations.ALL).apply(graph); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); return graph; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -58,7 +58,7 @@ public void run() { StructuredGraph graph = parse(snippet); - PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); + PhaseContext context = new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements); new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); new FloatingReadPhase().apply(graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -76,14 +76,16 @@ */ public abstract class GraalCompilerTest extends GraalTest { - protected final GraalCodeCacheProvider runtime; + private final GraalCodeCacheProvider codeCache; + private final MetaAccessProvider metaAccess; protected final Replacements replacements; protected final Backend backend; protected final Suites suites; public GraalCompilerTest() { this.replacements = Graal.getRequiredCapability(Replacements.class); - this.runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class); + this.metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); + this.codeCache = Graal.getRequiredCapability(GraalCodeCacheProvider.class); this.backend = Graal.getRequiredCapability(Backend.class); this.suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); } @@ -158,8 +160,12 @@ return result.toString(); } - protected GraalCodeCacheProvider runtime() { - return runtime; + protected GraalCodeCacheProvider getCodeCache() { + return codeCache; + } + + protected MetaAccessProvider getMetaAccess() { + return metaAccess; } /** @@ -324,7 +330,7 @@ before(method); Object[] executeArgs = argsWithReceiver(receiver, args); - ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(method); checkArgs(javaMethod, executeArgs); InstalledCode compiledMethod = getCode(javaMethod, parse(method)); @@ -347,7 +353,7 @@ if (kind == Kind.Object) { if (arg != null && javaType instanceof ResolvedJavaType) { ResolvedJavaType resolvedJavaType = (ResolvedJavaType) javaType; - Assert.assertTrue(resolvedJavaType + " from " + runtime.lookupJavaType(arg.getClass()), resolvedJavaType.isAssignableFrom(runtime.lookupJavaType(arg.getClass()))); + Assert.assertTrue(resolvedJavaType + " from " + metaAccess.lookupJavaType(arg.getClass()), resolvedJavaType.isAssignableFrom(metaAccess.lookupJavaType(arg.getClass()))); } } else { Assert.assertNotNull(arg); @@ -384,7 +390,7 @@ protected void test(Method method, Object receiver, Object... args) { Result expect = executeExpected(method, receiver, args); - if (runtime == null) { + if (getCodeCache() == null) { return; } testAgainstExpected(method, expect, receiver, args); @@ -396,7 +402,7 @@ protected Result executeActualCheckDeopt(Method method, Set shouldNotDeopt, Object receiver, Object... args) { Map deoptCounts = new EnumMap<>(DeoptimizationReason.class); - ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(method); ProfilingInfo profile = javaMethod.getProfilingInfo(); for (DeoptimizationReason reason : shouldNotDeopt) { deoptCounts.put(reason, profile.getDeoptimizationCount(reason)); @@ -456,7 +462,7 @@ final int id = compilationId.incrementAndGet(); - InstalledCode installedCode = Debug.scope("Compiling", new Object[]{runtime, new DebugDumpScope(String.valueOf(id), true)}, new Callable() { + InstalledCode installedCode = Debug.scope("Compiling", new Object[]{getCodeCache(), new DebugDumpScope(String.valueOf(id), true)}, new Callable() { public InstalledCode call() throws Exception { final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed(); @@ -465,15 +471,15 @@ } long start = System.currentTimeMillis(); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime().getTarget(), null, phasePlan, OptimisticOptimizations.ALL, - new SpeculationLog(), suites, new CompilationResult()); + CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); + final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, metaAccess, getCodeCache(), replacements, backend, getCodeCache().getTarget(), null, phasePlan, + OptimisticOptimizations.ALL, new SpeculationLog(), suites, new CompilationResult()); if (printCompilation) { TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize())); } - return Debug.scope("CodeInstall", new Object[]{runtime, method}, new Callable() { + return Debug.scope("CodeInstall", new Object[]{getCodeCache(), method}, new Callable() { @Override public InstalledCode call() throws Exception { @@ -507,7 +513,7 @@ } protected InstalledCode addMethod(final ResolvedJavaMethod method, final CompilationResult compResult) { - return runtime.addMethod(method, compResult); + return getCodeCache().addMethod(method, compResult); } /** @@ -544,9 +550,9 @@ private StructuredGraph parse0(Method m, GraphBuilderConfiguration conf) { assert m.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + m; - ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(m); + ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(m); StructuredGraph graph = new StructuredGraph(javaMethod); - new GraphBuilderPhase(runtime, conf, OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(metaAccess, conf, OptimisticOptimizations.ALL).apply(graph); return graph; } @@ -558,7 +564,7 @@ PhasePlan plan = new PhasePlan(); GraphBuilderConfiguration gbConf = GraphBuilderConfiguration.getEagerDefault(); gbConf.setEagerInfopointMode(eagerInfopointMode); - plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(runtime, gbConf, OptimisticOptimizations.ALL)); + plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(metaAccess, gbConf, OptimisticOptimizations.ALL)); return plan; } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -145,7 +145,7 @@ n.replaceFirstInput(local, constant); } Debug.dump(graph, "Graph"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), new Assumptions(false), replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements)); for (FrameState fs : local.usages().filter(FrameState.class).snapshot()) { fs.replaceFirstInput(local, null); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -58,8 +58,8 @@ public void callInfopoints() { final Method method = getMethod("testMethod"); final StructuredGraph graph = parse(method); - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, getDefaultPhasePlan(), + CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); + final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), getMetaAccess(), getCodeCache(), replacements, backend, getCodeCache().getTarget(), null, getDefaultPhasePlan(), OptimisticOptimizations.ALL, new SpeculationLog(), suites, new CompilationResult()); for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); @@ -80,8 +80,8 @@ } } assertTrue(graphLineSPs > 0); - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, getDefaultPhasePlan(true), + CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); + final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), getMetaAccess(), getCodeCache(), replacements, backend, getCodeCache().getTarget(), null, getDefaultPhasePlan(true), OptimisticOptimizations.ALL, new SpeculationLog(), suites, new CompilationResult()); int lineSPs = 0; for (Infopoint sp : cr.getInfopoints()) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -66,7 +66,7 @@ hints.put(invoke, 1000d); } Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(hints, new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -77,7 +77,7 @@ } Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(hints, new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -61,7 +61,7 @@ test("testSynchronizedSnippet", new A(), new A()); StructuredGraph graph = getGraph("testSynchronizedSnippet"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); new LockEliminationPhase().apply(graph); assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); @@ -79,7 +79,7 @@ test("testSynchronizedMethodSnippet", new A()); StructuredGraph graph = getGraph("testSynchronizedMethodSnippet"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements)); new LockEliminationPhase().apply(graph); assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); @@ -90,7 +90,7 @@ StructuredGraph graph = parse(method); PhasePlan phasePlan = getDefaultPhasePlan(); Assumptions assumptions = new Assumptions(true); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); new CanonicalizerPhase(true).apply(graph, context); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -134,8 +134,8 @@ } Assumptions assumptions = new Assumptions(false); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); - new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); Debug.scope("Test", new DebugDumpScope("Test:" + snippet), new Runnable() { @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -553,7 +553,7 @@ @Override public SchedulePhase call() throws Exception { Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new CanonicalizerPhase(true).apply(graph, context); if (mode == TestMode.INLINED_WITHOUT_FRAMESTATES) { new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); @@ -575,7 +575,7 @@ new FloatingReadPhase().apply(graph); new RemoveValueProxyPhase().apply(graph); - MidTierContext midContext = new MidTierContext(runtime(), assumptions, replacements, runtime().getTarget(), OptimisticOptimizations.ALL); + MidTierContext midContext = new MidTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, getCodeCache().getTarget(), OptimisticOptimizations.ALL); new GuardLoweringPhase().apply(graph, midContext); new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, midContext); new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, midContext); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -94,7 +94,7 @@ hints.put(invoke, 1000d); } Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(hints, new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ProfilingInfoTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ProfilingInfoTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ProfilingInfoTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -145,8 +145,8 @@ } private void testTypeProfile(String testSnippet, int bci) { - ResolvedJavaType stringType = runtime.lookupJavaType(String.class); - ResolvedJavaType stringBuilderType = runtime.lookupJavaType(StringBuilder.class); + ResolvedJavaType stringType = getMetaAccess().lookupJavaType(String.class); + ResolvedJavaType stringBuilderType = getMetaAccess().lookupJavaType(StringBuilder.class); ProfilingInfo info = profile(testSnippet, "ABC"); JavaTypeProfile typeProfile = info.getTypeProfile(bci); @@ -297,7 +297,7 @@ Method method = getMethod(methodName); Assert.assertTrue(Modifier.isStatic(method.getModifiers())); - ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); if (resetProfile) { javaMethod.reprofile(); } @@ -314,7 +314,7 @@ } private void resetProfile(String methodName) { - ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(getMethod(methodName)); + ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(getMethod(methodName)); javaMethod.reprofile(); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -91,7 +91,7 @@ private StructuredGraph compileTestSnippet(final String snippet) { StructuredGraph graph = parse(snippet); - PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); + PhaseContext context = new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); new LoweringPhase(canonicalizer).apply(graph, context); canonicalizer.apply(graph, context); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -83,7 +83,7 @@ // structure changes significantly public void run() { StructuredGraph graph = parse(snippet); - PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); + PhaseContext context = new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements); new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); new FloatingReadPhase().apply(graph); new EliminatePartiallyRedundantGuardsPhase(true, false).apply(graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -245,9 +245,9 @@ private void test(String test, String ref) { StructuredGraph testGraph = parse(test); Assumptions assumptions = new Assumptions(false); - new CanonicalizerPhase(true).apply(testGraph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(testGraph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); StructuredGraph refGraph = parse(ref); - new CanonicalizerPhase(true).apply(refGraph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(refGraph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); assertEquals(testGraph, refGraph); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -167,9 +167,9 @@ StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); Assumptions assumptions = new Assumptions(false); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); - new ConditionalEliminationPhase(runtime()).apply(graph); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); StructuredGraph referenceGraph = parse(referenceSnippet); assertEquals(referenceGraph, graph); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -110,7 +110,7 @@ private void testZeroReturn(String methodName) { StructuredGraph graph = parse(methodName); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), new Assumptions(false), replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements)); new DeadCodeEliminationPhase().apply(graph); assertConstantReturn(graph, 0); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -90,7 +90,7 @@ // No debug scope to reduce console noise for @Test(expected = ...) tests StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), new Assumptions(false), replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements)); StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); assertEquals(referenceGraph, graph); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -185,13 +185,13 @@ StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); Assumptions assumptions = new Assumptions(false); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); - new ConditionalEliminationPhase(runtime()).apply(graph); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); // a second canonicalizer is needed to process nested MaterializeNodes - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); StructuredGraph referenceGraph = parse(referenceSnippet); - new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); assertEquals(referenceGraph, graph); } @@ -241,9 +241,9 @@ StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); Assumptions assumptions = new Assumptions(false); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); - new ConditionalEliminationPhase(runtime()).apply(graph); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), assumptions, replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); + new ConditionalEliminationPhase(getMetaAccess()).apply(graph); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements)); Debug.dump(graph, "Graph"); Assert.assertFalse("shouldn't have nodes of type " + clazz, graph.getNodes().filter(clazz).iterator().hasNext()); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -47,7 +47,7 @@ protected void test(String snippet, final int expectedRegisters, final int expectedRegRegMoves, final int expectedSpillMoves) { final StructuredGraph graph = parse(snippet); - Debug.scope("AllocatorTest", new Object[]{graph, graph.method(), runtime}, new Runnable() { + Debug.scope("AllocatorTest", new Object[]{graph, graph.method(), getCodeCache()}, new Runnable() { @Override public void run() { @@ -119,7 +119,7 @@ @Override public LIR call() { - return GraalCompiler.emitHIR(runtime, backend.target, graph, replacements, assumptions, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog(), suites); + return GraalCompiler.emitHIR(getMetaAccess(), getCodeCache(), backend.target, graph, replacements, assumptions, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog(), suites); } }); @@ -127,7 +127,7 @@ @Override public RegisterStats call() { - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); + CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); GraalCompiler.emitLIR(backend, backend.target, lir, graph, cc); return new RegisterStats(lir); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -56,19 +56,19 @@ public void test1() { Method method = getMethod("testMethod"); final StructuredGraph graph = parse(method); - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), new Assumptions(false), replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements)); new DeadCodeEliminationPhase().apply(graph); for (Node node : graph.getNodes()) { if (node instanceof ConstantNode) { ConstantNode constant = (ConstantNode) node; if (constant.kind() == Kind.Object && " ".equals(constant.value.asObject())) { - graph.replaceFloating(constant, ConstantNode.forObject("-", runtime, graph)); + graph.replaceFloating(constant, ConstantNode.forObject("-", getMetaAccess(), graph)); } } } - final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); InstalledCode compiledMethod = getCode(javaMethod, graph); try { Object result = compiledMethod.execute("1", "2", "3"); @@ -82,7 +82,7 @@ public void test3() { Method method = getMethod("testMethod"); final StructuredGraph graph = parse(method); - final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); InstalledCode compiledMethod = getCode(javaMethod, graph); try { Object result = compiledMethod.executeVarargs("1", "2", "3"); @@ -96,7 +96,7 @@ public void test4() { Method method = getMethod("testMethodVirtual"); final StructuredGraph graph = parse(method); - final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); InstalledCode compiledMethod = getCode(javaMethod, graph); try { f1 = "0"; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/SynchronizedMethodDeoptimizationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/SynchronizedMethodDeoptimizationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/SynchronizedMethodDeoptimizationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -53,7 +53,7 @@ Assert.assertEquals(testString, testMethodSynchronized(testString)); } final StructuredGraph graph = parseProfiled(method); - final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); InstalledCode compiledMethod = getCode(javaMethod, graph); try { Object result = compiledMethod.executeVarargs(testString); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -41,7 +41,7 @@ protected void processMethod(final String snippet) { graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new EarlyReadEliminationPhase(new CanonicalizerPhase(true)).apply(graph, context); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -224,16 +224,16 @@ } private ReturnNode testEscapeAnalysis(String snippet, final Constant expectedConstantResult, final boolean iterativeEscapeAnalysis) { - ResolvedJavaMethod method = runtime.lookupJavaMethod(getMethod(snippet)); + ResolvedJavaMethod method = getMetaAccess().lookupJavaMethod(getMethod(snippet)); final StructuredGraph graph = new StructuredGraph(method); - return Debug.scope("GraalCompiler", new Object[]{graph, method, runtime}, new Callable() { + return Debug.scope("GraalCompiler", new Object[]{graph, method, getCodeCache()}, new Callable() { public ReturnNode call() { - new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); new CanonicalizerPhase(true).apply(graph, context); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -88,7 +88,7 @@ private void processMethod(final String snippet) { graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new IterativeInliningPhase(new CanonicalizerPhase(true)).apply(graph, context); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -243,7 +243,7 @@ protected void processMethod(final String snippet) { graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new PartialEscapePhase(false, true, new CanonicalizerPhase(true)).apply(graph, context); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -198,7 +198,7 @@ StructuredGraph graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); new CanonicalizerPhase(true).apply(graph, context); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -237,7 +237,7 @@ StructuredGraph graph = eagerInfopointMode ? parseDebug(method) : parse(method); PhasePlan phasePlan = getDefaultPhasePlan(eagerInfopointMode); Assumptions assumptions = new Assumptions(true); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); Debug.dump(graph, "Graph"); new CanonicalizerPhase(true).apply(graph, context); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Oct 10 17:07:11 2013 +0200 @@ -131,10 +131,10 @@ * argument can be null. * @return the result of the compilation */ - public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final GraalCodeCacheProvider runtime, - final Replacements replacements, final Backend backend, final TargetDescription target, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts, - final SpeculationLog speculationLog, final Suites suites, final CompilationResult compilationResult) { - Debug.scope("GraalCompiler", new Object[]{graph, runtime}, new Runnable() { + public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final MetaAccessProvider metaAccess, + final GraalCodeCacheProvider codeCache, final Replacements replacements, final Backend backend, final TargetDescription target, final GraphCache cache, final PhasePlan plan, + final OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog, final Suites suites, final CompilationResult compilationResult) { + Debug.scope("GraalCompiler", new Object[]{graph, codeCache}, new Runnable() { public void run() { final Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); @@ -142,7 +142,7 @@ public LIR call() { try (TimerCloseable a = FrontEnd.start()) { - return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog, suites); + return emitHIR(metaAccess, codeCache, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog, suites); } } }); @@ -180,12 +180,12 @@ /** * Builds the graph, optimizes it. * - * @param runtime - * + * @param metaAccess + * @param codeCache * @param target */ - public static LIR emitHIR(GraalCodeCacheProvider runtime, TargetDescription target, final StructuredGraph graph, Replacements replacements, Assumptions assumptions, GraphCache cache, - PhasePlan plan, OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog, final Suites suites) { + public static LIR emitHIR(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, TargetDescription target, final StructuredGraph graph, Replacements replacements, + Assumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog, final Suites suites) { if (speculationLog != null) { speculationLog.snapshot(); @@ -198,13 +198,13 @@ Debug.dump(graph, "initial state"); } - HighTierContext highTierContext = new HighTierContext(runtime, assumptions, replacements, cache, plan, optimisticOpts); + HighTierContext highTierContext = new HighTierContext(metaAccess, codeCache, assumptions, replacements, cache, plan, optimisticOpts); suites.getHighTier().apply(graph, highTierContext); - MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target, optimisticOpts); + MidTierContext midTierContext = new MidTierContext(metaAccess, codeCache, assumptions, replacements, target, optimisticOpts); suites.getMidTier().apply(graph, midTierContext); - LowTierContext lowTierContext = new LowTierContext(runtime, assumptions, replacements, target); + LowTierContext lowTierContext = new LowTierContext(metaAccess, codeCache, assumptions, replacements, target); suites.getLowTier().apply(graph, lowTierContext); // we do not want to store statistics about OSR compilations because it may prevent inlining diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Oct 10 17:07:11 2013 +0200 @@ -60,7 +60,8 @@ public final LIR lir; protected final StructuredGraph graph; - protected final CodeCacheProvider runtime; + protected final MetaAccessProvider metaAccess; + protected final CodeCacheProvider codeCache; protected final TargetDescription target; protected final CallingConvention cc; @@ -85,16 +86,17 @@ */ public abstract boolean canStoreConstant(Constant c); - public LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + public LIRGenerator(StructuredGraph graph, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { this.graph = graph; - this.runtime = runtime; + this.metaAccess = metaAccess; + this.codeCache = codeCache; this.target = target; this.frameMap = frameMap; if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) { this.cc = cc; } else { - JavaType[] parameterTypes = new JavaType[]{runtime.lookupJavaType(long.class)}; - CallingConvention tmp = frameMap.registerConfig.getCallingConvention(JavaCallee, runtime.lookupJavaType(void.class), parameterTypes, target, false); + JavaType[] parameterTypes = new JavaType[]{metaAccess.lookupJavaType(long.class)}; + CallingConvention tmp = frameMap.registerConfig.getCallingConvention(JavaCallee, metaAccess.lookupJavaType(void.class), parameterTypes, target, false); this.cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0)); } this.nodeOperands = graph.createNodeMap(); @@ -113,8 +115,13 @@ } @Override - public CodeCacheProvider getRuntime() { - return runtime; + public MetaAccessProvider getMetaAccess() { + return metaAccess; + } + + @Override + public CodeCacheProvider getCodeCache() { + return codeCache; } public StructuredGraph getGraph() { @@ -551,7 +558,7 @@ @Override public void emitInvoke(Invoke x) { LoweredCallTargetNode callTarget = (LoweredCallTargetNode) x.callTarget(); - CallingConvention invokeCc = frameMap.registerConfig.getCallingConvention(callTarget.callType(), x.asNode().stamp().javaType(runtime), callTarget.signature(), target(), false); + CallingConvention invokeCc = frameMap.registerConfig.getCallingConvention(callTarget.callType(), x.asNode().stamp().javaType(metaAccess), callTarget.signature(), target(), false); frameMap.callsMethod(invokeCc); Value[] parameters = visitInvokeArguments(invokeCc, callTarget.arguments()); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu Oct 10 17:07:11 2013 +0200 @@ -35,14 +35,20 @@ */ public abstract class Backend { + private final MetaAccessProvider metaAccess; private final CodeCacheProvider runtime; public final TargetDescription target; - protected Backend(CodeCacheProvider runtime, TargetDescription target) { - this.runtime = runtime; + protected Backend(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target) { + this.metaAccess = metaAccess; + this.runtime = codeCache; this.target = target; } + public MetaAccessProvider metaAccess() { + return metaAccess; + } + public CodeCacheProvider runtime() { return runtime; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/CanonicalizerTool.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/CanonicalizerTool.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/CanonicalizerTool.java Thu Oct 10 17:07:11 2013 +0200 @@ -30,7 +30,7 @@ Assumptions assumptions(); - MetaAccessProvider runtime(); + MetaAccessProvider getMetaAccess(); boolean canonicalizeReads(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java --- a/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -31,7 +31,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.runtime.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.compiler.test.*; @@ -98,12 +97,11 @@ private void testHelper(String name, CodeGenerator gen) { Method method = getMethod(name); - ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); InstalledCode installedCode = getCode(javaMethod, parse(method)); - CodeCacheProvider codeCache = Graal.getRequiredCapability(CodeCacheProvider.class); - TargetDescription target = codeCache.getTarget(); - RegisterConfig registerConfig = codeCache.lookupRegisterConfig(); + TargetDescription target = getCodeCache().getTarget(); + RegisterConfig registerConfig = getCodeCache().lookupRegisterConfig(); AMD64Assembler asm = new AMD64Assembler(target, registerConfig); gen.generateCode(asm); @@ -117,7 +115,7 @@ } private Register getArgumentRegister(int index, Kind kind) { - Register[] regs = runtime.lookupRegisterConfig().getCallingConventionRegisters(CallingConvention.Type.JavaCall, kind); + Register[] regs = getCodeCache().lookupRegisterConfig().getCallingConventionRegisters(CallingConvention.Type.JavaCall, kind); return regs[index]; } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java Thu Oct 10 17:07:11 2013 +0200 @@ -40,6 +40,6 @@ @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - AMD64Call.directCall(tasm, masm, tasm.runtime.lookupForeignCall(UNCOMMON_TRAP), null, false, info); + AMD64Call.directCall(tasm, masm, tasm.codeCache.lookupForeignCall(UNCOMMON_TRAP), null, false, info); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Thu Oct 10 17:07:11 2013 +0200 @@ -74,7 +74,7 @@ @Override public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new AMD64HotSpotLIRGenerator(graph, runtime(), target, frameMap, cc, lir); + return new AMD64HotSpotLIRGenerator(graph, runtime(), runtime(), target, frameMap, cc, lir); } /** @@ -248,7 +248,7 @@ AMD64Address src = new AMD64Address(receiver, config.hubOffset); AMD64HotSpotLIRGenerator gen = (AMD64HotSpotLIRGenerator) lirGen; - AMD64HotSpotRuntime hr = ((AMD64HotSpotRuntime) gen.getRuntime()); + AMD64HotSpotRuntime hr = ((AMD64HotSpotRuntime) gen.getCodeCache()); if (hr.useCompressedKlassPointers()) { Register register = r10; AMD64HotSpotMove.decodeKlassPointer(asm, register, hr.heapBaseRegister(), src, config.narrowKlassBase, config.narrowKlassShift, config.logKlassAlignment); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotDeoptimizeCallerOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotDeoptimizeCallerOp.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotDeoptimizeCallerOp.java Thu Oct 10 17:07:11 2013 +0200 @@ -38,6 +38,6 @@ @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { leaveFrameAndRestoreRbp(tasm, masm); - AMD64Call.directJmp(tasm, masm, tasm.runtime.lookupForeignCall(UNCOMMON_TRAP)); + AMD64Call.directJmp(tasm, masm, tasm.codeCache.lookupForeignCall(UNCOMMON_TRAP)); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Thu Oct 10 17:07:11 2013 +0200 @@ -67,11 +67,11 @@ public class AMD64HotSpotLIRGenerator extends AMD64LIRGenerator implements HotSpotLIRGenerator { private HotSpotRuntime runtime() { - return (HotSpotRuntime) runtime; + return (HotSpotRuntime) codeCache; } - protected AMD64HotSpotLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, cc, lir); + protected AMD64HotSpotLIRGenerator(StructuredGraph graph, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, metaAccess, codeCache, target, frameMap, cc, lir); } /** @@ -305,7 +305,7 @@ AMD64AddressValue address; Value index = operand(x.offset()); if (ValueUtil.isConstant(index) && NumUtil.isInt(ValueUtil.asConstant(index).asLong() + disp)) { - assert !runtime.needsDataPatch(asConstant(index)); + assert !codeCache.needsDataPatch(asConstant(index)); disp += (int) ValueUtil.asConstant(index).asLong(); address = new AMD64AddressValue(kind, load(operand(x.object())), disp); } else { @@ -355,7 +355,7 @@ @Override public void emitUnwind(Value exception) { - ForeignCallLinkage linkage = getRuntime().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER); + ForeignCallLinkage linkage = getCodeCache().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER); CallingConvention outgoingCc = linkage.getOutgoingCallingConvention(); assert outgoingCc.getArgumentCount() == 2; RegisterValue exceptionParameter = (RegisterValue) outgoingCc.getArgument(0); @@ -367,9 +367,9 @@ int pendingDeoptimizationOffset = graalRuntime().getConfig().pendingDeoptimizationOffset; RegisterValue thread = runtime().threadRegister().asValue(HotSpotGraalRuntime.wordKind()); AMD64AddressValue pendingDeoptAddress = new AMD64AddressValue(actionAndReason.getKind(), thread, pendingDeoptimizationOffset); - if (actionAndReason instanceof Constant && !runtime.needsDataPatch((Constant) actionAndReason)) { + if (actionAndReason instanceof Constant && !codeCache.needsDataPatch((Constant) actionAndReason)) { Constant constantActionAndReason = (Constant) actionAndReason; - assert !runtime.needsDataPatch(constantActionAndReason); + assert !codeCache.needsDataPatch(constantActionAndReason); append(new StoreConstantOp(constantActionAndReason.getKind(), pendingDeoptAddress, constantActionAndReason, null)); } else { append(new StoreOp(actionAndReason.getKind(), pendingDeoptAddress, load(actionAndReason), null)); @@ -384,7 +384,7 @@ @Override public void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason) { - moveDeoptimizationActionAndReasonToThread(runtime.encodeDeoptActionAndReason(action, reason)); + moveDeoptimizationActionAndReasonToThread(metaAccess.encodeDeoptActionAndReason(action, reason)); append(new AMD64HotSpotDeoptimizeCallerOp()); } @@ -396,7 +396,7 @@ @Override public void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) { Variable handler = load(operand(handlerInCallerPc)); - ForeignCallLinkage linkage = getRuntime().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER); + ForeignCallLinkage linkage = getCodeCache().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER); CallingConvention outgoingCc = linkage.getOutgoingCallingConvention(); assert outgoingCc.getArgumentCount() == 2; RegisterValue exceptionFixed = (RegisterValue) outgoingCc.getArgument(0); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java Thu Oct 10 17:07:11 2013 +0200 @@ -120,7 +120,7 @@ @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - Register heapBase = ((HotSpotRuntime) tasm.runtime).heapBaseRegister(); + Register heapBase = ((HotSpotRuntime) tasm.codeCache).heapBaseRegister(); masm.movq(asRegister(scratch), asRegister(input)); if (kind == Kind.Object) { encodePointer(masm, asRegister(scratch), heapBase, base, shift, alignment); @@ -172,7 +172,7 @@ final Register scratchRegister = asRegister(scratch); final Register cmpRegister = asRegister(cmpValue); final Register newRegister = asRegister(newValue); - Register heapBase = ((HotSpotRuntime) tasm.runtime).heapBaseRegister(); + Register heapBase = ((HotSpotRuntime) tasm.codeCache).heapBaseRegister(); encodePointer(masm, cmpRegister, heapBase, base, shift, alignment); masm.movq(scratchRegister, newRegister); encodePointer(masm, scratchRegister, heapBase, base, shift, alignment); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Thu Oct 10 17:07:11 2013 +0200 @@ -72,7 +72,7 @@ registerForeignCall(DECRYPT, config.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); - convertSnippets = new AMD64ConvertSnippets.Templates(this, replacements, graalRuntime.getTarget()); + convertSnippets = new AMD64ConvertSnippets.Templates(this, this, replacements, graalRuntime.getTarget()); super.registerReplacements(replacements); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java Thu Oct 10 17:07:11 2013 +0200 @@ -50,7 +50,7 @@ public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { leaveFrameAndRestoreRbp(tasm, masm); - ForeignCallLinkage linkage = tasm.runtime.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER); + ForeignCallLinkage linkage = tasm.codeCache.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER); CallingConvention cc = linkage.getOutgoingCallingConvention(); assert cc.getArgumentCount() == 2; assert exception.equals(cc.getArgument(0)); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCDeoptimizeOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCDeoptimizeOp.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCDeoptimizeOp.java Thu Oct 10 17:07:11 2013 +0200 @@ -48,6 +48,6 @@ // [Deopt Handler Code] // 0xffffffff749bb60c: call 0xffffffff748da540 ; {runtime_call} // 0xffffffff749bb610: nop - SPARCCall.directCall(tasm, masm, tasm.runtime.lookupForeignCall(UNCOMMON_TRAP), null, false, info); + SPARCCall.directCall(tasm, masm, tasm.codeCache.lookupForeignCall(UNCOMMON_TRAP), null, false, info); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu Oct 10 17:07:11 2013 +0200 @@ -71,7 +71,7 @@ @Override public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new SPARCHotSpotLIRGenerator(graph, runtime(), target, frameMap, cc, lir); + return new SPARCHotSpotLIRGenerator(graph, runtime(), runtime(), target, frameMap, cc, lir); } /** diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotDeoptimizeCallerOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotDeoptimizeCallerOp.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotDeoptimizeCallerOp.java Thu Oct 10 17:07:11 2013 +0200 @@ -47,7 +47,7 @@ // HotSpotFrameContext frameContext = backend.new HotSpotFrameContext(isStub); // frameContext.enter(tasm); Register scratch = g3; - SPARCCall.indirectJmp(tasm, masm, scratch, tasm.runtime.lookupForeignCall(UNCOMMON_TRAP)); + SPARCCall.indirectJmp(tasm, masm, scratch, tasm.codeCache.lookupForeignCall(UNCOMMON_TRAP)); // frameContext.leave(tasm); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Thu Oct 10 17:07:11 2013 +0200 @@ -50,11 +50,11 @@ public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSpotLIRGenerator { private HotSpotRuntime runtime() { - return (HotSpotRuntime) runtime; + return (HotSpotRuntime) codeCache; } - public SPARCHotSpotLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, cc, lir); + public SPARCHotSpotLIRGenerator(StructuredGraph graph, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, metaAccess, codeCache, target, frameMap, cc, lir); } /** @@ -128,7 +128,7 @@ Variable newValue = load(operand(x.newValue())); if (ValueUtil.isConstant(offset)) { - assert !runtime.needsDataPatch(asConstant(offset)); + assert !codeCache.needsDataPatch(asConstant(offset)); Variable longAddress = newVariable(Kind.Long); emitMove(longAddress, address); address = emitAdd(longAddress, asConstant(offset)); @@ -176,7 +176,7 @@ @Override public void emitUnwind(Value exception) { - ForeignCallLinkage linkage = getRuntime().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER); + ForeignCallLinkage linkage = getCodeCache().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER); CallingConvention linkageCc = linkage.getOutgoingCallingConvention(); assert linkageCc.getArgumentCount() == 2; RegisterValue exceptionParameter = (RegisterValue) linkageCc.getArgument(0); @@ -199,7 +199,7 @@ @Override public void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason) { - moveDeoptimizationActionAndReasonToThread(runtime.encodeDeoptActionAndReason(action, reason)); + moveDeoptimizationActionAndReasonToThread(metaAccess.encodeDeoptActionAndReason(action, reason)); append(new SPARCHotSpotDeoptimizeCallerOp()); } @@ -211,7 +211,7 @@ @Override public void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) { Variable handler = load(operand(handlerInCallerPc)); - ForeignCallLinkage linkage = getRuntime().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER); + ForeignCallLinkage linkage = getCodeCache().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER); CallingConvention linkageCc = linkage.getOutgoingCallingConvention(); assert linkageCc.getArgumentCount() == 2; RegisterValue exceptionFixed = (RegisterValue) linkageCc.getArgument(0); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,7 +51,7 @@ public void emitCode(TargetMethodAssembler tasm, SPARCMacroAssembler masm) { leaveFrame(tasm); - ForeignCallLinkage linkage = tasm.runtime.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER); + ForeignCallLinkage linkage = tasm.codeCache.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER); CallingConvention cc = linkage.getOutgoingCallingConvention(); assert cc.getArgumentCount() == 2; assert exception.equals(cc.getArgument(0)); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -64,7 +64,7 @@ public void testStaticFinalObjectAOT() { StructuredGraph result = compile("getStaticFinalObject", true); assertEquals(1, result.getNodes().filter(ConstantNode.class).count()); - assertEquals(runtime.getTarget().wordKind, result.getNodes().filter(ConstantNode.class).first().kind()); + assertEquals(getCodeCache().getTarget().wordKind, result.getNodes().filter(ConstantNode.class).first().kind()); assertEquals(2, result.getNodes(FloatingReadNode.class).count()); assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } @@ -88,7 +88,7 @@ NodeIterable filter = result.getNodes().filter(ConstantNode.class); assertEquals(1, filter.count()); - HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) runtime.lookupJavaType(AheadOfTimeCompilationTest.class); + HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) getMetaAccess().lookupJavaType(AheadOfTimeCompilationTest.class); assertEquals(type.klass(), filter.first().asConstant()); assertEquals(1, result.getNodes(FloatingReadNode.class).count()); @@ -118,7 +118,7 @@ StructuredGraph result = compile("getPrimitiveClassObject", true); NodeIterable filter = result.getNodes().filter(ConstantNode.class); assertEquals(1, filter.count()); - assertEquals(runtime.getTarget().wordKind, filter.first().kind()); + assertEquals(getCodeCache().getTarget().wordKind, filter.first().kind()); assertEquals(2, result.getNodes(FloatingReadNode.class).count()); assertEquals(0, result.getNodes().filter(ReadNode.class).count()); @@ -179,7 +179,7 @@ assertEquals(1, result.getNodes().filter(ConstantNode.class).count()); ConstantNode constant = result.getNodes().filter(ConstantNode.class).first(); assertEquals(Kind.Long, constant.kind()); - assertEquals(((HotSpotResolvedObjectType) runtime.lookupJavaType(Boolean.class)).klass(), constant.asConstant()); + assertEquals(((HotSpotResolvedObjectType) getMetaAccess().lookupJavaType(Boolean.class)).klass(), constant.asConstant()); } @Test @@ -200,13 +200,13 @@ boolean originalSetting = AOTCompilation.getValue(); AOTCompilation.setValue(compileAOT); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); + CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); // create suites everytime, as we modify options for the compiler final Suites suitesLocal = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); - final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime().getTarget(), null, phasePlan, OptimisticOptimizations.ALL, - new SpeculationLog(), suitesLocal, new CompilationResult()); + final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, getMetaAccess(), getCodeCache(), replacements, backend, getCodeCache().getTarget(), null, phasePlan, + OptimisticOptimizations.ALL, new SpeculationLog(), suitesLocal, new CompilationResult()); addMethod(method, compResult); AOTCompilation.setValue(originalSetting); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -54,8 +54,8 @@ LoweredCallTargetNode directCall = (LoweredCallTargetNode) invoke.callTarget(); JavaMethod callee = directCall.target(); Assert.assertTrue(callee.getName().equals("")); - Assert.assertTrue(runtime.lookupJavaType(ArrayIndexOutOfBoundsException.class).equals(callee.getDeclaringClass()) || - runtime.lookupJavaType(NullPointerException.class).equals(callee.getDeclaringClass())); + Assert.assertTrue(getMetaAccess().lookupJavaType(ArrayIndexOutOfBoundsException.class).equals(callee.getDeclaringClass()) || + getMetaAccess().lookupJavaType(NullPointerException.class).equals(callee.getDeclaringClass())); } } } else { @@ -65,7 +65,7 @@ Invoke invoke = (Invoke) node; LoweredCallTargetNode directCall = (LoweredCallTargetNode) invoke.callTarget(); JavaMethod callee = directCall.target(); - if (callee.getDeclaringClass().equals(runtime.lookupJavaType(System.class)) && callee.getName().equals("arraycopy")) { + if (callee.getDeclaringClass().equals(getMetaAccess().lookupJavaType(System.class)) && callee.getName().equals("arraycopy")) { found = true; } else { fail("found invoke to some method other than arraycopy: " + callee); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -112,7 +112,7 @@ for (String methodName : methodNames) { Method method = lookup(className, methodName); if (method != null) { - ResolvedJavaMethod installedCodeOwner = runtime.lookupJavaMethod(method); + ResolvedJavaMethod installedCodeOwner = getMetaAccess().lookupJavaMethod(method); StructuredGraph graph = replacements.getMethodSubstitution(installedCodeOwner); if (graph != null) { Assert.assertNotNull(getCode(installedCodeOwner, graph, true)); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -36,7 +36,7 @@ @Test public void testInstallCodeInvalidation() { - final ResolvedJavaMethod testJavaMethod = runtime.lookupJavaMethod(getMethod("foo")); + final ResolvedJavaMethod testJavaMethod = getMetaAccess().lookupJavaMethod(getMethod("foo")); final StructuredGraph graph = parse("otherFoo"); final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, graph); Assert.assertTrue(nmethod.isValid()); @@ -60,7 +60,7 @@ @Test public void testInstallCodeInvalidationWhileRunning() { - final ResolvedJavaMethod testJavaMethod = runtime.lookupJavaMethod(getMethod("foo")); + final ResolvedJavaMethod testJavaMethod = getMetaAccess().lookupJavaMethod(getMethod("foo")); final StructuredGraph graph = parse("otherFoo"); final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, graph); Object result; @@ -75,7 +75,7 @@ @Test public void testInstalledCodeCalledFromCompiledCode() { - final ResolvedJavaMethod testJavaMethod = runtime.lookupJavaMethod(getMethod("foo")); + final ResolvedJavaMethod testJavaMethod = getMetaAccess().lookupJavaMethod(getMethod("foo")); final StructuredGraph graph = parse("otherFoo"); final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, graph); Assert.assertTrue(nmethod.isValid()); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -84,12 +84,12 @@ if (argsToBind != null) { Object receiver = isStatic(m.getModifiers()) ? null : this; Object[] args = argsWithReceiver(receiver, argsToBind); - JavaType[] parameterTypes = signatureToTypes(runtime.lookupJavaMethod(m)); + JavaType[] parameterTypes = signatureToTypes(getMetaAccess().lookupJavaMethod(m)); assert parameterTypes.length == args.length; for (int i = 0; i < argsToBind.length; i++) { LocalNode local = graph.getLocal(i); Constant c = Constant.forBoxed(parameterTypes[i].getKind(), argsToBind[i]); - ConstantNode replacement = ConstantNode.forConstant(c, runtime, graph); + ConstantNode replacement = ConstantNode.forConstant(c, getMetaAccess(), graph); local.replaceAtUsages(replacement); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -247,8 +247,8 @@ public void run() { StructuredGraph graph = parse(snippet); - HighTierContext highContext = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); - MidTierContext midContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL); + HighTierContext highContext = new HighTierContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + MidTierContext midContext = new MidTierContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements, getCodeCache().getTarget(), OptimisticOptimizations.ALL); new InliningPhase(new InliningPhase.InlineEverythingPolicy(), new CanonicalizerPhase(true)).apply(graph, highContext); new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, highContext); new GuardLoweringPhase().apply(graph, midContext); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -632,10 +632,10 @@ public AssertionError call() { final StructuredGraph graph = parse(snippet); - HighTierContext highTierContext = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + HighTierContext highTierContext = new HighTierContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, highTierContext); - MidTierContext midTierContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL); + MidTierContext midTierContext = new MidTierContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements, getCodeCache().getTarget(), OptimisticOptimizations.ALL); new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, highTierContext); new GuardLoweringPhase().apply(graph, midTierContext); @@ -646,7 +646,7 @@ int barriers = 0; // First, the total number of expected barriers is checked. - if (((HotSpotRuntime) runtime()).config.useG1GC) { + if (((HotSpotRuntime) getMetaAccess()).config.useG1GC) { barriers = graph.getNodes().filter(G1PreWriteBarrier.class).count() + graph.getNodes().filter(G1PostWriteBarrier.class).count() + graph.getNodes().filter(G1ArrayRangePreWriteBarrier.class).count() + graph.getNodes().filter(G1ArrayRangePostWriteBarrier.class).count(); Assert.assertTrue(expectedBarriers * 2 == barriers); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Thu Oct 10 17:07:11 2013 +0200 @@ -154,8 +154,8 @@ InliningUtil.InlinedBytecodes.add(method.getCodeSize()); HotSpotRuntime runtime = graalRuntime.getRuntime(); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - return GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, graalRuntime.getBackend(), graalRuntime.getTarget(), graalRuntime.getCache(), plan, optimisticOpts, - method.getSpeculationLog(), suitesProvider.getDefaultSuites(), new CompilationResult()); + return GraalCompiler.compileGraph(graph, cc, method, runtime, runtime, replacements, graalRuntime.getBackend(), graalRuntime.getTarget(), graalRuntime.getCache(), plan, + optimisticOpts, method.getSpeculationLog(), suitesProvider.getDefaultSuites(), new CompilationResult()); } }); } finally { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu Oct 10 17:07:11 2013 +0200 @@ -69,7 +69,7 @@ public static final ForeignCallDescriptor EXCEPTION_HANDLER_IN_CALLER = new ForeignCallDescriptor("exceptionHandlerInCaller", void.class, Object.class, Word.class); public HotSpotBackend(HotSpotRuntime runtime, TargetDescription target) { - super(runtime, target); + super(runtime, runtime, target); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Thu Oct 10 17:07:11 2013 +0200 @@ -40,7 +40,7 @@ private final HotSpotVMConfig config; public HotSpotReplacementsImpl(HotSpotRuntime runtime, Assumptions assumptions, TargetDescription target) { - super(runtime, assumptions, target); + super(runtime, runtime, assumptions, target); this.config = runtime.config; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Oct 10 17:07:11 2013 +0200 @@ -98,7 +98,7 @@ /** * HotSpot implementation of {@link GraalCodeCacheProvider}. */ -public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider, SuitesProvider { +public abstract class HotSpotRuntime implements MetaAccessProvider, GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider, SuitesProvider { public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class); public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class); @@ -325,16 +325,16 @@ r.registerSubstitutions(CRC32Substitutions.class); r.registerSubstitutions(ReflectionSubstitutions.class); - checkcastDynamicSnippets = new CheckCastDynamicSnippets.Templates(this, r, graalRuntime.getTarget()); - instanceofSnippets = new InstanceOfSnippets.Templates(this, r, graalRuntime.getTarget()); - newObjectSnippets = new NewObjectSnippets.Templates(this, r, graalRuntime.getTarget()); - monitorSnippets = new MonitorSnippets.Templates(this, r, graalRuntime.getTarget(), c.useFastLocking); - writeBarrierSnippets = new WriteBarrierSnippets.Templates(this, r, graalRuntime.getTarget()); - boxingSnippets = new BoxingSnippets.Templates(this, r, graalRuntime.getTarget()); - exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(this, r, graalRuntime.getTarget()); - unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(this, r, graalRuntime.getTarget()); + checkcastDynamicSnippets = new CheckCastDynamicSnippets.Templates(this, this, r, graalRuntime.getTarget()); + instanceofSnippets = new InstanceOfSnippets.Templates(this, this, r, graalRuntime.getTarget()); + newObjectSnippets = new NewObjectSnippets.Templates(this, this, r, graalRuntime.getTarget()); + monitorSnippets = new MonitorSnippets.Templates(this, this, r, graalRuntime.getTarget(), c.useFastLocking); + writeBarrierSnippets = new WriteBarrierSnippets.Templates(this, this, r, graalRuntime.getTarget()); + boxingSnippets = new BoxingSnippets.Templates(this, this, r, graalRuntime.getTarget()); + exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(this, this, r, graalRuntime.getTarget()); + unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(this, this, r, graalRuntime.getTarget()); - r.registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(this, r, graalRuntime.getTarget())); + r.registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(this, this, r, graalRuntime.getTarget())); } public HotSpotGraalRuntime getGraalRuntime() { @@ -1048,7 +1048,7 @@ private GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) { StructuredGraph g = n.graph(); ValueNode array = n.array(); - ValueNode arrayLength = readArrayLength(array, tool.getRuntime()); + ValueNode arrayLength = readArrayLength(array, tool.getMetaAccess()); if (arrayLength == null) { Stamp stamp = StampFactory.positiveInt(); ReadNode readArrayLength = g.add(new ReadNode(array, ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, g), stamp, BarrierType.NONE, false)); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -50,7 +50,7 @@ Class c = (Class) javaClass.asConstant().asObject(); if (c != null) { Class componentType = c.getComponentType(); - return ConstantNode.forObject(componentType, tool.runtime(), graph()); + return ConstantNode.forObject(componentType, tool.getMetaAccess(), graph()); } } return this; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -50,7 +50,7 @@ Class c = (Class) javaClass.asConstant().asObject(); if (c != null) { Class superclass = c.getSuperclass(); - return ConstantNode.forObject(superclass, tool.runtime(), graph()); + return ConstantNode.forObject(superclass, tool.getMetaAccess(), graph()); } } return this; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,7 +51,7 @@ assert lockDepth != -1; HotSpotLIRGenerator hsGen = (HotSpotLIRGenerator) gen; StackSlot slot = hsGen.getLockSlot(lockDepth); - ForeignCallLinkage linkage = gen.getRuntime().lookupForeignCall(MonitorExitStubCall.MONITOREXIT); + ForeignCallLinkage linkage = gen.getCodeCache().lookupForeignCall(MonitorExitStubCall.MONITOREXIT); gen.emitForeignCall(linkage, this, gen.operand(object), gen.emitAddress(slot)); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Thu Oct 10 17:07:11 2013 +0200 @@ -62,7 +62,7 @@ @Override public void generate(LIRGenerator gen) { - ForeignCallLinkage linkage = gen.getRuntime().lookupForeignCall(NEW_ARRAY); + ForeignCallLinkage linkage = gen.getCodeCache().lookupForeignCall(NEW_ARRAY); Variable result = gen.emitForeignCall(linkage, this, gen.operand(hub), gen.operand(length)); gen.setResult(this, result); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Thu Oct 10 17:07:11 2013 +0200 @@ -60,7 +60,7 @@ @Override public void generate(LIRGenerator gen) { - ForeignCallLinkage linkage = gen.getRuntime().lookupForeignCall(NEW_INSTANCE); + ForeignCallLinkage linkage = gen.getCodeCache().lookupForeignCall(NEW_INSTANCE); Variable result = gen.emitForeignCall(linkage, this, gen.operand(hub)); gen.setResult(this, result); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Thu Oct 10 17:07:11 2013 +0200 @@ -43,8 +43,8 @@ public static final ForeignCallDescriptor NEW_MULTI_ARRAY = new ForeignCallDescriptor("new_multi_array", Object.class, Word.class, int.class, Word.class); - public NewMultiArrayStubCall(MetaAccessProvider runtime, ValueNode hub, int rank, ValueNode dims) { - super(runtime, NEW_MULTI_ARRAY, defaultStamp); + public NewMultiArrayStubCall(MetaAccessProvider metaAccess, ValueNode hub, int rank, ValueNode dims) { + super(metaAccess, NEW_MULTI_ARRAY, defaultStamp); this.hub = hub; this.rank = rank; this.dims = dims; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -41,11 +41,11 @@ private final ForeignCallDescriptor descriptor; - public StubForeignCallNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, ValueNode... arguments) { + public StubForeignCallNode(MetaAccessProvider metaAccess, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; - this.runtime = runtime; + this.runtime = metaAccess; } public ForeignCallDescriptor getDescriptor() { @@ -68,7 +68,7 @@ @Override public void generate(LIRGeneratorTool gen) { assert graph().start() instanceof StubStartNode; - ForeignCallLinkage linkage = gen.getRuntime().lookupForeignCall(descriptor); + ForeignCallLinkage linkage = gen.getCodeCache().lookupForeignCall(descriptor); Value[] operands = operands(gen); Value result = gen.emitForeignCall(linkage, null, operands); if (result != null) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -57,7 +57,7 @@ Constant whereArg = Constant.forObject(whereString.intern()); Constant formatArg = Constant.forObject(format.intern()); - ForeignCallLinkage linkage = gen.getRuntime().lookupForeignCall(VMErrorNode.VM_ERROR); + ForeignCallLinkage linkage = gen.getCodeCache().lookupForeignCall(VMErrorNode.VM_ERROR); gen.emitForeignCall(linkage, null, whereArg, formatArg, gen.operand(value)); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Thu Oct 10 17:07:11 2013 +0200 @@ -61,6 +61,6 @@ @Override public void lower(LoweringTool tool) { assert graph().getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA; - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,10 +51,10 @@ for (ConstantNode node : graph.getNodes().filter(ConstantNode.class)) { Constant constant = node.asConstant(); if (constant.getKind() == Kind.Object && constant.asObject() instanceof Class) { - ResolvedJavaType type = context.getRuntime().lookupJavaType((Class) constant.asObject()); + ResolvedJavaType type = context.getMetaAccess().lookupJavaType((Class) constant.asObject()); assert type instanceof HotSpotResolvedObjectType; - HotSpotRuntime runtime = (HotSpotRuntime) context.getRuntime(); + HotSpotRuntime runtime = (HotSpotRuntime) context.getMetaAccess(); Constant klass = ((HotSpotResolvedObjectType) type).klass(); ConstantNode klassNode = ConstantNode.forConstant(klass, runtime, graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -75,7 +75,7 @@ return null; } Kind componentKind = srcType.getComponentType().getKind(); - final ResolvedJavaMethod snippetMethod = tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.getSnippetForKind(componentKind)); + final ResolvedJavaMethod snippetMethod = tool.getMetaAccess().lookupJavaMethod(ArrayCopySnippets.getSnippetForKind(componentKind)); return Debug.scope("ArrayCopySnippet", snippetMethod, new Callable() { @Override @@ -93,7 +93,7 @@ } // the canonicalization before loop unrolling is needed to propagate the length into // additions, etc. - PhaseContext context = new PhaseContext(tool.getRuntime(), tool.assumptions(), tool.getReplacements()); + PhaseContext context = new PhaseContext(tool.getMetaAccess(), tool.getCodeCache(), tool.assumptions(), tool.getReplacements()); new CanonicalizerPhase(true).apply(snippetGraph, context); new LoopFullUnrollPhase(new CanonicalizerPhase(true)).apply(snippetGraph, context); new CanonicalizerPhase(true).apply(snippetGraph, context); @@ -108,7 +108,7 @@ final Replacements replacements = tool.getReplacements(); StructuredGraph snippetGraph = selectSnippet(tool, replacements); if (snippetGraph == null) { - final ResolvedJavaMethod snippetMethod = tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.genericArraycopySnippet); + final ResolvedJavaMethod snippetMethod = tool.getMetaAccess().lookupJavaMethod(ArrayCopySnippets.genericArraycopySnippet); snippetGraph = Debug.scope("ArrayCopySnippet", snippetMethod, new Callable() { @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteSubstitutions.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteSubstitutions.java Thu Oct 10 17:07:11 2013 +0200 @@ -34,7 +34,7 @@ public class CallSiteSubstitutions implements ReplacementsProvider { @Override - public void registerReplacements(MetaAccessProvider runtime, Replacements replacements, TargetDescription target) { + public void registerReplacements(MetaAccessProvider metaAccess, Replacements replacements, TargetDescription target) { replacements.registerSubstitutions(ConstantCallSiteSubstitutions.class); replacements.registerSubstitutions(MutableCallSiteSubstitutions.class); replacements.registerSubstitutions(VolatileCallSiteSubstitutions.class); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -59,7 +59,7 @@ @Override public Node canonical(CanonicalizerTool tool) { - ConstantNode target = getConstantCallTarget(tool.runtime(), tool.assumptions()); + ConstantNode target = getConstantCallTarget(tool.getMetaAccess(), tool.assumptions()); if (target != null) { return target; } @@ -69,7 +69,7 @@ @Override public void lower(LoweringTool tool) { - ConstantNode target = getConstantCallTarget(tool.getRuntime(), tool.assumptions()); + ConstantNode target = getConstantCallTarget(tool.getMetaAccess(), tool.assumptions()); if (target != null) { graph().replaceFixedWithFloating(this, target); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastDynamicSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastDynamicSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastDynamicSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -31,6 +31,7 @@ import static com.oracle.graal.replacements.SnippetTemplate.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; @@ -66,8 +67,8 @@ private final SnippetInfo dynamic = snippet(CheckCastDynamicSnippets.class, "checkcastDynamic"); - public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); } public void lower(CheckCastDynamicNode checkcast) { @@ -80,7 +81,7 @@ SnippetTemplate template = template(args); Debug.log("Lowering dynamic checkcast in %s: node=%s, template=%s, arguments=%s", graph, checkcast, template, args); - template.instantiate(runtime, checkcast, DEFAULT_REPLACER, args); + template.instantiate(metaAccess, checkcast, DEFAULT_REPLACER, args); } } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -200,8 +200,8 @@ private final SnippetInfo instanceofSecondary = snippet(InstanceOfSnippets.class, "instanceofSecondary"); private final SnippetInfo instanceofDynamic = snippet(InstanceOfSnippets.class, "instanceofDynamic"); - public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); } @Override @@ -211,13 +211,13 @@ ValueNode object = instanceOf.object(); TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), InstanceOfMinHintHitProbability.getValue(), InstanceOfMaxHints.getValue()); final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type(); - ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, instanceOf.graph()); + ConstantNode hub = ConstantNode.forConstant(type.klass(), metaAccess, instanceOf.graph()); Arguments args; StructuredGraph graph = hub.graph(); if (hintInfo.hintHitProbability >= hintHitProbabilityThresholdForDeoptimizingSnippet()) { - Hints hints = createHints(hintInfo, runtime, false, graph); + Hints hints = createHints(hintInfo, metaAccess, false, graph); args = new Arguments(instanceofWithProfile, graph.getGuardsStage()); args.add("object", object); args.addVarargs("hints", Word.class, StampFactory.forKind(wordKind()), hints.hubs); @@ -225,14 +225,14 @@ } else if (hintInfo.exact != null) { args = new Arguments(instanceofExact, graph.getGuardsStage()); args.add("object", object); - args.add("exactHub", ConstantNode.forConstant(((HotSpotResolvedObjectType) hintInfo.exact).klass(), runtime, graph)); + args.add("exactHub", ConstantNode.forConstant(((HotSpotResolvedObjectType) hintInfo.exact).klass(), metaAccess, graph)); } else if (type.isPrimaryType()) { args = new Arguments(instanceofPrimary, graph.getGuardsStage()); args.add("hub", hub); args.add("object", object); args.addConst("superCheckOffset", type.superCheckOffset()); } else { - Hints hints = createHints(hintInfo, runtime, false, graph); + Hints hints = createHints(hintInfo, metaAccess, false, graph); args = new Arguments(instanceofSecondary, graph.getGuardsStage()); args.add("hub", hub); args.add("object", object); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -28,6 +28,7 @@ import static com.oracle.graal.replacements.SnippetTemplate.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; @@ -64,22 +65,22 @@ private final SnippetInfo loadException = snippet(LoadExceptionObjectSnippets.class, "loadException"); - public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); } public void lower(LoadExceptionObjectNode loadExceptionObject) { if (USE_C_RUNTIME) { StructuredGraph graph = loadExceptionObject.graph(); - HotSpotRuntime hsRuntime = (HotSpotRuntime) runtime; + HotSpotRuntime hsRuntime = (HotSpotRuntime) metaAccess; ReadRegisterNode thread = graph.add(new ReadRegisterNode(hsRuntime.threadRegister(), true, false)); graph.addBeforeFixed(loadExceptionObject, thread); - ForeignCallNode loadExceptionC = graph.add(new ForeignCallNode(runtime, LOAD_AND_CLEAR_EXCEPTION, thread)); + ForeignCallNode loadExceptionC = graph.add(new ForeignCallNode(metaAccess, LOAD_AND_CLEAR_EXCEPTION, thread)); loadExceptionC.setStateAfter(loadExceptionObject.stateAfter()); graph.replaceFixedWithFixed(loadExceptionObject, loadExceptionC); } else { Arguments args = new Arguments(loadException, loadExceptionObject.graph().getGuardsStage()); - template(args).instantiate(runtime, loadExceptionObject, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, loadExceptionObject, DEFAULT_REPLACER, args); } } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -415,8 +415,8 @@ private final boolean useFastLocking; - public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target, boolean useFastLocking) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target, boolean useFastLocking) { + super(metaAccess, codeCache, replacements, target); this.useFastLocking = useFastLocking; } @@ -436,7 +436,7 @@ boolean tracingEnabledForMethod = stateAfter != null && (isTracingEnabledForMethod(stateAfter.method()) || isTracingEnabledForMethod(graph.method())); args.addConst("trace", isTracingEnabledForType(monitorenterNode.object()) || tracingEnabledForMethod); - Map nodes = template(args).instantiate(runtime, monitorenterNode, DEFAULT_REPLACER, args); + Map nodes = template(args).instantiate(metaAccess, monitorenterNode, DEFAULT_REPLACER, args); for (Node n : nodes.values()) { if (n instanceof BeginLockScopeNode) { @@ -460,7 +460,7 @@ args.addConst("lockDepth", monitorexitNode.getLockDepth()); args.addConst("trace", isTracingEnabledForType(monitorexitNode.object()) || isTracingEnabledForMethod(stateAfter.method()) || isTracingEnabledForMethod(graph.method())); - Map nodes = template(args).instantiate(runtime, monitorexitNode, DEFAULT_REPLACER, args); + Map nodes = template(args).instantiate(metaAccess, monitorexitNode, DEFAULT_REPLACER, args); for (Node n : nodes.values()) { if (n instanceof EndLockScopeNode) { @@ -521,7 +521,7 @@ for (ReturnNode ret : rets) { returnType = checkCounter.getMethod().getSignature().getReturnType(checkCounter.getMethod().getDeclaringClass()); String msg = "unbalanced monitors in " + MetaUtil.format("%H.%n(%p)", graph.method()) + ", count = %d"; - ConstantNode errMsg = ConstantNode.forObject(msg, runtime, graph); + ConstantNode errMsg = ConstantNode.forObject(msg, metaAccess, graph); callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter.getMethod(), new ValueNode[]{errMsg}, returnType)); invoke = graph.add(new InvokeNode(callTarget, 0)); List stack = Collections.emptyList(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -296,8 +296,8 @@ private final SnippetInfo allocateArrayDynamic = snippet(NewObjectSnippets.class, "allocateArrayDynamic"); private final SnippetInfo newmultiarray = snippet(NewObjectSnippets.class, "newmultiarray"); - public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); } /** @@ -307,7 +307,7 @@ StructuredGraph graph = newInstanceNode.graph(); HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newInstanceNode.instanceClass(); assert !type.isArray(); - ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, graph); + ConstantNode hub = ConstantNode.forConstant(type.klass(), metaAccess, graph); int size = instanceSize(type); Arguments args = new Arguments(allocateInstance, graph.getGuardsStage()); @@ -319,7 +319,7 @@ SnippetTemplate template = template(args); Debug.log("Lowering allocateInstance in %s: node=%s, template=%s, arguments=%s", graph, newInstanceNode, template, args); - template.instantiate(runtime, newInstanceNode, DEFAULT_REPLACER, args); + template.instantiate(metaAccess, newInstanceNode, DEFAULT_REPLACER, args); } /** @@ -330,9 +330,9 @@ ResolvedJavaType elementType = newArrayNode.elementType(); HotSpotResolvedObjectType arrayType = (HotSpotResolvedObjectType) elementType.getArrayClass(); Kind elementKind = elementType.getKind(); - ConstantNode hub = ConstantNode.forConstant(arrayType.klass(), runtime, graph); + ConstantNode hub = ConstantNode.forConstant(arrayType.klass(), metaAccess, graph); final int headerSize = HotSpotRuntime.getArrayBaseOffset(elementKind); - int log2ElementSize = CodeUtil.log2(((HotSpotRuntime) runtime).getScalingFactor(elementKind)); + int log2ElementSize = CodeUtil.log2(((HotSpotRuntime) metaAccess).getScalingFactor(elementKind)); Arguments args = new Arguments(allocateArray, graph.getGuardsStage()); args.add("hub", hub); @@ -345,7 +345,7 @@ SnippetTemplate template = template(args); Debug.log("Lowering allocateArray in %s: node=%s, template=%s, arguments=%s", graph, newArrayNode, template, args); - template.instantiate(runtime, newArrayNode, DEFAULT_REPLACER, args); + template.instantiate(metaAccess, newArrayNode, DEFAULT_REPLACER, args); } public void lower(DynamicNewArrayNode newArrayNode) { @@ -355,7 +355,7 @@ args.addConst("fillContents", newArrayNode.fillContents()); SnippetTemplate template = template(args); - template.instantiate(runtime, newArrayNode, DEFAULT_REPLACER, args); + template.instantiate(metaAccess, newArrayNode, DEFAULT_REPLACER, args); } public void lower(NewMultiArrayNode newmultiarrayNode) { @@ -366,13 +366,13 @@ dims[i] = newmultiarrayNode.dimension(i); } HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newmultiarrayNode.type(); - ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, graph); + ConstantNode hub = ConstantNode.forConstant(type.klass(), metaAccess, graph); Arguments args = new Arguments(newmultiarray, graph.getGuardsStage()); args.add("hub", hub); args.addConst("rank", rank); args.addVarargs("dimensions", int.class, StampFactory.forKind(Kind.Int), dims); - template(args).instantiate(runtime, newmultiarrayNode, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, newmultiarrayNode, DEFAULT_REPLACER, args); } private static int instanceSize(HotSpotResolvedObjectType type) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -63,7 +63,7 @@ if (type.isArray()) { Method method = ObjectCloneSnippets.arrayCloneMethods.get(type.getComponentType().getKind()); if (method != null) { - final ResolvedJavaMethod snippetMethod = tool.getRuntime().lookupJavaMethod(method); + final ResolvedJavaMethod snippetMethod = tool.getMetaAccess().lookupJavaMethod(method); final Replacements replacements = tool.getReplacements(); StructuredGraph snippetGraph = Debug.scope("ArrayCopySnippet", snippetMethod, new Callable() { @@ -77,7 +77,7 @@ return lowerReplacement(snippetGraph.copy(), tool); } } else { - type = getConcreteType(getObject().stamp(), tool.assumptions(), tool.getRuntime()); + type = getConcreteType(getObject().stamp(), tool.assumptions(), tool.getMetaAccess()); if (type != null) { StructuredGraph newGraph = new StructuredGraph(); LocalNode local = newGraph.add(new LocalNode(0, getObject().stamp())); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectGetClassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectGetClassNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectGetClassNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -72,7 +72,7 @@ ObjectStamp objectStamp = (ObjectStamp) stamp; if (objectStamp.isExactType()) { Constant clazz = objectStamp.type().getEncoding(Representation.JavaClass); - return ConstantNode.forConstant(clazz, tool.runtime(), graph()); + return ConstantNode.forConstant(clazz, tool.getMetaAccess(), graph()); } } return this; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -40,7 +40,7 @@ @Override public Node canonical(CanonicalizerTool tool) { - ConstantNode callerClassNode = getCallerClassNode(tool.runtime()); + ConstantNode callerClassNode = getCallerClassNode(tool.getMetaAccess()); if (callerClassNode != null) { return callerClassNode; } @@ -49,7 +49,7 @@ @Override public void lower(LoweringTool tool) { - ConstantNode callerClassNode = getCallerClassNode(tool.getRuntime()); + ConstantNode callerClassNode = getCallerClassNode(tool.getMetaAccess()); if (callerClassNode != null) { graph().replaceFixedWithFloating(this, callerClassNode); @@ -64,10 +64,10 @@ * If inlining is deep enough this method returns a {@link ConstantNode} of the caller class by * walking the the stack. * - * @param runtime + * @param metaAccess * @return ConstantNode of the caller class, or null */ - private ConstantNode getCallerClassNode(MetaAccessProvider runtime) { + private ConstantNode getCallerClassNode(MetaAccessProvider metaAccess) { if (!shouldIntrinsify(getTargetMethod())) { return null; } @@ -93,7 +93,7 @@ if (!method.ignoredBySecurityStackWalk()) { // We have reached the desired frame; return the holder class. HotSpotResolvedObjectType callerClass = (HotSpotResolvedObjectType) method.getDeclaringClass(); - return ConstantNode.forObject(callerClass.mirror(), runtime, graph()); + return ConstantNode.forObject(callerClass.mirror(), metaAccess, graph()); } break; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java Thu Oct 10 17:07:11 2013 +0200 @@ -122,13 +122,13 @@ } } - static Hints createHints(TypeCheckHints hints, MetaAccessProvider runtime, boolean positiveOnly, Graph graph) { + static Hints createHints(TypeCheckHints hints, MetaAccessProvider metaAccess, boolean positiveOnly, Graph graph) { ConstantNode[] hubs = new ConstantNode[hints.hints.length]; boolean[] isPositive = new boolean[hints.hints.length]; int index = 0; for (int i = 0; i < hubs.length; i++) { if (!positiveOnly || hints.hints[i].positive) { - hubs[index] = ConstantNode.forConstant(((HotSpotResolvedObjectType) hints.hints[i].type).klass(), runtime, graph); + hubs[index] = ConstantNode.forConstant(((HotSpotResolvedObjectType) hints.hints[i].type).klass(), metaAccess, graph); isPositive[index] = hints.hints[i].positive; index++; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -256,8 +256,8 @@ private final SnippetInfo[] arraycopySnippets; private final SnippetInfo genericPrimitiveSnippet; - public Templates(MetaAccessProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); arraycopySnippets = new SnippetInfo[Kind.values().length]; arraycopySnippets[Kind.Boolean.ordinal()] = snippet(UnsafeArrayCopySnippets.class, "arraycopyBoolean"); @@ -288,7 +288,7 @@ node.addSnippetArguments(args); SnippetTemplate template = template(args); - template.instantiate(runtime, node, DEFAULT_REPLACER, args); + template.instantiate(metaAccess, node, DEFAULT_REPLACER, args); } } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -26,6 +26,7 @@ import static com.oracle.graal.replacements.SnippetTemplate.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; @@ -52,15 +53,15 @@ private final SnippetInfo unsafeLoad = snippet(UnsafeLoadSnippets.class, "lowerUnsafeLoad"); - public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); } public void lower(UnsafeLoadNode load, @SuppressWarnings("unused") LoweringTool tool) { Arguments args = new Arguments(unsafeLoad, load.graph().getGuardsStage()); args.add("object", load.object()); args.add("offset", load.offset()); - template(args).instantiate(runtime, load, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, load, DEFAULT_REPLACER, args); } } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -336,8 +336,8 @@ private final SnippetInfo g1ArrayRangePreWriteBarrier = snippet(WriteBarrierSnippets.class, "g1ArrayRangePreWriteBarrier"); private final SnippetInfo g1ArrayRangePostWriteBarrier = snippet(WriteBarrierSnippets.class, "g1ArrayRangePostWriteBarrier"); - public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); } public void lower(SerialWriteBarrier writeBarrier, @SuppressWarnings("unused") LoweringTool tool) { @@ -346,7 +346,7 @@ args.add("location", writeBarrier.getLocation()); args.addConst("usePrecise", writeBarrier.usePrecise()); args.addConst("alwaysNull", ObjectStamp.isObjectAlwaysNull(writeBarrier.getValue())); - template(args).instantiate(runtime, writeBarrier, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, writeBarrier, DEFAULT_REPLACER, args); } public void lower(SerialArrayRangeWriteBarrier arrayRangeWriteBarrier, @SuppressWarnings("unused") LoweringTool tool) { @@ -354,7 +354,7 @@ args.add("object", arrayRangeWriteBarrier.getObject()); args.add("startIndex", arrayRangeWriteBarrier.getStartIndex()); args.add("length", arrayRangeWriteBarrier.getLength()); - template(args).instantiate(runtime, arrayRangeWriteBarrier, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, arrayRangeWriteBarrier, DEFAULT_REPLACER, args); } public void lower(G1PreWriteBarrier writeBarrierPre, @SuppressWarnings("unused") LoweringTool tool) { @@ -365,7 +365,7 @@ args.addConst("doLoad", writeBarrierPre.doLoad()); args.addConst("nullCheck", writeBarrierPre.getNullCheck()); args.addConst("trace", traceBarrier()); - template(args).instantiate(runtime, writeBarrierPre, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, writeBarrierPre, DEFAULT_REPLACER, args); } public void lower(G1ReferentFieldReadBarrier readBarrier, @SuppressWarnings("unused") LoweringTool tool) { @@ -376,7 +376,7 @@ args.addConst("doLoad", readBarrier.doLoad()); args.addConst("nullCheck", false); args.addConst("trace", traceBarrier()); - template(args).instantiate(runtime, readBarrier, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, readBarrier, DEFAULT_REPLACER, args); } public void lower(G1PostWriteBarrier writeBarrierPost, @SuppressWarnings("unused") LoweringTool tool) { @@ -387,7 +387,7 @@ args.addConst("usePrecise", writeBarrierPost.usePrecise()); args.addConst("alwaysNull", ObjectStamp.isObjectAlwaysNull(writeBarrierPost.getValue())); args.addConst("trace", traceBarrier()); - template(args).instantiate(runtime, writeBarrierPost, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, writeBarrierPost, DEFAULT_REPLACER, args); } public void lower(G1ArrayRangePreWriteBarrier arrayRangeWriteBarrier, @SuppressWarnings("unused") LoweringTool tool) { @@ -395,7 +395,7 @@ args.add("object", arrayRangeWriteBarrier.getObject()); args.add("startIndex", arrayRangeWriteBarrier.getStartIndex()); args.add("length", arrayRangeWriteBarrier.getLength()); - template(args).instantiate(runtime, arrayRangeWriteBarrier, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, arrayRangeWriteBarrier, DEFAULT_REPLACER, args); } public void lower(G1ArrayRangePostWriteBarrier arrayRangeWriteBarrier, @SuppressWarnings("unused") LoweringTool tool) { @@ -403,7 +403,7 @@ args.add("object", arrayRangeWriteBarrier.getObject()); args.add("startIndex", arrayRangeWriteBarrier.getStartIndex()); args.add("length", arrayRangeWriteBarrier.getLength()); - template(args).instantiate(runtime, arrayRangeWriteBarrier, DEFAULT_REPLACER, args); + template(args).instantiate(metaAccess, arrayRangeWriteBarrier, DEFAULT_REPLACER, args); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Thu Oct 10 17:07:11 2013 +0200 @@ -304,7 +304,7 @@ private void inline(InvokeNode invoke) { ResolvedJavaMethod method = ((MethodCallTargetNode) invoke.callTarget()).targetMethod(); - ReplacementsImpl repl = new ReplacementsImpl(runtime, new Assumptions(false), runtime.getTarget()); + ReplacementsImpl repl = new ReplacementsImpl(runtime, runtime, new Assumptions(false), runtime.getTarget()); StructuredGraph calleeGraph = repl.makeGraph(method, null, null, false); InliningUtil.inline(invoke, calleeGraph, false); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Thu Oct 10 17:07:11 2013 +0200 @@ -44,7 +44,7 @@ static class Template extends AbstractTemplates { Template(HotSpotRuntime runtime, Replacements replacements, TargetDescription target, Class declaringClass) { - super(runtime, replacements, target); + super(runtime, runtime, replacements, target); this.info = snippet(declaringClass, null); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Thu Oct 10 17:07:11 2013 +0200 @@ -156,8 +156,8 @@ phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); // The stub itself needs the incoming calling convention. CallingConvention incomingCc = linkage.getIncomingCallingConvention(); - final CompilationResult compResult = GraalCompiler.compileGraph(graph, incomingCc, getInstalledCodeOwner(), runtime, replacements, backend, runtime.getTarget(), null, phasePlan, - OptimisticOptimizations.ALL, new SpeculationLog(), runtime.getDefaultSuites(), new CompilationResult()); + final CompilationResult compResult = GraalCompiler.compileGraph(graph, incomingCc, getInstalledCodeOwner(), runtime, runtime, replacements, backend, runtime.getTarget(), null, + phasePlan, OptimisticOptimizations.ALL, new SpeculationLog(), runtime.getDefaultSuites(), new CompilationResult()); assert destroyedRegisters != null; code = Debug.scope("CodeInstall", new Callable() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/Test.java --- a/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/Test.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/Test.java Thu Oct 10 17:07:11 2013 +0200 @@ -27,7 +27,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.api.runtime.*; import com.oracle.graal.java.decompiler.test.example.*; -import com.oracle.graal.nodes.spi.*; import com.oracle.graal.printer.*; public class Test { @@ -39,9 +38,9 @@ */ public static void main(String[] args) throws NoSuchMethodException, SecurityException { DebugEnvironment.initialize(System.out); - GraalCodeCacheProvider runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class); + MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); Method method = Example.class.getDeclaredMethod("loop7", new Class[]{int.class, int.class}); - final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); + final ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(method); TestUtil.compileMethod(javaMethod); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java --- a/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java Thu Oct 10 17:07:11 2013 +0200 @@ -40,16 +40,18 @@ public class TestUtil { public static void compileMethod(ResolvedJavaMethod method) { - GraalCodeCacheProvider runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class); + MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); + GraalCodeCacheProvider codeCache = Graal.getRequiredCapability(GraalCodeCacheProvider.class); Replacements replacements = Graal.getRequiredCapability(Replacements.class); Suites suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); StructuredGraph graph = new StructuredGraph(method); - new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); + CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); Backend backend = Graal.getRequiredCapability(Backend.class); - GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime.getTarget(), null, phasePlan, OptimisticOptimizations.ALL, new SpeculationLog(), suites, new CompilationResult()); + GraalCompiler.compileGraph(graph, cc, method, metaAccess, codeCache, replacements, backend, codeCache.getTarget(), null, phasePlan, OptimisticOptimizations.ALL, new SpeculationLog(), + suites, new CompilationResult()); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -85,7 +85,7 @@ */ protected BlockPlaceholderNode placeholders; - private final MetaAccessProvider runtime; + private final MetaAccessProvider metaAccess; private ConstantPool constantPool; private ResolvedJavaMethod method; private int entryBCI; @@ -150,11 +150,11 @@ return currentGraph; } - public GraphBuilderPhase(MetaAccessProvider runtime, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts) { + public GraphBuilderPhase(MetaAccessProvider metaAccess, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts) { this.graphBuilderConfig = graphBuilderConfig; this.optimisticOpts = optimisticOpts; - this.runtime = runtime; - assert runtime != null; + this.metaAccess = metaAccess; + assert metaAccess != null; } @Override @@ -435,7 +435,7 @@ DispatchBeginNode dispatchBegin; if (exceptionObject == null) { - dispatchBegin = currentGraph.add(new ExceptionObjectNode(runtime)); + dispatchBegin = currentGraph.add(new ExceptionObjectNode(metaAccess)); dispatchState.apush(dispatchBegin); dispatchState.setRethrowException(true); dispatchBegin.setStateAfter(dispatchState.create(bci)); @@ -894,7 +894,7 @@ private void genNewPrimitiveArray(int typeCode) { Class clazz = arrayTypeCodeToClass(typeCode); - ResolvedJavaType elementType = runtime.lookupJavaType(clazz); + ResolvedJavaType elementType = metaAccess.lookupJavaType(clazz); frameState.apush(append(new NewArrayNode(elementType, frameState.ipop(), true))); } @@ -956,10 +956,10 @@ lastInstr = falseSucc; if (OmitHotExceptionStacktrace.getValue()) { - ValueNode exception = ConstantNode.forObject(cachedNullPointerException, runtime, currentGraph); + ValueNode exception = ConstantNode.forObject(cachedNullPointerException, metaAccess, currentGraph); trueSucc.setNext(handleException(exception, bci())); } else { - ForeignCallNode call = currentGraph.add(new ForeignCallNode(runtime, CREATE_NULL_POINTER_EXCEPTION)); + ForeignCallNode call = currentGraph.add(new ForeignCallNode(metaAccess, CREATE_NULL_POINTER_EXCEPTION)); call.setStateAfter(frameState.create(bci())); trueSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -980,10 +980,10 @@ lastInstr = trueSucc; if (OmitHotExceptionStacktrace.getValue()) { - ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, runtime, currentGraph); + ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, metaAccess, currentGraph); falseSucc.setNext(handleException(exception, bci())); } else { - ForeignCallNode call = currentGraph.add(new ForeignCallNode(runtime, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); + ForeignCallNode call = currentGraph.add(new ForeignCallNode(metaAccess, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); call.setStateAfter(frameState.create(bci())); falseSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -1081,7 +1081,7 @@ if (target instanceof ResolvedJavaMethod) { Object appendix = constantPool.lookupAppendix(stream.readCPI4(), Bytecodes.INVOKEDYNAMIC); if (appendix != null) { - frameState.apush(ConstantNode.forObject(appendix, runtime, currentGraph)); + frameState.apush(ConstantNode.forObject(appendix, metaAccess, currentGraph)); } ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(false), target.getSignature().getParameterCount(false)); appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); @@ -1098,7 +1098,7 @@ boolean hasReceiver = !isStatic(((ResolvedJavaMethod) target).getModifiers()); Object appendix = constantPool.lookupAppendix(stream.readCPI(), Bytecodes.INVOKEVIRTUAL); if (appendix != null) { - frameState.apush(ConstantNode.forObject(appendix, runtime, currentGraph)); + frameState.apush(ConstantNode.forObject(appendix, metaAccess, currentGraph)); } ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(hasReceiver), target.getSignature().getParameterCount(hasReceiver)); if (hasReceiver) { @@ -1351,7 +1351,7 @@ protected ConstantNode appendConstant(Constant constant) { assert constant != null; - return ConstantNode.forConstant(constant, runtime, currentGraph); + return ConstantNode.forConstant(constant, metaAccess, currentGraph); } private T append(T fixed) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -44,30 +44,30 @@ */ public class VerifyOptionsPhase extends Phase { - public static boolean checkOptions(MetaAccessProvider runtime) { + public static boolean checkOptions(MetaAccessProvider metaAccess) { ServiceLoader sl = ServiceLoader.loadInstalled(Options.class); Set checked = new HashSet<>(); for (Options opts : sl) { for (OptionDescriptor desc : opts) { - ResolvedJavaType holder = runtime.lookupJavaType(desc.getDeclaringClass()); - checkType(holder, desc, runtime, checked); + ResolvedJavaType holder = metaAccess.lookupJavaType(desc.getDeclaringClass()); + checkType(holder, desc, metaAccess, checked); } } return true; } - private static void checkType(ResolvedJavaType type, OptionDescriptor option, MetaAccessProvider runtime, Set checked) { + private static void checkType(ResolvedJavaType type, OptionDescriptor option, MetaAccessProvider metaAccess, Set checked) { if (!checked.contains(type)) { checked.add(type); ResolvedJavaType superType = type.getSuperclass(); if (superType != null && !MetaUtil.isJavaLangObject(superType)) { - checkType(superType, option, runtime, checked); + checkType(superType, option, metaAccess, checked); } for (ResolvedJavaMethod method : type.getDeclaredMethods()) { if (method.isClassInitializer()) { StructuredGraph graph = new StructuredGraph(method); - new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); - new VerifyOptionsPhase(type, runtime, option).apply(graph); + new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new VerifyOptionsPhase(type, metaAccess, option).apply(graph); } } } @@ -79,14 +79,14 @@ private final Set boxingTypes; private final OptionDescriptor option; - public VerifyOptionsPhase(ResolvedJavaType declaringClass, MetaAccessProvider runtime, OptionDescriptor option) { - this.runtime = runtime; + public VerifyOptionsPhase(ResolvedJavaType declaringClass, MetaAccessProvider metaAccess, OptionDescriptor option) { + this.runtime = metaAccess; this.declaringClass = declaringClass; - this.optionValueType = runtime.lookupJavaType(OptionValue.class); + this.optionValueType = metaAccess.lookupJavaType(OptionValue.class); this.option = option; this.boxingTypes = new HashSet<>(); for (Class c : new Class[]{Boolean.class, Byte.class, Short.class, Character.class, Integer.class, Float.class, Long.class, Double.class}) { - this.boxingTypes.add(runtime.lookupJavaType(c)); + this.boxingTypes.add(metaAccess.lookupJavaType(c)); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -50,7 +50,7 @@ Object[] argsToBind; public JTTTest() { - Assert.assertNotNull(runtime); + Assert.assertNotNull(getCodeCache()); } @Override @@ -59,12 +59,12 @@ if (argsToBind != null) { Object receiver = isStatic(m.getModifiers()) ? null : this; Object[] args = argsWithReceiver(receiver, argsToBind); - JavaType[] parameterTypes = signatureToTypes(runtime.lookupJavaMethod(m)); + JavaType[] parameterTypes = signatureToTypes(getMetaAccess().lookupJavaMethod(m)); assert parameterTypes.length == args.length; for (int i = 0; i < args.length; i++) { LocalNode local = graph.getLocal(i); Constant c = Constant.forBoxed(parameterTypes[i].getKind(), args[i]); - ConstantNode replacement = ConstantNode.forConstant(c, runtime, graph); + ConstantNode replacement = ConstantNode.forConstant(c, getMetaAccess(), graph); local.replaceAtUsages(replacement); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Thu Oct 10 17:07:11 2013 +0200 @@ -153,7 +153,7 @@ if (key.getKind() == Kind.Int) { Register intKey = asIntReg(key); for (int i = 0; i < keyConstants.length; i++) { - if (tasm.runtime.needsDataPatch(keyConstants[i])) { + if (tasm.codeCache.needsDataPatch(keyConstants[i])) { tasm.recordDataReferenceInCode(keyConstants[i], 0, true); } long lc = keyConstants[i].asLong(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Thu Oct 10 17:07:11 2013 +0200 @@ -28,12 +28,12 @@ /** * AMD64 specific frame map. - * + * * This is the format of an AMD64 stack frame: - * + * *
  *   Base       Contents
- *
+ * 
  *            :                                :  -----
  *   caller   | incoming overflow argument n   |    ^
  *   frame    :     ...                        :    | positive
@@ -55,9 +55,9 @@
  *            :     ...                        :    | positive   |      |
  *            | outgoing overflow argument 0   |    | offsets    v      v
  *    %sp-->  +--------------------------------+---------------------------
- *
+ * 
  * 
- * + * * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size of such * a block may be greater than the size of a normal spill slot or the word size. *

@@ -69,8 +69,8 @@ */ public class AMD64FrameMap extends FrameMap { - public AMD64FrameMap(CodeCacheProvider runtime, TargetDescription target, RegisterConfig registerConfig) { - super(runtime, target, registerConfig); + public AMD64FrameMap(CodeCacheProvider codeCache, TargetDescription target, RegisterConfig registerConfig) { + super(codeCache, target, registerConfig); // (negative) offset relative to sp + total frame size initialSpillSize = returnAddressSize() + calleeSaveAreaSize(); spillSize = initialSpillSize; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Oct 10 17:07:11 2013 +0200 @@ -441,7 +441,7 @@ */ switch (input.getKind().getStackKind()) { case Int: - if (tasm.runtime.needsDataPatch(input)) { + if (tasm.codeCache.needsDataPatch(input)) { tasm.recordDataReferenceInCode(input, 0, true); } // Do not optimize with an XOR as this instruction may be between @@ -451,7 +451,7 @@ break; case Long: - if (tasm.runtime.needsDataPatch(input)) { + if (tasm.codeCache.needsDataPatch(input)) { tasm.recordDataReferenceInCode(input, 0, true); } // Do not optimize with an XOR as this instruction may be between @@ -462,7 +462,7 @@ case Float: // This is *not* the same as 'constant == 0.0f' in the case where constant is -0.0f if (Float.floatToRawIntBits(input.asFloat()) == Float.floatToRawIntBits(0.0f)) { - assert !tasm.runtime.needsDataPatch(input); + assert !tasm.codeCache.needsDataPatch(input); masm.xorps(asFloatReg(result), asFloatReg(result)); } else { masm.movflt(asFloatReg(result), (AMD64Address) tasm.asFloatConstRef(input)); @@ -471,7 +471,7 @@ case Double: // This is *not* the same as 'constant == 0.0d' in the case where constant is -0.0d if (Double.doubleToRawLongBits(input.asDouble()) == Double.doubleToRawLongBits(0.0d)) { - assert !tasm.runtime.needsDataPatch(input); + assert !tasm.codeCache.needsDataPatch(input); masm.xorpd(asDoubleReg(result), asDoubleReg(result)); } else { masm.movdbl(asDoubleReg(result), (AMD64Address) tasm.asDoubleConstRef(input)); @@ -496,7 +496,7 @@ } private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Value result, Constant input) { - assert !tasm.runtime.needsDataPatch(input); + assert !tasm.codeCache.needsDataPatch(input); AMD64Address dest = (AMD64Address) tasm.asAddress(result); switch (input.getKind().getStackKind()) { case Int: diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.hsail/src/com/oracle/graal/lir/hsail/HSAILFrameMap.java --- a/graal/com.oracle.graal.lir.hsail/src/com/oracle/graal/lir/hsail/HSAILFrameMap.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.hsail/src/com/oracle/graal/lir/hsail/HSAILFrameMap.java Thu Oct 10 17:07:11 2013 +0200 @@ -37,8 +37,8 @@ */ public final class HSAILFrameMap extends FrameMap { - public HSAILFrameMap(CodeCacheProvider runtime, TargetDescription target, RegisterConfig registerConfig) { - super(runtime, target, registerConfig); + public HSAILFrameMap(CodeCacheProvider codeCache, TargetDescription target, RegisterConfig registerConfig) { + super(codeCache, target, registerConfig); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXControlFlow.java --- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXControlFlow.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXControlFlow.java Thu Oct 10 17:07:11 2013 +0200 @@ -222,7 +222,7 @@ if (keyKind == Kind.Int || keyKind == Kind.Long) { for (int i = 0; i < keyConstants.length; i++) { - if (tasm.runtime.needsDataPatch(keyConstants[i])) { + if (tasm.codeCache.needsDataPatch(keyConstants[i])) { tasm.recordDataReferenceInCode(keyConstants[i], 0, true); } new Setp(EQ, keyConstants[i], key, predRegNum).emit(masm); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXFrameMap.java --- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXFrameMap.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXFrameMap.java Thu Oct 10 17:07:11 2013 +0200 @@ -37,8 +37,8 @@ */ public final class PTXFrameMap extends FrameMap { - public PTXFrameMap(CodeCacheProvider runtime, TargetDescription target, RegisterConfig registerConfig) { - super(runtime, target, registerConfig); + public PTXFrameMap(CodeCacheProvider codeCache, TargetDescription target, RegisterConfig registerConfig) { + super(codeCache, target, registerConfig); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java --- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java Thu Oct 10 17:07:11 2013 +0200 @@ -215,7 +215,7 @@ switch (input.getKind().getStackKind()) { case Int: case Long: - if (tasm.runtime.needsDataPatch(input)) { + if (tasm.codeCache.needsDataPatch(input)) { tasm.recordDataReferenceInCode(input, 0, true); } new Mov(dest, input).emit(masm); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Thu Oct 10 17:07:11 2013 +0200 @@ -279,7 +279,7 @@ if (key.getKind() == Kind.Int) { Register intKey = asIntReg(key); for (int i = 0; i < keyConstants.length; i++) { - if (tasm.runtime.needsDataPatch(keyConstants[i])) { + if (tasm.codeCache.needsDataPatch(keyConstants[i])) { tasm.recordDataReferenceInCode(keyConstants[i], 0, true); } long lc = keyConstants[i].asLong(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java Thu Oct 10 17:07:11 2013 +0200 @@ -69,8 +69,8 @@ */ public final class SPARCFrameMap extends FrameMap { - public SPARCFrameMap(CodeCacheProvider runtime, TargetDescription target, RegisterConfig registerConfig) { - super(runtime, target, registerConfig); + public SPARCFrameMap(CodeCacheProvider codeCache, TargetDescription target, RegisterConfig registerConfig) { + super(codeCache, target, registerConfig); // offset relative to sp + total frame size initialSpillSize = 0; spillSize = initialSpillSize; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Oct 10 17:07:11 2013 +0200 @@ -413,7 +413,7 @@ private static void const2reg(TargetMethodAssembler tasm, SPARCMacroAssembler masm, Value result, Constant input) { switch (input.getKind().getStackKind()) { case Int: - if (tasm.runtime.needsDataPatch(input)) { + if (tasm.codeCache.needsDataPatch(input)) { tasm.recordDataReferenceInCode(input, 0, true); new Setuw(input.asInt(), asRegister(result)).emit(masm); } else { @@ -425,7 +425,7 @@ } break; case Long: { - if (tasm.runtime.needsDataPatch(input)) { + if (tasm.codeCache.needsDataPatch(input)) { tasm.recordDataReferenceInCode(input, 0, true); new Setx(input.asLong(), asRegister(result), true).emit(masm); } else { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Thu Oct 10 17:07:11 2013 +0200 @@ -40,7 +40,6 @@ */ public abstract class FrameMap { - public final CodeCacheProvider runtime; public final TargetDescription target; public final RegisterConfig registerConfig; @@ -87,12 +86,11 @@ /** * Creates a new frame map for the specified method. */ - public FrameMap(CodeCacheProvider runtime, TargetDescription target, RegisterConfig registerConfig) { - this.runtime = runtime; + public FrameMap(CodeCacheProvider codeCache, TargetDescription target, RegisterConfig registerConfig) { this.target = target; this.registerConfig = registerConfig; this.frameSize = -1; - this.outgoingSize = runtime.getMinimumOutgoingSize(); + this.outgoingSize = codeCache.getMinimumOutgoingSize(); this.objectStackBlocks = new ArrayList<>(); } @@ -116,7 +114,7 @@ /** * Gets the frame size of the compiled frame, not including the size of the * {@link Architecture#getReturnAddressSize() return address slot}. - * + * * @return The size of the frame (in bytes). */ public int frameSize() { @@ -136,7 +134,7 @@ /** * Gets the total frame size of the compiled frame, including the size of the * {@link Architecture#getReturnAddressSize() return address slot}. - * + * * @return The total size of the frame (in bytes). */ public abstract int totalFrameSize(); @@ -149,7 +147,7 @@ /** * Aligns the given frame size to the stack alignment size and return the aligned size. - * + * * @param size the initial frame size to be aligned * @return the aligned frame size */ @@ -181,7 +179,7 @@ /** * Computes the offset of a stack slot relative to the frame register. - * + * * @param slot a stack slot * @return the offset of the stack slot */ @@ -197,7 +195,7 @@ /** * Computes the index of a stack slot relative to slot 0. This is also the bit index of stack * slots in the reference map. - * + * * @param slot a stack slot * @return the index of the stack slot */ @@ -209,7 +207,7 @@ /** * Gets the offset from the stack pointer to the stack area where callee-saved registers are * stored. - * + * * @return The offset to the callee save area (in bytes). */ public abstract int offsetToCalleeSaveArea(); @@ -217,7 +215,7 @@ /** * Informs the frame map that the compiled code calls a particular method, which may need stack * space for outgoing arguments. - * + * * @param cc The calling convention for the called method. */ public void callsMethod(CallingConvention cc) { @@ -226,7 +224,7 @@ /** * Reserves space for stack-based outgoing arguments. - * + * * @param argsSize The amount of space (in bytes) to reserve for stack-based outgoing arguments. */ public void reserveOutgoing(int argsSize) { @@ -239,7 +237,7 @@ * Reserves a new spill slot in the frame of the method being compiled. The returned slot is * aligned on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte * boundary. - * + * * @param kind The kind of the spill slot to be reserved. * @param additionalOffset * @return A spill slot denoting the reserved memory area. @@ -247,8 +245,9 @@ protected abstract StackSlot allocateNewSpillSlot(PlatformKind kind, int additionalOffset); /** - * Returns the spill slot size for the given {@link PlatformKind}. - * The default value is the size in bytes for the target architecture. + * Returns the spill slot size for the given {@link PlatformKind}. The default value is the size + * in bytes for the target architecture. + * * @param kind the {@link PlatformKind} to be stored in the spill slot. * @return the size in bytes */ @@ -258,9 +257,9 @@ /** * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned - * on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary, - * unless overridden by a subclass. - * + * on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary, unless + * overridden by a subclass. + * * @param kind The kind of the spill slot to be reserved. * @return A spill slot denoting the reserved memory area. */ @@ -299,7 +298,7 @@ /** * Reserves a block of memory in the frame of the method being compiled. The returned block is * aligned on a word boundary. If the requested size is 0, the method returns {@code null}. - * + * * @param size The size to reserve (in bytes). * @param refs Specifies if the block is all references. If true, the block will be in all * reference maps for this method. The caller is responsible to initialize the memory @@ -351,7 +350,7 @@ * Marks the specified location as a reference in the reference map of the debug information. * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a * {@link Constant} is automatically tracked. - * + * * @param location The location to be added to the reference map. * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}. diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,7 +51,7 @@ public final AbstractAssembler asm; public final CompilationResult compilationResult; public final TargetDescription target; - public final CodeCacheProvider runtime; + public final CodeCacheProvider codeCache; public final FrameMap frameMap; /** @@ -62,9 +62,9 @@ private List exceptionInfoList; - public TargetMethodAssembler(TargetDescription target, CodeCacheProvider runtime, FrameMap frameMap, AbstractAssembler asm, FrameContext frameContext, CompilationResult compilationResult) { + public TargetMethodAssembler(TargetDescription target, CodeCacheProvider codeCache, FrameMap frameMap, AbstractAssembler asm, FrameContext frameContext, CompilationResult compilationResult) { this.target = target; - this.runtime = runtime; + this.codeCache = codeCache; this.frameMap = frameMap; this.asm = asm; this.compilationResult = compilationResult; @@ -185,7 +185,7 @@ public int asIntConst(Value value) { assert (value.getKind().getStackKind() == Kind.Int || value.getKind() == Kind.Long) && isConstant(value); Constant constant = (Constant) value; - assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch"; + assert !codeCache.needsDataPatch(constant) : constant + " should be in a DataPatch"; long c = constant.asLong(); if (!NumUtil.isInt(c)) { throw GraalInternalError.shouldNotReachHere(); @@ -199,7 +199,7 @@ public float asFloatConst(Value value) { assert (value.getKind().getStackKind() == Kind.Float && isConstant(value)); Constant constant = (Constant) value; - assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch"; + assert !codeCache.needsDataPatch(constant) : constant + " should be in a DataPatch"; return constant.asFloat(); } @@ -209,7 +209,7 @@ public long asLongConst(Value value) { assert (value.getKind().getStackKind() == Kind.Long && isConstant(value)); Constant constant = (Constant) value; - assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch"; + assert !codeCache.needsDataPatch(constant) : constant + " should be in a DataPatch"; return constant.asLong(); } @@ -219,7 +219,7 @@ public double asDoubleConst(Value value) { assert (value.getKind().getStackKind() == Kind.Double && isConstant(value)); Constant constant = (Constant) value; - assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch"; + assert !codeCache.needsDataPatch(constant) : constant + " should be in a DataPatch"; return constant.asDouble(); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampJoinTest.java --- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampJoinTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampJoinTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -151,6 +151,6 @@ } private ResolvedJavaType getType(Class clazz) { - return runtime().lookupJavaType(clazz); + return getMetaAccess().lookupJavaType(clazz); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -62,5 +62,5 @@ return deoptState; } - public abstract ValueNode getActionAndReason(MetaAccessProvider runtime); + public abstract ValueNode getActionAndReason(MetaAccessProvider metaAccess); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -49,8 +49,8 @@ * * @param value the constant */ - protected ConstantNode(Constant value, MetaAccessProvider runtime) { - super(StampFactory.forConstant(value, runtime)); + protected ConstantNode(Constant value, MetaAccessProvider metaAccess) { + super(StampFactory.forConstant(value, metaAccess)); this.value = value; } @@ -74,9 +74,9 @@ return true; } - public static ConstantNode forConstant(Constant constant, MetaAccessProvider runtime, Graph graph) { + public static ConstantNode forConstant(Constant constant, MetaAccessProvider metaAccess, Graph graph) { if (constant.getKind() == Kind.Object) { - return graph.unique(new ConstantNode(constant, runtime)); + return graph.unique(new ConstantNode(constant, metaAccess)); } else { return graph.unique(new ConstantNode(constant)); } @@ -185,9 +185,9 @@ * @param graph * @return a node representing the object */ - public static ConstantNode forObject(Object o, MetaAccessProvider runtime, Graph graph) { + public static ConstantNode forObject(Object o, MetaAccessProvider metaAccess, Graph graph) { assert !(o instanceof Constant) : "wrapping a Constant into a Constant"; - return graph.unique(new ConstantNode(Constant.forObject(o), runtime)); + return graph.unique(new ConstantNode(Constant.forObject(o), metaAccess)); } public static ConstantNode forIntegerKind(Kind kind, long value, Graph graph) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -47,12 +47,12 @@ @Override public void generate(LIRGeneratorTool gen) { - gen.emitDeoptimize(gen.getRuntime().encodeDeoptActionAndReason(action, reason), this); + gen.emitDeoptimize(gen.getMetaAccess().encodeDeoptActionAndReason(action, reason), this); } @Override - public ValueNode getActionAndReason(MetaAccessProvider runtime) { - return ConstantNode.forConstant(runtime.encodeDeoptActionAndReason(action, reason), runtime, graph()); + public ValueNode getActionAndReason(MetaAccessProvider metaAccess) { + return ConstantNode.forConstant(metaAccess.encodeDeoptActionAndReason(action, reason), metaAccess, graph()); } @NodeIntrinsic diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -37,7 +37,7 @@ } @Override - public ValueNode getActionAndReason(MetaAccessProvider runtime) { + public ValueNode getActionAndReason(MetaAccessProvider metaAccess) { return getActionAndReason(); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -183,7 +183,7 @@ if (this.trueSuccessorProbability < probabilityB) { // Reordering of those two if statements is beneficial from the point of view of // their probabilities. - if (prepareForSwap(tool.runtime(), condition(), nextIf.condition(), this.trueSuccessorProbability, probabilityB)) { + if (prepareForSwap(tool.getMetaAccess(), condition(), nextIf.condition(), this.trueSuccessorProbability, probabilityB)) { // Reording is allowed from (if1 => begin => if2) to (if2 => begin => if1). assert intermediateBegin.next() == nextIf; AbstractBeginNode bothFalseBegin = nextIf.falseSuccessor(); @@ -208,7 +208,7 @@ } } - private static boolean prepareForSwap(MetaAccessProvider runtime, LogicNode a, LogicNode b, double probabilityA, double probabilityB) { + private static boolean prepareForSwap(MetaAccessProvider metaAccess, LogicNode a, LogicNode b, double probabilityA, double probabilityB) { if (a instanceof InstanceOfNode) { InstanceOfNode instanceOfA = (InstanceOfNode) a; if (b instanceof IsNullNode) { @@ -297,13 +297,13 @@ } } else if (conditionA == Condition.EQ && conditionB == Condition.EQ) { boolean canSwap = false; - if ((compareA.x() == compareB.x() && valuesDistinct(runtime, compareA.y(), compareB.y()))) { + if ((compareA.x() == compareB.x() && valuesDistinct(metaAccess, compareA.y(), compareB.y()))) { canSwap = true; - } else if ((compareA.x() == compareB.y() && valuesDistinct(runtime, compareA.y(), compareB.x()))) { + } else if ((compareA.x() == compareB.y() && valuesDistinct(metaAccess, compareA.y(), compareB.x()))) { canSwap = true; - } else if ((compareA.y() == compareB.x() && valuesDistinct(runtime, compareA.x(), compareB.y()))) { + } else if ((compareA.y() == compareB.x() && valuesDistinct(metaAccess, compareA.x(), compareB.y()))) { canSwap = true; - } else if ((compareA.y() == compareB.y() && valuesDistinct(runtime, compareA.x(), compareB.x()))) { + } else if ((compareA.y() == compareB.y() && valuesDistinct(metaAccess, compareA.x(), compareB.x()))) { canSwap = true; } @@ -318,9 +318,9 @@ return false; } - private static boolean valuesDistinct(MetaAccessProvider runtime, ValueNode a, ValueNode b) { + private static boolean valuesDistinct(MetaAccessProvider metaAccess, ValueNode a, ValueNode b) { if (a.isConstant() && b.isConstant()) { - return !runtime.constantEquals(a.asConstant(), b.asConstant()); + return !metaAccess.constantEquals(a.asConstant(), b.asConstant()); } Stamp stampA = a.stamp(); @@ -487,7 +487,7 @@ for (int i = 0; i < xs.length; i++) { AbstractEndNode end = ends.next(); phiValues.put(end, phi.valueAt(end)); - if (compare.condition().foldCondition(xs[i], ys[i], tool.runtime(), compare.unorderedIsTrue())) { + if (compare.condition().foldCondition(xs[i], ys[i], tool.getMetaAccess(), compare.unorderedIsTrue())) { trueEnds.add(end); } else { falseEnds.add(end); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -109,7 +109,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -129,7 +129,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -77,13 +77,13 @@ public void generate(LIRGeneratorTool gen) { } - private LogicNode optimizeConditional(Constant constant, ConditionalNode conditionalNode, MetaAccessProvider runtime, Condition cond) { + private LogicNode optimizeConditional(Constant constant, ConditionalNode conditionalNode, MetaAccessProvider metaAccess, Condition cond) { Constant trueConstant = conditionalNode.trueValue().asConstant(); Constant falseConstant = conditionalNode.falseValue().asConstant(); - if (falseConstant != null && trueConstant != null && runtime != null) { - boolean trueResult = cond.foldCondition(trueConstant, constant, runtime, unorderedIsTrue()); - boolean falseResult = cond.foldCondition(falseConstant, constant, runtime, unorderedIsTrue()); + if (falseConstant != null && trueConstant != null && metaAccess != null) { + boolean trueResult = cond.foldCondition(trueConstant, constant, metaAccess, unorderedIsTrue()); + boolean falseResult = cond.foldCondition(falseConstant, constant, metaAccess, unorderedIsTrue()); if (trueResult == falseResult) { return LogicConstantNode.forBoolean(trueResult, graph()); @@ -117,18 +117,18 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (x().isConstant() && y().isConstant() && tool.runtime() != null) { - return LogicConstantNode.forBoolean(condition().foldCondition(x().asConstant(), y().asConstant(), tool.runtime(), unorderedIsTrue()), graph()); + if (x().isConstant() && y().isConstant() && tool.getMetaAccess() != null) { + return LogicConstantNode.forBoolean(condition().foldCondition(x().asConstant(), y().asConstant(), tool.getMetaAccess(), unorderedIsTrue()), graph()); } if (x().isConstant()) { if (y() instanceof ConditionalNode) { - return optimizeConditional(x().asConstant(), (ConditionalNode) y(), tool.runtime(), condition().mirror()); + return optimizeConditional(x().asConstant(), (ConditionalNode) y(), tool.getMetaAccess(), condition().mirror()); } else if (y() instanceof NormalizeCompareNode) { return optimizeNormalizeCmp(x().asConstant(), (NormalizeCompareNode) y(), true); } } else if (y().isConstant()) { if (x() instanceof ConditionalNode) { - return optimizeConditional(y().asConstant(), (ConditionalNode) x(), tool.runtime(), condition()); + return optimizeConditional(y().asConstant(), (ConditionalNode) x(), tool.getMetaAccess(), condition()); } else if (x() instanceof NormalizeCompareNode) { return optimizeNormalizeCmp(y().asConstant(), (NormalizeCompareNode) x(), false); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Thu Oct 10 17:07:11 2013 +0200 @@ -317,13 +317,13 @@ * * @param lt the constant on the left side of the comparison * @param rt the constant on the right side of the comparison - * @param runtime needed to compare runtime-specific types + * @param metaAccess needed to compare runtime-specific types * @return {@link Boolean#TRUE} if the comparison is known to be true, {@link Boolean#FALSE} if * the comparison is known to be false */ - public boolean foldCondition(Constant lt, Constant rt, CodeCacheProvider runtime) { + public boolean foldCondition(Constant lt, Constant rt, MetaAccessProvider metaAccess) { assert lt.getKind() != Kind.Double && lt.getKind() != Kind.Float && rt.getKind() != Kind.Double && rt.getKind() != Kind.Float; - return foldCondition(lt, rt, runtime, false); + return foldCondition(lt, rt, metaAccess, false); } /** @@ -331,12 +331,12 @@ * * @param lt the constant on the left side of the comparison * @param rt the constant on the right side of the comparison - * @param runtime needed to compare runtime-specific types + * @param metaAccess needed to compare runtime-specific types * @param unorderedIsTrue true if an undecided float comparison should result in "true" * @return true if the comparison is known to be true, false if the comparison is known to be * false */ - public boolean foldCondition(Constant lt, Constant rt, MetaAccessProvider runtime, boolean unorderedIsTrue) { + public boolean foldCondition(Constant lt, Constant rt, MetaAccessProvider metaAccess, boolean unorderedIsTrue) { switch (lt.getKind()) { case Boolean: case Byte: @@ -401,9 +401,9 @@ case Object: { switch (this) { case EQ: - return runtime.constantEquals(lt, rt); + return metaAccess.constantEquals(lt, rt); case NE: - return !runtime.constantEquals(lt, rt); + return !metaAccess.constantEquals(lt, rt); default: throw new GraalInternalError("expected condition: %s", this); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -244,7 +244,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -112,7 +112,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -63,7 +63,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -64,7 +64,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -63,7 +63,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -68,7 +68,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } public static void addCounterBefore(String group, String name, long increment, boolean withContext, FixedNode position) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -56,7 +56,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -36,28 +36,28 @@ public class ForeignCallNode extends AbstractStateSplit implements LIRLowerable, DeoptimizingNode, MemoryCheckpoint.Multi { @Input private final NodeInputList arguments; - private final MetaAccessProvider runtime; + private final MetaAccessProvider metaAccess; @Input private FrameState deoptState; private final ForeignCallDescriptor descriptor; - public ForeignCallNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, ValueNode... arguments) { + public ForeignCallNode(MetaAccessProvider metaAccess, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; - this.runtime = runtime; + this.metaAccess = metaAccess; } - protected ForeignCallNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, Stamp stamp) { + protected ForeignCallNode(MetaAccessProvider metaAccess, ForeignCallDescriptor descriptor, Stamp stamp) { super(stamp); this.arguments = new NodeInputList<>(this); this.descriptor = descriptor; - this.runtime = runtime; + this.metaAccess = metaAccess; } @Override public boolean hasSideEffect() { - return !runtime.isReexecutable(descriptor); + return !metaAccess.isReexecutable(descriptor); } public ForeignCallDescriptor getDescriptor() { @@ -66,7 +66,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return runtime.getKilledLocations(descriptor); + return metaAccess.getKilledLocations(descriptor); } protected Value[] operands(LIRGeneratorTool gen) { @@ -79,7 +79,7 @@ @Override public void generate(LIRGeneratorTool gen) { - ForeignCallLinkage linkage = gen.getRuntime().lookupForeignCall(descriptor); + ForeignCallLinkage linkage = gen.getCodeCache().lookupForeignCall(descriptor); Value[] operands = operands(gen); Value result = gen.emitForeignCall(linkage, this, operands); if (result != null) { @@ -126,7 +126,7 @@ @Override public boolean canDeoptimize() { - return runtime.canDeoptimize(descriptor); + return metaAccess.canDeoptimize(descriptor); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -62,14 +62,14 @@ @Override public void lower(LoweringTool tool) { if (graph().getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } } @Override public Node canonical(CanonicalizerTool tool) { - MetaAccessProvider runtime = tool.runtime(); - if (runtime != null && object.stamp() instanceof ObjectStamp) { + MetaAccessProvider metaAccess = tool.getMetaAccess(); + if (metaAccess != null && object.stamp() instanceof ObjectStamp) { ObjectStamp stamp = (ObjectStamp) object.stamp(); ResolvedJavaType exactType; @@ -85,7 +85,7 @@ } if (exactType != null) { - return ConstantNode.forConstant(exactType.getEncoding(Representation.ObjectHub), runtime, graph()); + return ConstantNode.forConstant(exactType.getEncoding(Representation.ObjectHub), metaAccess, graph()); } } return this; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -52,7 +52,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } public ResolvedJavaMethod getMethod() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -30,7 +30,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } public NodeIterable getOSRLocals() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -60,29 +60,29 @@ } public static ValueNode canonicalizeRead(ValueNode read, LocationNode location, ValueNode object, CanonicalizerTool tool, boolean compressible) { - MetaAccessProvider runtime = tool.runtime(); + MetaAccessProvider metaAccess = tool.getMetaAccess(); if (read.usages().isEmpty()) { // Read without usages can be savely removed. return null; } - if (tool.canonicalizeReads() && runtime != null && object != null && object.isConstant()) { + if (tool.canonicalizeReads() && metaAccess != null && object != null && object.isConstant()) { if (location.getLocationIdentity() == LocationIdentity.FINAL_LOCATION && location instanceof ConstantLocationNode) { long displacement = ((ConstantLocationNode) location).getDisplacement(); Kind kind = location.getValueKind(); if (object.kind() == Kind.Object) { Object base = object.asConstant().asObject(); if (base != null) { - Constant constant = tool.runtime().readUnsafeConstant(kind, base, displacement, compressible); + Constant constant = tool.getMetaAccess().readUnsafeConstant(kind, base, displacement, compressible); if (constant != null) { - return ConstantNode.forConstant(constant, runtime, read.graph()); + return ConstantNode.forConstant(constant, metaAccess, read.graph()); } } } else if (object.kind() == Kind.Long || object.kind().getStackKind() == Kind.Int) { long base = object.asConstant().asLong(); if (base != 0L) { - Constant constant = tool.runtime().readUnsafeConstant(kind, null, base + displacement, compressible); + Constant constant = tool.getMetaAccess().readUnsafeConstant(kind, null, base + displacement, compressible); if (constant != null) { - return ConstantNode.forConstant(constant, runtime, read.graph()); + return ConstantNode.forConstant(constant, metaAccess, read.graph()); } } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -47,7 +47,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @NodeIntrinsic diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,7 +51,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -52,7 +52,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -69,7 +69,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -89,7 +89,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -84,7 +84,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -65,6 +65,6 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -47,7 +47,7 @@ @Override public Node canonical(CanonicalizerTool tool) { - ValueNode length = readArrayLength(array(), tool.runtime()); + ValueNode length = readArrayLength(array(), tool.getMetaAccess()); if (length != null) { return length; } @@ -60,17 +60,17 @@ * @param array an array * @return a node representing the length of {@code array} or null if it is not available */ - public static ValueNode readArrayLength(ValueNode array, MetaAccessProvider runtime) { + public static ValueNode readArrayLength(ValueNode array, MetaAccessProvider metaAccess) { if (array instanceof ArrayLengthProvider) { ValueNode length = ((ArrayLengthProvider) array).length(); if (length != null) { return length; } } - if (runtime != null && array.isConstant() && !array.isNullConstant()) { + if (metaAccess != null && array.isConstant() && !array.isNullConstant()) { Constant constantValue = array.asConstant(); if (constantValue != null && constantValue.isNonNull()) { - Integer constantLength = runtime.lookupArrayLength(constantValue); + Integer constantLength = metaAccess.lookupArrayLength(constantValue); if (constantLength != null) { return ConstantNode.forInt(constantLength, array.graph()); } @@ -81,7 +81,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @NodeIntrinsic diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -61,7 +61,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override @@ -78,7 +78,7 @@ } if (hub.isConstant() && hub.kind() == Kind.Object && hub.asConstant().asObject() instanceof Class) { Class clazz = (Class) hub.asConstant().asObject(); - ResolvedJavaType t = tool.runtime().lookupJavaType(clazz); + ResolvedJavaType t = tool.getMetaAccess().lookupJavaType(clazz); return graph().add(new CheckCastNode(t, object(), null, forStoreCheck)); } return this; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -79,7 +79,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } // specialized on value type until boxing/unboxing is sorted out in intrinsification diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -56,7 +56,7 @@ if (elementType.isConstant()) { Class elementClass = (Class) elementType.asConstant().asObject(); if (elementClass != null && !(elementClass.equals(void.class))) { - ResolvedJavaType javaType = tool.runtime().lookupJavaType(elementClass); + ResolvedJavaType javaType = tool.getMetaAccess().lookupJavaType(elementClass); return graph().add(new NewArrayNode(javaType, length(), fillContents())); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -39,8 +39,8 @@ */ public class ExceptionObjectNode extends DispatchBeginNode implements Lowerable, MemoryCheckpoint.Single { - public ExceptionObjectNode(MetaAccessProvider runtime) { - super(StampFactory.declaredNonNull(runtime.lookupJavaType(Throwable.class))); + public ExceptionObjectNode(MetaAccessProvider metaAccess) { + super(StampFactory.declaredNonNull(metaAccess.lookupJavaType(Throwable.class))); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -53,7 +53,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override @@ -61,7 +61,7 @@ assert object() != null : this; if (mirror().isConstant()) { Class clazz = (Class) mirror().asConstant().asObject(); - ResolvedJavaType t = tool.runtime().lookupJavaType(clazz); + ResolvedJavaType t = tool.getMetaAccess().lookupJavaType(clazz); return graph().unique(new InstanceOfNode(t, object(), null)); } return this; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -54,7 +54,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -45,6 +45,6 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -60,7 +60,7 @@ @Override public Node canonical(CanonicalizerTool tool) { - MetaAccessProvider runtime = tool.runtime(); + MetaAccessProvider runtime = tool.getMetaAccess(); if (tool.canonicalizeReads() && runtime != null) { ConstantNode constant = asConstant(runtime); if (constant != null) { @@ -77,7 +77,7 @@ /** * Gets a constant value for this load if possible. */ - public ConstantNode asConstant(MetaAccessProvider runtime) { + public ConstantNode asConstant(MetaAccessProvider metaAccess) { Constant constant = null; if (isStatic()) { constant = field().readConstantValue(null); @@ -85,12 +85,12 @@ constant = field().readConstantValue(object().asConstant()); } if (constant != null) { - return ConstantNode.forConstant(constant, runtime, graph()); + return ConstantNode.forConstant(constant, metaAccess, graph()); } return null; } - private PhiNode asPhi(MetaAccessProvider runtime) { + private PhiNode asPhi(MetaAccessProvider metaAccess) { if (!isStatic() && Modifier.isFinal(field.getModifiers()) && object() instanceof PhiNode && ((PhiNode) object()).values().filter(NodePredicates.isNotA(ConstantNode.class)).isEmpty()) { PhiNode phi = (PhiNode) object(); Constant[] constants = new Constant[phi.valueCount()]; @@ -103,7 +103,7 @@ } PhiNode newPhi = graph().addWithoutUnique(new PhiNode(stamp(), phi.merge())); for (int i = 0; i < phi.valueCount(); i++) { - newPhi.addInput(ConstantNode.forConstant(constants[i], runtime, graph())); + newPhi.addInput(ConstantNode.forConstant(constants[i], metaAccess, graph())); } return newPhi; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,7 +51,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } public int getLockDepth() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -52,7 +52,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } public int getLockDepth() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -79,7 +79,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -63,7 +63,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } public ResolvedJavaType type() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -52,7 +52,7 @@ @Override public void generate(LIRGeneratorTool gen) { - ForeignCallLinkage linkage = gen.getRuntime().lookupForeignCall(REGISTER_FINALIZER); + ForeignCallLinkage linkage = gen.getCodeCache().lookupForeignCall(REGISTER_FINALIZER); gen.emitForeignCall(linkage, this, gen.operand(object())); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -86,7 +86,7 @@ for (int i = 0; i < keyCount(); i++) { Constant typeHub = keyAt(i); assert constant.getKind() == typeHub.getKind(); - if (tool.runtime().constantEquals(constant, typeHub)) { + if (tool.getMetaAccess().constantEquals(constant, typeHub)) { survivingEdge = keySuccessorIndex(i); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Thu Oct 10 17:07:11 2013 +0200 @@ -33,7 +33,9 @@ TargetDescription target(); - CodeCacheProvider getRuntime(); + MetaAccessProvider getMetaAccess(); + + CodeCacheProvider getCodeCache(); /** * Checks whether the supplied constant can be used without loading it into a register for most diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Thu Oct 10 17:07:11 2013 +0200 @@ -31,7 +31,9 @@ public interface LoweringTool { - GraalCodeCacheProvider getRuntime(); + MetaAccessProvider getMetaAccess(); + + GraalCodeCacheProvider getCodeCache(); Replacements getReplacements(); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java Thu Oct 10 17:07:11 2013 +0200 @@ -30,5 +30,5 @@ */ public interface ReplacementsProvider { - void registerReplacements(MetaAccessProvider runtime, Replacements replacements, TargetDescription target); + void registerReplacements(MetaAccessProvider metaAccess, Replacements replacements, TargetDescription target); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Thu Oct 10 17:07:11 2013 +0200 @@ -168,10 +168,10 @@ } } - public static Stamp forConstant(Constant value, MetaAccessProvider runtime) { + public static Stamp forConstant(Constant value, MetaAccessProvider metaAccess) { assert value.getKind() == Kind.Object; if (value.getKind() == Kind.Object) { - ResolvedJavaType type = value.isNull() ? null : runtime.lookupJavaType(value); + ResolvedJavaType type = value.isNull() ? null : metaAccess.lookupJavaType(value); return new ObjectStamp(type, value.isNonNull(), value.isNonNull(), value.isNull()); } else { throw new GraalInternalError(Kind.Object + " expected, actual kind: %s", value.getKind()); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -67,7 +67,7 @@ @Override public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); + tool.getCodeCache().lower(this, tool); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -67,7 +67,7 @@ @Override protected void run(StructuredGraph graph, PhaseContext context) { - new Instance(context.getRuntime(), context.getAssumptions(), canonicalizeReads, customCanonicalizer).run(graph); + new Instance(context.getMetaAccess(), context.getAssumptions(), canonicalizeReads, customCanonicalizer).run(graph); } /** @@ -79,7 +79,7 @@ } public void applyIncremental(StructuredGraph graph, PhaseContext context, int newNodesMark, boolean dumpGraph) { - new Instance(context.getRuntime(), context.getAssumptions(), canonicalizeReads, newNodesMark, customCanonicalizer).apply(graph, dumpGraph); + new Instance(context.getMetaAccess(), context.getAssumptions(), canonicalizeReads, newNodesMark, customCanonicalizer).apply(graph, dumpGraph); } /** @@ -91,7 +91,7 @@ } public void applyIncremental(StructuredGraph graph, PhaseContext context, Iterable workingSet, boolean dumpGraph) { - new Instance(context.getRuntime(), context.getAssumptions(), canonicalizeReads, workingSet, customCanonicalizer).apply(graph, dumpGraph); + new Instance(context.getMetaAccess(), context.getAssumptions(), canonicalizeReads, workingSet, customCanonicalizer).apply(graph, dumpGraph); } public void applyIncremental(StructuredGraph graph, PhaseContext context, Iterable workingSet, int newNodesMark) { @@ -99,19 +99,19 @@ } public void applyIncremental(StructuredGraph graph, PhaseContext context, Iterable workingSet, int newNodesMark, boolean dumpGraph) { - new Instance(context.getRuntime(), context.getAssumptions(), canonicalizeReads, workingSet, newNodesMark, customCanonicalizer).apply(graph, dumpGraph); + new Instance(context.getMetaAccess(), context.getAssumptions(), canonicalizeReads, workingSet, newNodesMark, customCanonicalizer).apply(graph, dumpGraph); } @Deprecated public void addToPhasePlan(PhasePlan plan, PhaseContext context) { - plan.addPhase(PhasePosition.AFTER_PARSING, new Instance(context.getRuntime(), context.getAssumptions(), canonicalizeReads, customCanonicalizer)); + plan.addPhase(PhasePosition.AFTER_PARSING, new Instance(context.getMetaAccess(), context.getAssumptions(), canonicalizeReads, customCanonicalizer)); } private static final class Instance extends Phase { private final int newNodesMark; private final Assumptions assumptions; - private final MetaAccessProvider runtime; + private final MetaAccessProvider metaAccess; private final CustomCanonicalizer customCanonicalizer; private final Iterable initWorkingSet; private final boolean canonicalizeReads; @@ -119,23 +119,23 @@ private NodeWorkList workList; private Tool tool; - private Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, CustomCanonicalizer customCanonicalizer) { - this(runtime, assumptions, canonicalizeReads, null, 0, customCanonicalizer); + private Instance(MetaAccessProvider metaAccess, Assumptions assumptions, boolean canonicalizeReads, CustomCanonicalizer customCanonicalizer) { + this(metaAccess, assumptions, canonicalizeReads, null, 0, customCanonicalizer); } - private Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, Iterable workingSet, CustomCanonicalizer customCanonicalizer) { - this(runtime, assumptions, canonicalizeReads, workingSet, 0, customCanonicalizer); + private Instance(MetaAccessProvider metaAccess, Assumptions assumptions, boolean canonicalizeReads, Iterable workingSet, CustomCanonicalizer customCanonicalizer) { + this(metaAccess, assumptions, canonicalizeReads, workingSet, 0, customCanonicalizer); } - private Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, int newNodesMark, CustomCanonicalizer customCanonicalizer) { - this(runtime, assumptions, canonicalizeReads, null, newNodesMark, customCanonicalizer); + private Instance(MetaAccessProvider metaAccess, Assumptions assumptions, boolean canonicalizeReads, int newNodesMark, CustomCanonicalizer customCanonicalizer) { + this(metaAccess, assumptions, canonicalizeReads, null, newNodesMark, customCanonicalizer); } - private Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, Iterable workingSet, int newNodesMark, CustomCanonicalizer customCanonicalizer) { + private Instance(MetaAccessProvider metaAccess, Assumptions assumptions, boolean canonicalizeReads, Iterable workingSet, int newNodesMark, CustomCanonicalizer customCanonicalizer) { super("Canonicalizer"); this.newNodesMark = newNodesMark; this.assumptions = assumptions; - this.runtime = runtime; + this.metaAccess = metaAccess; this.canonicalizeReads = canonicalizeReads; this.customCanonicalizer = customCanonicalizer; this.initWorkingSet = workingSet; @@ -192,7 +192,7 @@ boolean improvedStamp = tryInferStamp(valueNode); Constant constant = valueNode.stamp().asConstant(); if (constant != null && !(node instanceof ConstantNode)) { - performReplacement(valueNode, ConstantNode.forConstant(constant, runtime, valueNode.graph())); + performReplacement(valueNode, ConstantNode.forConstant(constant, metaAccess, valueNode.graph())); } else if (improvedStamp) { // the improved stamp may enable additional canonicalization tryCanonicalize(valueNode, nodeClass); @@ -376,8 +376,8 @@ } @Override - public MetaAccessProvider runtime() { - return runtime; + public MetaAccessProvider getMetaAccess() { + return metaAccess; } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeoptimizationGroupingPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeoptimizationGroupingPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeoptimizationGroupingPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -56,7 +56,7 @@ EndNode firstEnd = graph.add(new EndNode()); phi = graph.addWithoutUnique(new PhiNode(Kind.Int, merge)); merge.addForwardEnd(firstEnd); - phi.addInput(((AbstractDeoptimizeNode) target).getActionAndReason(context.getRuntime())); + phi.addInput(((AbstractDeoptimizeNode) target).getActionAndReason(context.getMetaAccess())); target.predecessor().replaceFirstSuccessor(target, firstEnd); exitLoops((AbstractDeoptimizeNode) target, firstEnd, cfg); @@ -70,7 +70,7 @@ } EndNode newEnd = graph.add(new EndNode()); merge.addForwardEnd(newEnd); - phi.addInput(deopt.getActionAndReason(context.getRuntime())); + phi.addInput(deopt.getActionAndReason(context.getMetaAccess())); deopt.predecessor().replaceFirstSuccessor(deopt, newEnd); exitLoops(deopt, newEnd, cfg); obsoletes.add(deopt); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -173,7 +173,7 @@ if (inliningPolicy.isWorthInlining(context.getReplacements(), callee, inliningDepth, calleeInfo.probability(), calleeInfo.relevance(), true)) { doInline(callerGraphInfo, calleeInfo, callerAssumptions, context); } else if (context.getOptimisticOptimizations().devirtualizeInvokes()) { - callee.tryToDevirtualizeInvoke(context.getRuntime(), callerAssumptions); + callee.tryToDevirtualizeInvoke(context.getMetaAccess(), callerAssumptions); } metricInliningConsidered.increment(); } @@ -184,7 +184,7 @@ InlineInfo callee = calleeInfo.callee(); try { List invokeUsages = callee.invoke().asNode().usages().snapshot(); - callee.inline(context.getRuntime(), callerAssumptions, context.getReplacements()); + callee.inline(context.getMetaAccess(), context.getCodeCache(), callerAssumptions, context.getReplacements()); callerAssumptions.record(calleeInfo.assumptions()); metricInliningRuns.increment(); Debug.dump(callerGraph, "after %s", callee); @@ -258,7 +258,7 @@ ValueNode arg = args.get(localNode.index()); if (arg.isConstant()) { Constant constant = arg.asConstant(); - newGraph.replaceFloating(localNode, ConstantNode.forConstant(constant, context.getRuntime(), newGraph)); + newGraph.replaceFloating(localNode, ConstantNode.forConstant(constant, context.getMetaAccess(), newGraph)); callerHasMoreInformationAboutArguments = true; } else { Stamp joinedStamp = localNode.stamp().join(arg.stamp()); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Thu Oct 10 17:07:11 2013 +0200 @@ -292,13 +292,13 @@ * Performs the inlining described by this object and returns the node that represents the * return value of the inlined method (or null for void methods and methods that have no * non-exceptional exit). - **/ - void inline(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements); + */ + void inline(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements); /** * Try to make the call static bindable to avoid interface and virtual method calls. */ - void tryToDevirtualizeInvoke(MetaAccessProvider runtime, Assumptions assumptions); + void tryToDevirtualizeInvoke(MetaAccessProvider metaAccess, Assumptions assumptions); } public abstract static class AbstractInlineInfo implements InlineInfo { @@ -367,12 +367,12 @@ } @Override - public void inline(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements) { + public void inline(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements) { inline(invoke, concrete, inlineableElement, assumptions, !suppressNullCheck); } @Override - public void tryToDevirtualizeInvoke(MetaAccessProvider runtime, Assumptions assumptions) { + public void tryToDevirtualizeInvoke(MetaAccessProvider metaAccess, Assumptions assumptions) { // nothing todo, can already be bound statically } @@ -470,20 +470,20 @@ } @Override - public void inline(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements) { - createGuard(graph(), runtime); + public void inline(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements) { + createGuard(graph(), metaAccess); inline(invoke, concrete, inlineableElement, assumptions, false); } @Override - public void tryToDevirtualizeInvoke(MetaAccessProvider runtime, Assumptions assumptions) { - createGuard(graph(), runtime); + public void tryToDevirtualizeInvoke(MetaAccessProvider metaAccess, Assumptions assumptions) { + createGuard(graph(), metaAccess); replaceInvokeCallTarget(invoke, graph(), InvokeKind.Special, concrete); } - private void createGuard(StructuredGraph graph, MetaAccessProvider runtime) { + private void createGuard(StructuredGraph graph, MetaAccessProvider metaAccess) { ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke); - ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(Representation.ObjectHub), runtime, graph); + ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(Representation.ObjectHub), metaAccess, graph); LoadHubNode receiverHub = graph.unique(new LoadHubNode(nonNullReceiver, typeHub.kind(), null)); CompareNode typeCheck = CompareNode.createCompareNode(Condition.EQ, receiverHub, typeHub); @@ -587,11 +587,11 @@ } @Override - public void inline(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements) { + public void inline(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements) { if (hasSingleMethod()) { - inlineSingleMethod(graph(), runtime, assumptions); + inlineSingleMethod(graph(), metaAccess, assumptions); } else { - inlineMultipleMethods(graph(), runtime, assumptions, replacements); + inlineMultipleMethods(graph(), metaAccess, assumptions, replacements, codeCache); } } @@ -603,7 +603,7 @@ return notRecordedTypeProbability > 0; } - private void inlineMultipleMethods(StructuredGraph graph, MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements) { + private void inlineMultipleMethods(StructuredGraph graph, MetaAccessProvider metaAccess, Assumptions assumptions, Replacements replacements, GraalCodeCacheProvider codeCache) { int numberOfMethods = concretes.size(); FixedNode continuation = invoke.next(); @@ -658,7 +658,7 @@ assert invoke.asNode().isAlive(); // replace the invoke with a switch on the type of the actual receiver - boolean methodDispatch = createDispatchOnTypeBeforeInvoke(graph, successors, false, runtime); + boolean methodDispatch = createDispatchOnTypeBeforeInvoke(graph, successors, false, metaAccess); assert invoke.next() == continuation; invoke.setNext(null); @@ -713,8 +713,8 @@ if (opportunities > 0) { metricInliningTailDuplication.increment(); Debug.log("MultiTypeGuardInlineInfo starting tail duplication (%d opportunities)", opportunities); - TailDuplicationPhase.tailDuplicate(returnMerge, TailDuplicationPhase.TRUE_DECISION, replacementNodes, new PhaseContext(runtime, assumptions, replacements), new CanonicalizerPhase( - !AOTCompilation.getValue())); + TailDuplicationPhase.tailDuplicate(returnMerge, TailDuplicationPhase.TRUE_DECISION, replacementNodes, new PhaseContext(metaAccess, codeCache, assumptions, replacements), + new CanonicalizerPhase(!AOTCompilation.getValue())); } } } @@ -752,21 +752,21 @@ return result; } - private void inlineSingleMethod(StructuredGraph graph, MetaAccessProvider runtime, Assumptions assumptions) { + private void inlineSingleMethod(StructuredGraph graph, MetaAccessProvider metaAccess, Assumptions assumptions) { assert concretes.size() == 1 && inlineableElements.length == 1 && ptypes.size() > 1 && !shouldFallbackToInvoke() && notRecordedTypeProbability == 0; AbstractBeginNode calleeEntryNode = graph.add(new BeginNode()); AbstractBeginNode unknownTypeSux = createUnknownTypeSuccessor(graph); AbstractBeginNode[] successors = new AbstractBeginNode[]{calleeEntryNode, unknownTypeSux}; - createDispatchOnTypeBeforeInvoke(graph, successors, false, runtime); + createDispatchOnTypeBeforeInvoke(graph, successors, false, metaAccess); calleeEntryNode.setNext(invoke.asNode()); inline(invoke, methodAt(0), inlineableElementAt(0), assumptions, false); } - private boolean createDispatchOnTypeBeforeInvoke(StructuredGraph graph, AbstractBeginNode[] successors, boolean invokeIsOnlySuccessor, MetaAccessProvider runtime) { + private boolean createDispatchOnTypeBeforeInvoke(StructuredGraph graph, AbstractBeginNode[] successors, boolean invokeIsOnlySuccessor, MetaAccessProvider metaAccess) { assert ptypes.size() >= 1; ValueNode nonNullReceiver = nonNullReceiver(invoke); Kind hubKind = ((MethodCallTargetNode) invoke.callTarget()).targetMethod().getDeclaringClass().getEncoding(Representation.ObjectHub).getKind(); @@ -783,7 +783,7 @@ ResolvedJavaMethod firstMethod = concretes.get(i); Constant firstMethodConstant = firstMethod.getEncoding(); - ValueNode firstMethodConstantNode = ConstantNode.forConstant(firstMethodConstant, runtime, graph); + ValueNode firstMethodConstantNode = ConstantNode.forConstant(firstMethodConstant, metaAccess, graph); constantMethods[i] = firstMethodConstantNode; double concretesProbability = concretesProbabilities.get(i); assert concretesProbability >= 0.0; @@ -928,15 +928,15 @@ } @Override - public void tryToDevirtualizeInvoke(MetaAccessProvider runtime, Assumptions assumptions) { + public void tryToDevirtualizeInvoke(MetaAccessProvider metaAccess, Assumptions assumptions) { if (hasSingleMethod()) { - devirtualizeWithTypeSwitch(graph(), InvokeKind.Special, concretes.get(0), runtime); + devirtualizeWithTypeSwitch(graph(), InvokeKind.Special, concretes.get(0), metaAccess); } else { - tryToDevirtualizeMultipleMethods(graph(), runtime); + tryToDevirtualizeMultipleMethods(graph(), metaAccess); } } - private void tryToDevirtualizeMultipleMethods(StructuredGraph graph, MetaAccessProvider runtime) { + private void tryToDevirtualizeMultipleMethods(StructuredGraph graph, MetaAccessProvider metaAccess) { MethodCallTargetNode methodCallTarget = (MethodCallTargetNode) invoke.callTarget(); if (methodCallTarget.invokeKind() == InvokeKind.Interface) { ResolvedJavaMethod targetMethod = methodCallTarget.targetMethod(); @@ -947,17 +947,17 @@ if (!leastCommonType.isInterface() && targetMethod.getDeclaringClass().isAssignableFrom(leastCommonType)) { ResolvedJavaMethod baseClassTargetMethod = leastCommonType.resolveMethod(targetMethod); if (baseClassTargetMethod != null) { - devirtualizeWithTypeSwitch(graph, InvokeKind.Virtual, leastCommonType.resolveMethod(targetMethod), runtime); + devirtualizeWithTypeSwitch(graph, InvokeKind.Virtual, leastCommonType.resolveMethod(targetMethod), metaAccess); } } } } - private void devirtualizeWithTypeSwitch(StructuredGraph graph, InvokeKind kind, ResolvedJavaMethod target, MetaAccessProvider runtime) { + private void devirtualizeWithTypeSwitch(StructuredGraph graph, InvokeKind kind, ResolvedJavaMethod target, MetaAccessProvider metaAccess) { AbstractBeginNode invocationEntry = graph.add(new BeginNode()); AbstractBeginNode unknownTypeSux = createUnknownTypeSuccessor(graph); AbstractBeginNode[] successors = new AbstractBeginNode[]{invocationEntry, unknownTypeSux}; - createDispatchOnTypeBeforeInvoke(graph, successors, true, runtime); + createDispatchOnTypeBeforeInvoke(graph, successors, true, metaAccess); invocationEntry.setNext(invoke.asNode()); ValueNode receiver = ((MethodCallTargetNode) invoke.callTarget()).receiver(); @@ -1006,13 +1006,13 @@ } @Override - public void inline(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements) { + public void inline(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements) { assumptions.record(takenAssumption); - super.inline(runtime, assumptions, replacements); + super.inline(metaAccess, codeCache, assumptions, replacements); } @Override - public void tryToDevirtualizeInvoke(MetaAccessProvider runtime, Assumptions assumptions) { + public void tryToDevirtualizeInvoke(MetaAccessProvider metaAccess, Assumptions assumptions) { assumptions.record(takenAssumption); replaceInvokeCallTarget(invoke, graph(), InvokeKind.Special, concrete); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -42,7 +42,7 @@ @Override protected void run(StructuredGraph graph, PhaseContext context) { - ConditionalEliminationPhase eliminate = new ConditionalEliminationPhase(context.getRuntime()); + ConditionalEliminationPhase eliminate = new ConditionalEliminationPhase(context.getMetaAccess()); HashSetNodeChangeListener listener = new HashSetNodeChangeListener(); int count = 0; while (true) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -63,8 +63,13 @@ } @Override - public GraalCodeCacheProvider getRuntime() { - return (GraalCodeCacheProvider) context.getRuntime(); + public GraalCodeCacheProvider getCodeCache() { + return context.getCodeCache(); + } + + @Override + public MetaAccessProvider getMetaAccess() { + return context.getMetaAccess(); } @Override diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java Thu Oct 10 17:07:11 2013 +0200 @@ -34,8 +34,9 @@ private final GraphCache cache; private final OptimisticOptimizations optimisticOpts; - public HighTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { - super(runtime, assumptions, replacements); + public HighTierContext(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements, GraphCache cache, PhasePlan plan, + OptimisticOptimizations optimisticOpts) { + super(metaAccess, codeCache, assumptions, replacements); this.plan = plan; this.cache = cache; this.optimisticOpts = optimisticOpts; @@ -54,6 +55,6 @@ } public HighTierContext replaceAssumptions(Assumptions newAssumptions) { - return new HighTierContext(getRuntime(), newAssumptions, getReplacements(), getGraphCache(), getPhasePlan(), getOptimisticOptimizations()); + return new HighTierContext(getMetaAccess(), getCodeCache(), newAssumptions, getReplacements(), getGraphCache(), getPhasePlan(), getOptimisticOptimizations()); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java Thu Oct 10 17:07:11 2013 +0200 @@ -30,8 +30,8 @@ private final TargetDescription target; - public LowTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, TargetDescription target) { - super(runtime, assumptions, replacements); + public LowTierContext(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, assumptions, replacements); this.target = target; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java Thu Oct 10 17:07:11 2013 +0200 @@ -32,8 +32,8 @@ private final TargetDescription target; private final OptimisticOptimizations optimisticOpts; - public MidTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, TargetDescription target, OptimisticOptimizations optimisticOpts) { - super(runtime, assumptions, replacements); + public MidTierContext(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements, TargetDescription target, OptimisticOptimizations optimisticOpts) { + super(metaAccess, codeCache, assumptions, replacements); this.target = target; this.optimisticOpts = optimisticOpts; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java Thu Oct 10 17:07:11 2013 +0200 @@ -28,18 +28,24 @@ public class PhaseContext { - private final MetaAccessProvider runtime; + private final MetaAccessProvider metaAccess; + private final GraalCodeCacheProvider codeCache; private final Assumptions assumptions; private final Replacements replacements; - public PhaseContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements) { - this.runtime = runtime; + public PhaseContext(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, Replacements replacements) { + this.metaAccess = metaAccess; + this.codeCache = codeCache; this.assumptions = assumptions; this.replacements = replacements; } - public MetaAccessProvider getRuntime() { - return runtime; + public MetaAccessProvider getMetaAccess() { + return metaAccess; + } + + public GraalCodeCacheProvider getCodeCache() { + return codeCache; } public Assumptions getAssumptions() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Thu Oct 10 17:07:11 2013 +0200 @@ -42,9 +42,9 @@ this.klass = klass; } - private boolean isAssignableType(ValueNode node, MetaAccessProvider runtime) { + private boolean isAssignableType(ValueNode node, MetaAccessProvider metaAccess) { if (node.stamp() instanceof ObjectStamp) { - ResolvedJavaType valueType = runtime.lookupJavaType(klass); + ResolvedJavaType valueType = metaAccess.lookupJavaType(klass); ResolvedJavaType nodeType = ObjectStamp.typeOrNull(node); if (nodeType != null && valueType.isAssignableFrom(nodeType)) { @@ -58,8 +58,8 @@ return node.isConstant() && node.asConstant().isNull(); } - private boolean checkUsage(ValueNode x, ValueNode y, MetaAccessProvider runtime) { - return isAssignableType(x, runtime) && !isNullConstant(y); + private boolean checkUsage(ValueNode x, ValueNode y, MetaAccessProvider metaAccess) { + return isAssignableType(x, metaAccess) && !isNullConstant(y); } private static boolean isEqualsMethod(StructuredGraph graph) { @@ -72,8 +72,8 @@ for (ObjectEqualsNode cn : graph.getNodes().filter(ObjectEqualsNode.class)) { if (!isEqualsMethod(graph)) { // bail out if we compare an object of type klass with == or != (except null checks) - assert !(checkUsage(cn.x(), cn.y(), context.getRuntime()) && checkUsage(cn.y(), cn.x(), context.getRuntime())) : "Verifcation of " + klass.getName() + " usage failed: Comparing " + - cn.x() + " and " + cn.y() + " in " + graph.method() + " must use .equals() for object equality, not '==' or '!='"; + assert !(checkUsage(cn.x(), cn.y(), context.getMetaAccess()) && checkUsage(cn.y(), cn.x(), context.getMetaAccess())) : "Verifcation of " + klass.getName() + + " usage failed: Comparing " + cn.x() + " and " + cn.y() + " in " + graph.method() + " must use .equals() for object equality, not '==' or '!='"; } } return true; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java --- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -149,8 +149,8 @@ private final EnumMap snippets; - public Templates(MetaAccessProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); snippets = new EnumMap<>(Op.class); snippets.put(Op.F2I, snippet(AMD64ConvertSnippets.class, "f2i")); @@ -180,7 +180,7 @@ SnippetTemplate template = template(args); Debug.log("Lowering %s in %s: node=%s, template=%s, arguments=%s", convert.opcode, graph, convert, template, args); - template.instantiate(runtime, replacee, DEFAULT_REPLACER, tool, args); + template.instantiate(metaAccess, replacee, DEFAULT_REPLACER, tool, args); graph.removeFloating(convert); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -44,14 +44,14 @@ public abstract class MethodSubstitutionTest extends GraalCompilerTest { protected StructuredGraph test(final String snippet) { - return Debug.scope("MethodSubstitutionTest", runtime.lookupJavaMethod(getMethod(snippet)), new Callable() { + return Debug.scope("MethodSubstitutionTest", getMetaAccess().lookupJavaMethod(getMethod(snippet)), new Callable() { @Override public StructuredGraph call() { StructuredGraph graph = parse(snippet); PhasePlan phasePlan = getDefaultPhasePlan(); Assumptions assumptions = new Assumptions(true); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); Debug.dump(graph, "Graph"); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); Debug.dump(graph, "Graph"); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -90,7 +90,7 @@ public void test1() { for (Class clazz : new Class[]{byte.class, char.class, short.class, int.class, float.class, long.class, double.class, String.class}) { bottomClass = clazz; - bottomType = runtime.lookupJavaType(clazz); + bottomType = getMetaAccess().lookupJavaType(clazz); arrayType = bottomType; for (int rank : new int[]{1, 2, 10, 50, 100, 200, 254, 255}) { while (rank(arrayType) != rank) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -49,14 +49,14 @@ public ObjectAccessTest() { target = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); - installer = new ReplacementsImpl(runtime, new Assumptions(false), target); + installer = new ReplacementsImpl(getMetaAccess(), getCodeCache(), new Assumptions(false), target); } private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); @Override protected StructuredGraph parse(Method m) { - ResolvedJavaMethod resolvedMethod = runtime.lookupJavaMethod(m); + ResolvedJavaMethod resolvedMethod = getMetaAccess().lookupJavaMethod(m); return installer.makeGraph(resolvedMethod, null, inliningPolicy.get(), false); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -53,14 +53,14 @@ public PointerTest() { target = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); - installer = new ReplacementsImpl(runtime, new Assumptions(false), target); + installer = new ReplacementsImpl(getMetaAccess(), getCodeCache(), new Assumptions(false), target); } private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); @Override protected StructuredGraph parse(Method m) { - ResolvedJavaMethod resolvedMethod = runtime.lookupJavaMethod(m); + ResolvedJavaMethod resolvedMethod = getMetaAccess().lookupJavaMethod(m); return installer.makeGraph(resolvedMethod, null, inliningPolicy.get(), false); } @@ -404,7 +404,7 @@ private void assertNumWordCasts(String snippetName, int expectedWordCasts) { Assumptions assumptions = new Assumptions(true); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, null, OptimisticOptimizations.ALL); + HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, null, OptimisticOptimizations.ALL); StructuredGraph graph = parse(snippetName); new CanonicalizerPhase(false).apply(graph, context); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -58,7 +58,7 @@ } ProfiledType[] ptypes = new ProfiledType[types.length]; for (int i = 0; i < types.length; i++) { - ptypes[i] = new ProfiledType(runtime.lookupJavaType(types[i]), 1.0D / types.length); + ptypes[i] = new ProfiledType(getMetaAccess().lookupJavaType(types[i]), 1.0D / types.length); } return new JavaTypeProfile(nullSeen, 0.0D, ptypes); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -43,14 +43,14 @@ public WordTest() { TargetDescription target = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); - installer = new ReplacementsImpl(runtime, new Assumptions(false), target); + installer = new ReplacementsImpl(getMetaAccess(), getCodeCache(), new Assumptions(false), target); } private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); @Override protected StructuredGraph parse(Method m) { - ResolvedJavaMethod resolvedMethod = runtime.lookupJavaMethod(m); + ResolvedJavaMethod resolvedMethod = getMetaAccess().lookupJavaMethod(m); return installer.makeGraph(resolvedMethod, null, inliningPolicy.get(), false); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java Thu Oct 10 17:07:11 2013 +0200 @@ -172,27 +172,27 @@ return value.shortValue(); } - public static FloatingNode canonicalizeBoxing(BoxNode box, MetaAccessProvider runtime) { + public static FloatingNode canonicalizeBoxing(BoxNode box, MetaAccessProvider metaAccess) { ValueNode value = box.getValue(); if (value.isConstant()) { Constant sourceConstant = value.asConstant(); switch (box.getBoxingKind()) { case Boolean: - return ConstantNode.forObject(Boolean.valueOf(sourceConstant.asInt() != 0), runtime, box.graph()); + return ConstantNode.forObject(Boolean.valueOf(sourceConstant.asInt() != 0), metaAccess, box.graph()); case Byte: - return ConstantNode.forObject(Byte.valueOf((byte) sourceConstant.asInt()), runtime, box.graph()); + return ConstantNode.forObject(Byte.valueOf((byte) sourceConstant.asInt()), metaAccess, box.graph()); case Char: - return ConstantNode.forObject(Character.valueOf((char) sourceConstant.asInt()), runtime, box.graph()); + return ConstantNode.forObject(Character.valueOf((char) sourceConstant.asInt()), metaAccess, box.graph()); case Short: - return ConstantNode.forObject(Short.valueOf((short) sourceConstant.asInt()), runtime, box.graph()); + return ConstantNode.forObject(Short.valueOf((short) sourceConstant.asInt()), metaAccess, box.graph()); case Int: - return ConstantNode.forObject(Integer.valueOf(sourceConstant.asInt()), runtime, box.graph()); + return ConstantNode.forObject(Integer.valueOf(sourceConstant.asInt()), metaAccess, box.graph()); case Long: - return ConstantNode.forObject(Long.valueOf(sourceConstant.asLong()), runtime, box.graph()); + return ConstantNode.forObject(Long.valueOf(sourceConstant.asLong()), metaAccess, box.graph()); case Float: - return ConstantNode.forObject(Float.valueOf(sourceConstant.asFloat()), runtime, box.graph()); + return ConstantNode.forObject(Float.valueOf(sourceConstant.asFloat()), metaAccess, box.graph()); case Double: - return ConstantNode.forObject(Double.valueOf(sourceConstant.asDouble()), runtime, box.graph()); + return ConstantNode.forObject(Double.valueOf(sourceConstant.asDouble()), metaAccess, box.graph()); default: assert false : "Unexpected source kind for boxing"; break; @@ -206,8 +206,8 @@ private final EnumMap boxSnippets = new EnumMap<>(Kind.class); private final EnumMap unboxSnippets = new EnumMap<>(Kind.class); - public Templates(MetaAccessProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); for (Kind kind : new Kind[]{Kind.Boolean, Kind.Byte, Kind.Char, Kind.Double, Kind.Float, Kind.Int, Kind.Long, Kind.Short}) { boxSnippets.put(kind, snippet(BoxingSnippets.class, kind.getJavaName() + "ValueOf")); unboxSnippets.put(kind, snippet(BoxingSnippets.class, kind.getJavaName() + "Value")); @@ -215,7 +215,7 @@ } public void lower(BoxNode box, LoweringTool tool) { - FloatingNode canonical = canonicalizeBoxing(box, runtime); + FloatingNode canonical = canonicalizeBoxing(box, metaAccess); // if in AOT mode, we don't want to embed boxed constants. if (canonical != null && !AOTCompilation.getValue()) { box.graph().replaceFloating(box, canonical); @@ -225,7 +225,7 @@ SnippetTemplate template = template(args); Debug.log("Lowering integerValueOf in %s: node=%s, template=%s, arguments=%s", box.graph(), box, template, args); - template.instantiate(runtime, box, DEFAULT_REPLACER, tool, args); + template.instantiate(metaAccess, box, DEFAULT_REPLACER, tool, args); GraphUtil.killWithUnusedFloatingInputs(box); } } @@ -236,7 +236,7 @@ SnippetTemplate template = template(args); Debug.log("Lowering integerValueOf in %s: node=%s, template=%s, arguments=%s", unbox.graph(), unbox, template, args); - template.instantiate(runtime, unbox, DEFAULT_REPLACER, tool, args); + template.instantiate(metaAccess, unbox, DEFAULT_REPLACER, tool, args); GraphUtil.killWithUnusedFloatingInputs(unbox); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java Thu Oct 10 17:07:11 2013 +0200 @@ -35,7 +35,7 @@ @ServiceProvider(ReplacementsProvider.class) public class GraalMethodSubstitutions implements ReplacementsProvider { - public void registerReplacements(MetaAccessProvider runtime, Replacements replacements, TargetDescription target) { + public void registerReplacements(MetaAccessProvider metaAccess, Replacements replacements, TargetDescription target) { for (Class clazz : BoxingSubstitutions.getClasses()) { replacements.registerSubstitutions(clazz); } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java Thu Oct 10 17:07:11 2013 +0200 @@ -53,8 +53,8 @@ */ public abstract class InstanceOfSnippetsTemplates extends AbstractTemplates { - public InstanceOfSnippetsTemplates(MetaAccessProvider runtime, Replacements replacements, TargetDescription target) { - super(runtime, replacements, target); + public InstanceOfSnippetsTemplates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + super(metaAccess, codeCache, replacements, target); } /** @@ -77,7 +77,7 @@ replacer.replaceUsingInstantiation(); } else { Arguments args = makeArguments(replacer, tool); - template(args).instantiate(runtime, instanceOf, replacer, tool, args); + template(args).instantiate(metaAccess, instanceOf, replacer, tool, args); } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -49,10 +49,10 @@ */ public class NodeIntrinsificationPhase extends Phase { - private final MetaAccessProvider runtime; + private final MetaAccessProvider metaAccess; - public NodeIntrinsificationPhase(MetaAccessProvider runtime) { - this.runtime = runtime; + public NodeIntrinsificationPhase(MetaAccessProvider metaAccess) { + this.metaAccess = metaAccess; } @Override @@ -113,7 +113,7 @@ if (constant != null) { // Replace the invoke with the result of the call - ConstantNode node = ConstantNode.forConstant(constant, runtime, methodCallTargetNode.graph()); + ConstantNode node = ConstantNode.forConstant(constant, metaAccess, methodCallTargetNode.graph()); methodCallTargetNode.invoke().intrinsify(node); // Clean up checkcast instructions inserted by javac if the return type is generic. @@ -158,8 +158,8 @@ Constant constant = constantNode.asConstant(); Object o = constant.asBoxedValue(); if (o instanceof Class) { - reflectionCallArguments[i] = Constant.forObject(runtime.lookupJavaType((Class) o)); - parameterTypes[i] = runtime.lookupJavaType(ResolvedJavaType.class); + reflectionCallArguments[i] = Constant.forObject(metaAccess.lookupJavaType((Class) o)); + parameterTypes[i] = metaAccess.lookupJavaType(ResolvedJavaType.class); } else { if (parameterTypes[i].getKind() == Kind.Boolean) { reflectionCallArguments[i] = Constant.forObject(Boolean.valueOf(constant.asInt() != 0)); @@ -175,7 +175,7 @@ } } else { reflectionCallArguments[i] = Constant.forObject(argument); - parameterTypes[i] = runtime.lookupJavaType(ValueNode.class); + parameterTypes[i] = metaAccess.lookupJavaType(ValueNode.class); } } return reflectionCallArguments; @@ -186,9 +186,9 @@ if (intrinsic.value() == NodeIntrinsic.class) { result = target.getDeclaringClass(); } else { - result = runtime.lookupJavaType(intrinsic.value()); + result = metaAccess.lookupJavaType(intrinsic.value()); } - assert runtime.lookupJavaType(ValueNode.class).isAssignableFrom(result) : "Node intrinsic class " + toJavaName(result, false) + " derived from @" + NodeIntrinsic.class.getSimpleName() + + assert metaAccess.lookupJavaType(ValueNode.class).isAssignableFrom(result) : "Node intrinsic class " + toJavaName(result, false) + " derived from @" + NodeIntrinsic.class.getSimpleName() + " annotation on " + format("%H.%n(%p)", target) + " is not a subclass of " + ValueNode.class; return result; } @@ -230,7 +230,7 @@ boolean needsMetaAccessProviderArgument = false; ResolvedJavaType[] signature = MetaUtil.resolveJavaTypes(MetaUtil.signatureToTypes(c.getSignature(), null), c.getDeclaringClass()); - if (signature.length != 0 && signature[0].equals(runtime.lookupJavaType(MetaAccessProvider.class))) { + if (signature.length != 0 && signature[0].equals(metaAccess.lookupJavaType(MetaAccessProvider.class))) { // Chop off the MetaAccessProvider first parameter signature = Arrays.copyOfRange(signature, 1, signature.length); needsMetaAccessProviderArgument = true; @@ -273,7 +273,7 @@ if (needsMetaAccessProviderArgument) { Constant[] copy = new Constant[arguments.length + 1]; System.arraycopy(arguments, 0, copy, 1, arguments.length); - copy[0] = Constant.forObject(runtime); + copy[0] = Constant.forObject(metaAccess); arguments = copy; } return arguments; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Oct 10 17:07:11 2013 +0200 @@ -51,7 +51,8 @@ public class ReplacementsImpl implements Replacements { - protected final MetaAccessProvider runtime; + protected final MetaAccessProvider metaAccess; + protected final GraalCodeCacheProvider codeCache; protected final TargetDescription target; protected final Assumptions assumptions; @@ -67,8 +68,9 @@ private final Set forcedSubstitutions; private final Map, SnippetTemplateCache> snippetTemplateCache; - public ReplacementsImpl(MetaAccessProvider runtime, Assumptions assumptions, TargetDescription target) { - this.runtime = runtime; + public ReplacementsImpl(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, TargetDescription target) { + this.metaAccess = metaAccess; + this.codeCache = codeCache; this.target = target; this.assumptions = assumptions; this.graphs = new ConcurrentHashMap<>(); @@ -167,12 +169,12 @@ * @return the original method */ protected ResolvedJavaMethod registerMethodSubstitution(Member originalMember, Method substituteMethod) { - ResolvedJavaMethod substitute = runtime.lookupJavaMethod(substituteMethod); + ResolvedJavaMethod substitute = metaAccess.lookupJavaMethod(substituteMethod); ResolvedJavaMethod original; if (originalMember instanceof Method) { - original = runtime.lookupJavaMethod((Method) originalMember); + original = metaAccess.lookupJavaMethod((Method) originalMember); } else { - original = runtime.lookupJavaConstructor((Constructor) originalMember); + original = metaAccess.lookupJavaConstructor((Constructor) originalMember); } Debug.log("substitution: " + MetaUtil.format("%H.%n(%p)", original) + " --> " + MetaUtil.format("%H.%n(%p)", substitute)); @@ -190,9 +192,9 @@ protected ResolvedJavaMethod registerMacroSubstitution(Member originalMethod, Class macro) { ResolvedJavaMethod originalJavaMethod; if (originalMethod instanceof Method) { - originalJavaMethod = runtime.lookupJavaMethod((Method) originalMethod); + originalJavaMethod = metaAccess.lookupJavaMethod((Method) originalMethod); } else { - originalJavaMethod = runtime.lookupJavaConstructor((Constructor) originalMethod); + originalJavaMethod = metaAccess.lookupJavaConstructor((Constructor) originalMethod); } registeredMacroSubstitutions.put(originalJavaMethod, macro); return originalJavaMethod; @@ -205,7 +207,7 @@ policyClass = snippet.inlining(); } if (policyClass == SnippetInliningPolicy.class) { - return new DefaultSnippetInliningPolicy(runtime); + return new DefaultSnippetInliningPolicy(metaAccess); } try { return policyClass.getConstructor().newInstance(); @@ -285,7 +287,7 @@ * Does final processing of a snippet graph. */ protected void finalizeGraph(StructuredGraph graph, boolean removeAllFrameStates) { - new NodeIntrinsificationPhase(runtime).apply(graph); + new NodeIntrinsificationPhase(metaAccess).apply(graph); if (!SnippetTemplate.hasConstantParameter(method)) { NodeIntrinsificationVerificationPhase.verify(graph); } @@ -331,12 +333,12 @@ @Override public void run() { - new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); - new WordTypeVerificationPhase(runtime, target.wordKind).apply(graph); - new WordTypeRewriterPhase(runtime, target.wordKind).apply(graph); + new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); + new WordTypeVerificationPhase(metaAccess, target.wordKind).apply(graph); + new WordTypeRewriterPhase(metaAccess, target.wordKind).apply(graph); if (OptCanonicalizer.getValue()) { - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime, assumptions, ReplacementsImpl.this)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(metaAccess, codeCache, assumptions, ReplacementsImpl.this)); } } }); @@ -356,7 +358,7 @@ */ protected void afterInline(StructuredGraph caller, StructuredGraph callee, Object beforeInlineData) { if (OptCanonicalizer.getValue()) { - new CanonicalizerPhase(true).apply(caller, new PhaseContext(runtime, assumptions, ReplacementsImpl.this)); + new CanonicalizerPhase(true).apply(caller, new PhaseContext(metaAccess, codeCache, assumptions, ReplacementsImpl.this)); } } @@ -364,10 +366,10 @@ * Called after all inlining for a given graph is complete. */ protected void afterInlining(StructuredGraph graph) { - new NodeIntrinsificationPhase(runtime).apply(graph); + new NodeIntrinsificationPhase(metaAccess).apply(graph); new DeadCodeEliminationPhase().apply(graph); if (OptCanonicalizer.getValue()) { - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime, assumptions, ReplacementsImpl.this)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(metaAccess, codeCache, assumptions, ReplacementsImpl.this)); } } @@ -382,9 +384,9 @@ ResolvedJavaMethod callee = callTarget.targetMethod(); if (callee == method) { final StructuredGraph originalGraph = new StructuredGraph(original); - new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(originalGraph); - new WordTypeVerificationPhase(runtime, target.wordKind).apply(graph); - new WordTypeRewriterPhase(runtime, target.wordKind).apply(graph); + new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(originalGraph); + new WordTypeVerificationPhase(metaAccess, target.wordKind).apply(graph); + new WordTypeRewriterPhase(metaAccess, target.wordKind).apply(graph); InliningUtil.inline(callTarget.invoke(), originalGraph, true); @@ -477,7 +479,7 @@ parameters = Arrays.copyOfRange(parameters, 1, parameters.length); } } else { - Signature signature = runtime.parseMethodDescriptor(methodSubstitution); + Signature signature = metaAccess.parseMethodDescriptor(methodSubstitution); parameters = new Class[signature.getParameterCount(false)]; for (int i = 0; i < parameters.length; i++) { parameters[i] = resolveType(signature.getParameterType(i, null)); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Oct 10 17:07:11 2013 +0200 @@ -321,13 +321,15 @@ */ public abstract static class AbstractTemplates implements SnippetTemplateCache { - protected final MetaAccessProvider runtime; + protected final MetaAccessProvider metaAccess; + protected final GraalCodeCacheProvider codeCache; protected final Replacements replacements; protected final TargetDescription target; private final ConcurrentHashMap templates; - protected AbstractTemplates(MetaAccessProvider runtime, Replacements replacements, TargetDescription target) { - this.runtime = runtime; + protected AbstractTemplates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { + this.metaAccess = metaAccess; + this.codeCache = codeCache; this.replacements = replacements; this.target = target; this.templates = new ConcurrentHashMap<>(); @@ -347,7 +349,7 @@ } } assert found != null : "did not find @" + Snippet.class.getSimpleName() + " method in " + declaringClass + (methodName == null ? "" : " named " + methodName); - return new SnippetInfo(runtime.lookupJavaMethod(found)); + return new SnippetInfo(metaAccess.lookupJavaMethod(found)); } /** @@ -361,7 +363,7 @@ @Override public SnippetTemplate call() throws Exception { - return new SnippetTemplate(runtime, replacements, args); + return new SnippetTemplate(metaAccess, codeCache, replacements, args); } }); templates.put(args.cacheKey, template); @@ -392,20 +394,20 @@ /** * Creates a snippet template. */ - protected SnippetTemplate(final MetaAccessProvider runtime, final Replacements replacements, Arguments args) { + protected SnippetTemplate(final MetaAccessProvider metaAccess, final GraalCodeCacheProvider codeCache, final Replacements replacements, Arguments args) { StructuredGraph snippetGraph = replacements.getSnippet(args.info.method); ResolvedJavaMethod method = snippetGraph.method(); Signature signature = method.getSignature(); - PhaseContext context = new PhaseContext(runtime, replacements.getAssumptions(), replacements); + PhaseContext context = new PhaseContext(metaAccess, codeCache, replacements.getAssumptions(), replacements); // Copy snippet graph, replacing constant parameters with given arguments final StructuredGraph snippetCopy = new StructuredGraph(snippetGraph.name, snippetGraph.method()); IdentityHashMap nodeReplacements = new IdentityHashMap<>(); nodeReplacements.put(snippetGraph.start(), snippetCopy.start()); - assert checkTemplate(runtime, args, method, signature); + assert checkTemplate(metaAccess, args, method, signature); int parameterCount = args.info.getParameterCount(); ConstantNode[] placeholders = new ConstantNode[parameterCount]; @@ -420,11 +422,11 @@ } else { constantArg = Constant.forBoxed(kind, arg); } - nodeReplacements.put(snippetGraph.getLocal(i), ConstantNode.forConstant(constantArg, runtime, snippetCopy)); + nodeReplacements.put(snippetGraph.getLocal(i), ConstantNode.forConstant(constantArg, metaAccess, snippetCopy)); } else if (args.info.isVarargsParameter(i)) { Varargs varargs = (Varargs) args.values[i]; Object array = Array.newInstance(varargs.componentType, varargs.length); - ConstantNode placeholder = ConstantNode.forObject(array, runtime, snippetCopy); + ConstantNode placeholder = ConstantNode.forObject(array, metaAccess, snippetCopy); nodeReplacements.put(snippetGraph.getLocal(i), placeholder); placeholders[i] = placeholder; } @@ -434,7 +436,7 @@ Debug.dump(snippetCopy, "Before specialization"); if (!nodeReplacements.isEmpty()) { // Do deferred intrinsification of node intrinsics - new NodeIntrinsificationPhase(runtime).apply(snippetCopy); + new NodeIntrinsificationPhase(metaAccess).apply(snippetCopy); new CanonicalizerPhase(true).apply(snippetCopy, context); } NodeIntrinsificationVerificationPhase.verify(snippetCopy); @@ -508,7 +510,7 @@ Debug.scope("LoweringSnippetTemplate", snippetCopy, new Runnable() { public void run() { - PhaseContext c = new PhaseContext(runtime, new Assumptions(false), replacements); + PhaseContext c = new PhaseContext(metaAccess, codeCache, new Assumptions(false), replacements); new LoweringPhase(new CanonicalizerPhase(true)).apply(snippetCopy, c); } }); @@ -593,9 +595,9 @@ return true; } - private static boolean checkConstantArgument(MetaAccessProvider runtime, final ResolvedJavaMethod method, Signature signature, int i, String name, Object arg, Kind kind) { + private static boolean checkConstantArgument(MetaAccessProvider metaAccess, final ResolvedJavaMethod method, Signature signature, int i, String name, Object arg, Kind kind) { ResolvedJavaType type = signature.getParameterType(i, method.getDeclaringClass()).resolve(method.getDeclaringClass()); - if (runtime.lookupJavaType(WordBase.class).isAssignableFrom(type)) { + if (metaAccess.lookupJavaType(WordBase.class).isAssignableFrom(type)) { assert arg instanceof Constant : method + ": word constant parameters must be passed boxed in a Constant value: " + arg; return true; } @@ -608,10 +610,10 @@ return true; } - private static boolean checkVarargs(MetaAccessProvider runtime, final ResolvedJavaMethod method, Signature signature, int i, String name, Varargs varargs) { + private static boolean checkVarargs(MetaAccessProvider metaAccess, final ResolvedJavaMethod method, Signature signature, int i, String name, Varargs varargs) { ResolvedJavaType type = (ResolvedJavaType) signature.getParameterType(i, method.getDeclaringClass()); assert type.isArray() : "varargs parameter must be an array type"; - assert type.getComponentType().isAssignableFrom(runtime.lookupJavaType(varargs.componentType)) : "componentType for " + name + " not matching " + MetaUtil.toJavaName(type) + " instance: " + + assert type.getComponentType().isAssignableFrom(metaAccess.lookupJavaType(varargs.componentType)) : "componentType for " + name + " not matching " + MetaUtil.toJavaName(type) + " instance: " + varargs.componentType; return true; } @@ -666,7 +668,7 @@ * * @return the map that will be used to bind arguments to parameters when inlining this template */ - private IdentityHashMap bind(StructuredGraph replaceeGraph, MetaAccessProvider runtime, Arguments args) { + private IdentityHashMap bind(StructuredGraph replaceeGraph, MetaAccessProvider metaAccess, Arguments args) { IdentityHashMap replacements = new IdentityHashMap<>(); assert args.info.getParameterCount() == parameters.length : "number of args (" + args.info.getParameterCount() + ") != number of parameters (" + parameters.length + ")"; for (int i = 0; i < parameters.length; i++) { @@ -680,7 +682,7 @@ Kind kind = ((LocalNode) parameter).kind(); assert argument != null || kind == Kind.Object : this + " cannot accept null for non-object parameter named " + args.info.names[i]; Constant constant = forBoxed(argument, kind); - replacements.put((LocalNode) parameter, ConstantNode.forConstant(constant, runtime, replaceeGraph)); + replacements.put((LocalNode) parameter, ConstantNode.forConstant(constant, metaAccess, replaceeGraph)); } } else if (parameter instanceof LocalNode[]) { LocalNode[] locals = (LocalNode[]) parameter; @@ -705,7 +707,7 @@ replacements.put(local, (ValueNode) value); } else { Constant constant = forBoxed(value, local.kind()); - ConstantNode element = ConstantNode.forConstant(constant, runtime, replaceeGraph); + ConstantNode element = ConstantNode.forConstant(constant, metaAccess, replaceeGraph); replacements.put(local, element); } } @@ -856,13 +858,13 @@ /** * Replaces a given fixed node with this specialized snippet. * - * @param runtime + * @param metaAccess * @param replacee the node that will be replaced * @param replacer object that replaces the usages of {@code replacee} * @param args the arguments to be bound to the flattened positional parameters of the snippet * @return the map of duplicated nodes (original -> duplicate) */ - public Map instantiate(MetaAccessProvider runtime, FixedNode replacee, UsageReplacer replacer, Arguments args) { + public Map instantiate(MetaAccessProvider metaAccess, FixedNode replacee, UsageReplacer replacer, Arguments args) { assert checkSnippetKills(replacee); try (TimerCloseable a = instantiationTimer.start()) { instantiationCounter.increment(); @@ -870,7 +872,7 @@ StartNode entryPointNode = snippet.start(); FixedNode firstCFGNode = entryPointNode.next(); StructuredGraph replaceeGraph = replacee.graph(); - IdentityHashMap replacements = bind(replaceeGraph, runtime, args); + IdentityHashMap replacements = bind(replaceeGraph, metaAccess, args); replacements.put(entryPointNode, replaceeGraph.start()); Map duplicates = replaceeGraph.addDuplicates(nodes, snippet, snippet.getNodeCount(), replacements); Debug.dump(replaceeGraph, "After inlining snippet %s", snippet.method()); @@ -950,12 +952,12 @@ /** * Replaces a given floating node with this specialized snippet. * - * @param runtime + * @param metaAccess * @param replacee the node that will be replaced * @param replacer object that replaces the usages of {@code replacee} * @param args the arguments to be bound to the flattened positional parameters of the snippet */ - public void instantiate(MetaAccessProvider runtime, FloatingNode replacee, UsageReplacer replacer, LoweringTool tool, Arguments args) { + public void instantiate(MetaAccessProvider metaAccess, FloatingNode replacee, UsageReplacer replacer, LoweringTool tool, Arguments args) { assert checkSnippetKills(replacee); try (TimerCloseable a = instantiationTimer.start()) { instantiationCounter.increment(); @@ -966,7 +968,7 @@ StartNode entryPointNode = snippet.start(); FixedNode firstCFGNode = entryPointNode.next(); StructuredGraph replaceeGraph = replacee.graph(); - IdentityHashMap replacements = bind(replaceeGraph, runtime, args); + IdentityHashMap replacements = bind(replaceeGraph, metaAccess, args); replacements.put(entryPointNode, replaceeGraph.start()); Map duplicates = replaceeGraph.addDuplicates(nodes, snippet, snippet.getNodeCount(), replacements); Debug.dump(replaceeGraph, "After inlining snippet %s", snippetCopy.method()); @@ -1038,16 +1040,16 @@ return buf.append(')').toString(); } - private static boolean checkTemplate(MetaAccessProvider runtime, Arguments args, ResolvedJavaMethod method, Signature signature) { + private static boolean checkTemplate(MetaAccessProvider metaAccess, Arguments args, ResolvedJavaMethod method, Signature signature) { for (int i = 0; i < args.info.getParameterCount(); i++) { if (args.info.isConstantParameter(i)) { Kind kind = signature.getParameterKind(i); - assert checkConstantArgument(runtime, method, signature, i, args.info.names[i], args.values[i], kind); + assert checkConstantArgument(metaAccess, method, signature, i, args.info.names[i], args.values[i], kind); } else if (args.info.isVarargsParameter(i)) { assert args.values[i] instanceof Varargs; Varargs varargs = (Varargs) args.values[i]; - assert checkVarargs(runtime, method, signature, i, args.info.names[i], varargs); + assert checkVarargs(metaAccess, method, signature, i, args.info.names[i], varargs); } } return true; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -96,7 +96,7 @@ */ protected StructuredGraph lowerReplacement(final StructuredGraph replacementGraph, LoweringTool tool) { replacementGraph.setGuardsStage(graph().getGuardsStage()); - final PhaseContext c = new PhaseContext(tool.getRuntime(), tool.assumptions(), tool.getReplacements()); + final PhaseContext c = new PhaseContext(tool.getMetaAccess(), tool.getCodeCache(), tool.assumptions(), tool.getReplacements()); Debug.scope("LoweringReplacement", replacementGraph, new Runnable() { public void run() { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/PureFunctionMacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/PureFunctionMacroNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/PureFunctionMacroNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -50,9 +50,9 @@ } else { ValueNode param = arguments.get(0); if (param.isConstant()) { - Constant constant = evaluate(param.asConstant(), tool.runtime()); + Constant constant = evaluate(param.asConstant(), tool.getMetaAccess()); if (constant != null) { - return ConstantNode.forConstant(constant, tool.runtime(), graph()); + return ConstantNode.forConstant(constant, tool.getMetaAccess(), graph()); } } } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Thu Oct 10 17:07:11 2013 +0200 @@ -56,8 +56,8 @@ public PartialEvaluationTest() { // Make sure Truffle runtime is initialized. Assert.assertTrue(Truffle.getRuntime() instanceof GraalTruffleRuntime); - this.partialEvaluator = new PartialEvaluator(runtime, ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements(), new TruffleCache(runtime, GraphBuilderConfiguration.getDefault(), - TruffleCompilerImpl.Optimizations, ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements())); + this.partialEvaluator = new PartialEvaluator(getMetaAccess(), getCodeCache(), ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements(), new TruffleCache(getMetaAccess(), getCodeCache(), + GraphBuilderConfiguration.getDefault(), TruffleCompilerImpl.Optimizations, ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements())); DebugEnvironment.initialize(System.out); } @@ -105,7 +105,7 @@ public StructuredGraph call() { StructuredGraph resultGraph = partialEvaluator.createGraph(compilable, assumptions); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(canonicalizeReads); - PhaseContext context = new PhaseContext(runtime, assumptions, replacements); + PhaseContext context = new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements); if (resultGraph.hasLoops()) { boolean unrolled; @@ -160,7 +160,7 @@ frameState.replaceAtUsages(null); frameState.safeDelete(); } - new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime, new Assumptions(false), replacements)); + new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), new Assumptions(false), replacements)); new DeadCodeEliminationPhase().apply(graph); } @@ -172,13 +172,13 @@ public StructuredGraph call() { Assumptions assumptions = new Assumptions(false); StructuredGraph graph = parse(methodName); - PhaseContext context = new PhaseContext(runtime, assumptions, replacements); + PhaseContext context = new PhaseContext(getMetaAccess(), getCodeCache(), assumptions, replacements); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); canonicalizer.apply(graph, context); // Additional inlining. final PhasePlan plan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), TruffleCompilerImpl.Optimizations); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getEagerDefault(), TruffleCompilerImpl.Optimizations); plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); canonicalizer.addToPhasePlan(plan, context); plan.addPhase(PhasePosition.AFTER_PARSING, new DeadCodeEliminationPhase()); @@ -187,7 +187,7 @@ canonicalizer.apply(graph, context); new DeadCodeEliminationPhase().apply(graph); - HighTierContext highTierContext = new HighTierContext(runtime, assumptions, replacements, null, plan, OptimisticOptimizations.NONE); + HighTierContext highTierContext = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, plan, OptimisticOptimizations.NONE); InliningPhase inliningPhase = new InliningPhase(canonicalizer); inliningPhase.apply(graph, highTierContext); removeFrameStates(graph); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Thu Oct 10 17:07:11 2013 +0200 @@ -66,7 +66,8 @@ */ public class PartialEvaluator { - private final MetaAccessProvider metaAccessProvider; + private final MetaAccessProvider metaAccess; + private final GraalCodeCacheProvider codeCache; private final ResolvedJavaMethod executeHelperMethod; private final CanonicalizerPhase canonicalizer; private final ResolvedJavaType[] skippedExceptionTypes; @@ -75,8 +76,9 @@ private final HotSpotGraphCache cache; private final TruffleCache truffleCache; - public PartialEvaluator(MetaAccessProvider metaAccessProvider, Replacements replacements, TruffleCache truffleCache) { - this.metaAccessProvider = metaAccessProvider; + public PartialEvaluator(MetaAccessProvider metaAccessProvider, GraalCodeCacheProvider codeCache, Replacements replacements, TruffleCache truffleCache) { + this.metaAccess = metaAccessProvider; + this.codeCache = codeCache; CustomCanonicalizer customCanonicalizer = new PartialEvaluatorCanonicalizer(metaAccessProvider); this.canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue(), customCanonicalizer); this.skippedExceptionTypes = TruffleCompilerImpl.getSkippedExceptionTypes(metaAccessProvider); @@ -116,14 +118,14 @@ @Override public void run() { - new GraphBuilderPhase(metaAccessProvider, config, TruffleCompilerImpl.Optimizations).apply(graph); + new GraphBuilderPhase(metaAccess, config, TruffleCompilerImpl.Optimizations).apply(graph); // Replace thisNode with constant. LocalNode thisNode = graph.getLocal(0); - thisNode.replaceAndDelete(ConstantNode.forObject(node, metaAccessProvider, graph)); + thisNode.replaceAndDelete(ConstantNode.forObject(node, metaAccess, graph)); // Canonicalize / constant propagate. - PhaseContext baseContext = new PhaseContext(metaAccessProvider, assumptions, replacements); + PhaseContext baseContext = new PhaseContext(metaAccess, codeCache, assumptions, replacements); canonicalizer.apply(graph, baseContext); // Intrinsify methods. @@ -157,7 +159,7 @@ // Additional inlining. final PhasePlan plan = new PhasePlan(); canonicalizer.apply(graph, baseContext); - HighTierContext context = new HighTierContext(metaAccessProvider, assumptions, replacements, cache, plan, OptimisticOptimizations.NONE); + HighTierContext context = new HighTierContext(metaAccess, codeCache, assumptions, replacements, cache, plan, OptimisticOptimizations.NONE); for (NeverPartOfCompilationNode neverPartOfCompilationNode : graph.getNodes(NeverPartOfCompilationNode.class)) { Throwable exception = new VerificationError(neverPartOfCompilationNode.getMessage()); @@ -190,7 +192,7 @@ } private void expandTree(StructuredGraph graph, Assumptions assumptions) { - PhaseContext context = new PhaseContext(metaAccessProvider, assumptions, replacements); + PhaseContext context = new PhaseContext(metaAccess, codeCache, assumptions, replacements); boolean changed; do { changed = false; @@ -252,7 +254,7 @@ ValueNode arg = arguments.get(local.index()); if (arg.isConstant()) { Constant constant = arg.asConstant(); - ConstantNode constantNode = ConstantNode.forConstant(constant, metaAccessProvider, graphCopy); + ConstantNode constantNode = ConstantNode.forConstant(constant, metaAccess, graphCopy); local.replaceAndDelete(constantNode); for (Node usage : constantNode.usages()) { if (usage instanceof Canonicalizable) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Thu Oct 10 17:07:11 2013 +0200 @@ -54,7 +54,8 @@ */ public final class TruffleCache { - private final MetaAccessProvider metaAccessProvider; + private final MetaAccessProvider metaAccess; + private final GraalCodeCacheProvider codeCache; private final GraphBuilderConfiguration config; private final OptimisticOptimizations optimisticOptimizations; private final Replacements replacements; @@ -63,12 +64,13 @@ private final StructuredGraph markerGraph = new StructuredGraph(); private final ResolvedJavaType stringBuilderClass; - public TruffleCache(MetaAccessProvider metaAccessProvider, GraphBuilderConfiguration config, OptimisticOptimizations optimisticOptimizations, Replacements replacements) { - this.metaAccessProvider = metaAccessProvider; + public TruffleCache(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, GraphBuilderConfiguration config, OptimisticOptimizations optimisticOptimizations, Replacements replacements) { + this.metaAccess = metaAccess; + this.codeCache = codeCache; this.config = config; this.optimisticOptimizations = optimisticOptimizations; this.replacements = replacements; - this.stringBuilderClass = metaAccessProvider.lookupJavaType(StringBuilder.class); + this.stringBuilderClass = metaAccess.lookupJavaType(StringBuilder.class); } @SuppressWarnings("unused") @@ -92,13 +94,13 @@ } cache.put(key, markerGraph); - resultGraph = Debug.scope("TruffleCache", new Object[]{metaAccessProvider, method}, new Callable() { + resultGraph = Debug.scope("TruffleCache", new Object[]{metaAccess, method}, new Callable() { public StructuredGraph call() { final StructuredGraph graph = new StructuredGraph(method); - PhaseContext context = new PhaseContext(metaAccessProvider, new Assumptions(false), replacements); - new GraphBuilderPhase(metaAccessProvider, config, optimisticOptimizations).apply(graph); + PhaseContext context = new PhaseContext(metaAccess, codeCache, new Assumptions(false), replacements); + new GraphBuilderPhase(metaAccess, config, optimisticOptimizations).apply(graph); for (LocalNode l : graph.getNodes(LocalNode.class)) { if (l.kind() == Kind.Object) { @@ -122,7 +124,7 @@ partialEscapePhase.apply(graph, context); // Conditional elimination. - ConditionalEliminationPhase conditionalEliminationPhase = new ConditionalEliminationPhase(metaAccessProvider); + ConditionalEliminationPhase conditionalEliminationPhase = new ConditionalEliminationPhase(metaAccess); conditionalEliminationPhase.apply(graph); // Canonicalize / constant propagate. @@ -206,8 +208,8 @@ private boolean tryCutOffRuntimeExceptions(MethodCallTargetNode methodCallTargetNode) { if (methodCallTargetNode.targetMethod().isConstructor()) { - ResolvedJavaType runtimeException = metaAccessProvider.lookupJavaType(RuntimeException.class); - ResolvedJavaType controlFlowException = metaAccessProvider.lookupJavaType(ControlFlowException.class); + ResolvedJavaType runtimeException = metaAccess.lookupJavaType(RuntimeException.class); + ResolvedJavaType controlFlowException = metaAccess.lookupJavaType(ControlFlowException.class); ResolvedJavaType exceptionType = Objects.requireNonNull(ObjectStamp.typeOrNull(methodCallTargetNode.receiver().stamp())); if (runtimeException.isAssignableFrom(methodCallTargetNode.targetMethod().getDeclaringClass()) && !controlFlowException.isAssignableFrom(exceptionType)) { DeoptimizeNode deoptNode = methodCallTargetNode.graph().add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.UnreachedCode)); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Thu Oct 10 17:07:11 2013 +0200 @@ -53,10 +53,10 @@ */ public class TruffleCompilerImpl implements TruffleCompiler { - private final GraalCodeCacheProvider runtime; + private final MetaAccessProvider metaAccess; + private final GraalCodeCacheProvider codeCache; private final Suites suites; private final PartialEvaluator partialEvaluator; - private final MetaAccessProvider metaAccessProvider; private final Replacements replacements; private final Backend backend; private final ResolvedJavaType[] skippedExceptionTypes; @@ -69,19 +69,19 @@ OptimisticOptimizations.Optimization.RemoveNeverExecutedCode, OptimisticOptimizations.Optimization.UseTypeCheckedInlining, OptimisticOptimizations.Optimization.UseTypeCheckHints); public TruffleCompilerImpl() { - this.runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class); + this.metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); + this.codeCache = Graal.getRequiredCapability(GraalCodeCacheProvider.class); this.suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); - this.metaAccessProvider = Graal.getRequiredCapability(MetaAccessProvider.class); this.backend = Graal.getRequiredCapability(Backend.class); this.replacements = ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements(); this.graalRuntime = HotSpotGraalRuntime.graalRuntime(); - this.skippedExceptionTypes = getSkippedExceptionTypes(metaAccessProvider); + this.skippedExceptionTypes = getSkippedExceptionTypes(metaAccess); final GraphBuilderConfiguration config = GraphBuilderConfiguration.getEagerDefault(); config.setSkippedExceptionTypes(skippedExceptionTypes); - this.truffleCache = new TruffleCache(this.runtime, config, TruffleCompilerImpl.Optimizations, this.replacements); + this.truffleCache = new TruffleCache(this.metaAccess, codeCache, config, TruffleCompilerImpl.Optimizations, this.replacements); - this.partialEvaluator = new PartialEvaluator(metaAccessProvider, replacements, truffleCache); + this.partialEvaluator = new PartialEvaluator(metaAccess, codeCache, replacements, truffleCache); if (Debug.isEnabled()) { DebugEnvironment.initialize(System.out); @@ -150,9 +150,9 @@ @Override public CompilationResult call() { try (TimerCloseable a = CompilationTime.start()) { - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - return GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, plan, OptimisticOptimizations.ALL, new SpeculationLog(), - suites, new CompilationResult()); + CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); + return GraalCompiler.compileGraph(graph, cc, graph.method(), metaAccess, codeCache, replacements, backend, codeCache.getTarget(), null, plan, OptimisticOptimizations.ALL, + new SpeculationLog(), suites, new CompilationResult()); } } }); @@ -178,7 +178,7 @@ @Override public InstalledCode call() throws Exception { try (TimerCloseable a = CodeInstallationTime.start()) { - InstalledCode installedCode = runtime.addMethod(graph.method(), result); + InstalledCode installedCode = codeCache.addMethod(graph.method(), result); if (installedCode != null) { Debug.dump(new Object[]{result, installedCode}, "After code installation"); } @@ -192,7 +192,7 @@ } if (Debug.isLogEnabled()) { - Debug.log(runtime.disassemble(result, compiledMethod)); + Debug.log(codeCache.disassemble(result, compiledMethod)); } if (compilable != null) { compilable.codeSize = result.getTargetCodeSize(); @@ -202,7 +202,7 @@ private PhasePlan createPhasePlan(final GraphBuilderConfiguration config) { final PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(metaAccessProvider, config, TruffleCompilerImpl.Optimizations); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(metaAccess, config, TruffleCompilerImpl.Optimizations); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); return phasePlan; } diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java Thu Oct 10 17:07:11 2013 +0200 @@ -41,16 +41,17 @@ private final Replacements graalReplacements; - private TruffleReplacements(MetaAccessProvider runtime, Assumptions assumptions, TargetDescription target, Replacements graalReplacements) { - super(runtime, assumptions, target); + private TruffleReplacements(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Assumptions assumptions, TargetDescription target, Replacements graalReplacements) { + super(metaAccess, codeCache, assumptions, target); this.graalReplacements = graalReplacements; } static Replacements makeInstance() { - MetaAccessProvider metaAccessProvider = Graal.getRequiredCapability(MetaAccessProvider.class); + MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); + GraalCodeCacheProvider codeCache = Graal.getRequiredCapability(GraalCodeCacheProvider.class); TargetDescription targetDescription = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); Replacements graalReplacements = Graal.getRequiredCapability(Replacements.class); - Replacements truffleReplacements = new TruffleReplacements(metaAccessProvider, graalReplacements.getAssumptions(), targetDescription, graalReplacements); + Replacements truffleReplacements = new TruffleReplacements(metaAccess, codeCache, graalReplacements.getAssumptions(), targetDescription, graalReplacements); truffleReplacements.registerSubstitutions(CompilerAssertsSubstitutions.class); truffleReplacements.registerSubstitutions(CompilerDirectivesSubstitutions.class); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/LoadIndexedFinalNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/LoadIndexedFinalNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/LoadIndexedFinalNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -58,8 +58,8 @@ if (index >= 0 && index < Array.getLength(array)) { int arrayBaseOffset = Unsafe.getUnsafe().arrayBaseOffset(array.getClass()); int arrayIndexScale = Unsafe.getUnsafe().arrayIndexScale(array.getClass()); - Constant constant = tool.runtime().readUnsafeConstant(elementKind(), array, arrayBaseOffset + index * arrayIndexScale, elementKind() == Kind.Object); - return ConstantNode.forConstant(constant, tool.runtime(), graph()); + Constant constant = tool.getMetaAccess().readUnsafeConstant(elementKind(), array, arrayBaseOffset + index * arrayIndexScale, elementKind() == Kind.Object); + return ConstantNode.forConstant(constant, tool.getMetaAccess(), graph()); } } return this; diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -79,14 +79,14 @@ structuredGraph.addBeforeFixed(this, loadFieldNode); FixedWithNextNode loadNode; if (isTagAccess()) { - ValueNode slotIndex = getSlotOffset(1, tool.getRuntime()); + ValueNode slotIndex = getSlotOffset(1, tool.getMetaAccess()); loadNode = graph().add(new LoadIndexedNode(loadFieldNode, slotIndex, getSlotKind())); } else if (!getSlotKind().isPrimitive()) { - ValueNode slotIndex = getSlotOffset(1, tool.getRuntime()); + ValueNode slotIndex = getSlotOffset(1, tool.getMetaAccess()); loadNode = graph().add(new LoadIndexedNode(loadFieldNode, slotIndex, Kind.Object)); } else { ValueNode slotOffset = graph().unique( - new IntegerAddNode(Kind.Long, getSlotOffset(Unsafe.ARRAY_LONG_INDEX_SCALE, tool.getRuntime()), ConstantNode.forLong(Unsafe.ARRAY_LONG_BASE_OFFSET, graph()))); + new IntegerAddNode(Kind.Long, getSlotOffset(Unsafe.ARRAY_LONG_INDEX_SCALE, tool.getMetaAccess()), ConstantNode.forLong(Unsafe.ARRAY_LONG_BASE_OFFSET, graph()))); loadNode = graph().add(new UnsafeLoadNode(loadFieldNode, slotOffset, getSlotKind())); } structuredGraph.replaceFixedWithFixed(this, loadNode); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -77,7 +77,7 @@ LoadFieldNode loadFieldNode = graph().add(new LoadFieldNode(getFrame(), field)); structuredGraph.addBeforeFixed(this, loadFieldNode); FixedWithNextNode storeNode; - ValueNode slotIndex = getSlotOffset(1, tool.getRuntime()); + ValueNode slotIndex = getSlotOffset(1, tool.getMetaAccess()); if (isTagAccess()) { storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, getSlotKind(), value)); } else if (!getSlotKind().isPrimitive()) { diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java Thu Oct 10 17:07:11 2013 +0200 @@ -57,7 +57,7 @@ if (c == null) { return objectArgument; } - ResolvedJavaType lookupJavaType = tool.runtime().lookupJavaType(c); + ResolvedJavaType lookupJavaType = tool.getMetaAccess().lookupJavaType(c); ConditionAnchorNode valueAnchorNode = graph().add(new ConditionAnchorNode(CompareNode.createCompareNode(Condition.EQ, conditionArgument, ConstantNode.forBoolean(true, graph())))); UnsafeCastNode piCast = graph().unique(new UnsafeCastNode(objectArgument, StampFactory.declaredNonNull(lookupJavaType), valueAnchorNode)); this.replaceAtUsages(piCast); diff -r a8819fceb5b5 -r 7e5cf369559f graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapePhase.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapePhase.java Thu Oct 10 17:06:03 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapePhase.java Thu Oct 10 17:07:11 2013 +0200 @@ -72,9 +72,9 @@ @Override protected Closure createEffectsClosure(PhaseContext context, SchedulePhase schedule) { if (readElimination) { - return new PEReadEliminationClosure(schedule, context.getRuntime(), context.getAssumptions()); + return new PEReadEliminationClosure(schedule, context.getMetaAccess(), context.getAssumptions()); } else { - return new PartialEscapeClosure.Final(schedule, context.getRuntime(), context.getAssumptions()); + return new PartialEscapeClosure.Final(schedule, context.getMetaAccess(), context.getAssumptions()); } }