changeset 19801:2e6e20ac56b4

moved WordTypes from c.o.g.word.phases to c.o.g.word
author Doug Simon <doug.simon@oracle.com>
date Thu, 12 Mar 2015 07:13:05 +0100
parents c59d8ba9ced5
children 4545e180658c
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypes.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java graal/com.oracle.graal.word/src/com/oracle/graal/word/WordTypes.java graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypes.java
diffstat 16 files changed, 145 insertions(+), 154 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu Mar 12 07:13:05 2015 +0100
@@ -43,7 +43,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.replacements.*;
-import com.oracle.graal.word.phases.*;
+import com.oracle.graal.word.*;
 
 /**
  * Defines the {@link Plugins} used when running on HotSpot.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java	Thu Mar 12 07:13:05 2015 +0100
@@ -29,7 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.word.phases.*;
+import com.oracle.graal.word.*;
 
 public final class HotSpotParameterPlugin implements ParameterPlugin {
     private final WordTypes wordTypes;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Thu Mar 12 07:13:05 2015 +0100
@@ -39,7 +39,7 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.replacements.*;
-import com.oracle.graal.word.phases.*;
+import com.oracle.graal.word.*;
 
 /**
  * Extends {@link WordOperationPlugin} to handle {@linkplain HotSpotOperation HotSpot word
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java	Thu Mar 12 07:13:05 2015 +0100
@@ -32,7 +32,6 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * Intrinsic for opening a scope binding a stack-based lock with an object. A lock scope must be
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java	Thu Mar 12 07:13:05 2015 +0100
@@ -29,7 +29,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * Converts a compile-time constant Java string into a C string installed with the generated code.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java	Thu Mar 12 07:13:05 2015 +0100
@@ -32,7 +32,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * Gets the address of the C++ JavaThread object for the current thread.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java	Thu Mar 12 07:13:05 2015 +0100
@@ -31,7 +31,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * Intrinsic for getting the lock in the current {@linkplain BeginLockScopeNode lock scope}.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java	Thu Mar 12 07:13:05 2015 +0100
@@ -35,7 +35,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * Intrinsic for allocating an on-stack array of integers to hold the dimensions of a multianewarray
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java	Thu Mar 12 07:13:05 2015 +0100
@@ -32,7 +32,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * Node that is used to maintain a stack based counter of how many locks are currently held.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Thu Mar 12 07:13:05 2015 +0100
@@ -38,7 +38,6 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * A {@linkplain #getGraph() generated} stub for a {@link Transition non-leaf} foreign call from
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypes.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypes.java	Thu Mar 12 07:13:05 2015 +0100
@@ -25,7 +25,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.nodes.type.*;
-import com.oracle.graal.word.phases.*;
+import com.oracle.graal.word.*;
 
 /**
  * Extends {@link WordTypes} with information about HotSpot metaspace pointer types.
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Thu Mar 12 07:13:05 2015 +0100
@@ -35,7 +35,7 @@
 import com.oracle.graal.java.GraphBuilderPlugin.GenericInvocationPlugin;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.word.phases.*;
+import com.oracle.graal.word.*;
 
 /**
  * An {@link GenericInvocationPlugin} that handles methods annotated by {@link Fold},
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java	Thu Mar 12 07:13:05 2015 +0100
@@ -38,7 +38,7 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.replacements.ReplacementsImpl.FrameStateProcessing;
-import com.oracle.graal.word.phases.*;
+import com.oracle.graal.word.*;
 
 /**
  * A utility for manually creating a graph. This will be expanded as necessary to support all
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Thu Mar 12 01:11:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Thu Mar 12 07:13:05 2015 +0100
@@ -42,7 +42,6 @@
 import com.oracle.graal.word.Word.Opcode;
 import com.oracle.graal.word.Word.Operation;
 import com.oracle.graal.word.nodes.*;
-import com.oracle.graal.word.phases.*;
 
 /**
  * A {@link GenericInvocationPlugin} for calls to {@linkplain Operation word operations}.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/WordTypes.java	Thu Mar 12 07:13:05 2015 +0100
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2012, 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.word;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.type.*;
+import com.oracle.graal.word.Word.Operation;
+
+/**
+ * Encapsulates information for Java types representing raw words (as opposed to Objects).
+ */
+public class WordTypes {
+
+    /**
+     * Resolved type for {@link WordBase}.
+     */
+    private final ResolvedJavaType wordBaseType;
+
+    /**
+     * Resolved type for {@link Word}.
+     */
+    private final ResolvedJavaType wordImplType;
+
+    /**
+     * Resolved type for {@link ObjectAccess}.
+     */
+    private final ResolvedJavaType objectAccessType;
+
+    /**
+     * Resolved type for {@link BarrieredAccess}.
+     */
+    private final ResolvedJavaType barrieredAccessType;
+
+    private final Kind wordKind;
+
+    public WordTypes(MetaAccessProvider metaAccess, Kind wordKind) {
+        this.wordKind = wordKind;
+        this.wordBaseType = metaAccess.lookupJavaType(WordBase.class);
+        this.wordImplType = metaAccess.lookupJavaType(Word.class);
+        this.objectAccessType = metaAccess.lookupJavaType(ObjectAccess.class);
+        this.barrieredAccessType = metaAccess.lookupJavaType(BarrieredAccess.class);
+    }
+
+    /**
+     * Determines if a given method denotes a word operation.
+     */
+    public boolean isWordOperation(ResolvedJavaMethod targetMethod) {
+        final boolean isObjectAccess = objectAccessType.equals(targetMethod.getDeclaringClass());
+        final boolean isBarrieredAccess = barrieredAccessType.equals(targetMethod.getDeclaringClass());
+        if (isObjectAccess || isBarrieredAccess) {
+            assert targetMethod.getAnnotation(Operation.class) != null : targetMethod + " should be annotated with @" + Operation.class.getSimpleName();
+            return true;
+        }
+        return isWord(targetMethod.getDeclaringClass());
+    }
+
+    /**
+     * Gets the method annotated with {@link Operation} based on a given method that represents a
+     * word operation (but may not necessarily have the annotation).
+     *
+     * @param callingContextType the {@linkplain ResolvedJavaType type} from which
+     *            {@code targetMethod} is invoked
+     * @return the {@link Operation} method resolved for {@code targetMethod} if any
+     */
+    public ResolvedJavaMethod getWordOperation(ResolvedJavaMethod targetMethod, ResolvedJavaType callingContextType) {
+        final boolean isWordBase = wordBaseType.isAssignableFrom(targetMethod.getDeclaringClass());
+        ResolvedJavaMethod wordMethod = targetMethod;
+        if (isWordBase && !targetMethod.isStatic()) {
+            assert wordImplType.isLinked();
+            wordMethod = wordImplType.resolveConcreteMethod(targetMethod, callingContextType);
+        }
+        assert wordMethod.getAnnotation(Operation.class) != null : wordMethod;
+        return wordMethod;
+    }
+
+    /**
+     * Determines if a given node has a word type.
+     */
+    public boolean isWord(ValueNode node) {
+        return isWord(StampTool.typeOrNull(node));
+    }
+
+    /**
+     * Determines if a given type is a word type.
+     */
+    public boolean isWord(ResolvedJavaType type) {
+        return type != null && wordBaseType.isAssignableFrom(type);
+    }
+
+    /**
+     * Gets the kind for a given type, returning the {@linkplain #getWordKind() word kind} if
+     * {@code type} is a {@linkplain #isWord(ResolvedJavaType) word type}.
+     */
+    public Kind asKind(JavaType type) {
+        if (type instanceof ResolvedJavaType && isWord((ResolvedJavaType) type)) {
+            return wordKind;
+        } else {
+            return type.getKind();
+        }
+    }
+
+    public Kind getWordKind() {
+        return wordKind;
+    }
+
+    /**
+     * Gets the stamp for a given {@linkplain #isWord(ResolvedJavaType) word type}.
+     */
+    public Stamp getWordStamp(ResolvedJavaType type) {
+        assert isWord(type);
+        return StampFactory.forKind(wordKind);
+    }
+
+    public ResolvedJavaType getWordImplType() {
+        return wordImplType;
+    }
+}
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypes.java	Thu Mar 12 01:11:22 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2012, 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.word.phases;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.word.*;
-import com.oracle.graal.word.Word.Operation;
-
-/**
- * Encapsulates information for Java types representing raw words (as opposed to Objects).
- */
-public class WordTypes {
-
-    /**
-     * Resolved type for {@link WordBase}.
-     */
-    private final ResolvedJavaType wordBaseType;
-
-    /**
-     * Resolved type for {@link Word}.
-     */
-    private final ResolvedJavaType wordImplType;
-
-    /**
-     * Resolved type for {@link ObjectAccess}.
-     */
-    private final ResolvedJavaType objectAccessType;
-
-    /**
-     * Resolved type for {@link BarrieredAccess}.
-     */
-    private final ResolvedJavaType barrieredAccessType;
-
-    private final Kind wordKind;
-
-    public WordTypes(MetaAccessProvider metaAccess, Kind wordKind) {
-        this.wordKind = wordKind;
-        this.wordBaseType = metaAccess.lookupJavaType(WordBase.class);
-        this.wordImplType = metaAccess.lookupJavaType(Word.class);
-        this.objectAccessType = metaAccess.lookupJavaType(ObjectAccess.class);
-        this.barrieredAccessType = metaAccess.lookupJavaType(BarrieredAccess.class);
-    }
-
-    /**
-     * Determines if a given method denotes a word operation.
-     */
-    public boolean isWordOperation(ResolvedJavaMethod targetMethod) {
-        final boolean isObjectAccess = objectAccessType.equals(targetMethod.getDeclaringClass());
-        final boolean isBarrieredAccess = barrieredAccessType.equals(targetMethod.getDeclaringClass());
-        if (isObjectAccess || isBarrieredAccess) {
-            assert targetMethod.getAnnotation(Operation.class) != null : targetMethod + " should be annotated with @" + Operation.class.getSimpleName();
-            return true;
-        }
-        return isWord(targetMethod.getDeclaringClass());
-    }
-
-    /**
-     * Gets the method annotated with {@link Operation} based on a given method that represents a
-     * word operation (but may not necessarily have the annotation).
-     * 
-     * @param callingContextType the {@linkplain ResolvedJavaType type} from which
-     *            {@code targetMethod} is invoked
-     * @return the {@link Operation} method resolved for {@code targetMethod} if any
-     */
-    public ResolvedJavaMethod getWordOperation(ResolvedJavaMethod targetMethod, ResolvedJavaType callingContextType) {
-        final boolean isWordBase = wordBaseType.isAssignableFrom(targetMethod.getDeclaringClass());
-        ResolvedJavaMethod wordMethod = targetMethod;
-        if (isWordBase && !targetMethod.isStatic()) {
-            assert wordImplType.isLinked();
-            wordMethod = wordImplType.resolveConcreteMethod(targetMethod, callingContextType);
-        }
-        assert wordMethod.getAnnotation(Operation.class) != null : wordMethod;
-        return wordMethod;
-    }
-
-    /**
-     * Determines if a given node has a word type.
-     */
-    public boolean isWord(ValueNode node) {
-        return isWord(StampTool.typeOrNull(node));
-    }
-
-    /**
-     * Determines if a given type is a word type.
-     */
-    public boolean isWord(ResolvedJavaType type) {
-        return type != null && wordBaseType.isAssignableFrom(type);
-    }
-
-    /**
-     * Gets the kind for a given type, returning the {@linkplain #getWordKind() word kind} if
-     * {@code type} is a {@linkplain #isWord(ResolvedJavaType) word type}.
-     */
-    public Kind asKind(JavaType type) {
-        if (type instanceof ResolvedJavaType && isWord((ResolvedJavaType) type)) {
-            return wordKind;
-        } else {
-            return type.getKind();
-        }
-    }
-
-    public Kind getWordKind() {
-        return wordKind;
-    }
-
-    /**
-     * Gets the stamp for a given {@linkplain #isWord(ResolvedJavaType) word type}.
-     */
-    public Stamp getWordStamp(ResolvedJavaType type) {
-        assert isWord(type);
-        return StampFactory.forKind(wordKind);
-    }
-
-    public ResolvedJavaType getWordImplType() {
-        return wordImplType;
-    }
-}