# HG changeset patch # User Thomas Wuerthinger # Date 1424109073 -3600 # Node ID e6637891a8708332fab27da98c97d78ec0a75dab # Parent b029f5244371ddf1473c0fec30741d77e533e591 Simplify NodeClass management. diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchProcessor.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchProcessor.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchProcessor.java Mon Feb 16 18:51:13 2015 +0100 @@ -455,7 +455,7 @@ } String generatePositionDeclaration() { - return String.format("Position[] %s_positions = MatchRuleRegistry.findPositions(lookup, %s.class, new String[]{\"%s\"});", nodeType.nodeClass, nodeType.nodeClass, + return String.format("Position[] %s_positions = MatchRuleRegistry.findPositions(%s.TYPE, new String[]{\"%s\"});", nodeType.nodeClass, nodeType.nodeClass, String.join("\", \"", nodeType.inputs)); } } @@ -535,7 +535,7 @@ out.println(" }"); out.println(); out.println(" @Override"); - out.println(" public List<" + desc + "> statements(MatchRuleRegistry.NodeClassLookup lookup) {"); + out.println(" public List<" + desc + "> statements() {"); out.println(" // Checkstyle: stop "); for (String positionDeclaration : info.positionDeclarations) { diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Mon Feb 16 18:51:13 2015 +0100 @@ -39,32 +39,16 @@ public class MatchRuleRegistry { /** - * Helper interface for mapping between Class and NodeClass. In static compilation environments, - * the current NodeClass might not be the same NodeClass used in the target so this provides a - * level of indirection. - */ - public interface NodeClassLookup { - NodeClass get(Class theClass); - } - - static class DefaultNodeClassLookup implements NodeClassLookup { - public NodeClass get(Class theClass) { - return NodeClass.get(theClass); - } - } - - /** * Convert a list of field names into {@link com.oracle.graal.graph.Position} objects that can * be used to read them during a match. The names should already have been confirmed to exist in * the type. * - * @param theClass + * @param nodeClass * @param names * @return an array of Position objects corresponding to the named fields. */ - public static Position[] findPositions(NodeClassLookup lookup, Class theClass, String[] names) { + public static Position[] findPositions(NodeClass nodeClass, String[] names) { Position[] result = new Position[names.length]; - NodeClass nodeClass = lookup.get(theClass); for (int i = 0; i < names.length; i++) { Edges edges = nodeClass.getEdges(Inputs); for (int e = 0; e < edges.getDirectCount(); e++) { @@ -73,7 +57,7 @@ } } if (result[i] == null) { - throw new GraalInternalError("unknown field \"%s\" in class %s", names[i], theClass); + throw new GraalInternalError("unknown field \"%s\" in class %s", names[i], nodeClass); } } return result; @@ -91,8 +75,7 @@ Map, List> result = registry.get(theClass); if (result == null) { - NodeClassLookup lookup = new DefaultNodeClassLookup(); - Map, List> rules = createRules(theClass, lookup); + Map, List> rules = createRules(theClass); registry.put(theClass, rules); assert registry.get(theClass) == rules; result = rules; @@ -120,7 +103,7 @@ * This is a separate, public method so that external clients can create rules with a custom * lookup and without the default caching behavior. */ - public static Map, List> createRules(Class theClass, NodeClassLookup lookup) { + public static Map, List> createRules(Class theClass) { HashMap, MatchStatementSet> matchSets = new HashMap<>(); Iterable sl = Services.load(MatchStatementSet.class); for (MatchStatementSet rules : sl) { @@ -134,7 +117,7 @@ do { MatchStatementSet matchSet = matchSets.get(currentClass); if (matchSet != null) { - List statements = matchSet.statements(lookup); + List statements = matchSet.statements(); for (MatchStatement statement : statements) { Class nodeClass = statement.getPattern().nodeClass(); List current = rules.get(nodeClass); diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java Mon Feb 16 18:51:13 2015 +0100 @@ -37,5 +37,5 @@ /** * @return the {@link MatchStatement}s available for this {@link NodeLIRBuilder} subclass. */ - List statements(MatchRuleRegistry.NodeClassLookup lookup); + List statements(); } diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Mon Feb 16 18:51:13 2015 +0100 @@ -52,10 +52,7 @@ */ public final class NodeClass extends FieldIntrospection { - private static final Object GetNodeClassLock = new Object(); - // Timers for creation of a NodeClass instance - private static final DebugTimer Init = Debug.timer("NodeClass.Init"); private static final DebugTimer Init_FieldScanning = Debug.timer("NodeClass.Init.FieldScanning"); private static final DebugTimer Init_FieldScanningInner = Debug.timer("NodeClass.Init.FieldScanning.Inner"); private static final DebugTimer Init_AnnotationParsing = Debug.timer("NodeClass.Init.AnnotationParsing"); @@ -75,32 +72,24 @@ */ @SuppressWarnings({"unchecked", "rawtypes"}) public static NodeClass get(Class c) { - Class key = (Class) c; + assert getNodeClassViaReflection(c) == null; + Class superclass = c.getSuperclass(); + NodeClass nodeSuperclass = null; + if (superclass != NODE_CLASS) { + nodeSuperclass = getNodeClassViaReflection(superclass); + } + return new NodeClass(c, nodeSuperclass); + } - NodeClass value = (NodeClass) allClasses.get(key); - // The fact that {@link ConcurrentHashMap#put} and {@link ConcurrentHashMap#get} - // are used makes the double-checked locking idiom work. - if (value == null) { - // The creation of a NodeClass must be serialized as the NodeClass constructor accesses - // both FieldIntrospection.allClasses and NodeClass.nextIterableId. - synchronized (GetNodeClassLock) { - try (TimerCloseable t = Init.start()) { - value = (NodeClass) allClasses.get(key); - if (value == null) { - Class superclass = c.getSuperclass(); - NodeClass superNodeClass = null; - if (superclass != NODE_CLASS) { - // Ensure NodeClass for superclass exists - superNodeClass = get(superclass); - } - value = new NodeClass(key, superNodeClass); - Object old = allClasses.putIfAbsent(key, value); - assert old == null : old + " " + key; - } - } - } + @SuppressWarnings("rawtypes") + private static NodeClass getNodeClassViaReflection(Class superclass) { + try { + Field field = superclass.getDeclaredField("TYPE"); + field.setAccessible(true); + return (NodeClass) field.get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { + throw new RuntimeException(e); } - return (NodeClass) value; } private static final Class NODE_CLASS = Node.class; diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNodeClassSubstitutionsTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNodeClassSubstitutionsTest.java Mon Feb 16 18:08:55 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.test; - -import org.junit.*; - -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.replacements.test.*; - -/** - * Tests HotSpot specific substitutions for {@link NodeClass}. - */ -public class HotSpotNodeClassSubstitutionsTest extends MethodSubstitutionTest { - - @Test - public void test() { - test("get", ValueNode.class); - } - - public static NodeClass get(Class c) { - return NodeClass.get(c); - } -} diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon Feb 16 18:51:13 2015 +0100 @@ -898,7 +898,6 @@ @HotSpotVMField(name = "Array::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayLengthOffset; @HotSpotVMField(name = "Array::_data[0]", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayBaseOffset; - @HotSpotVMField(name = "InstanceKlass::_graal_node_class", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassNodeClassOffset; @HotSpotVMField(name = "InstanceKlass::_source_file_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassSourceFileNameIndexOffset; @HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset; @HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset; diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java Mon Feb 16 18:51:13 2015 +0100 @@ -26,7 +26,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.*; -import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding; @@ -107,8 +106,6 @@ assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror(); } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) { assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().getComponentType(); - } else if (displacement == runtime.getConfig().instanceKlassNodeClassOffset) { - assert expected == NodeClass.get(((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror()); } } } diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java Mon Feb 16 18:51:13 2015 +0100 @@ -27,7 +27,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; /** @@ -62,14 +61,6 @@ int getIdentityHashCode(); /** - * Gets the result of {@link NodeClass#get(Class)} for the {@link Class} object represented by - * this constant. - * - * @return {@code null} if this constant does not represent a {@link Class} object - */ - JavaConstant getNodeClass(); - - /** * Gets the result of {@link Class#getComponentType()} for the {@link Class} object represented * by this constant. * diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java Mon Feb 16 18:51:13 2015 +0100 @@ -28,7 +28,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.lir.*; @@ -157,13 +156,6 @@ return System.identityHashCode(object); } - public JavaConstant getNodeClass() { - if (object instanceof Class) { - return HotSpotObjectConstantImpl.forObject(NodeClass.get((Class) object)); - } - return null; - } - public JavaConstant getComponentType() { if (object instanceof Class) { return HotSpotObjectConstantImpl.forObject(((Class) object).getComponentType()); diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotNodeClassSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotNodeClassSubstitutions.java Mon Feb 16 18:08:55 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.replacements; - -import static com.oracle.graal.compiler.common.GraalOptions.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.replacements.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.meta.*; -import com.oracle.graal.nodeinfo.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.replacements.nodes.*; - -/** - * Substitutions for improving the performance of {@link NodeClass#get}. - */ -@ClassSubstitution(NodeClass.class) -public class HotSpotNodeClassSubstitutions { - - /** - * A macro node for calls to {@link NodeClass#get(Class)}. It can use the compiler's knowledge - * about node classes to replace itself with a constant value for a constant {@link Class} - * parameter. - */ - @NodeInfo - public static final class NodeClassGetNode extends PureFunctionMacroNode { - public static final NodeClass TYPE = NodeClass.get(NodeClassGetNode.class); - - public NodeClassGetNode(Invoke invoke) { - super(TYPE, invoke); - } - - @Override - protected JavaConstant evaluate(JavaConstant param, MetaAccessProvider metaAccess) { - if (param.isNull() || ImmutableCode.getValue()) { - return null; - } - HotSpotObjectConstant c = (HotSpotObjectConstant) param; - return c.getNodeClass(); - } - } - - /** - * NOTE: A {@link MethodSubstitution} similar to - * {@link HotSpotNodeSubstitutions#getNodeClass(Node)} is not possible here because there is no - * guarantee that {@code c} is initialized (accessing a Class literal in Java is not a class - * initialization barrier). - */ - @MacroSubstitution(isStatic = true, forced = true, macro = NodeClassGetNode.class) - public static native NodeClass get(Class c); -} diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotNodeSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotNodeSubstitutions.java Mon Feb 16 18:08:55 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.replacements; - -import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; -import static com.oracle.graal.nodes.PiNode.*; - -import com.oracle.graal.api.replacements.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.word.*; -import com.oracle.graal.word.*; - -@ClassSubstitution(Node.class) -public class HotSpotNodeSubstitutions { - - /** - * Gets the value of the {@code InstanceKlass::_graal_node_class} field from the InstanceKlass - * pointed to by {@code node}'s header. - */ - @MethodSubstitution(isStatic = false) - public static NodeClass getNodeClass(final Node node) { - // HotSpot creates the NodeClass for each Node subclass while initializing it - // so we are guaranteed to read a non-null value here. As long as NodeClass - // is final, the stamp of the PiNode below will automatically be exact. - KlassPointer klass = loadHub(node); - return piCastNonNull(klass.readObject(Word.signed(instanceKlassNodeClassOffset()), KLASS_NODE_CLASS), NodeClass.class); - } -} diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon Feb 16 18:51:13 2015 +0100 @@ -661,13 +661,6 @@ return config().arrayKlassOffset; } - public static final LocationIdentity KLASS_NODE_CLASS = NamedLocationIdentity.immutable("KlassNodeClass"); - - @Fold - public static int instanceKlassNodeClassOffset() { - return config().instanceKlassNodeClassOffset; - } - public static final LocationIdentity CLASS_MIRROR_LOCATION = NamedLocationIdentity.immutable("Klass::_java_mirror"); @Fold diff -r b029f5244371 -r e6637891a870 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Mon Feb 16 18:08:55 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Mon Feb 16 18:51:13 2015 +0100 @@ -32,7 +32,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.api.runtime.*; -import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.lir.*; import com.oracle.graal.nodes.spi.*; @@ -63,8 +62,6 @@ replacements.registerSubstitutions(Class.class, HotSpotClassSubstitutions.class); replacements.registerSubstitutions(CRC32.class, CRC32Substitutions.class); replacements.registerSubstitutions(Reflection.class, ReflectionSubstitutions.class); - replacements.registerSubstitutions(NodeClass.class, HotSpotNodeClassSubstitutions.class); - replacements.registerSubstitutions(Node.class, HotSpotNodeSubstitutions.class); replacements.registerSubstitutions(CompositeValueClass.class, CompositeValueClassSubstitutions.class); replacements.registerSubstitutions(CompilerToVMImpl.class, CompilerToVMImplSubstitutions.class); replacements.registerSubstitutions(new NamedType("com.sun.crypto.provider.AESCrypt"), AESCryptSubstitutions.class); diff -r b029f5244371 -r e6637891a870 src/share/vm/graal/vmStructs_graal.hpp --- a/src/share/vm/graal/vmStructs_graal.hpp Mon Feb 16 18:08:55 2015 +0100 +++ b/src/share/vm/graal/vmStructs_graal.hpp Mon Feb 16 18:51:13 2015 +0100 @@ -31,7 +31,6 @@ #include "graal/graalEnv.hpp" #define VM_STRUCTS_GRAAL(nonstatic_field, static_field) \ - nonstatic_field(InstanceKlass, _graal_node_class, oop) \ nonstatic_field(ThreadShadow, _pending_deoptimization, int) \ nonstatic_field(ThreadShadow, _pending_failed_speculation, oop) \ nonstatic_field(ThreadShadow, _pending_transfer_to_interpreter, bool) \ diff -r b029f5244371 -r e6637891a870 src/share/vm/oops/instanceKlass.cpp --- a/src/share/vm/oops/instanceKlass.cpp Mon Feb 16 18:08:55 2015 +0100 +++ b/src/share/vm/oops/instanceKlass.cpp Mon Feb 16 18:51:13 2015 +0100 @@ -294,9 +294,6 @@ set_init_state(InstanceKlass::allocated); set_init_thread(NULL); set_reference_type(rt); -#ifdef GRAAL - set_graal_node_class(NULL); -#endif set_oop_map_cache(NULL); set_jni_ids(NULL); set_osr_nmethods_head(NULL); @@ -326,13 +323,6 @@ set_layout_helper(Klass::instance_layout_helper(0, true)); } -#ifdef GRAAL -void InstanceKlass::oops_do(OopClosure* cl) { - Klass::oops_do(cl); - cl->do_oop(adr_graal_node_class()); -} -#endif - void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data, Array* methods) { if (methods != NULL && methods != Universe::the_empty_method_array() && @@ -1208,29 +1198,6 @@ JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args) } -#ifdef GRAAL - if (SystemDictionary::Node_klass() != NULL && this_oop->is_subtype_of(SystemDictionary::Node_klass())) { - if (this_oop() != SystemDictionary::Node_klass()) { - if (!GraalRuntime::is_HotSpotGraalRuntime_initialized() && JavaAssertions::systemClassDefault() == false) { - // We want to ensure that the process of initializing HotSpotGraalRuntime - // is fast since it executes at VM startup. We must avoid triggering - // class initialization of any Node classes during this process. - ResourceMark rm; - char buf[200]; - jio_snprintf(buf, sizeof(buf), "Node subclass %s must not be initialized before HotSpotGraalRuntime is initialized", this_oop->name()->as_C_string()); - THROW_MSG(vmSymbols::java_lang_InternalError(), buf); - } - // Create the NodeClass for a Node subclass. - TempNewSymbol sig = SymbolTable::new_symbol("(Ljava/lang/Class;)Lcom/oracle/graal/graph/NodeClass;", CHECK); - JavaValue result(T_OBJECT); - JavaCalls::call_static(&result, SystemDictionary::NodeClass_klass(), vmSymbols::get_name(), sig, this_oop->java_mirror(), CHECK); - this_oop->set_graal_node_class((oop) result.get_jobject()); - } else { - // A NodeClass cannot be created for Node due to checks in - // NodeClass.FieldScanner.scanField() - } - } -#endif } @@ -2310,10 +2277,6 @@ } init_implementor(); -#ifdef GRAAL - set_graal_node_class(NULL); -#endif - constants()->remove_unshareable_info(); for (int i = 0; i < methods()->length(); i++) { diff -r b029f5244371 -r e6637891a870 src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp Mon Feb 16 18:08:55 2015 +0100 +++ b/src/share/vm/oops/instanceKlass.hpp Mon Feb 16 18:51:13 2015 +0100 @@ -241,10 +241,6 @@ Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) int _vtable_len; // length of Java vtable (in words) int _itable_len; // length of Java itable (in words) -#ifdef GRAAL - // com/oracle/graal/graph/NodeClass instance mirroring this class - oop _graal_node_class; -#endif OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily) MemberNameTable* _member_names; // Member names JNIid* _jni_ids; // First JNI identifier for static fields in this class @@ -751,16 +747,6 @@ void call_class_initializer(TRAPS); void set_initialization_state_and_notify(ClassState state, TRAPS); -#ifdef GRAAL - // Graal com.oracle.graal.graph.NodeClass mirror - oop graal_node_class() { return _graal_node_class; } - void set_graal_node_class(oop m) { klass_oop_store(&_graal_node_class, m); } - oop* adr_graal_node_class() { return (oop*)&this->_graal_node_class; } - - // GC support - virtual void oops_do(OopClosure* cl); -#endif - // OopMapCache support OopMapCache* oop_map_cache() { return _oop_map_cache; } void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }