--- a/hotspot/make/CompileTools.gmk Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/make/CompileTools.gmk Mon Jun 19 16:31:43 2017 -0700
@@ -47,7 +47,7 @@
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_MATCH_PROCESSOR, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := \
- $(SRC_DIR)/org.graalvm.api.word/src \
+ $(SRC_DIR)/org.graalvm.word/src \
$(SRC_DIR)/org.graalvm.compiler.core/src \
$(SRC_DIR)/org.graalvm.compiler.core.common/src \
$(SRC_DIR)/org.graalvm.compiler.core.match.processor/src \
@@ -115,7 +115,7 @@
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_REPLACEMENTS_VERIFIER, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := \
- $(SRC_DIR)/org.graalvm.api.word/src \
+ $(SRC_DIR)/org.graalvm.word/src \
$(SRC_DIR)/org.graalvm.compiler.replacements.verifier/src \
$(SRC_DIR)/org.graalvm.compiler.api.replacements/src \
$(SRC_DIR)/org.graalvm.compiler.code/src \
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/GraalFilters.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/GraalFilters.java Mon Jun 19 16:31:43 2017 -0700
@@ -34,7 +34,6 @@
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
-import org.graalvm.api.word.WordBase;
import org.graalvm.compiler.api.directives.GraalDirectives;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.MethodSubstitution;
@@ -44,6 +43,7 @@
import org.graalvm.compiler.hotspot.replacements.HotSpotClassSubstitutions;
import org.graalvm.compiler.hotspot.word.MetaspacePointer;
import org.graalvm.compiler.replacements.Snippets;
+import org.graalvm.word.WordBase;
public class GraalFilters {
private List<ResolvedJavaType> specialClasses;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/module-info.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/module-info.java Mon Jun 19 16:31:43 2017 -0700
@@ -42,7 +42,6 @@
uses org.graalvm.compiler.options.OptionValuesAccess;
uses org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory;
- exports org.graalvm.api.word to jdk.aot;
exports org.graalvm.compiler.api.directives to jdk.aot;
exports org.graalvm.compiler.api.runtime to jdk.aot;
exports org.graalvm.compiler.api.replacements to jdk.aot;
@@ -71,4 +70,5 @@
exports org.graalvm.compiler.runtime to jdk.aot;
exports org.graalvm.compiler.replacements to jdk.aot;
exports org.graalvm.compiler.word to jdk.aot;
+ exports org.graalvm.word to jdk.aot;
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/AtomicUnsigned.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2015, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-/**
- * A {@link Unsigned} value that may be updated atomically. See the
- * {@link java.util.concurrent.atomic} package specification for description of the properties of
- * atomic variables.
- */
-public class AtomicUnsigned extends AtomicWord<Unsigned> {
-
- /**
- * Atomically adds the given value to the current value.
- *
- * @param delta the value to add
- * @return the previous value
- */
- public final Unsigned getAndAdd(Unsigned delta) {
- return WordFactory.unsigned(value.getAndAdd(delta.rawValue()));
- }
-
- /**
- * Atomically adds the given value to the current value.
- *
- * @param delta the value to add
- * @return the updated value
- */
- public final Unsigned addAndGet(Unsigned delta) {
- return WordFactory.unsigned(value.addAndGet(delta.rawValue()));
- }
-
- /**
- * Atomically subtracts the given value from the current value.
- *
- * @param delta the value to add
- * @return the previous value
- */
- public final Unsigned getAndSubtract(Unsigned delta) {
- return WordFactory.unsigned(value.getAndAdd(-delta.rawValue()));
- }
-
- /**
- * Atomically subtracts the given value from the current value.
- *
- * @param delta the value to add
- * @return the updated value
- */
- public final Unsigned subtractAndGet(Unsigned delta) {
- return WordFactory.unsigned(value.addAndGet(-delta.rawValue()));
- }
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/AtomicWord.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2015, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * A {@link WordBase word} value that may be updated atomically. See the
- * {@link java.util.concurrent.atomic} package specification for description of the properties of
- * atomic variables.
- *
- * Similar to {@link AtomicReference}, but for {@link WordBase word} types. A dedicated
- * implementation is necessary because Object and word types cannot be mixed.
- */
-public class AtomicWord<T extends WordBase> {
-
- /**
- * For simplicity, we convert the word value to a long and delegate to existing atomic
- * operations.
- */
- protected final AtomicLong value;
-
- /**
- * Creates a new AtomicWord with initial value {@link WordFactory#zero}.
- */
- public AtomicWord() {
- value = new AtomicLong();
- }
-
- /**
- * Gets the current value.
- *
- * @return the current value
- */
- public final T get() {
- return WordFactory.unsigned(value.get());
- }
-
- /**
- * Sets to the given value.
- *
- * @param newValue the new value
- */
- public final void set(T newValue) {
- value.set(newValue.rawValue());
- }
-
- /**
- * Atomically sets to the given value and returns the old value.
- *
- * @param newValue the new value
- * @return the previous value
- */
- public final T getAndSet(T newValue) {
- return WordFactory.unsigned(value.getAndSet(newValue.rawValue()));
- }
-
- /**
- * Atomically sets the value to the given updated value if the current value {@code ==} the
- * expected value.
- *
- * @param expect the expected value
- * @param update the new value
- * @return {@code true} if successful. False return indicates that the actual value was not
- * equal to the expected value.
- */
- public final boolean compareAndSet(T expect, T update) {
- return value.compareAndSet(expect.rawValue(), update.rawValue());
- }
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/ComparableWord.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2012, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-public interface ComparableWord extends WordBase {
-
- /**
- * Compares this word with the specified value.
- *
- * @param val value to which this word is to be compared.
- * @return {@code this == val}
- */
- boolean equal(ComparableWord val);
-
- /**
- * Compares this word with the specified value.
- *
- * @param val value to which this word is to be compared.
- * @return {@code this != val}
- */
- boolean notEqual(ComparableWord val);
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/LocationIdentity.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2011, 2016, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-// JaCoCo Exclude
-
-/**
- * Marker interface for location identities. A different location identity of two memory accesses
- * guarantees that the two accesses do not interfere.
- *
- * Clients of {@link LocationIdentity} must use {@link #equals(Object)}, not {@code ==}, when
- * comparing two {@link LocationIdentity} values for equality. Likewise, they must not use
- * {@link java.util.IdentityHashMap}s with {@link LocationIdentity} values as keys.
- */
-public abstract class LocationIdentity {
-
- private static final class AnyLocationIdentity extends LocationIdentity {
- @Override
- public boolean isImmutable() {
- return false;
- }
-
- @Override
- public String toString() {
- return "ANY_LOCATION";
- }
- }
-
- private static final class InitLocationIdentity extends LocationIdentity {
- @Override
- public boolean isImmutable() {
- return true;
- }
-
- @Override
- public String toString() {
- return "INIT_LOCATION";
- }
- }
-
- public static final LocationIdentity ANY_LOCATION = new AnyLocationIdentity();
- public static final LocationIdentity INIT_LOCATION = new InitLocationIdentity();
-
- /**
- * Indicates that the given location is the union of all possible mutable locations. A write to
- * such a location kill all reads from mutable locations and a read from this location is killed
- * by any write (except for initialization writes).
- */
- public static LocationIdentity any() {
- return ANY_LOCATION;
- }
-
- /**
- * Location only allowed to be used for writes. Indicates that a completely new memory location
- * is written. Kills no read. The previous value at the given location must be either
- * uninitialized or null. Writes to this location do not need a GC pre-barrier.
- */
- public static LocationIdentity init() {
- return INIT_LOCATION;
- }
-
- /**
- * Denotes a location is unchanging in all cases. Not that this is different than the Java
- * notion of final which only requires definite assignment.
- */
- public abstract boolean isImmutable();
-
- public final boolean isMutable() {
- return !isImmutable();
- }
-
- public final boolean isAny() {
- return this == ANY_LOCATION;
- }
-
- public final boolean isInit() {
- return this == INIT_LOCATION;
- }
-
- public final boolean isSingle() {
- return this != ANY_LOCATION;
- }
-
- public final boolean overlaps(LocationIdentity other) {
- return isAny() || other.isAny() || this.equals(other);
- }
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/Pointer.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,965 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-/**
- * Lowest-level memory access of native C memory.
- * <p>
- * Do not use these methods to access Java objects. These methods access the raw memory without any
- * null checks, read- or write barriers. Even when the VM uses compressed pointers, then readObject
- * and writeObject methods access uncompressed pointers.
- */
-public interface Pointer extends Unsigned, PointerBase {
-
- /**
- * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type
- * checks are performed. The caller must ensure that the Pointer contains a valid Java object
- * that can i.e., processed by the garbage collector.
- *
- * @return this Pointer cast to Object.
- */
- Object toObject();
-
- /**
- * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type
- * checks are performed. The caller must ensure that the Pointer contains a valid Java object
- * that can i.e., processed by the garbage collector and the Pointer does not contain 0.
- *
- * @return this Pointer cast to non-null Object.
- */
- Object toObjectNonNull();
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- byte readByte(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- char readChar(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- short readShort(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- int readInt(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- long readLong(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- float readFloat(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- double readDouble(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- <T extends WordBase> T readWord(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- Object readObject(WordBase offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- byte readByte(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- char readChar(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- short readShort(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- int readInt(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- long readLong(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- float readFloat(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- double readDouble(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- <T extends WordBase> T readWord(int offset, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the read
- * @return the result of the memory access
- */
- Object readObject(int offset, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeByte(WordBase offset, byte val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeChar(WordBase offset, char val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeShort(WordBase offset, short val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeInt(WordBase offset, int val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeLong(WordBase offset, long val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeFloat(WordBase offset, float val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeDouble(WordBase offset, double val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeWord(WordBase offset, WordBase val, LocationIdentity locationIdentity);
-
- /**
- * Initializes the memory at address {@code (this + offset)}. Both the base address and offset
- * are in bytes. The memory must be uninitialized or zero prior to this operation.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void initializeLong(WordBase offset, long val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeObject(WordBase offset, Object val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeByte(int offset, byte val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeChar(int offset, char val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeShort(int offset, short val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeInt(int offset, int val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeLong(int offset, long val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeFloat(int offset, float val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeDouble(int offset, double val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeWord(int offset, WordBase val, LocationIdentity locationIdentity);
-
- /**
- * Initializes the memory at address {@code (this + offset)}. Both the base address and offset
- * are in bytes. The memory must be uninitialized or zero prior to this operation.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void initializeLong(int offset, long val, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param locationIdentity the identity of the write
- * @param val the value to be written to memory
- */
- void writeObject(int offset, Object val, LocationIdentity locationIdentity);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- byte readByte(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- char readChar(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- short readShort(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- int readInt(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- long readLong(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- float readFloat(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- double readDouble(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- <T extends WordBase> T readWord(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- Object readObject(WordBase offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- byte readByte(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- char readChar(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- short readShort(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- int readInt(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- long readLong(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- float readFloat(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- double readDouble(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- <T extends WordBase> T readWord(int offset);
-
- /**
- * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @return the result of the memory access
- */
- Object readObject(int offset);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeByte(WordBase offset, byte val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeChar(WordBase offset, char val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeShort(WordBase offset, short val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeInt(WordBase offset, int val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeLong(WordBase offset, long val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeFloat(WordBase offset, float val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeDouble(WordBase offset, double val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeWord(WordBase offset, WordBase val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- * <p>
- * The offset is always treated as a {@link Signed} value. However, the static type is
- * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
- * knows that the highest-order bit of the unsigned value is never used).
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeObject(WordBase offset, Object val);
-
- int compareAndSwapInt(WordBase offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
-
- long compareAndSwapLong(WordBase offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
-
- <T extends WordBase> T compareAndSwapWord(WordBase offset, T expectedValue, T newValue, LocationIdentity locationIdentity);
-
- Object compareAndSwapObject(WordBase offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapInt(WordBase offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapLong(WordBase offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapWord(WordBase offset, WordBase expectedValue, WordBase newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapObject(WordBase offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeByte(int offset, byte val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeChar(int offset, char val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeShort(int offset, short val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeInt(int offset, int val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeLong(int offset, long val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeFloat(int offset, float val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeDouble(int offset, double val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeWord(int offset, WordBase val);
-
- /**
- * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
- * bytes.
- *
- * @param offset the signed offset for the memory access
- * @param val the value to be written to memory
- */
- void writeObject(int offset, Object val);
-
- int compareAndSwapInt(int offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
-
- long compareAndSwapLong(int offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
-
- <T extends WordBase> T compareAndSwapWord(int offset, T expectedValue, T newValue, LocationIdentity locationIdentity);
-
- Object compareAndSwapObject(int offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapInt(int offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapLong(int offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapWord(int offset, WordBase expectedValue, WordBase newValue, LocationIdentity locationIdentity);
-
- boolean logicCompareAndSwapObject(int offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
-
- // Math functions that are defined in Unsigned, but known to preserve the
- // pointer-characteristics.
- // It is therefore safe that they return a static type of Pointer instead of Unsigned.
-
- @Override
- Pointer add(Unsigned val);
-
- @Override
- Pointer add(int val);
-
- @Override
- Pointer subtract(Unsigned val);
-
- @Override
- Pointer subtract(int val);
-
- @Override
- Pointer and(Unsigned val);
-
- @Override
- Pointer and(int val);
-
- @Override
- Pointer or(Unsigned val);
-
- @Override
- Pointer or(int val);
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/PointerBase.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2013, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-/**
- * Marker interface for all {@link WordBase word types} that have the semantic of a pointer (but not
- * necessarily all the memory access methods defined in {@link Pointer}).
- */
-public interface PointerBase extends ComparableWord {
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/PointerUtils.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2015, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-/**
- * Utility methods on Pointers.
- */
-public final class PointerUtils {
-
- private PointerUtils() {
- // This is a class of static methods, so no need for any instances.
- }
-
- /**
- * The value of a null Pointer.
- *
- * @return A null Pointer value.
- */
- @SuppressWarnings("unchecked")
- public static <T extends PointerBase> T nullPointer() {
- return (T) WordFactory.zero();
- }
-
- /**
- * Predicate to check for the null Pointer value.
- *
- * @return Whether that Pointer is the null Pointer.
- */
- public static boolean isNull(ComparableWord that) {
- return that.equal(nullPointer());
- }
-
- /**
- * Predicate to check for a non-null Pointer value.
- *
- * @return Whether that Pointer is not the null Pointer.
- */
- public static boolean isNonNull(ComparableWord that) {
- return that.notEqual(nullPointer());
- }
-
- /**
- * Round a Pointer down to the nearest smaller multiple.
- *
- * @param that The Pointer to be rounded up.
- * @param multiple The multiple to which that Pointer should be decreased.
- * @return That Pointer, but rounded down.
- */
- public static Pointer roundDown(PointerBase that, Unsigned multiple) {
- return (Pointer) UnsignedUtils.roundDown((Unsigned) that, multiple);
- }
-
- /**
- * Round a Pointer up to the nearest larger multiple.
- *
- * @param that The Pointer to be rounded up.
- * @param multiple The multiple to which that Pointer should be increased.
- * @return That Pointer, but rounded up.
- */
- public static Pointer roundUp(PointerBase that, Unsigned multiple) {
- return (Pointer) UnsignedUtils.roundUp((Unsigned) that, multiple);
- }
-
- /**
- * Check that a Pointer is an even multiple.
- *
- * @param that The Pointer to be verified as a multiple.
- * @param multiple The multiple against which the Pointer should be verified.
- * @return true if that Pointer is a multiple, false otherwise.
- */
- public static boolean isAMultiple(PointerBase that, Unsigned multiple) {
- return that.equal(PointerUtils.roundDown(that, multiple));
- }
-
- /**
- * Return the distance between two Pointers.
- *
- * @param pointer1 A first Pointer.
- * @param pointer2 A second Pointer.
- * @return The distance in bytes between the two Pointers.
- */
- public static Unsigned absoluteDifference(PointerBase pointer1, PointerBase pointer2) {
- Pointer p1 = (Pointer) pointer1;
- Pointer p2 = (Pointer) pointer2;
- final Unsigned result;
- if (p1.aboveOrEqual(p2)) {
- result = p1.subtract(p2);
- } else {
- result = p2.subtract(p1);
- }
- return result;
- }
-
- /**
- * The minimum of two Pointers.
- *
- * @param x A Pointer.
- * @param y Another Pointer.
- * @return The whichever Pointer is smaller.
- */
- public static <T extends PointerBase> T min(T x, T y) {
- return (((Pointer) x).belowOrEqual((Pointer) y)) ? x : y;
- }
-
- /**
- * The maximum of two Pointers.
- *
- * @param x A Pointer.
- * @param y Another Pointer.
- * @return The whichever Pointer is larger.
- */
- public static <T extends PointerBase> T max(T x, T y) {
- return (((Pointer) x).aboveOrEqual((Pointer) y)) ? x : y;
- }
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/Signed.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2012, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-public interface Signed extends ComparableWord {
-
- /**
- * Returns a Signed whose value is {@code (this + val)}.
- *
- * @param val value to be added to this Signed.
- * @return {@code this + val}
- */
- Signed add(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this - val)}.
- *
- * @param val value to be subtracted from this Signed.
- * @return {@code this - val}
- */
- Signed subtract(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this * val)}.
- *
- * @param val value to be multiplied by this Signed.
- * @return {@code this * val}
- */
- Signed multiply(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this / val)}.
- *
- * @param val value by which this Signed is to be divided.
- * @return {@code this / val}
- */
- Signed signedDivide(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this % val)}.
- *
- * @param val value by which this Signed is to be divided, and the remainder computed.
- * @return {@code this % val}
- */
- Signed signedRemainder(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this << n)}.
- *
- * @param n shift distance, in bits.
- * @return {@code this << n}
- */
- Signed shiftLeft(Unsigned n);
-
- /**
- * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed.
- *
- * @param n shift distance, in bits.
- * @return {@code this >> n}
- */
- Signed signedShiftRight(Unsigned n);
-
- /**
- * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
- * if and only if this and val are both negative.)
- *
- * @param val value to be AND'ed with this Signed.
- * @return {@code this & val}
- */
- Signed and(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
- * if and only if either this or val is negative.)
- *
- * @param val value to be OR'ed with this Signed.
- * @return {@code this | val}
- */
- Signed or(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
- * if and only if exactly one of this and val are negative.)
- *
- * @param val value to be XOR'ed with this Signed.
- * @return {@code this ^ val}
- */
- Signed xor(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and
- * only if this Signed is non-negative.)
- *
- * @return {@code ~this}
- */
- Signed not();
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this == val}
- */
- boolean equal(Signed val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this != val}
- */
- boolean notEqual(Signed val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this < val}
- */
- boolean lessThan(Signed val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this <= val}
- */
- boolean lessOrEqual(Signed val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this > val}
- */
- boolean greaterThan(Signed val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this >= val}
- */
- boolean greaterOrEqual(Signed val);
-
- /**
- * Returns a Signed whose value is {@code (this + val)}.
- *
- * @param val value to be added to this Signed.
- * @return {@code this + val}
- */
- Signed add(int val);
-
- /**
- * Returns a Signed whose value is {@code (this - val)}.
- *
- * @param val value to be subtracted from this Signed.
- * @return {@code this - val}
- */
- Signed subtract(int val);
-
- /**
- * Returns a Signed whose value is {@code (this * val)}.
- *
- * @param val value to be multiplied by this Signed.
- * @return {@code this * val}
- */
- Signed multiply(int val);
-
- /**
- * Returns a Signed whose value is {@code (this / val)}.
- *
- * @param val value by which this Signed is to be divided.
- * @return {@code this / val}
- */
- Signed signedDivide(int val);
-
- /**
- * Returns a Signed whose value is {@code (this % val)}.
- *
- * @param val value by which this Signed is to be divided, and the remainder computed.
- * @return {@code this % val}
- */
- Signed signedRemainder(int val);
-
- /**
- * Returns a Signed whose value is {@code (this << n)}.
- *
- * @param n shift distance, in bits.
- * @return {@code this << n}
- */
- Signed shiftLeft(int n);
-
- /**
- * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed.
- *
- * @param n shift distance, in bits.
- * @return {@code this >> n}
- */
- Signed signedShiftRight(int n);
-
- /**
- * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
- * if and only if this and val are both negative.)
- *
- * @param val value to be AND'ed with this Signed.
- * @return {@code this & val}
- */
- Signed and(int val);
-
- /**
- * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
- * if and only if either this or val is negative.)
- *
- * @param val value to be OR'ed with this Signed.
- * @return {@code this | val}
- */
- Signed or(int val);
-
- /**
- * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
- * if and only if exactly one of this and val are negative.)
- *
- * @param val value to be XOR'ed with this Signed.
- * @return {@code this ^ val}
- */
- Signed xor(int val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this == val}
- */
- boolean equal(int val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this != val}
- */
- boolean notEqual(int val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this < val}
- */
- boolean lessThan(int val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this <= val}
- */
- boolean lessOrEqual(int val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this > val}
- */
- boolean greaterThan(int val);
-
- /**
- * Compares this Signed with the specified value.
- *
- * @param val value to which this Signed is to be compared.
- * @return {@code this >= val}
- */
- boolean greaterOrEqual(int val);
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/Unsigned.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/*
- * Copyright (c) 2012, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-public interface Unsigned extends ComparableWord {
-
- /**
- * Returns a Unsigned whose value is {@code (this + val)}.
- *
- * @param val value to be added to this Unsigned.
- * @return {@code this + val}
- */
- Unsigned add(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this - val)}.
- *
- * @param val value to be subtracted from this Unsigned.
- * @return {@code this - val}
- */
- Unsigned subtract(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this * val)}.
- *
- * @param val value to be multiplied by this Unsigned.
- * @return {@code this * val}
- */
- Unsigned multiply(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this / val)}.
- *
- * @param val value by which this Unsigned is to be divided.
- * @return {@code this / val}
- */
- Unsigned unsignedDivide(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this % val)}.
- *
- * @param val value by which this Unsigned is to be divided, and the remainder computed.
- * @return {@code this % val}
- */
- Unsigned unsignedRemainder(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this << n)}.
- *
- * @param n shift distance, in bits.
- * @return {@code this << n}
- */
- Unsigned shiftLeft(Unsigned n);
-
- /**
- * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
- *
- * @param n shift distance, in bits.
- * @return {@code this >> n}
- */
- Unsigned unsignedShiftRight(Unsigned n);
-
- /**
- * Returns a Unsigned whose value is {@code (this & val)}.
- *
- * @param val value to be AND'ed with this Unsigned.
- * @return {@code this & val}
- */
- Unsigned and(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this | val)}.
- *
- * @param val value to be OR'ed with this Unsigned.
- * @return {@code this | val}
- */
- Unsigned or(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this ^ val)}.
- *
- * @param val value to be XOR'ed with this Unsigned.
- * @return {@code this ^ val}
- */
- Unsigned xor(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (~this)}.
- *
- * @return {@code ~this}
- */
- Unsigned not();
-
- /**
- * Compares this Unsigned with the specified value.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this == val}
- */
- boolean equal(Unsigned val);
-
- /**
- * Compares this Unsigned with the specified value.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this != val}
- */
- boolean notEqual(Unsigned val);
-
- /**
- * Compares this Unsigned with the specified value.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this < val}
- */
- boolean belowThan(Unsigned val);
-
- /**
- * Compares this Unsigned with the specified value.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this <= val}
- */
- boolean belowOrEqual(Unsigned val);
-
- /**
- * Compares this Unsigned with the specified value.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this > val}
- */
- boolean aboveThan(Unsigned val);
-
- /**
- * Compares this Unsigned with the specified value.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this >= val}
- */
- boolean aboveOrEqual(Unsigned val);
-
- /**
- * Returns a Unsigned whose value is {@code (this + val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to be added to this Unsigned.
- * @return {@code this + val}
- */
- Unsigned add(int val);
-
- /**
- * Returns a Unsigned whose value is {@code (this - val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to be subtracted from this Unsigned.
- * @return {@code this - val}
- */
- Unsigned subtract(int val);
-
- /**
- * Returns a Unsigned whose value is {@code (this * val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to be multiplied by this Unsigned.
- * @return {@code this * val}
- */
- Unsigned multiply(int val);
-
- /**
- * Returns a Unsigned whose value is {@code (this / val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value by which this Unsigned is to be divided.
- * @return {@code this / val}
- */
- Unsigned unsignedDivide(int val);
-
- /**
- * Returns a Unsigned whose value is {@code (this % val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value by which this Unsigned is to be divided, and the remainder computed.
- * @return {@code this % val}
- */
- Unsigned unsignedRemainder(int val);
-
- /**
- * Returns a Unsigned whose value is {@code (this << n)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param n shift distance, in bits.
- * @return {@code this << n}
- */
- Unsigned shiftLeft(int n);
-
- /**
- * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param n shift distance, in bits.
- * @return {@code this >> n}
- */
- Unsigned unsignedShiftRight(int n);
-
- /**
- * Returns a Unsigned whose value is {@code (this & val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to be AND'ed with this Unsigned.
- * @return {@code this & val}
- */
- Unsigned and(int val);
-
- /**
- * Returns a Unsigned whose value is {@code (this | val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to be OR'ed with this Unsigned.
- * @return {@code this | val}
- */
- Unsigned or(int val);
-
- /**
- * Returns a Unsigned whose value is {@code (this ^ val)}.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to be XOR'ed with this Unsigned.
- * @return {@code this ^ val}
- */
- Unsigned xor(int val);
-
- /**
- * Compares this Unsigned with the specified value.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this == val}
- */
- boolean equal(int val);
-
- /**
- * Compares this Unsigned with the specified value.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this != val}
- */
- boolean notEqual(int val);
-
- /**
- * Compares this Unsigned with the specified value.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this < val}
- */
- boolean belowThan(int val);
-
- /**
- * Compares this Unsigned with the specified value.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this <= val}
- */
- boolean belowOrEqual(int val);
-
- /**
- * Compares this Unsigned with the specified value.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this > val}
- */
- boolean aboveThan(int val);
-
- /**
- * Compares this Unsigned with the specified value.
- * <p>
- * Note that the right operand is a signed value, while the operation is performed unsigned.
- * Therefore, the result is only well-defined for positive right operands.
- *
- * @param val value to which this Unsigned is to be compared.
- * @return {@code this >= val}
- */
- boolean aboveOrEqual(int val);
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/UnsignedUtils.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2015, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-/**
- * Utility methods on Unsigned values.
- */
-public final class UnsignedUtils {
-
- private UnsignedUtils() {
- // This is a class of static methods, so no need for any instances.
- }
-
- /**
- * Round an Unsigned down to the nearest smaller multiple.
- *
- * @param that The Unsigned to be rounded down.
- * @param multiple The multiple to which that Unsigned should be decreased.
- * @return That Unsigned, but rounded down.
- */
- public static Unsigned roundDown(Unsigned that, Unsigned multiple) {
- return that.unsignedDivide(multiple).multiply(multiple);
- }
-
- /**
- * Round an Unsigned up to the nearest larger multiple.
- *
- * @param that The Unsigned to be rounded up.
- * @param multiple The multiple to which that Unsigned should be increased.
- * @return That Unsigned, but rounded up.
- */
- public static Unsigned roundUp(Unsigned that, Unsigned multiple) {
- return UnsignedUtils.roundDown(that.add(multiple.subtract(1)), multiple);
- }
-
- /**
- * Check that an Unsigned is an even multiple.
- *
- * @param that The Unsigned to be verified as a multiple.
- * @param multiple The multiple against which the Unsigned should be verified.
- * @return true if that Unsigned is a multiple, false otherwise.
- */
- public static boolean isAMultiple(Unsigned that, Unsigned multiple) {
- return that.equal(UnsignedUtils.roundDown(that, multiple));
- }
-
- /**
- * The minimum of two Unsigneds.
- *
- * @param x An Unsigned.
- * @param y Another Unsigned.
- * @return The whichever Unsigned is smaller.
- */
- public static Unsigned min(Unsigned x, Unsigned y) {
- return (x.belowOrEqual(y)) ? x : y;
- }
-
- /**
- * The maximum of two Unsigneds.
- *
- * @param x An Unsigned.
- * @param y Another Unsigned.
- * @return The whichever Unsigned is larger.
- */
- public static Unsigned max(Unsigned x, Unsigned y) {
- return (x.aboveOrEqual(y)) ? x : y;
- }
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/WordBase.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2012, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-public interface WordBase {
-
- long rawValue();
-
- /**
- * This is deprecated because of the easy to mistype name collision between {@link #equals} and
- * the other word based equality routines. In general you should never be statically calling
- * this method anyway.
- */
- @Override
- @Deprecated
- boolean equals(Object o);
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.api.word/src/org/graalvm/api/word/WordFactory.java Mon Jun 19 11:23:16 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 org.graalvm.api.word;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.InvocationTargetException;
-
-public abstract class WordFactory {
-
- /**
- * Links a method to a canonical operation represented by an {@link FactoryOpcode} val.
- */
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- protected @interface FactoryOperation {
- FactoryOpcode opcode();
- }
-
- /**
- * The canonical {@link FactoryOperation} represented by a method in a word type.
- */
- protected enum FactoryOpcode {
- ZERO,
- FROM_UNSIGNED,
- FROM_SIGNED,
- }
-
- protected interface BoxFactory {
- <T extends WordBase> T box(long val);
- }
-
- protected static final BoxFactory boxFactory;
-
- static {
- try {
- /*
- * We know the implementation class, but cannot reference it statically because we need
- * to break the dependency between the interface and the implementation.
- */
- boxFactory = (BoxFactory) Class.forName("org.graalvm.compiler.word.Word$BoxFactoryImpl").getConstructor().newInstance();
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
- throw new ExceptionInInitializerError("Could not find and initialize the word type factory. The Graal compiler needs to be on the class path to use the word type.");
- }
- }
-
- /**
- * We allow subclassing, because only subclasses can access the protected inner classes that we
- * use to mark the operations.
- */
- protected WordFactory() {
- }
-
- /**
- * The constant 0, i.e., the word with no bits set. There is no difference between a signed and
- * unsigned zero.
- *
- * @return the constant 0.
- */
- @FactoryOperation(opcode = FactoryOpcode.ZERO)
- public static <T extends WordBase> T zero() {
- return boxFactory.box(0L);
- }
-
- /**
- * Unsafe conversion from a Java long value to a Word. The parameter is treated as an unsigned
- * 64-bit value (in contrast to the semantics of a Java long).
- *
- * @param val a 64 bit unsigned value
- * @return the value cast to Word
- */
- @FactoryOperation(opcode = FactoryOpcode.FROM_UNSIGNED)
- public static <T extends Unsigned> T unsigned(long val) {
- return boxFactory.box(val);
- }
-
- /**
- * Unsafe conversion from a Java long value to a {@link PointerBase pointer}. The parameter is
- * treated as an unsigned 64-bit value (in contrast to the semantics of a Java long).
- *
- * @param val a 64 bit unsigned value
- * @return the value cast to PointerBase
- */
- @FactoryOperation(opcode = FactoryOpcode.FROM_UNSIGNED)
- public static <T extends PointerBase> T pointer(long val) {
- return boxFactory.box(val);
- }
-
- /**
- * Unsafe conversion from a Java int value to a Word. The parameter is treated as an unsigned
- * 32-bit value (in contrast to the semantics of a Java int).
- *
- * @param val a 32 bit unsigned value
- * @return the value cast to Word
- */
- @FactoryOperation(opcode = FactoryOpcode.FROM_UNSIGNED)
- public static <T extends Unsigned> T unsigned(int val) {
- return boxFactory.box(val & 0xffffffffL);
- }
-
- /**
- * Unsafe conversion from a Java long value to a Word. The parameter is treated as a signed
- * 64-bit value (unchanged semantics of a Java long).
- *
- * @param val a 64 bit signed value
- * @return the value cast to Word
- */
- @FactoryOperation(opcode = FactoryOpcode.FROM_SIGNED)
- public static <T extends Signed> T signed(long val) {
- return boxFactory.box(val);
- }
-
- /**
- * Unsafe conversion from a Java int value to a Word. The parameter is treated as a signed
- * 32-bit value (unchanged semantics of a Java int).
- *
- * @param val a 32 bit signed value
- * @return the value cast to Word
- */
- @FactoryOperation(opcode = FactoryOpcode.FROM_SIGNED)
- public static <T extends Signed> T signed(int val) {
- return boxFactory.box(val);
- }
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Assembler.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Assembler.java Mon Jun 19 16:31:43 2017 -0700
@@ -94,6 +94,8 @@
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.STXR;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.SUB;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.SUBS;
+import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.TBZ;
+import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.TBNZ;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.UBFM;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.UDIV;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.InstructionType.FP32;
@@ -475,6 +477,8 @@
BCOND(0x54000000),
CBNZ(0x01000000),
CBZ(0x00000000),
+ TBZ(0x36000000),
+ TBNZ(0x37000000),
B(0x00000000),
BL(0x80000000),
@@ -808,6 +812,82 @@
conditionalBranchInstruction(reg, imm21, generalFromSize(size), Instruction.CBZ, pos);
}
+ /**
+ * Test a single bit and branch if the bit is nonzero.
+ *
+ * @param reg general purpose register. May not be null, zero-register or stackpointer.
+ * @param uimm6 Unsigned 6-bit bit index.
+ * @param imm16 signed 16 bit offset
+ */
+ protected void tbnz(Register reg, int uimm6, int imm16) {
+ tbnz(reg, uimm6, imm16, -1);
+ }
+
+ /**
+ * Test a single bit and branch if the bit is zero.
+ *
+ * @param reg general purpose register. May not be null, zero-register or stackpointer.
+ * @param uimm6 Unsigned 6-bit bit index.
+ * @param imm16 signed 16 bit offset
+ */
+ protected void tbz(Register reg, int uimm6, int imm16) {
+ tbz(reg, uimm6, imm16, -1);
+ }
+
+ /**
+ * Test a single bit and branch if the bit is nonzero.
+ *
+ * @param reg general purpose register. May not be null, zero-register or stackpointer.
+ * @param uimm6 Unsigned 6-bit bit index.
+ * @param imm16 signed 16 bit offset
+ * @param pos Position at which instruction is inserted into buffer. -1 means insert at end.
+ */
+ protected void tbnz(Register reg, int uimm6, int imm16, int pos) {
+ assert reg.getRegisterCategory().equals(CPU);
+ assert NumUtil.isUnsignedNbit(6, uimm6);
+ assert NumUtil.isSignedNbit(18, imm16);
+ assert (imm16 & 3) == 0;
+ // size bit is overloaded as top bit of uimm6 bit index
+ int size = (((uimm6 >> 5) & 1) == 0 ? 32 : 64);
+ // remaining 5 bits are encoded lower down
+ int uimm5 = uimm6 >> 1;
+ int offset = (imm16 & NumUtil.getNbitNumberInt(16)) >> 2;
+ InstructionType type = generalFromSize(size);
+ int encoding = type.encoding | TBNZ.encoding | (uimm5 << 19) | (offset << 5) | rd(reg);
+ if (pos == -1) {
+ emitInt(encoding);
+ } else {
+ emitInt(encoding, pos);
+ }
+ }
+
+ /**
+ * Test a single bit and branch if the bit is zero.
+ *
+ * @param reg general purpose register. May not be null, zero-register or stackpointer.
+ * @param uimm6 Unsigned 6-bit bit index.
+ * @param imm16 signed 16 bit offset
+ * @param pos Position at which instruction is inserted into buffer. -1 means insert at end.
+ */
+ protected void tbz(Register reg, int uimm6, int imm16, int pos) {
+ assert reg.getRegisterCategory().equals(CPU);
+ assert NumUtil.isUnsignedNbit(6, uimm6);
+ assert NumUtil.isSignedNbit(18, imm16);
+ assert (imm16 & 3) == 0;
+ // size bit is overloaded as top bit of uimm6 bit index
+ int size = (((uimm6 >> 5) & 1) == 0 ? 32 : 64);
+ // remaining 5 bits are encoded lower down
+ int uimm5 = uimm6 >> 1;
+ int offset = (imm16 & NumUtil.getNbitNumberInt(16)) >> 2;
+ InstructionType type = generalFromSize(size);
+ int encoding = type.encoding | TBZ.encoding | (uimm5 << 19) | (offset << 5) | rd(reg);
+ if (pos == -1) {
+ emitInt(encoding);
+ } else {
+ emitInt(encoding, pos);
+ }
+ }
+
private void conditionalBranchInstruction(Register reg, int imm21, InstructionType type, Instruction instr, int pos) {
assert reg.getRegisterCategory().equals(CPU);
int instrEncoding = instr.encoding | CompareBranchOp;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64MacroAssembler.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64MacroAssembler.java Mon Jun 19 16:31:43 2017 -0700
@@ -1216,8 +1216,10 @@
BRANCH_UNCONDITIONALLY(0x1),
BRANCH_NONZERO(0x2),
BRANCH_ZERO(0x3),
- JUMP_ADDRESS(0x4),
- ADR(0x5);
+ BRANCH_BIT_NONZERO(0x4),
+ BRANCH_BIT_ZERO(0x5),
+ JUMP_ADDRESS(0x6),
+ ADR(0x7);
/**
* Offset by which additional information for branch conditionally, branch zero and branch
@@ -1295,6 +1297,46 @@
}
/**
+ * Test a single bit and branch if the bit is nonzero.
+ *
+ * @param cmp general purpose register. May not be null, zero-register or stackpointer.
+ * @param uimm6 Unsigned 6-bit bit index.
+ * @param label Can only handle 21-bit word-aligned offsets for now. May be unbound. Non null.
+ */
+ public void tbnz(Register cmp, int uimm6, Label label) {
+ assert NumUtil.isUnsignedNbit(6, uimm6);
+ if (label.isBound()) {
+ int offset = label.position() - position();
+ super.tbnz(cmp, uimm6, offset);
+ } else {
+ label.addPatchAt(position());
+ int indexEncoding = uimm6 << PatchLabelKind.INFORMATION_OFFSET;
+ int regEncoding = cmp.encoding << (PatchLabelKind.INFORMATION_OFFSET + 6);
+ emitInt(PatchLabelKind.BRANCH_BIT_NONZERO.encoding | indexEncoding | regEncoding);
+ }
+ }
+
+ /**
+ * Test a single bit and branch if the bit is zero.
+ *
+ * @param cmp general purpose register. May not be null, zero-register or stackpointer.
+ * @param uimm6 Unsigned 6-bit bit index.
+ * @param label Can only handle 21-bit word-aligned offsets for now. May be unbound. Non null.
+ */
+ public void tbz(Register cmp, int uimm6, Label label) {
+ assert NumUtil.isUnsignedNbit(6, uimm6);
+ if (label.isBound()) {
+ int offset = label.position() - position();
+ super.tbz(cmp, uimm6, offset);
+ } else {
+ label.addPatchAt(position());
+ int indexEncoding = uimm6 << PatchLabelKind.INFORMATION_OFFSET;
+ int regEncoding = cmp.encoding << (PatchLabelKind.INFORMATION_OFFSET + 6);
+ emitInt(PatchLabelKind.BRANCH_BIT_ZERO.encoding | indexEncoding | regEncoding);
+ }
+ }
+
+ /**
* Branches to label if condition is true.
*
* @param condition any condition value allowed. Non null.
@@ -1474,6 +1516,22 @@
}
break;
}
+ case BRANCH_BIT_NONZERO:
+ case BRANCH_BIT_ZERO: {
+ int information = instruction >>> PatchLabelKind.INFORMATION_OFFSET;
+ int sizeEncoding = information & NumUtil.getNbitNumberInt(6);
+ int regEncoding = information >>> 6;
+ Register reg = AArch64.cpuRegisters.get(regEncoding);
+ switch (type) {
+ case BRANCH_BIT_NONZERO:
+ super.tbnz(reg, sizeEncoding, branchOffset, branch);
+ break;
+ case BRANCH_BIT_ZERO:
+ super.tbz(reg, sizeEncoding, branchOffset, branch);
+ break;
+ }
+ break;
+ }
case ADR: {
int information = instruction >>> PatchLabelKind.INFORMATION_OFFSET;
int regEncoding = information;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java Mon Jun 19 16:31:43 2017 -0700
@@ -3492,6 +3492,14 @@
emitByte(0xC0 | encode);
}
+ public final void btrq(Register src, int imm8) {
+ int encode = prefixqAndEncode(src.encoding);
+ emitByte(0x0F);
+ emitByte(0xBA);
+ emitByte(0xF0 | encode);
+ emitByte(imm8);
+ }
+
public final void xaddl(AMD64Address dst, Register src) {
prefix(dst, src);
emitByte(0x0F);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.sparc/src/org/graalvm/compiler/asm/sparc/SPARCMacroAssembler.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.sparc/src/org/graalvm/compiler/asm/sparc/SPARCMacroAssembler.java Mon Jun 19 16:31:43 2017 -0700
@@ -81,6 +81,10 @@
nop(); // delay slot
}
+ public void bz(Label l) {
+ BPCC.emit(this, Xcc, ConditionFlag.Zero, NOT_ANNUL, PREDICT_NOT_TAKEN, l);
+ }
+
@Override
protected final void patchJumpTarget(int branch, int branchTarget) {
final int disp = (branchTarget - branch) / 4;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java Mon Jun 19 16:31:43 2017 -0700
@@ -300,7 +300,6 @@
* Sets the assumptions made during compilation.
*/
public void setAssumptions(Assumption[] assumptions) {
- checkOpen();
this.assumptions = assumptions;
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64AddressNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64AddressNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -76,7 +76,9 @@
AllocatableValue baseReference = LIRKind.derivedBaseFromValue(baseValue);
AllocatableValue indexReference;
- if (addressingMode.equals(AddressingMode.IMMEDIATE_UNSCALED)) {
+ if (index == null) {
+ indexReference = null;
+ } else if (addressingMode.equals(AddressingMode.IMMEDIATE_UNSCALED)) {
indexReference = LIRKind.derivedBaseFromValue(indexValue);
} else {
if (LIRKind.isValue(indexValue.getValueKind())) {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64AddressNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64AddressNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -73,7 +73,9 @@
AllocatableValue baseReference = LIRKind.derivedBaseFromValue(baseValue);
AllocatableValue indexReference;
- if (scale.equals(Scale.Times1)) {
+ if (index == null) {
+ indexReference = null;
+ } else if (scale.equals(Scale.Times1)) {
indexReference = LIRKind.derivedBaseFromValue(indexValue);
} else {
if (LIRKind.isValue(indexValue)) {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/spi/ForeignCallsProvider.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/spi/ForeignCallsProvider.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,8 +22,8 @@
*/
package org.graalvm.compiler.core.common.spi;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.LIRKind;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.ValueKindFactory;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java Mon Jun 19 16:31:43 2017 -0700
@@ -41,7 +41,6 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
import org.graalvm.compiler.api.replacements.Snippet.NonNullParameter;
@@ -84,6 +83,7 @@
import org.graalvm.compiler.phases.verify.VerifyUsageWithEquals;
import org.graalvm.compiler.phases.verify.VerifyVirtualizableUsage;
import org.graalvm.compiler.runtime.RuntimeProvider;
+import org.graalvm.word.LocationIdentity;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -31,6 +31,8 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Executable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -655,7 +657,8 @@
}
}
- protected Object referenceInvoke(ResolvedJavaMethod method, Object receiver, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ protected Object referenceInvoke(ResolvedJavaMethod method, Object receiver, Object... args)
+ throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
return invoke(method, receiver, args);
}
@@ -1053,12 +1056,12 @@
return backend.createDefaultInstalledCode(method, compilationResult);
}
- private final Map<ResolvedJavaMethod, Method> methodMap = new HashMap<>();
+ private final Map<ResolvedJavaMethod, Executable> methodMap = new HashMap<>();
/**
* Converts a reflection {@link Method} to a {@link ResolvedJavaMethod}.
*/
- protected ResolvedJavaMethod asResolvedJavaMethod(Method method) {
+ protected ResolvedJavaMethod asResolvedJavaMethod(Executable method) {
ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method);
methodMap.put(javaMethod, method);
return javaMethod;
@@ -1080,17 +1083,21 @@
* Gets the reflection {@link Method} from which a given {@link ResolvedJavaMethod} was created
* or null if {@code javaMethod} does not correspond to a reflection method.
*/
- protected Method lookupMethod(ResolvedJavaMethod javaMethod) {
+ protected Executable lookupMethod(ResolvedJavaMethod javaMethod) {
return methodMap.get(javaMethod);
}
- protected Object invoke(ResolvedJavaMethod javaMethod, Object receiver, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- Method method = lookupMethod(javaMethod);
+ protected Object invoke(ResolvedJavaMethod javaMethod, Object receiver, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
+ Executable method = lookupMethod(javaMethod);
Assert.assertTrue(method != null);
if (!method.isAccessible()) {
method.setAccessible(true);
}
- return method.invoke(receiver, applyArgSuppliers(args));
+ if (method instanceof Method) {
+ return ((Method) method).invoke(receiver, applyArgSuppliers(args));
+ }
+ assert receiver == null : "no receiver for constructor invokes";
+ return ((Constructor<?>) method).newInstance(applyArgSuppliers(args));
}
/**
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReferenceGetLoopTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReferenceGetLoopTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -27,13 +27,13 @@
import java.lang.ref.WeakReference;
import org.junit.Test;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.loop.LoopEx;
import org.graalvm.compiler.loop.LoopsData;
import org.graalvm.compiler.nodes.FieldLocationIdentity;
import org.graalvm.compiler.nodes.StructuredGraph;
import org.graalvm.compiler.nodes.memory.Access;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.ResolvedJavaField;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/GraalTutorial.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/GraalTutorial.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,15 +22,13 @@
*/
package org.graalvm.compiler.core.test.tutorial;
+import java.lang.reflect.Method;
+import java.util.regex.Pattern;
+
+import org.graalvm.compiler.bytecode.BytecodeDisassembler;
import org.junit.Assert;
import org.junit.Test;
-import java.util.regex.Pattern;
-
-import org.graalvm.compiler.bytecode.Bytecode;
-import org.graalvm.compiler.bytecode.BytecodeDisassembler;
-import org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode;
-
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.InvalidInstalledCodeException;
import jdk.vm.ci.meta.ResolvedJavaMethod;
@@ -51,18 +49,31 @@
*/
@Test
- public void testPrintBytecodes() {
- ResolvedJavaMethod method = findMethod(String.class, "hashCode");
- Bytecode bytecode = new ResolvedJavaMethodBytecode(method);
+ public void testGetBytecodes() throws NoSuchMethodException {
+ Method reflectionMethod = String.class.getDeclaredMethod("hashCode");
+ ResolvedJavaMethod method = metaAccess.lookupJavaMethod(reflectionMethod);
+
+ /*
+ * ResolvedJavaMethod provides all information that you want about a method, for example,
+ * the bytecodes.
+ */
+ byte[] bytecodes = method.getCode();
- byte[] bytecodes = bytecode.getCode();
- Assert.assertNotNull(bytecodes);
+ /*
+ * BytecodeDisassembler shows you how to iterate bytecodes, how to access type information,
+ * and more.
+ */
+ String disassembly = new BytecodeDisassembler().disassemble(method);
+ /*
+ * We don't want test cases to print any output, so we check the validity of the output
+ * instead.
+ */
Pattern disassemblyLineRE = Pattern.compile(" *\\d+: [a-z][\\w_]+");
- String disassembly = new BytecodeDisassembler().disassemble(bytecode);
for (String line : disassembly.split("\\n")) {
Assert.assertTrue(line, disassemblyLineRE.matcher(line).find());
}
+ Assert.assertTrue(bytecodes.length > 0);
}
/*
@@ -137,6 +148,21 @@
* Tutorial example for snippets and lowering.
*/
+ public static int identityHashCodeUsage(Object obj) {
+ return System.identityHashCode(obj);
+ }
+
+ @Test
+ public void testIdentityHashCodeUsage() throws InvalidInstalledCodeException {
+ Object a = new Object();
+ int expectedResult = identityHashCodeUsage(a);
+
+ InstalledCode compiledMethod = compileAndInstallMethod(findMethod(GraalTutorial.class, "identityHashCodeUsage"));
+
+ int result = (int) compiledMethod.executeVarargs(a);
+ Assert.assertEquals(expectedResult, result);
+ }
+
static class A {
}
@@ -179,17 +205,18 @@
* Tutorial example for intrinsic methods.
*/
- public static double intrinsicUsage(double val) {
- return Math.sin(val);
+ public static int intrinsicIntegerReverseBytes(int val) {
+ return Integer.reverseBytes(val);
}
@Test
- public void testIntrinsicUsage() throws InvalidInstalledCodeException {
- double expectedResult = intrinsicUsage(42d);
+ public void testIntrinsicIntegerReverseBytes() throws InvalidInstalledCodeException {
+ int input = 0x12345678;
+ int expected = intrinsicIntegerReverseBytes(input);
- InstalledCode compiledMethod = compileAndInstallMethod(findMethod(GraalTutorial.class, "intrinsicUsage"));
+ InstalledCode compiledMethod = compileAndInstallMethod(findMethod(GraalTutorial.class, "intrinsicIntegerReverseBytes"));
- double result = (double) compiledMethod.executeVarargs(42d);
- Assert.assertEquals(expectedResult, result, 0);
+ int actual = (int) compiledMethod.executeVarargs(input);
+ Assert.assertEquals(expected, actual);
}
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/target/Backend.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/target/Backend.java Mon Jun 19 16:31:43 2017 -0700
@@ -60,18 +60,26 @@
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.SpeculationLog;
+import java.util.ArrayList;
+
/**
* Represents a compiler backend for Graal.
*/
public abstract class Backend implements TargetProvider, ValueKindFactory<LIRKind> {
private final Providers providers;
+ private final ArrayList<CodeInstallationTaskFactory> codeInstallationTaskFactories;
public static final ForeignCallDescriptor ARITHMETIC_FREM = new ForeignCallDescriptor("arithmeticFrem", float.class, float.class, float.class);
public static final ForeignCallDescriptor ARITHMETIC_DREM = new ForeignCallDescriptor("arithmeticDrem", double.class, double.class, double.class);
protected Backend(Providers providers) {
this.providers = providers;
+ this.codeInstallationTaskFactories = new ArrayList<>();
+ }
+
+ public synchronized void addCodeInstallationTask(CodeInstallationTaskFactory factory) {
+ this.codeInstallationTaskFactories.add(factory);
}
public Providers getProviders() {
@@ -156,6 +164,16 @@
}
/**
+ * @see #createInstalledCode(ResolvedJavaMethod, CompilationRequest, CompilationResult,
+ * SpeculationLog, InstalledCode, boolean, Object[])
+ */
+ @SuppressWarnings("try")
+ public InstalledCode createInstalledCode(ResolvedJavaMethod method, CompilationRequest compilationRequest, CompilationResult compilationResult,
+ SpeculationLog speculationLog, InstalledCode predefinedInstalledCode, boolean isDefault) {
+ return createInstalledCode(method, compilationRequest, compilationResult, speculationLog, predefinedInstalledCode, isDefault, null);
+ }
+
+ /**
* Installs code based on a given compilation result.
*
* @param method the method compiled to produce {@code compiledCode} or {@code null} if the
@@ -170,15 +188,39 @@
* {@code compRequest.getMethod()}. The default implementation for a method is the
* code executed for standard calls to the method. This argument is ignored if
* {@code compRequest == null}.
+ * @param context a custom debug context to use for the code installation.
* @return a reference to the compiled and ready-to-run installed code
* @throws BailoutException if the code installation failed
*/
@SuppressWarnings("try")
public InstalledCode createInstalledCode(ResolvedJavaMethod method, CompilationRequest compilationRequest, CompilationResult compilationResult,
- SpeculationLog speculationLog, InstalledCode predefinedInstalledCode, boolean isDefault) {
- try (Scope s2 = Debug.scope("CodeInstall", getProviders().getCodeCache(), compilationResult)) {
+ SpeculationLog speculationLog, InstalledCode predefinedInstalledCode, boolean isDefault, Object[] context) {
+ Object[] debugContext = context != null ? context : new Object[]{getProviders().getCodeCache(), method, compilationResult};
+ CodeInstallationTask[] tasks = new CodeInstallationTask[codeInstallationTaskFactories.size()];
+ for (int i = 0; i < codeInstallationTaskFactories.size(); i++) {
+ tasks[i] = codeInstallationTaskFactories.get(i).create();
+ }
+ try (Scope s = Debug.scope("CodeInstall", debugContext)) {
+ for (CodeInstallationTask task : tasks) {
+ task.preProcess(compilationResult);
+ }
+
CompiledCode compiledCode = createCompiledCode(method, compilationRequest, compilationResult);
- return getProviders().getCodeCache().installCode(method, compiledCode, predefinedInstalledCode, speculationLog, isDefault);
+ InstalledCode installedCode = getProviders().getCodeCache().installCode(method, compiledCode, predefinedInstalledCode, speculationLog, isDefault);
+
+ // Run post-code installation tasks.
+ try {
+ for (CodeInstallationTask task : tasks) {
+ task.postProcess(installedCode);
+ }
+ for (CodeInstallationTask task : tasks) {
+ task.releaseInstallation(installedCode);
+ }
+ } catch (Throwable t) {
+ installedCode.invalidate();
+ throw t;
+ }
+ return installedCode;
} catch (Throwable e) {
throw Debug.handle(e);
}
@@ -236,4 +278,38 @@
public CompilationIdentifier getCompilationIdentifier(ResolvedJavaMethod resolvedJavaMethod) {
return CompilationIdentifier.INVALID_COMPILATION_ID;
}
+
+ /**
+ * Encapsulates custom tasks done before and after code installation.
+ */
+ public abstract static class CodeInstallationTask {
+ /**
+ * Task to run before code installation.
+ */
+ @SuppressWarnings("unused")
+ public void preProcess(CompilationResult compilationResult) {
+ }
+
+ /**
+ * Task to run after the code is installed.
+ */
+ @SuppressWarnings("unused")
+ public void postProcess(InstalledCode installedCode) {
+ }
+
+ /**
+ * Task to run after all the post-code installation tasks are complete, used to release the
+ * installed code.
+ */
+ @SuppressWarnings("unused")
+ public void releaseInstallation(InstalledCode installedCode) {
+ }
+ }
+
+ /**
+ * Creates code installation tasks.
+ */
+ public abstract static class CodeInstallationTaskFactory {
+ public abstract CodeInstallationTask create();
+ }
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeSourcePosition.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeSourcePosition.java Mon Jun 19 16:31:43 2017 -0700
@@ -36,9 +36,15 @@
* The receiver of the method this frame refers to.
*/
private final JavaConstant receiver;
+ private final int hashCode;
public NodeSourcePosition(JavaConstant receiver, NodeSourcePosition caller, ResolvedJavaMethod method, int bci) {
super(caller, method, bci);
+ if (caller == null) {
+ this.hashCode = 31 * bci + method.hashCode();
+ } else {
+ this.hashCode = caller.hashCode * 7 + 31 * bci + method.hashCode();
+ }
this.receiver = receiver;
assert receiver == null || method.getDeclaringClass().isInstance(receiver);
}
@@ -50,6 +56,9 @@
}
if (obj != null && getClass() == obj.getClass()) {
NodeSourcePosition that = (NodeSourcePosition) obj;
+ if (hashCode != that.hashCode) {
+ return false;
+ }
if (this.getBCI() == that.getBCI() && Objects.equals(this.getMethod(), that.getMethod()) && Objects.equals(this.getCaller(), that.getCaller()) &&
Objects.equals(this.receiver, that.receiver)) {
return true;
@@ -58,6 +67,11 @@
return false;
}
+ @Override
+ public int hashCode() {
+ return hashCode;
+ }
+
public JavaConstant getReceiver() {
return receiver;
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,11 +26,11 @@
import static jdk.vm.ci.aarch64.AArch64.r3;
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
import static jdk.vm.ci.meta.Value.ILLEGAL;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
+import static org.graalvm.word.LocationIdentity.any;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static jdk.vm.ci.amd64.AMD64.rdx;
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
import static jdk.vm.ci.meta.Value.ILLEGAL;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER;
import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
@@ -34,6 +33,7 @@
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP;
import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
+import static org.graalvm.word.LocationIdentity.any;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java Mon Jun 19 16:31:43 2017 -0700
@@ -28,13 +28,13 @@
import static jdk.vm.ci.sparc.SPARC.i1;
import static jdk.vm.ci.sparc.SPARC.o0;
import static jdk.vm.ci.sparc.SPARC.o1;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER;
import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP;
import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
+import static org.graalvm.word.LocationIdentity.any;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/WriteBarrierVerificationTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/WriteBarrierVerificationTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.debug.Debug;
import org.graalvm.compiler.debug.Debug.Scope;
import org.graalvm.compiler.debug.DebugConfig;
@@ -64,6 +63,7 @@
import org.graalvm.compiler.phases.tiers.HighTierContext;
import org.graalvm.compiler.phases.tiers.MidTierContext;
import org.graalvm.util.EconomicMap;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.ResolvedJavaField;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java Mon Jun 19 16:31:43 2017 -0700
@@ -54,7 +54,6 @@
import jdk.vm.ci.hotspot.EventProvider;
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
import jdk.vm.ci.hotspot.HotSpotCompilationRequestResult;
-import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotInstalledCode;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
import jdk.vm.ci.hotspot.HotSpotNmethod;
@@ -414,14 +413,11 @@
@SuppressWarnings("try")
private void installMethod(final CompilationResult compResult) {
final CodeCacheProvider codeCache = jvmciRuntime.getHostJVMCIBackend().getCodeCache();
+ HotSpotBackend backend = compiler.getGraalRuntime().getHostBackend();
installedCode = null;
Object[] context = {new DebugDumpScope(getIdString(), true), codeCache, getMethod(), compResult};
- try (Scope s = Debug.scope("CodeInstall", context)) {
- HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, getRequest().getMethod(), getRequest(), compResult);
- installedCode = (HotSpotInstalledCode) codeCache.installCode(getRequest().getMethod(), compiledCode, null, getRequest().getMethod().getSpeculationLog(), installAsDefault);
- } catch (Throwable e) {
- throw Debug.handle(e);
- }
+ installedCode = (HotSpotInstalledCode) backend.createInstalledCode(getRequest().getMethod(), getRequest(), compResult,
+ getRequest().getMethod().getSpeculationLog(), null, installAsDefault, context);
}
@Override
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,7 +24,6 @@
import java.util.EnumSet;
-import org.graalvm.api.word.Pointer;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.core.common.CompilationIdentifier;
import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
@@ -69,6 +68,7 @@
import org.graalvm.util.EconomicMap;
import org.graalvm.util.EconomicSet;
import org.graalvm.util.MapCursor;
+import org.graalvm.word.Pointer;
import jdk.vm.ci.code.CompilationRequest;
import jdk.vm.ci.code.CompiledCode;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkage.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkage.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,10 +24,10 @@
import jdk.vm.ci.meta.InvokeTarget;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
import org.graalvm.compiler.core.target.Backend;
import org.graalvm.compiler.hotspot.stubs.Stub;
+import org.graalvm.word.LocationIdentity;
/**
* The details required to link a HotSpot runtime or stub call.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkageImpl.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkageImpl.java Mon Jun 19 16:31:43 2017 -0700
@@ -23,9 +23,6 @@
package org.graalvm.compiler.hotspot;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
-
-import org.graalvm.api.word.LocationIdentity;
-
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
@@ -34,6 +31,7 @@
import org.graalvm.compiler.hotspot.stubs.Stub;
import org.graalvm.compiler.word.WordTypes;
import org.graalvm.util.EconomicSet;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CallingConvention;
import jdk.vm.ci.code.CallingConvention.Type;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/DefaultHotSpotLoweringProvider.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/DefaultHotSpotLoweringProvider.java Mon Jun 19 16:31:43 2017 -0700
@@ -23,7 +23,6 @@
package org.graalvm.compiler.hotspot.meta;
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.core.common.GraalOptions.AlwaysInlineVTableStubs;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.core.common.GraalOptions.InlineVTableStubs;
@@ -38,10 +37,10 @@
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.KLASS_LAYOUT_HELPER_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION;
+import static org.graalvm.word.LocationIdentity.any;
import java.lang.ref.Reference;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.directives.GraalDirectives;
import org.graalvm.compiler.core.common.GraalOptions;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
@@ -155,6 +154,7 @@
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.replacements.DefaultJavaLoweringProvider;
import org.graalvm.compiler.replacements.nodes.AssertionNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotForeignCallsProviderImpl.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotForeignCallsProviderImpl.java Mon Jun 19 16:31:43 2017 -0700
@@ -30,7 +30,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
@@ -44,6 +43,7 @@
import org.graalvm.compiler.word.Word;
import org.graalvm.compiler.word.WordTypes;
import org.graalvm.util.EconomicMap;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CallingConvention;
import jdk.vm.ci.code.CodeCacheProvider;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java Mon Jun 19 16:31:43 2017 -0700
@@ -38,7 +38,6 @@
import java.math.BigInteger;
import java.util.zip.CRC32;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import org.graalvm.compiler.bytecode.BytecodeProvider;
import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
@@ -100,6 +99,7 @@
import org.graalvm.compiler.serviceprovider.JDK9Method;
import org.graalvm.compiler.word.WordOperationPlugin;
import org.graalvm.compiler.word.WordTypes;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.hotspot.HotSpotObjectConstant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java Mon Jun 19 16:31:43 2017 -0700
@@ -98,7 +98,6 @@
import java.util.EnumMap;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
import org.graalvm.compiler.debug.GraalError;
@@ -122,6 +121,7 @@
import org.graalvm.compiler.word.Word;
import org.graalvm.compiler.word.WordTypes;
import org.graalvm.util.EconomicMap;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotWordOperationPlugin.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotWordOperationPlugin.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,12 +22,11 @@
*/
package org.graalvm.compiler.hotspot.meta;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.POINTER_EQ;
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.POINTER_NE;
import static org.graalvm.compiler.nodes.ConstantNode.forBoolean;
+import static org.graalvm.word.LocationIdentity.any;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import org.graalvm.compiler.bytecode.BridgeMethodUtils;
import org.graalvm.compiler.core.common.type.Stamp;
@@ -53,6 +52,7 @@
import org.graalvm.compiler.nodes.type.StampTool;
import org.graalvm.compiler.word.WordOperationPlugin;
import org.graalvm.compiler.word.WordTypes;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/BeginLockScopeNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/BeginLockScopeNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.hotspot.HotSpotLIRGenerator;
@@ -39,6 +38,7 @@
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import org.graalvm.compiler.word.Word;
import org.graalvm.compiler.word.WordTypes;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.Value;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/EndLockScopeNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/EndLockScopeNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -35,6 +34,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
/**
* Intrinsic for closing a {@linkplain BeginLockScopeNode scope} binding a stack-based lock with an
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/StubForeignCallNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/StubForeignCallNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -28,7 +28,6 @@
import java.util.Arrays;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
@@ -43,6 +42,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Value;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/aot/InitializeKlassNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/aot/InitializeKlassNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_4;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_16;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.DeoptimizingFixedWithNextNode;
@@ -34,6 +33,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
@NodeInfo(cycles = CYCLES_4, size = SIZE_16, allowedUsageTypes = {Memory})
public class InitializeKlassNode extends DeoptimizingFixedWithNextNode implements Lowerable, MemoryCheckpoint.Single {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/aot/InitializeKlassStubCall.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/aot/InitializeKlassStubCall.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_16;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.spi.Canonicalizable;
@@ -43,6 +42,7 @@
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import org.graalvm.compiler.nodes.util.GraphUtil;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
import jdk.vm.ci.meta.Constant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/AESCryptSubstitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/AESCryptSubstitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -29,9 +29,6 @@
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.VERY_SLOW_PATH_PROBABILITY;
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.MethodSubstitution;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
@@ -44,6 +41,9 @@
import org.graalvm.compiler.nodes.extended.ForeignCallNode;
import org.graalvm.compiler.nodes.extended.RawLoadNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.DeoptimizationAction;
import jdk.vm.ci.meta.DeoptimizationReason;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32Substitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32Substitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,9 +26,6 @@
import java.util.zip.CRC32;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.WordBase;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
@@ -41,6 +38,9 @@
import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;
import org.graalvm.compiler.nodes.extended.ForeignCallNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.WordBase;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CipherBlockChainingSubstitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CipherBlockChainingSubstitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,11 +26,6 @@
import static org.graalvm.compiler.hotspot.HotSpotBackend.DECRYPT_WITH_ORIGINAL_KEY;
import static org.graalvm.compiler.hotspot.HotSpotBackend.ENCRYPT;
import static org.graalvm.compiler.hotspot.replacements.UnsafeAccess.UNSAFE;
-
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.WordFactory;
-
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
@@ -45,6 +40,9 @@
import org.graalvm.compiler.nodes.extended.ForeignCallNode;
import org.graalvm.compiler.nodes.extended.RawLoadNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ClassGetHubNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ClassGetHubNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,8 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_1;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
-
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;
@@ -52,6 +50,7 @@
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.ConstantReflectionProvider;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HashCodeSnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HashCodeSnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -35,7 +35,6 @@
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.NOT_FREQUENT_PROBABILITY;
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
import org.graalvm.compiler.nodes.StructuredGraph;
@@ -47,6 +46,7 @@
import org.graalvm.compiler.replacements.SnippetTemplate.SnippetInfo;
import org.graalvm.compiler.replacements.Snippets;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.TargetDescription;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotReplacementsUtil.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotReplacementsUtil.java Mon Jun 19 16:31:43 2017 -0700
@@ -28,8 +28,6 @@
import static org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl.VERIFY_OOP;
import static org.graalvm.compiler.hotspot.replacements.UnsafeAccess.UNSAFE;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
import org.graalvm.compiler.core.common.SuppressFBWarnings;
@@ -60,6 +58,8 @@
import org.graalvm.compiler.replacements.nodes.ReadRegisterNode;
import org.graalvm.compiler.replacements.nodes.WriteRegisterNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.code.Register;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/IdentityHashCodeNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/IdentityHashCodeNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.AbstractObjectStamp;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.Node;
@@ -40,6 +39,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.hotspot.HotSpotObjectConstant;
import jdk.vm.ci.meta.JavaConstant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/LoadExceptionObjectSnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/LoadExceptionObjectSnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -33,7 +33,6 @@
import static org.graalvm.compiler.nodes.PiNode.piCastToSnippetReplaceeStamp;
import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
import org.graalvm.compiler.core.common.type.Stamp;
@@ -51,6 +50,7 @@
import org.graalvm.compiler.replacements.Snippets;
import org.graalvm.compiler.replacements.nodes.ReadRegisterNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.code.Register;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/MonitorSnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/MonitorSnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -71,10 +71,6 @@
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.WordBase;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
@@ -122,6 +118,10 @@
import org.graalvm.compiler.replacements.SnippetTemplate.SnippetInfo;
import org.graalvm.compiler.replacements.Snippets;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.WordBase;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.code.Register;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -68,8 +68,6 @@
import static org.graalvm.compiler.replacements.nodes.CStringConstant.cstring;
import static org.graalvm.compiler.replacements.nodes.ExplodeLoopNode.explodeLoop;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
@@ -88,6 +86,7 @@
import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyFixedNode;
import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode;
import org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp;
+import org.graalvm.compiler.hotspot.replacements.aot.ResolveConstantSnippets;
import org.graalvm.compiler.hotspot.word.KlassPointer;
import org.graalvm.compiler.nodes.ConstantNode;
import org.graalvm.compiler.nodes.DeoptimizeNode;
@@ -119,6 +118,8 @@
import org.graalvm.compiler.replacements.Snippets;
import org.graalvm.compiler.replacements.nodes.ExplodeLoopNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.code.MemoryBarriers;
@@ -290,6 +291,7 @@
public static Object allocatePrimitiveArrayPIC(KlassPointer hub, int length, Word prototypeMarkWord, @ConstantParameter int headerSize, @ConstantParameter int log2ElementSize,
@ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter boolean maybeUnroll, @ConstantParameter String typeContext,
@ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
+ // Primitive array types are eagerly pre-resolved. We can use a floating load.
KlassPointer picHub = LoadConstantIndirectlyNode.loadKlass(hub);
return allocateArrayImpl(picHub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters);
}
@@ -298,7 +300,10 @@
public static Object allocateArrayPIC(KlassPointer hub, int length, Word prototypeMarkWord, @ConstantParameter int headerSize, @ConstantParameter int log2ElementSize,
@ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter boolean maybeUnroll, @ConstantParameter String typeContext,
@ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
- KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub);
+ // We need to resolve array type. While element type is guaranteed to be initialized, we
+ // cannot guarantee initialization of the array class if NewArrayInstance comes from
+ // canonicalization of DynamicNewArrayInstance.
+ KlassPointer picHub = ResolveConstantSnippets.pureInitializeKlass(hub);
return allocateArrayImpl(picHub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters);
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA2Substitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA2Substitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,8 +25,6 @@
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.MethodSubstitution;
import org.graalvm.compiler.debug.GraalError;
@@ -35,6 +33,8 @@
import org.graalvm.compiler.nodes.PiNode;
import org.graalvm.compiler.nodes.extended.RawLoadNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA5Substitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA5Substitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,8 +25,6 @@
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.MethodSubstitution;
import org.graalvm.compiler.debug.GraalError;
@@ -35,6 +33,8 @@
import org.graalvm.compiler.nodes.PiNode;
import org.graalvm.compiler.nodes.extended.RawLoadNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHASubstitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHASubstitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,8 +25,6 @@
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.MethodSubstitution;
import org.graalvm.compiler.debug.GraalError;
@@ -35,6 +33,8 @@
import org.graalvm.compiler.nodes.PiNode;
import org.graalvm.compiler.nodes.extended.RawLoadNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/StringToBytesSnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/StringToBytesSnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.hotspot.replacements.UnsafeAccess.UNSAFE;
import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
@@ -42,6 +41,7 @@
import org.graalvm.compiler.replacements.Snippets;
import org.graalvm.compiler.replacements.nodes.CStringConstant;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ThreadSubstitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ThreadSubstitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,13 +22,13 @@
*/
package org.graalvm.compiler.hotspot.replacements;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.JAVA_THREAD_OSTHREAD_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.JAVA_THREAD_THREAD_OBJECT_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.osThreadInterruptedOffset;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.osThreadOffset;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.threadObjectOffset;
+import static org.graalvm.word.LocationIdentity.any;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.MethodSubstitution;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/WriteBarrierSnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/WriteBarrierSnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -44,10 +44,6 @@
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.Unsigned;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
import org.graalvm.compiler.core.common.CompressEncoding;
@@ -91,6 +87,10 @@
import org.graalvm.compiler.replacements.Snippets;
import org.graalvm.compiler.replacements.nodes.DirectStoreNode;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.Unsigned;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.TargetDescription;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopyCallNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopyCallNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,9 +26,6 @@
import static org.graalvm.compiler.nodeinfo.InputType.Memory;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_UNKNOWN;
-
-import org.graalvm.api.word.LocationIdentity;
-
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
@@ -60,6 +57,7 @@
import org.graalvm.compiler.nodes.memory.address.OffsetAddressNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.meta.JavaConstant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopyNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopyNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,9 +22,8 @@
*/
package org.graalvm.compiler.hotspot.replacements.arraycopy;
-import static org.graalvm.api.word.LocationIdentity.any;
+import static org.graalvm.word.LocationIdentity.any;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.NamedLocationIdentity;
@@ -32,6 +31,7 @@
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
import org.graalvm.compiler.replacements.nodes.BasicArrayCopyNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopySlowPathNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopySlowPathNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,9 +25,8 @@
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.meta.JavaKind;
-import static org.graalvm.api.word.LocationIdentity.any;
+import static org.graalvm.word.LocationIdentity.any;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.hotspot.word.KlassPointer;
import org.graalvm.compiler.nodeinfo.InputType;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.type.StampTool;
import org.graalvm.compiler.replacements.SnippetTemplate;
import org.graalvm.compiler.replacements.nodes.BasicArrayCopyNode;
+import org.graalvm.word.LocationIdentity;
@NodeInfo(allowedUsageTypes = InputType.Memory)
public final class ArrayCopySlowPathNode extends BasicArrayCopyNode {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopySnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopySnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -39,8 +39,6 @@
import java.lang.reflect.Method;
import java.util.EnumMap;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.directives.GraalDirectives;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
@@ -76,6 +74,8 @@
import org.graalvm.compiler.replacements.nodes.ExplodeLoopNode;
import org.graalvm.compiler.word.Word;
import org.graalvm.util.UnmodifiableEconomicMap;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopyUnrollNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/ArrayCopyUnrollNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,9 +24,8 @@
import jdk.vm.ci.meta.JavaKind;
-import static org.graalvm.api.word.LocationIdentity.any;
+import static org.graalvm.word.LocationIdentity.any;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.InputType;
@@ -39,6 +38,7 @@
import org.graalvm.compiler.nodes.memory.MemoryNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
@NodeInfo(allowedUsageTypes = InputType.Memory)
public class ArrayCopyUnrollNode extends ArrayRangeWriteNode implements MemoryCheckpoint.Single, Lowerable, MemoryAccess {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,9 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_UNKNOWN;
-
-import org.graalvm.api.word.LocationIdentity;
-
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
@@ -53,6 +50,7 @@
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/UnsafeArrayCopyNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/UnsafeArrayCopyNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,11 +22,10 @@
*/
package org.graalvm.compiler.hotspot.replacements.arraycopy;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_256;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64;
+import static org.graalvm.word.LocationIdentity.any;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.InputType;
@@ -40,6 +39,7 @@
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
import org.graalvm.compiler.replacements.SnippetTemplate.Arguments;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/UnsafeArrayCopySnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/arraycopy/UnsafeArrayCopySnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -35,11 +35,6 @@
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.NOT_FREQUENT_PROBABILITY;
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER;
-
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Unsigned;
-import org.graalvm.api.word.WordFactory;
-
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
import org.graalvm.compiler.api.replacements.Fold;
@@ -58,6 +53,9 @@
import org.graalvm.compiler.replacements.SnippetTemplate.Arguments;
import org.graalvm.compiler.replacements.SnippetTemplate.SnippetInfo;
import org.graalvm.compiler.word.ObjectAccess;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Unsigned;
+import org.graalvm.word.WordFactory;
import org.graalvm.compiler.replacements.Snippets;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/CreateExceptionStub.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/CreateExceptionStub.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,12 +22,12 @@
*/
package org.graalvm.compiler.hotspot.stubs;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.SAFEPOINT;
import static org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl.REEXECUTABLE;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.clearPendingException;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
+import static org.graalvm.word.LocationIdentity.any;
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
import org.graalvm.compiler.api.replacements.Fold;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ExceptionHandlerStub.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ExceptionHandlerStub.java Mon Jun 19 16:31:43 2017 -0700
@@ -36,7 +36,6 @@
import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
import org.graalvm.compiler.api.replacements.Snippet;
@@ -52,6 +51,7 @@
import org.graalvm.compiler.hotspot.nodes.StubForeignCallNode;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.Register;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ForeignCallStub.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ForeignCallStub.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,9 +24,6 @@
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
-
-import org.graalvm.api.word.LocationIdentity;
-
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCall;
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCallee;
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
@@ -57,6 +54,7 @@
import org.graalvm.compiler.replacements.nodes.ReadRegisterNode;
import org.graalvm.compiler.word.Word;
import org.graalvm.compiler.word.WordTypes;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
import jdk.vm.ci.hotspot.HotSpotSignature;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java Mon Jun 19 16:31:43 2017 -0700
@@ -41,9 +41,6 @@
import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject;
-
-import org.graalvm.api.word.WordFactory;
-
import static jdk.vm.ci.hotspot.HotSpotMetaAccessProvider.computeArrayAllocationSize;
import org.graalvm.compiler.api.replacements.Fold;
@@ -62,6 +59,7 @@
import org.graalvm.compiler.nodes.ConstantNode;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java Mon Jun 19 16:31:43 2017 -0700
@@ -64,7 +64,6 @@
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.FAST_PATH_PROBABILITY;
import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
@@ -81,6 +80,7 @@
import org.graalvm.compiler.nodes.ConstantNode;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubUtil.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubUtil.java Mon Jun 19 16:31:43 2017 -0700
@@ -35,8 +35,6 @@
import java.util.Arrays;
import java.util.List;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
@@ -52,6 +50,8 @@
import org.graalvm.compiler.nodes.extended.GuardingNode;
import org.graalvm.compiler.replacements.Log;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.DeoptimizationAction;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java Mon Jun 19 16:31:43 2017 -0700
@@ -32,7 +32,6 @@
import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf;
-import org.graalvm.api.word.Pointer;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
import org.graalvm.compiler.api.replacements.Snippet;
@@ -48,6 +47,7 @@
import org.graalvm.compiler.nodes.UnwindNode;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.Pointer;
import jdk.vm.ci.code.Register;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/word/KlassPointer.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/word/KlassPointer.java Mon Jun 19 16:31:43 2017 -0700
@@ -27,10 +27,10 @@
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.READ_KLASS_POINTER;
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.TO_KLASS_POINTER;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
import org.graalvm.compiler.word.Word.Opcode;
import org.graalvm.compiler.word.Word.Operation;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
/**
* Marker type for a metaspace pointer to a type.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/word/MetaspacePointer.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/word/MetaspacePointer.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,15 +25,15 @@
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.FROM_POINTER;
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.IS_NULL;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.Signed;
-import org.graalvm.api.word.Unsigned;
-import org.graalvm.api.word.WordBase;
import org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType;
import org.graalvm.compiler.word.Word;
import org.graalvm.compiler.word.Word.Opcode;
import org.graalvm.compiler.word.Word.Operation;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.Signed;
+import org.graalvm.word.Unsigned;
+import org.graalvm.word.WordBase;
/**
* Marker type for a metaspace pointer.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/word/MethodPointer.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/word/MethodPointer.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,7 @@
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.POINTER_NE;
import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.TO_METHOD_POINTER;
-import org.graalvm.api.word.Pointer;
+import org.graalvm.word.Pointer;
/**
* Marker type for a metaspace pointer to a method.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java Mon Jun 19 16:31:43 2017 -0700
@@ -264,7 +264,6 @@
import java.util.Formatter;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.bytecode.Bytecode;
import org.graalvm.compiler.bytecode.BytecodeDisassembler;
@@ -407,6 +406,7 @@
import org.graalvm.compiler.phases.util.ValueMergeUtil;
import org.graalvm.util.EconomicMap;
import org.graalvm.util.Equivalence;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.code.BytecodeFrame;
@@ -1931,6 +1931,15 @@
return inlineInfo;
}
}
+
+ // There was no inline plugin with a definite answer to whether or not
+ // to inline. If we're parsing an intrinsic, then we need to enforce the
+ // invariant here that methods are always force inlined in intrinsics/snippets.
+ if (parsingIntrinsic()) {
+ if (inline(targetMethod, targetMethod, this.bytecodeProvider, args)) {
+ return SUCCESSFULLY_INLINED;
+ }
+ }
return null;
}
@@ -3678,9 +3687,9 @@
ResolvedJavaType resolvedType = (ResolvedJavaType) type;
ClassInitializationPlugin classInitializationPlugin = this.graphBuilderConfig.getPlugins().getClassInitializationPlugin();
- if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedType.getArrayClass())) {
+ if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedType)) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
- classInitializationPlugin.apply(this, resolvedType.getArrayClass(), stateBefore);
+ classInitializationPlugin.apply(this, resolvedType, stateBefore);
}
ValueNode length = frameState.pop(JavaKind.Int);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/StaticFieldAccessTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 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 org.graalvm.compiler.nodes.test;
+
+import java.lang.reflect.Constructor;
+
+import org.graalvm.compiler.core.test.GraalCompilerTest;
+import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
+import org.junit.Test;
+
+public class StaticFieldAccessTest extends GraalCompilerTest {
+
+ static StaticFieldAccessTest tester;
+
+ public static class Inner {
+ static Object o;
+
+ static {
+ Constructor<?>[] c = Inner.class.getConstructors();
+ if (c.length != 1) {
+ throw new InternalError("can't find single constructor");
+ }
+ tester.parseDebug(tester.asResolvedJavaMethod(c[0]), AllowAssumptions.YES);
+ }
+
+ public Inner(Object o) {
+ Inner.o = o;
+ }
+ }
+
+ @Test
+ public void test() {
+ tester = this;
+ System.out.println(Inner.o);
+ }
+}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/FieldLocationIdentity.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/FieldLocationIdentity.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,7 +24,7 @@
import jdk.vm.ci.meta.JavaKind.FormatWithToString;
-import org.graalvm.api.word.LocationIdentity;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.ResolvedJavaField;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -23,7 +23,7 @@
package org.graalvm.compiler.nodes;
import jdk.vm.ci.meta.JavaKind;
-import org.graalvm.api.word.LocationIdentity;
+
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
@@ -41,6 +41,7 @@
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import org.graalvm.compiler.nodes.spi.UncheckedInterfaceProvider;
import org.graalvm.compiler.nodes.util.GraphUtil;
+import org.graalvm.word.LocationIdentity;
import java.util.Map;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeWithExceptionNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeWithExceptionNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -23,7 +23,7 @@
package org.graalvm.compiler.nodes;
import jdk.vm.ci.meta.JavaKind;
-import org.graalvm.api.word.LocationIdentity;
+
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
@@ -37,6 +37,7 @@
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import org.graalvm.compiler.nodes.spi.UncheckedInterfaceProvider;
import org.graalvm.compiler.nodes.util.GraphUtil;
+import org.graalvm.word.LocationIdentity;
import java.util.Map;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/KillingBeginNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/KillingBeginNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,10 +26,10 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
+import org.graalvm.word.LocationIdentity;
@NodeInfo(allowedUsageTypes = {Memory}, cycles = CYCLES_0, size = SIZE_0)
public final class KillingBeginNode extends AbstractBeginNode implements MemoryCheckpoint.Single {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/NamedLocationIdentity.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/NamedLocationIdentity.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,7 @@
import java.util.EnumMap;
import org.graalvm.util.Equivalence;
-import org.graalvm.api.word.LocationIdentity;
+import org.graalvm.word.LocationIdentity;
import org.graalvm.util.EconomicSet;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StartNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StartNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,10 +26,10 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
+import org.graalvm.word.LocationIdentity;
/**
* The start node of a graph.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java Mon Jun 19 16:31:43 2017 -0700
@@ -234,6 +234,7 @@
private final int entryBCI;
private GuardsStage guardsStage = GuardsStage.FLOATING_GUARDS;
private boolean isAfterFloatingReadPhase = false;
+ private boolean isAfterFixedReadPhase = false;
private boolean hasValueProxies = true;
private boolean isAfterExpandLogic = false;
private final boolean useProfilingInfo;
@@ -685,11 +686,20 @@
return isAfterFloatingReadPhase;
}
+ public boolean isAfterFixedReadPhase() {
+ return isAfterFixedReadPhase;
+ }
+
public void setAfterFloatingReadPhase(boolean state) {
assert state : "cannot 'unapply' floating read phase on graph";
isAfterFloatingReadPhase = state;
}
+ public void setAfterFixReadPhase(boolean state) {
+ assert state : "cannot 'unapply' fix reads phase on graph";
+ isAfterFixedReadPhase = state;
+ }
+
public boolean hasValueProxies() {
return hasValueProxies;
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/Block.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/Block.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import java.util.ArrayList;
import java.util.Iterator;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
import org.graalvm.compiler.core.common.cfg.AbstractControlFlowGraph;
import org.graalvm.compiler.core.common.cfg.Loop;
@@ -38,6 +37,7 @@
import org.graalvm.compiler.nodes.LoopBeginNode;
import org.graalvm.compiler.nodes.LoopEndNode;
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
+import org.graalvm.word.LocationIdentity;
public final class Block extends AbstractBlockBase<Block> {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/HIRLoop.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/HIRLoop.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,9 +22,9 @@
*/
package org.graalvm.compiler.nodes.cfg;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.cfg.Loop;
import org.graalvm.compiler.nodes.LoopBeginNode;
+import org.graalvm.word.LocationIdentity;
public final class HIRLoop extends Loop<Block> {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/LocationSet.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/LocationSet.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,7 @@
import java.util.Arrays;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
+import org.graalvm.word.LocationIdentity;
public class LocationSet {
private LocationIdentity firstLocation;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/debug/StringToBytesNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/debug/StringToBytesNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.InputType;
@@ -35,6 +34,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/BytecodeExceptionNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/BytecodeExceptionNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_8;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.core.common.type.TypeReference;
@@ -38,6 +37,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.MetaAccessProvider;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/ForeignCallNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/ForeignCallNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -29,7 +29,6 @@
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
@@ -47,6 +46,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/GuardedUnsafeLoadNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/GuardedUnsafeLoadNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,10 +24,10 @@
import static org.graalvm.compiler.nodeinfo.InputType.Guard;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/JavaReadNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/JavaReadNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/JavaWriteNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/JavaWriteNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,6 @@
*/
package org.graalvm.compiler.nodes.extended;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.StateSplit;
@@ -33,6 +32,7 @@
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/MembarNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/MembarNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -34,6 +33,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
/**
* Creates a memory barrier.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/RawLoadNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/RawLoadNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.PrimitiveStamp;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.core.common.type.StampFactory;
@@ -40,6 +39,7 @@
import org.graalvm.compiler.nodes.spi.Virtualizable;
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Assumptions;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/RawStoreNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/RawStoreNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -41,6 +40,7 @@
import org.graalvm.compiler.nodes.spi.Virtualizable;
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Assumptions;
import jdk.vm.ci.meta.JavaConstant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeAccessNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeAccessNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
@@ -36,6 +35,7 @@
import org.graalvm.compiler.nodes.NamedLocationIdentity;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.type.StampTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Assumptions;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeCopyNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeCopyNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,11 +22,11 @@
*/
package org.graalvm.compiler.nodes.extended;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
import org.graalvm.compiler.graph.Node.NodeIntrinsic;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeMemoryLoadNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeMemoryLoadNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -33,6 +32,7 @@
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeMemoryStoreNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/UnsafeMemoryStoreNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -34,6 +33,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AbstractCompareAndSwapNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AbstractCompareAndSwapNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.InputType.Memory;
import static org.graalvm.compiler.nodeinfo.InputType.State;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.InputType;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.memory.LIRLowerableAccess;
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
+import org.graalvm.word.LocationIdentity;
/**
* Low-level atomic compare-and-swap operation.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AccessFieldNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AccessFieldNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -63,7 +63,6 @@
super(c, stamp);
this.object = object;
this.field = field;
- assert object != null || field.getDeclaringClass().isInitialized();
}
/**
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AtomicReadAndAddNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AtomicReadAndAddNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -27,7 +27,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Value;
import sun.misc.Unsafe;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AtomicReadAndWriteNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AtomicReadAndWriteNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -34,6 +33,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
import sun.misc.Unsafe;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/ExceptionObjectNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/ExceptionObjectNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,7 +24,7 @@
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.MetaAccessProvider;
-import org.graalvm.api.word.LocationIdentity;
+
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.core.common.type.TypeReference;
import org.graalvm.compiler.graph.NodeClass;
@@ -38,6 +38,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import static org.graalvm.compiler.nodeinfo.InputType.Memory;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/LogicCompareAndSwapNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/LogicCompareAndSwapNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_8;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
@@ -34,6 +33,7 @@
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/LoweredAtomicReadAndWriteNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/LoweredAtomicReadAndWriteNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -27,7 +27,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -39,6 +38,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Value;
import sun.misc.Unsafe;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/MonitorEnterNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/MonitorEnterNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_64;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.IterableNodeType;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.spi.Virtualizable;
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.word.LocationIdentity;
/**
* The {@code MonitorEnterNode} represents the acquisition of a monitor.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/MonitorExitNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/MonitorExitNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_64;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.IterableNodeType;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.spi.Virtualizable;
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.word.LocationIdentity;
/**
* The {@code MonitorExitNode} represents a monitor release. If it is the release of the monitor of
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/RawMonitorEnterNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/RawMonitorEnterNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_64;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.ObjectStamp;
import org.graalvm.compiler.graph.IterableNodeType;
import org.graalvm.compiler.graph.NodeClass;
@@ -38,6 +37,7 @@
import org.graalvm.compiler.nodes.spi.Virtualizable;
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.word.LocationIdentity;
/**
* The {@code RawMonitorEnterNode} represents the acquisition of a monitor. The object needs to
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/UnsafeCompareAndSwapNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/UnsafeCompareAndSwapNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -27,7 +27,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_8;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -36,6 +35,7 @@
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/ValueCompareAndSwapNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/ValueCompareAndSwapNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,13 +25,13 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_8;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_8;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
/**
* A special purpose store node that differs from {@link LogicCompareAndSwapNode} in that it returns
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/AbstractWriteNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/AbstractWriteNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.ValueNodeUtil;
import org.graalvm.compiler.nodes.extended.GuardingNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
+import org.graalvm.word.LocationIdentity;
@NodeInfo(allowedUsageTypes = {InputType.Memory, InputType.Guard}, cycles = CYCLES_2, size = SIZE_1)
public abstract class AbstractWriteNode extends FixedAccessNode implements StateSplit, MemoryCheckpoint.Single, MemoryAccess, GuardingNode {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/Access.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/Access.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,9 +22,9 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.nodes.extended.GuardedNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
+import org.graalvm.word.LocationIdentity;
public interface Access extends GuardedNode, HeapAccess {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FixedAccessNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FixedAccessNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,6 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.IterableNodeType;
import org.graalvm.compiler.graph.NodeClass;
@@ -32,6 +31,7 @@
import org.graalvm.compiler.nodes.FrameState;
import org.graalvm.compiler.nodes.extended.GuardingNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
+import org.graalvm.word.LocationIdentity;
/**
* Accesses a value at an memory address specified by an {@linkplain #address address}. The access
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FloatableAccessNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FloatableAccessNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,13 +22,13 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.FrameState;
import org.graalvm.compiler.nodes.extended.GuardingNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
+import org.graalvm.word.LocationIdentity;
/**
* An {@link FixedAccessNode} that can be converted to a {@link FloatingAccessNode}.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FloatingAccessNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FloatingAccessNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,6 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.InputType;
@@ -30,6 +29,7 @@
import org.graalvm.compiler.nodes.FloatingGuardedNode;
import org.graalvm.compiler.nodes.extended.GuardingNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
+import org.graalvm.word.LocationIdentity;
@NodeInfo
public abstract class FloatingAccessNode extends FloatingGuardedNode implements Access, MemoryAccess {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FloatingReadNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FloatingReadNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.core.common.type.ObjectStamp;
import org.graalvm.compiler.core.common.type.Stamp;
@@ -41,6 +40,7 @@
import org.graalvm.compiler.nodes.extended.GuardingNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
/**
* A floating read of a value from memory specified in terms of an object base and an object
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryAccess.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryAccess.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,7 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
+import org.graalvm.word.LocationIdentity;
/**
* This interface marks nodes that access some memory location, and that have an edge to the last
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryCheckpoint.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryCheckpoint.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,10 +22,10 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.nodes.FixedNode;
import org.graalvm.compiler.nodes.FixedNodeInterface;
+import org.graalvm.word.LocationIdentity;
/**
* This interface marks subclasses of {@link FixedNode} that kill a set of memory locations
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryMap.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryMap.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,7 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
+import org.graalvm.word.LocationIdentity;
/**
* Maps a {@linkplain LocationIdentity location} to the last node that (potentially) wrote to the
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryMapNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryMapNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,17 +22,16 @@
*/
package org.graalvm.compiler.nodes.memory;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.nodeinfo.InputType.Extension;
import static org.graalvm.compiler.nodeinfo.InputType.Memory;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
+import static org.graalvm.word.LocationIdentity.any;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.NodeInputList;
@@ -45,6 +44,7 @@
import org.graalvm.util.Equivalence;
import org.graalvm.util.EconomicMap;
import org.graalvm.util.MapCursor;
+import org.graalvm.word.LocationIdentity;
@NodeInfo(allowedUsageTypes = {Extension, Memory}, cycles = CYCLES_0, size = SIZE_0)
public final class MemoryMapNode extends FloatingNode implements MemoryMap, MemoryNode, LIRLowerable {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryPhiNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/MemoryPhiNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,6 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.NodeInputList;
@@ -31,6 +30,7 @@
import org.graalvm.compiler.nodes.AbstractMergeNode;
import org.graalvm.compiler.nodes.PhiNode;
import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.word.LocationIdentity;
/**
* Memory {@code PhiNode}s merge memory dependencies at control flow merges.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/ReadNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/ReadNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
import static org.graalvm.compiler.nodes.NamedLocationIdentity.ARRAY_LENGTH_LOCATION;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.debug.DebugCloseable;
@@ -48,6 +47,7 @@
import org.graalvm.compiler.nodes.spi.Virtualizable;
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.util.GraphUtil;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.MetaAccessProvider;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/WriteNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/WriteNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,6 @@
*/
package org.graalvm.compiler.nodes.memory;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.NodeClass;
@@ -30,6 +29,7 @@
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
/**
* Writes a given {@linkplain #value() value} a {@linkplain FixedAccessNode memory location}.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/MemoryProxy.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/MemoryProxy.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,8 +22,8 @@
*/
package org.graalvm.compiler.nodes.spi;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.nodes.memory.MemoryNode;
+import org.graalvm.word.LocationIdentity;
public interface MemoryProxy extends Proxy, MemoryNode {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/virtual/CommitAllocationNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/virtual/CommitAllocationNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -33,7 +33,6 @@
import java.util.List;
import java.util.Map;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
@@ -54,6 +53,7 @@
import org.graalvm.compiler.nodes.spi.LoweringTool;
import org.graalvm.compiler.nodes.spi.VirtualizableAllocation;
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
+import org.graalvm.word.LocationIdentity;
// @formatter:off
@NodeInfo(nameTemplate = "Alloc {i#virtualObjects}",
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/AddressLoweringByUsePhase.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/AddressLoweringByUsePhase.java Mon Jun 19 16:31:43 2017 -0700
@@ -94,8 +94,13 @@
// the lowered address amy already be a replacement
// in which case we want to use it not delete it!
if (lowered != address) {
- address.replaceAtUsages(lowered);
- GraphUtil.killWithUnusedFloatingInputs(address);
+ // replace original with lowered at this usage only
+ // n.b. lowered is added unique so repeat lowerings will elide
+ node.replaceFirstInput(address, lowered);
+ // if that was the last reference we can kill the old (dead) node
+ if (address.hasNoUsages()) {
+ GraphUtil.killWithUnusedFloatingInputs(address);
+ }
}
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FixReadsPhase.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FixReadsPhase.java Mon Jun 19 16:31:43 2017 -0700
@@ -53,6 +53,7 @@
import org.graalvm.compiler.nodes.calc.ConditionalNode;
import org.graalvm.compiler.nodes.calc.UnaryNode;
import org.graalvm.compiler.nodes.cfg.Block;
+import org.graalvm.compiler.nodes.cfg.ControlFlowGraph;
import org.graalvm.compiler.nodes.cfg.ControlFlowGraph.RecursiveVisitor;
import org.graalvm.compiler.nodes.extended.IntegerSwitchNode;
import org.graalvm.compiler.nodes.memory.FixedAccessNode;
@@ -64,7 +65,10 @@
import org.graalvm.compiler.phases.BasePhase;
import org.graalvm.compiler.phases.Phase;
import org.graalvm.compiler.phases.graph.ScheduledNodeIterator;
+import org.graalvm.compiler.phases.schedule.SchedulePhase;
+import org.graalvm.compiler.phases.schedule.SchedulePhase.SchedulingStrategy;
import org.graalvm.compiler.phases.tiers.LowTierContext;
+import org.graalvm.compiler.phases.tiers.PhaseContext;
import org.graalvm.util.EconomicMap;
import org.graalvm.util.MapCursor;
@@ -85,8 +89,8 @@
private static final DebugCounter counterConstantInputReplacements = Debug.counter("FixReads_ConstantInputReplacement");
private static final DebugCounter counterBetterMergedStamps = Debug.counter("FixReads_BetterMergedStamp");
- private boolean replaceInputsWithConstants;
- private Phase schedulePhase;
+ protected boolean replaceInputsWithConstants;
+ protected Phase schedulePhase;
@Override
public float codeSizeIncrease() {
@@ -123,7 +127,7 @@
}
- private static class RawConditionalEliminationVisitor implements RecursiveVisitor<Integer> {
+ protected static class RawConditionalEliminationVisitor implements RecursiveVisitor<Integer> {
protected final NodeMap<StampElement> stampMap;
protected final NodeStack undoOperations;
@@ -134,7 +138,7 @@
private final BlockMap<Integer> blockActionStart;
private final EconomicMap<MergeNode, EconomicMap<ValueNode, Stamp>> endMaps;
- RawConditionalEliminationVisitor(StructuredGraph graph, ScheduleResult schedule, MetaAccessProvider metaAccess, boolean replaceInputsWithConstants) {
+ protected RawConditionalEliminationVisitor(StructuredGraph graph, ScheduleResult schedule, MetaAccessProvider metaAccess, boolean replaceInputsWithConstants) {
this.graph = graph;
this.schedule = schedule;
this.metaAccess = metaAccess;
@@ -145,38 +149,49 @@
replaceConstantInputs = replaceInputsWithConstants && GraalOptions.ReplaceInputsWithConstantsBasedOnStamps.getValue(graph.getOptions());
}
+ protected void replaceInput(Position p, Node oldInput, Node newConstantInput) {
+ p.set(oldInput, newConstantInput);
+ }
+
+ protected int replaceConstantInputs(Node node) {
+ int replacements = 0;
+ // Check if we can replace any of the inputs with a constant.
+ for (Position p : node.inputPositions()) {
+ Node input = p.get(node);
+ if (p.getInputType() == InputType.Value) {
+ if (input instanceof ValueNode) {
+ ValueNode valueNode = (ValueNode) input;
+ if (valueNode instanceof ConstantNode) {
+ // Input already is a constant.
+ } else {
+ Stamp bestStamp = getBestStamp(valueNode);
+ Constant constant = bestStamp.asConstant();
+ if (constant != null) {
+ if (bestStamp instanceof FloatStamp) {
+ FloatStamp floatStamp = (FloatStamp) bestStamp;
+ if (floatStamp.contains(0.0d)) {
+ // Could also be -0.0d.
+ continue;
+ }
+ }
+ counterConstantInputReplacements.increment();
+ ConstantNode stampConstant = ConstantNode.forConstant(bestStamp, constant, metaAccess, graph);
+ assert stampConstant.stamp().isCompatible(valueNode.stamp());
+ replaceInput(p, node, stampConstant);
+ replacements++;
+ }
+ }
+ }
+ }
+ }
+ return replacements;
+ }
+
protected void processNode(Node node) {
assert node.isAlive();
if (replaceConstantInputs) {
- // Check if we can replace any of the inputs with a constant.
- for (Position p : node.inputPositions()) {
- Node input = p.get(node);
- if (p.getInputType() == InputType.Value) {
- if (input instanceof ValueNode) {
- ValueNode valueNode = (ValueNode) input;
- if (valueNode instanceof ConstantNode) {
- // Input already is a constant.
- } else {
- Stamp bestStamp = getBestStamp(valueNode);
- Constant constant = bestStamp.asConstant();
- if (constant != null) {
- if (bestStamp instanceof FloatStamp) {
- FloatStamp floatStamp = (FloatStamp) bestStamp;
- if (floatStamp.contains(0.0d)) {
- // Could also be -0.0d.
- continue;
- }
- }
- counterConstantInputReplacements.increment();
- ConstantNode stampConstant = ConstantNode.forConstant(bestStamp, constant, metaAccess, graph);
- assert stampConstant.stamp().isCompatible(valueNode.stamp());
- p.set(node, stampConstant);
- }
- }
- }
- }
- }
+ replaceConstantInputs(node);
}
if (node instanceof MergeNode) {
@@ -200,7 +215,7 @@
}
}
- private void registerCombinedStamps(MergeNode node) {
+ protected void registerCombinedStamps(MergeNode node) {
EconomicMap<ValueNode, Stamp> endMap = endMaps.get(node);
MapCursor<ValueNode, Stamp> entries = endMap.getEntries();
while (entries.advance()) {
@@ -210,7 +225,7 @@
}
}
- private void processEnd(EndNode node) {
+ protected void processEnd(EndNode node) {
AbstractMergeNode abstractMerge = node.merge();
if (abstractMerge instanceof MergeNode) {
MergeNode merge = (MergeNode) abstractMerge;
@@ -294,14 +309,14 @@
return blockToNodeMap.get(node);
}
- private void processUnary(UnaryNode node) {
+ protected void processUnary(UnaryNode node) {
Stamp newStamp = node.foldStamp(getBestStamp(node.getValue()));
if (!checkReplaceWithConstant(newStamp, node)) {
registerNewValueStamp(node, newStamp);
}
}
- private boolean checkReplaceWithConstant(Stamp newStamp, ValueNode node) {
+ protected boolean checkReplaceWithConstant(Stamp newStamp, ValueNode node) {
Constant constant = newStamp.asConstant();
if (constant != null && !(node instanceof ConstantNode)) {
ConstantNode stampConstant = ConstantNode.forConstant(newStamp, constant, metaAccess, graph);
@@ -314,7 +329,7 @@
return false;
}
- private void processBinary(BinaryNode node) {
+ protected void processBinary(BinaryNode node) {
Stamp xStamp = getBestStamp(node.getX());
Stamp yStamp = getBestStamp(node.getY());
Stamp newStamp = node.foldStamp(xStamp, yStamp);
@@ -323,7 +338,7 @@
}
}
- private void processIntegerSwitch(IntegerSwitchNode node) {
+ protected void processIntegerSwitch(IntegerSwitchNode node) {
Stamp bestStamp = getBestStamp(node.value());
if (node.tryRemoveUnreachableKeys(null, bestStamp)) {
Debug.log("\t Canonicalized integer switch %s for value %s and stamp %s", node, node.value(), bestStamp);
@@ -331,7 +346,7 @@
}
}
- private void processIf(IfNode node) {
+ protected void processIf(IfNode node) {
TriState result = tryProveCondition(node.condition());
if (result != TriState.UNKNOWN) {
boolean isTrue = (result == TriState.TRUE);
@@ -345,7 +360,7 @@
}
}
- private void processConditional(ConditionalNode node) {
+ protected void processConditional(ConditionalNode node) {
TriState result = tryProveCondition(node.condition());
if (result != TriState.UNKNOWN) {
boolean isTrue = (result == TriState.TRUE);
@@ -358,7 +373,7 @@
}
}
- private TriState tryProveCondition(LogicNode condition) {
+ protected TriState tryProveCondition(LogicNode condition) {
Stamp conditionStamp = this.getBestStamp(condition);
if (conditionStamp == StampFactory.tautology()) {
return TriState.TRUE;
@@ -377,7 +392,7 @@
return TriState.UNKNOWN;
}
- private void processAbstractBegin(AbstractBeginNode beginNode) {
+ protected void processAbstractBegin(AbstractBeginNode beginNode) {
Node predecessor = beginNode.predecessor();
if (predecessor instanceof IfNode) {
IfNode ifNode = (IfNode) predecessor;
@@ -484,8 +499,37 @@
fixReadsClosure.processNodes(block, schedule);
}
if (GraalOptions.RawConditionalElimination.getValue(graph.getOptions())) {
- schedule.getCFG().visitDominatorTree(new RawConditionalEliminationVisitor(graph, schedule, context.getMetaAccess(), replaceInputsWithConstants), false);
+ schedule.getCFG().visitDominatorTree(createVisitor(graph, schedule, context), false);
+ }
+ graph.setAfterFixReadPhase(true);
+ }
+
+ public static class RawCEPhase extends BasePhase<LowTierContext> {
+
+ private final boolean replaceInputsWithConstants;
+
+ public RawCEPhase(boolean replaceInputsWithConstants) {
+ this.replaceInputsWithConstants = replaceInputsWithConstants;
}
+
+ @Override
+ protected CharSequence getName() {
+ return "RawCEPhase";
+ }
+
+ @Override
+ protected void run(StructuredGraph graph, LowTierContext context) {
+ if (GraalOptions.RawConditionalElimination.getValue(graph.getOptions())) {
+ SchedulePhase schedulePhase = new SchedulePhase(SchedulingStrategy.LATEST, true);
+ schedulePhase.apply(graph);
+ ScheduleResult schedule = graph.getLastSchedule();
+ schedule.getCFG().visitDominatorTree(new RawConditionalEliminationVisitor(graph, schedule, context.getMetaAccess(), replaceInputsWithConstants), false);
+ }
+ }
+ }
+
+ protected ControlFlowGraph.RecursiveVisitor<?> createVisitor(StructuredGraph graph, ScheduleResult schedule, PhaseContext context) {
+ return new RawConditionalEliminationVisitor(graph, schedule, context.getMetaAccess(), replaceInputsWithConstants);
}
protected static final class StampElement {
@@ -517,4 +561,8 @@
return result.toString();
}
}
+
+ public void setReplaceInputsWithConstants(boolean replaceInputsWithConstants) {
+ this.replaceInputsWithConstants = replaceInputsWithConstants;
+ }
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FloatingReadPhase.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FloatingReadPhase.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,15 +22,14 @@
*/
package org.graalvm.compiler.phases.common;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.graph.Graph.NodeEvent.NODE_ADDED;
import static org.graalvm.compiler.graph.Graph.NodeEvent.ZERO_USAGES;
+import static org.graalvm.word.LocationIdentity.any;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.cfg.Loop;
import org.graalvm.compiler.debug.DebugCloseable;
import org.graalvm.compiler.graph.Graph.NodeEventScope;
@@ -72,6 +71,7 @@
import org.graalvm.util.EconomicMap;
import org.graalvm.util.EconomicSet;
import org.graalvm.util.UnmodifiableMapCursor;
+import org.graalvm.word.LocationIdentity;
public class FloatingReadPhase extends Phase {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/LoweringPhase.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/LoweringPhase.java Mon Jun 19 16:31:43 2017 -0700
@@ -35,7 +35,6 @@
import java.util.Collection;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.debug.DebugCloseable;
@@ -76,6 +75,7 @@
import org.graalvm.compiler.phases.Phase;
import org.graalvm.compiler.phases.schedule.SchedulePhase;
import org.graalvm.compiler.phases.tiers.PhaseContext;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.DeoptimizationAction;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/MemoryScheduleVerification.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/MemoryScheduleVerification.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,7 +24,6 @@
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.cfg.BlockMap;
import org.graalvm.compiler.core.common.cfg.Loop;
import org.graalvm.compiler.debug.Debug;
@@ -42,6 +41,7 @@
import org.graalvm.compiler.phases.graph.ReentrantBlockIterator;
import org.graalvm.compiler.phases.graph.ReentrantBlockIterator.BlockIteratorClosure;
import org.graalvm.util.Equivalence;
+import org.graalvm.word.LocationIdentity;
import org.graalvm.util.EconomicSet;
public final class MemoryScheduleVerification extends BlockIteratorClosure<EconomicSet<FloatingReadNode>> {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/SchedulePhase.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/SchedulePhase.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,6 @@
*/
package org.graalvm.compiler.phases.schedule;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.GraalOptions;
import org.graalvm.compiler.core.common.SuppressFBWarnings;
import org.graalvm.compiler.core.common.cfg.AbstractControlFlowGraph;
@@ -68,6 +67,7 @@
import org.graalvm.compiler.nodes.spi.ValueProxy;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.phases.Phase;
+import org.graalvm.word.LocationIdentity;
import java.util.ArrayList;
import java.util.Arrays;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/BinaryGraphPrinter.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/BinaryGraphPrinter.java Mon Jun 19 16:31:43 2017 -0700
@@ -70,6 +70,7 @@
import jdk.vm.ci.meta.ResolvedJavaField;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.Signature;
+import org.graalvm.compiler.graph.NodeSourcePosition;
public class BinaryGraphPrinter implements GraphPrinter {
@@ -88,6 +89,7 @@
private static final int POOL_NODE_CLASS = 0x06;
private static final int POOL_FIELD = 0x07;
private static final int POOL_SIGNATURE = 0x08;
+ private static final int POOL_NODE_SOURCE_POSITION = 0x09;
private static final int PROPERTY_POOL = 0x00;
private static final int PROPERTY_INT = 0x01;
@@ -102,7 +104,7 @@
private static final int KLASS = 0x00;
private static final int ENUM_KLASS = 0x01;
- static final int CURRENT_MAJOR_VERSION = 1;
+ static final int CURRENT_MAJOR_VERSION = 4;
static final int CURRENT_MINOR_VERSION = 0;
static final byte[] MAGIC_BYTES = {'B', 'I', 'G', 'V'};
@@ -341,6 +343,8 @@
writeByte(POOL_FIELD);
} else if (object instanceof Signature) {
writeByte(POOL_SIGNATURE);
+ } else if (CURRENT_MAJOR_VERSION >= 4 && object instanceof NodeSourcePosition) {
+ writeByte(POOL_NODE_SOURCE_POSITION);
} else {
writeByte(POOL_STRING);
}
@@ -425,6 +429,21 @@
writePoolObject(signature.getParameterType(i, null).getName());
}
writePoolObject(signature.getReturnType(null).getName());
+ } else if (CURRENT_MAJOR_VERSION >= 4 && object instanceof NodeSourcePosition) {
+ writeByte(POOL_NODE_SOURCE_POSITION);
+ NodeSourcePosition pos = (NodeSourcePosition) object;
+ ResolvedJavaMethod method = pos.getMethod();
+ writePoolObject(method);
+ final int bci = pos.getBCI();
+ writeInt(bci);
+ StackTraceElement ste = method.asStackTraceElement(bci);
+ if (ste != null) {
+ writePoolObject(ste.getFileName());
+ writeInt(ste.getLineNumber());
+ } else {
+ writePoolObject(null);
+ }
+ writePoolObject(pos.getCaller());
} else {
writeByte(POOL_STRING);
writeString(object.toString());
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.aarch64/src/org/graalvm/compiler/replacements/aarch64/AArch64IntegerArithmeticSnippets.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.aarch64/src/org/graalvm/compiler/replacements/aarch64/AArch64IntegerArithmeticSnippets.java Mon Jun 19 16:31:43 2017 -0700
@@ -38,6 +38,7 @@
import org.graalvm.compiler.nodes.calc.UnsignedDivNode;
import org.graalvm.compiler.nodes.calc.UnsignedRemNode;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.phases.util.Providers;
import org.graalvm.compiler.replacements.SnippetTemplate;
@@ -205,6 +206,13 @@
protected SafeSignedDivNode(ValueNode x, ValueNode y) {
super(TYPE, x, y);
}
+
+ @Override
+ public void generate(NodeLIRBuilderTool gen) {
+ // override to ensure we always pass a null frame state
+ // the parent method expects to create one from a non null before state
+ gen.setResult(this, gen.getLIRGeneratorTool().getArithmetic().emitDiv(gen.operand(getX()), gen.operand(getY()), null));
+ }
}
@NodeInfo
@@ -214,6 +222,13 @@
protected SafeSignedRemNode(ValueNode x, ValueNode y) {
super(TYPE, x, y);
}
+
+ @Override
+ public void generate(NodeLIRBuilderTool gen) {
+ // override to ensure we always pass a null frame state
+ // the parent method expects to create one from a non null before state
+ gen.setResult(this, gen.getLIRGeneratorTool().getArithmetic().emitRem(gen.operand(getX()), gen.operand(getY()), null));
+ }
}
@NodeInfo
@@ -223,6 +238,13 @@
protected SafeUnsignedDivNode(ValueNode x, ValueNode y) {
super(TYPE, x, y);
}
+
+ @Override
+ public void generate(NodeLIRBuilderTool gen) {
+ // override to ensure we always pass a null frame state
+ // the parent method expects to create one from a non null before state
+ gen.setResult(this, gen.getLIRGeneratorTool().getArithmetic().emitUDiv(gen.operand(getX()), gen.operand(getY()), null));
+ }
}
@NodeInfo
@@ -232,6 +254,13 @@
protected SafeUnsignedRemNode(ValueNode x, ValueNode y) {
super(TYPE, x, y);
}
+
+ @Override
+ public void generate(NodeLIRBuilderTool gen) {
+ // override to ensure we always pass a null frame state
+ // the parent method expects to create one from a non null before state
+ gen.setResult(this, gen.getLIRGeneratorTool().getArithmetic().emitURem(gen.operand(getX()), gen.operand(getY()), null));
+ }
}
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java Mon Jun 19 16:31:43 2017 -0700
@@ -31,7 +31,6 @@
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.TAN;
import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.bytecode.BytecodeProvider;
import org.graalvm.compiler.lir.amd64.AMD64ArithmeticLIRGeneratorTool.RoundingMode;
import org.graalvm.compiler.nodes.ValueNode;
@@ -54,6 +53,7 @@
import org.graalvm.compiler.replacements.nodes.BitCountNode;
import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode;
import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.amd64.AMD64;
import jdk.vm.ci.amd64.AMD64.CPUFeature;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringIndexOfNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringIndexOfNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,8 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_256;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.NodeInputList;
@@ -40,6 +38,8 @@
import org.graalvm.compiler.nodes.memory.MemoryNode;
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.Value;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringSubstitutions.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringSubstitutions.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,11 +22,11 @@
*/
package org.graalvm.compiler.replacements.amd64;
-import org.graalvm.api.word.Pointer;
import org.graalvm.compiler.api.replacements.ClassSubstitution;
import org.graalvm.compiler.api.replacements.MethodSubstitution;
import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.Pointer;
import sun.misc.Unsafe;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DerivedOopTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DerivedOopTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -196,6 +196,7 @@
internalPointer = getRawPointer(o2) + offsetB;
SideEffect2 = internalPointer;
}
+ GraalDirectives.controlFlowAnchor();
// make sure the internal pointer is computed before the safepoint
GraalDirectives.blackhole(internalPointer);
objResult.beforeGC.basePointer = getRawPointer(objResult);
@@ -215,6 +216,7 @@
internalPointer = getRawPointer(o2) + offsetB;
SideEffect2 = internalPointer;
}
+ GraalDirectives.controlFlowAnchor();
// make sure the internal pointer is computed before the safepoint
GraalDirectives.blackhole(internalPointer);
objResult.beforeGC.basePointer = getRawPointer(objResult);
@@ -233,6 +235,7 @@
internalPointer = getRawPointer(b) + offsetB;
SideEffect2 = internalPointer;
}
+ GraalDirectives.controlFlowAnchor();
// make sure the internal pointer is computed before the safepoint
GraalDirectives.blackhole(internalPointer);
objResult.beforeGC.basePointer = getRawPointer(objResult);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MethodSubstitutionTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MethodSubstitutionTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -132,7 +132,7 @@
protected Object invokeSafe(ResolvedJavaMethod method, Object receiver, Object... args) {
try {
return invoke(method, receiver, args);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e) {
throw new RuntimeException(e);
}
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/NewMultiArrayTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/NewMultiArrayTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -78,7 +78,8 @@
}
@Override
- protected Object referenceInvoke(ResolvedJavaMethod method, Object receiver, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ protected Object referenceInvoke(ResolvedJavaMethod method, Object receiver, Object... args)
+ throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
if (bottomType != null) {
try {
return Array.newInstance(bottomClass, dimensions);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ObjectAccessTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ObjectAccessTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,9 +22,6 @@
*/
package org.graalvm.compiler.replacements.test;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.nodes.NamedLocationIdentity;
import org.graalvm.compiler.nodes.ReturnNode;
@@ -35,6 +32,9 @@
import org.graalvm.compiler.nodes.extended.JavaWriteNode;
import org.graalvm.compiler.nodes.memory.address.OffsetAddressNode;
import org.graalvm.compiler.word.ObjectAccess;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.WordFactory;
import org.junit.Assert;
import org.junit.Test;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,7 +24,6 @@
import static org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo.createStandardInlineInfo;
-import org.graalvm.api.word.LocationIdentity;
import org.junit.Test;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.core.test.GraalCompilerTest;
@@ -47,6 +46,7 @@
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
import org.graalvm.compiler.phases.tiers.PhaseContext;
import org.graalvm.compiler.replacements.CachingPEGraphDecoder;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PointerTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PointerTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,9 +22,6 @@
*/
package org.graalvm.compiler.replacements.test;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.nodes.NamedLocationIdentity;
import org.graalvm.compiler.nodes.ReturnNode;
@@ -39,6 +36,9 @@
import org.graalvm.compiler.phases.tiers.HighTierContext;
import org.graalvm.compiler.word.Word;
import org.graalvm.compiler.word.WordCastNode;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.WordFactory;
import org.junit.Assert;
import org.junit.Test;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/WordTest.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/WordTest.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,16 +22,16 @@
*/
package org.graalvm.compiler.replacements.test;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.Unsigned;
-import org.graalvm.api.word.WordBase;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.core.common.CompilationIdentifier;
import org.graalvm.compiler.nodes.StructuredGraph;
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.word.Word;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.Unsigned;
+import org.graalvm.word.WordBase;
+import org.graalvm.word.WordFactory;
import org.junit.Test;
import jdk.vm.ci.meta.ResolvedJavaMethod;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/DefaultJavaLoweringProvider.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/DefaultJavaLoweringProvider.java Mon Jun 19 16:31:43 2017 -0700
@@ -37,7 +37,6 @@
import java.util.BitSet;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.directives.GraalDirectives;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
@@ -125,6 +124,7 @@
import org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode.BinaryOperation;
import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode;
import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.code.MemoryBarriers;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/GraphKit.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/GraphKit.java Mon Jun 19 16:31:43 2017 -0700
@@ -29,7 +29,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.core.common.type.StampPair;
@@ -67,6 +66,7 @@
import org.graalvm.compiler.phases.common.inlining.InliningUtil;
import org.graalvm.compiler.phases.util.Providers;
import org.graalvm.compiler.word.WordTypes;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.meta.ConstantReflectionProvider;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetCounterNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetCounterNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -29,7 +29,6 @@
import java.lang.reflect.Field;
import java.util.Arrays;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
@@ -50,6 +49,7 @@
import org.graalvm.compiler.replacements.SnippetTemplate.Arguments;
import org.graalvm.compiler.replacements.SnippetTemplate.SnippetInfo;
import org.graalvm.compiler.word.ObjectAccess;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.TargetDescription;
import sun.misc.Unsafe;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetLowerableMemoryNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetLowerableMemoryNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.NodeInputList;
@@ -38,6 +37,7 @@
import org.graalvm.compiler.nodes.memory.MemoryNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.word.LocationIdentity;
@NodeInfo(cycles = CYCLES_IGNORED, size = SIZE_IGNORED)
public class SnippetLowerableMemoryNode extends FixedWithNextNode implements Lowerable, MemoryAccess {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java Mon Jun 19 16:31:43 2017 -0700
@@ -23,13 +23,13 @@
package org.graalvm.compiler.replacements;
import static java.util.FormattableFlags.ALTERNATE;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.debug.Debug.applyFormattingFlagsAndWidth;
import static org.graalvm.compiler.debug.GraalDebugConfig.Options.DebugStubsAndSnippets;
import static org.graalvm.compiler.graph.iterators.NodePredicates.isNotA;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED;
import static org.graalvm.compiler.phases.common.DeadCodeEliminationPhase.Optionality.Required;
+import static org.graalvm.word.LocationIdentity.any;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
@@ -45,8 +45,6 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordBase;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
import org.graalvm.compiler.api.replacements.Snippet.NonNullParameter;
@@ -129,6 +127,8 @@
import org.graalvm.util.EconomicSet;
import org.graalvm.util.Equivalence;
import org.graalvm.util.UnmodifiableEconomicMap;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordBase;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.meta.Constant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java Mon Jun 19 16:31:43 2017 -0700
@@ -36,7 +36,6 @@
import java.lang.reflect.Field;
import java.util.Arrays;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.api.directives.GraalDirectives;
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import org.graalvm.compiler.bytecode.BytecodeProvider;
@@ -101,6 +100,7 @@
import org.graalvm.compiler.replacements.nodes.arithmetic.IntegerAddExactNode;
import org.graalvm.compiler.replacements.nodes.arithmetic.IntegerMulExactNode;
import org.graalvm.compiler.replacements.nodes.arithmetic.IntegerSubExactNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.DeoptimizationAction;
import jdk.vm.ci.meta.DeoptimizationReason;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayEqualsNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayEqualsNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -26,7 +26,6 @@
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_1024;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1024;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
@@ -46,6 +45,7 @@
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.util.GraphUtil;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.JavaConstant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/BasicArrayCopyNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/BasicArrayCopyNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,13 +22,12 @@
*/
package org.graalvm.compiler.replacements.nodes;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.nodeinfo.InputType.Memory;
import static org.graalvm.compiler.nodeinfo.InputType.State;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_256;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64;
+import static org.graalvm.word.LocationIdentity.any;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.debug.Debug;
import org.graalvm.compiler.graph.NodeClass;
@@ -51,6 +50,7 @@
import org.graalvm.compiler.nodes.type.StampTool;
import org.graalvm.compiler.nodes.virtual.VirtualArrayNode;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroStateSplitNode.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroStateSplitNode.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,7 +22,6 @@
*/
package org.graalvm.compiler.replacements.nodes;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.type.StampPair;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.graph.NodeClass;
@@ -37,6 +36,7 @@
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.java.MethodCallTargetNode;
import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.meta.ResolvedJavaMethod;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EarlyReadEliminationPhase.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EarlyReadEliminationPhase.java Mon Jun 19 16:31:43 2017 -0700
@@ -32,8 +32,16 @@
public class EarlyReadEliminationPhase extends EffectsPhase<PhaseContext> {
+ private final boolean considerGuards;
+
public EarlyReadEliminationPhase(CanonicalizerPhase canonicalizer) {
super(1, canonicalizer, true);
+ this.considerGuards = true;
+ }
+
+ public EarlyReadEliminationPhase(CanonicalizerPhase canonicalizer, boolean considerGuards) {
+ super(1, canonicalizer, true);
+ this.considerGuards = considerGuards;
}
@Override
@@ -46,7 +54,7 @@
@Override
protected Closure<?> createEffectsClosure(PhaseContext context, ScheduleResult schedule, ControlFlowGraph cfg) {
assert schedule == null;
- return new ReadEliminationClosure(cfg);
+ return new ReadEliminationClosure(cfg, considerGuards);
}
@Override
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsClosure.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsClosure.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.cfg.BlockMap;
import org.graalvm.compiler.core.common.cfg.Loop;
import org.graalvm.compiler.core.common.type.Stamp;
@@ -61,6 +60,7 @@
import org.graalvm.compiler.phases.graph.ReentrantBlockIterator.BlockIteratorClosure;
import org.graalvm.compiler.phases.graph.ReentrantBlockIterator.LoopInfo;
import org.graalvm.util.Equivalence;
+import org.graalvm.word.LocationIdentity;
import org.graalvm.util.EconomicMap;
import org.graalvm.util.EconomicSet;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PEReadEliminationBlockState.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PEReadEliminationBlockState.java Mon Jun 19 16:31:43 2017 -0700
@@ -25,7 +25,6 @@
import java.util.Iterator;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.nodes.FieldLocationIdentity;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.virtual.AllocatedObjectNode;
@@ -34,6 +33,7 @@
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.util.EconomicMap;
import org.graalvm.util.Equivalence;
+import org.graalvm.word.LocationIdentity;
public final class PEReadEliminationBlockState extends PartialEscapeBlockState<PEReadEliminationBlockState> {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PEReadEliminationClosure.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PEReadEliminationClosure.java Mon Jun 19 16:31:43 2017 -0700
@@ -29,7 +29,6 @@
import java.util.Iterator;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.cfg.Loop;
import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
import org.graalvm.compiler.debug.Debug;
@@ -66,6 +65,7 @@
import org.graalvm.util.Equivalence;
import org.graalvm.util.MapCursor;
import org.graalvm.util.Pair;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.JavaConstant;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/ReadEliminationBlockState.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/ReadEliminationBlockState.java Mon Jun 19 16:31:43 2017 -0700
@@ -24,9 +24,9 @@
import java.util.Iterator;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.util.Equivalence;
+import org.graalvm.word.LocationIdentity;
import org.graalvm.util.EconomicMap;
/**
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/ReadEliminationClosure.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/ReadEliminationClosure.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,13 +22,12 @@
*/
package org.graalvm.compiler.virtual.phases.ea;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.core.common.GraalOptions.ReadEliminationMaxLoopVisits;
+import static org.graalvm.word.LocationIdentity.any;
import java.util.Iterator;
import java.util.List;
-import org.graalvm.api.word.LocationIdentity;
import org.graalvm.compiler.core.common.cfg.Loop;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.debug.Debug;
@@ -63,6 +62,7 @@
import org.graalvm.util.EconomicMap;
import org.graalvm.util.EconomicSet;
import org.graalvm.util.MapCursor;
+import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.meta.JavaKind;
@@ -72,9 +72,11 @@
* overlap.
*/
public final class ReadEliminationClosure extends EffectsClosure<ReadEliminationBlockState> {
+ private final boolean considerGuards;
- public ReadEliminationClosure(ControlFlowGraph cfg) {
+ public ReadEliminationClosure(ControlFlowGraph cfg, boolean considerGuards) {
super(null, cfg);
+ this.considerGuards = considerGuards;
}
@Override
@@ -119,7 +121,7 @@
ValueNode object = GraphUtil.unproxify(read.getAddress());
LoadCacheEntry identifier = new LoadCacheEntry(object, read.getLocationIdentity());
ValueNode cachedValue = state.getCacheEntry(identifier);
- if (cachedValue != null && areValuesReplaceable(read, cachedValue)) {
+ if (cachedValue != null && areValuesReplaceable(read, cachedValue, considerGuards)) {
effects.replaceAtUsages(read, cachedValue, read);
addScalarAlias(read, cachedValue);
deleted = true;
@@ -151,7 +153,7 @@
ValueNode object = GraphUtil.unproxify(load.object());
UnsafeLoadCacheEntry identifier = new UnsafeLoadCacheEntry(object, load.offset(), load.getLocationIdentity());
ValueNode cachedValue = state.getCacheEntry(identifier);
- if (cachedValue != null && areValuesReplaceable(load, cachedValue)) {
+ if (cachedValue != null && areValuesReplaceable(load, cachedValue, considerGuards)) {
effects.replaceAtUsages(load, cachedValue, load);
addScalarAlias(load, cachedValue);
deleted = true;
@@ -189,9 +191,9 @@
return deleted;
}
- private static boolean areValuesReplaceable(ValueNode originalValue, ValueNode replacementValue) {
+ private static boolean areValuesReplaceable(ValueNode originalValue, ValueNode replacementValue, boolean considerGuards) {
return originalValue.stamp().isCompatible(replacementValue.stamp()) &&
- (getGuard(originalValue) == null || getGuard(originalValue) == getGuard(replacementValue));
+ (!considerGuards || (getGuard(originalValue) == null || getGuard(originalValue) == getGuard(replacementValue)));
}
private static GuardingNode getGuard(ValueNode node) {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/BarrieredAccess.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/BarrieredAccess.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,13 +22,13 @@
*/
package org.graalvm.compiler.word;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.Signed;
-import org.graalvm.api.word.Unsigned;
-import org.graalvm.api.word.WordBase;
import org.graalvm.compiler.word.Word.Opcode;
import org.graalvm.compiler.word.Word.Operation;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.Signed;
+import org.graalvm.word.Unsigned;
+import org.graalvm.word.WordBase;
/**
* Medium-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/ObjectAccess.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/ObjectAccess.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,13 +22,13 @@
*/
package org.graalvm.compiler.word;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.Signed;
-import org.graalvm.api.word.Unsigned;
-import org.graalvm.api.word.WordBase;
import org.graalvm.compiler.word.Word.Opcode;
import org.graalvm.compiler.word.Word.Operation;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.Signed;
+import org.graalvm.word.Unsigned;
+import org.graalvm.word.WordBase;
/**
* Low-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/Word.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/Word.java Mon Jun 19 16:31:43 2017 -0700
@@ -29,13 +29,6 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.graalvm.api.word.ComparableWord;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.Pointer;
-import org.graalvm.api.word.Signed;
-import org.graalvm.api.word.Unsigned;
-import org.graalvm.api.word.WordBase;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.core.common.calc.Condition;
import org.graalvm.compiler.core.common.calc.UnsignedMath;
import org.graalvm.compiler.debug.GraalError;
@@ -55,6 +48,13 @@
import org.graalvm.compiler.nodes.calc.XorNode;
import org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType;
import org.graalvm.compiler.nodes.memory.address.AddressNode.Address;
+import org.graalvm.word.ComparableWord;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.Pointer;
+import org.graalvm.word.Signed;
+import org.graalvm.word.Unsigned;
+import org.graalvm.word.WordBase;
+import org.graalvm.word.WordFactory;
public abstract class Word extends WordFactory implements Signed, Unsigned, Pointer {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordOperationPlugin.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordOperationPlugin.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,15 +22,13 @@
*/
package org.graalvm.compiler.word;
-import static org.graalvm.api.word.LocationIdentity.any;
import static org.graalvm.compiler.nodes.ConstantNode.forInt;
import static org.graalvm.compiler.nodes.ConstantNode.forIntegerKind;
+import static org.graalvm.word.LocationIdentity.any;
import java.lang.reflect.Constructor;
import java.util.Arrays;
-import org.graalvm.api.word.LocationIdentity;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import org.graalvm.compiler.bytecode.BridgeMethodUtils;
import org.graalvm.compiler.core.common.calc.Condition;
@@ -70,6 +68,8 @@
import org.graalvm.compiler.nodes.type.StampTool;
import org.graalvm.compiler.word.Word.Opcode;
import org.graalvm.compiler.word.Word.Operation;
+import org.graalvm.word.LocationIdentity;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.meta.JavaKind;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordTypes.java Mon Jun 19 11:23:16 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordTypes.java Mon Jun 19 16:31:43 2017 -0700
@@ -22,13 +22,13 @@
*/
package org.graalvm.compiler.word;
-import org.graalvm.api.word.WordBase;
-import org.graalvm.api.word.WordFactory;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.type.StampTool;
import org.graalvm.compiler.word.Word.Operation;
+import org.graalvm.word.WordBase;
+import org.graalvm.word.WordFactory;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/AtomicUnsigned.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+/**
+ * A {@link Unsigned} value that may be updated atomically. See the
+ * {@link java.util.concurrent.atomic} package specification for description of the properties of
+ * atomic variables.
+ */
+public class AtomicUnsigned extends AtomicWord<Unsigned> {
+
+ /**
+ * Atomically adds the given value to the current value.
+ *
+ * @param delta the value to add
+ * @return the previous value
+ */
+ public final Unsigned getAndAdd(Unsigned delta) {
+ return WordFactory.unsigned(value.getAndAdd(delta.rawValue()));
+ }
+
+ /**
+ * Atomically adds the given value to the current value.
+ *
+ * @param delta the value to add
+ * @return the updated value
+ */
+ public final Unsigned addAndGet(Unsigned delta) {
+ return WordFactory.unsigned(value.addAndGet(delta.rawValue()));
+ }
+
+ /**
+ * Atomically subtracts the given value from the current value.
+ *
+ * @param delta the value to add
+ * @return the previous value
+ */
+ public final Unsigned getAndSubtract(Unsigned delta) {
+ return WordFactory.unsigned(value.getAndAdd(-delta.rawValue()));
+ }
+
+ /**
+ * Atomically subtracts the given value from the current value.
+ *
+ * @param delta the value to add
+ * @return the updated value
+ */
+ public final Unsigned subtractAndGet(Unsigned delta) {
+ return WordFactory.unsigned(value.addAndGet(-delta.rawValue()));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/AtomicWord.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * A {@link WordBase word} value that may be updated atomically. See the
+ * {@link java.util.concurrent.atomic} package specification for description of the properties of
+ * atomic variables.
+ *
+ * Similar to {@link AtomicReference}, but for {@link WordBase word} types. A dedicated
+ * implementation is necessary because Object and word types cannot be mixed.
+ */
+public class AtomicWord<T extends WordBase> {
+
+ /**
+ * For simplicity, we convert the word value to a long and delegate to existing atomic
+ * operations.
+ */
+ protected final AtomicLong value;
+
+ /**
+ * Creates a new AtomicWord with initial value {@link WordFactory#zero}.
+ */
+ public AtomicWord() {
+ value = new AtomicLong();
+ }
+
+ /**
+ * Gets the current value.
+ *
+ * @return the current value
+ */
+ public final T get() {
+ return WordFactory.unsigned(value.get());
+ }
+
+ /**
+ * Sets to the given value.
+ *
+ * @param newValue the new value
+ */
+ public final void set(T newValue) {
+ value.set(newValue.rawValue());
+ }
+
+ /**
+ * Atomically sets to the given value and returns the old value.
+ *
+ * @param newValue the new value
+ * @return the previous value
+ */
+ public final T getAndSet(T newValue) {
+ return WordFactory.unsigned(value.getAndSet(newValue.rawValue()));
+ }
+
+ /**
+ * Atomically sets the value to the given updated value if the current value {@code ==} the
+ * expected value.
+ *
+ * @param expect the expected value
+ * @param update the new value
+ * @return {@code true} if successful. False return indicates that the actual value was not
+ * equal to the expected value.
+ */
+ public final boolean compareAndSet(T expect, T update) {
+ return value.compareAndSet(expect.rawValue(), update.rawValue());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/ComparableWord.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+public interface ComparableWord extends WordBase {
+
+ /**
+ * Compares this word with the specified value.
+ *
+ * @param val value to which this word is to be compared.
+ * @return {@code this == val}
+ */
+ boolean equal(ComparableWord val);
+
+ /**
+ * Compares this word with the specified value.
+ *
+ * @param val value to which this word is to be compared.
+ * @return {@code this != val}
+ */
+ boolean notEqual(ComparableWord val);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/LocationIdentity.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2011, 2016, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+// JaCoCo Exclude
+
+/**
+ * Marker interface for location identities. A different location identity of two memory accesses
+ * guarantees that the two accesses do not interfere.
+ *
+ * Clients of {@link LocationIdentity} must use {@link #equals(Object)}, not {@code ==}, when
+ * comparing two {@link LocationIdentity} values for equality. Likewise, they must not use
+ * {@link java.util.IdentityHashMap}s with {@link LocationIdentity} values as keys.
+ */
+public abstract class LocationIdentity {
+
+ private static final class AnyLocationIdentity extends LocationIdentity {
+ @Override
+ public boolean isImmutable() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "ANY_LOCATION";
+ }
+ }
+
+ private static final class InitLocationIdentity extends LocationIdentity {
+ @Override
+ public boolean isImmutable() {
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "INIT_LOCATION";
+ }
+ }
+
+ public static final LocationIdentity ANY_LOCATION = new AnyLocationIdentity();
+ public static final LocationIdentity INIT_LOCATION = new InitLocationIdentity();
+
+ /**
+ * Indicates that the given location is the union of all possible mutable locations. A write to
+ * such a location kill all reads from mutable locations and a read from this location is killed
+ * by any write (except for initialization writes).
+ */
+ public static LocationIdentity any() {
+ return ANY_LOCATION;
+ }
+
+ /**
+ * Location only allowed to be used for writes. Indicates that a completely new memory location
+ * is written. Kills no read. The previous value at the given location must be either
+ * uninitialized or null. Writes to this location do not need a GC pre-barrier.
+ */
+ public static LocationIdentity init() {
+ return INIT_LOCATION;
+ }
+
+ /**
+ * Denotes a location is unchanging in all cases. Not that this is different than the Java
+ * notion of final which only requires definite assignment.
+ */
+ public abstract boolean isImmutable();
+
+ public final boolean isMutable() {
+ return !isImmutable();
+ }
+
+ public final boolean isAny() {
+ return this == ANY_LOCATION;
+ }
+
+ public final boolean isInit() {
+ return this == INIT_LOCATION;
+ }
+
+ public final boolean isSingle() {
+ return this != ANY_LOCATION;
+ }
+
+ public final boolean overlaps(LocationIdentity other) {
+ return isAny() || other.isAny() || this.equals(other);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/Pointer.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,965 @@
+/*
+ * Copyright (c) 2012, 2016, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+/**
+ * Lowest-level memory access of native C memory.
+ * <p>
+ * Do not use these methods to access Java objects. These methods access the raw memory without any
+ * null checks, read- or write barriers. Even when the VM uses compressed pointers, then readObject
+ * and writeObject methods access uncompressed pointers.
+ */
+public interface Pointer extends Unsigned, PointerBase {
+
+ /**
+ * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type
+ * checks are performed. The caller must ensure that the Pointer contains a valid Java object
+ * that can i.e., processed by the garbage collector.
+ *
+ * @return this Pointer cast to Object.
+ */
+ Object toObject();
+
+ /**
+ * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type
+ * checks are performed. The caller must ensure that the Pointer contains a valid Java object
+ * that can i.e., processed by the garbage collector and the Pointer does not contain 0.
+ *
+ * @return this Pointer cast to non-null Object.
+ */
+ Object toObjectNonNull();
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ byte readByte(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ char readChar(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ short readShort(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ int readInt(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ long readLong(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ float readFloat(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ double readDouble(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ <T extends WordBase> T readWord(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ Object readObject(WordBase offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ byte readByte(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ char readChar(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ short readShort(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ int readInt(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ long readLong(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ float readFloat(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ double readDouble(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ <T extends WordBase> T readWord(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the read
+ * @return the result of the memory access
+ */
+ Object readObject(int offset, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeByte(WordBase offset, byte val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeChar(WordBase offset, char val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeShort(WordBase offset, short val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeInt(WordBase offset, int val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeLong(WordBase offset, long val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeFloat(WordBase offset, float val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeDouble(WordBase offset, double val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeWord(WordBase offset, WordBase val, LocationIdentity locationIdentity);
+
+ /**
+ * Initializes the memory at address {@code (this + offset)}. Both the base address and offset
+ * are in bytes. The memory must be uninitialized or zero prior to this operation.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void initializeLong(WordBase offset, long val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeObject(WordBase offset, Object val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeByte(int offset, byte val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeChar(int offset, char val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeShort(int offset, short val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeInt(int offset, int val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeLong(int offset, long val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeFloat(int offset, float val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeDouble(int offset, double val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeWord(int offset, WordBase val, LocationIdentity locationIdentity);
+
+ /**
+ * Initializes the memory at address {@code (this + offset)}. Both the base address and offset
+ * are in bytes. The memory must be uninitialized or zero prior to this operation.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void initializeLong(int offset, long val, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param locationIdentity the identity of the write
+ * @param val the value to be written to memory
+ */
+ void writeObject(int offset, Object val, LocationIdentity locationIdentity);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ byte readByte(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ char readChar(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ short readShort(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ int readInt(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ long readLong(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ float readFloat(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ double readDouble(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ <T extends WordBase> T readWord(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ Object readObject(WordBase offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ byte readByte(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ char readChar(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ short readShort(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ int readInt(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ long readLong(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ float readFloat(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ double readDouble(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ <T extends WordBase> T readWord(int offset);
+
+ /**
+ * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @return the result of the memory access
+ */
+ Object readObject(int offset);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeByte(WordBase offset, byte val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeChar(WordBase offset, char val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeShort(WordBase offset, short val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeInt(WordBase offset, int val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeLong(WordBase offset, long val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeFloat(WordBase offset, float val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeDouble(WordBase offset, double val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeWord(WordBase offset, WordBase val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ * <p>
+ * The offset is always treated as a {@link Signed} value. However, the static type is
+ * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+ * knows that the highest-order bit of the unsigned value is never used).
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeObject(WordBase offset, Object val);
+
+ int compareAndSwapInt(WordBase offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
+
+ long compareAndSwapLong(WordBase offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
+
+ <T extends WordBase> T compareAndSwapWord(WordBase offset, T expectedValue, T newValue, LocationIdentity locationIdentity);
+
+ Object compareAndSwapObject(WordBase offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapInt(WordBase offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapLong(WordBase offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapWord(WordBase offset, WordBase expectedValue, WordBase newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapObject(WordBase offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeByte(int offset, byte val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeChar(int offset, char val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeShort(int offset, short val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeInt(int offset, int val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeLong(int offset, long val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeFloat(int offset, float val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeDouble(int offset, double val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeWord(int offset, WordBase val);
+
+ /**
+ * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+ * bytes.
+ *
+ * @param offset the signed offset for the memory access
+ * @param val the value to be written to memory
+ */
+ void writeObject(int offset, Object val);
+
+ int compareAndSwapInt(int offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
+
+ long compareAndSwapLong(int offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
+
+ <T extends WordBase> T compareAndSwapWord(int offset, T expectedValue, T newValue, LocationIdentity locationIdentity);
+
+ Object compareAndSwapObject(int offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapInt(int offset, int expectedValue, int newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapLong(int offset, long expectedValue, long newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapWord(int offset, WordBase expectedValue, WordBase newValue, LocationIdentity locationIdentity);
+
+ boolean logicCompareAndSwapObject(int offset, Object expectedValue, Object newValue, LocationIdentity locationIdentity);
+
+ // Math functions that are defined in Unsigned, but known to preserve the
+ // pointer-characteristics.
+ // It is therefore safe that they return a static type of Pointer instead of Unsigned.
+
+ @Override
+ Pointer add(Unsigned val);
+
+ @Override
+ Pointer add(int val);
+
+ @Override
+ Pointer subtract(Unsigned val);
+
+ @Override
+ Pointer subtract(int val);
+
+ @Override
+ Pointer and(Unsigned val);
+
+ @Override
+ Pointer and(int val);
+
+ @Override
+ Pointer or(Unsigned val);
+
+ @Override
+ Pointer or(int val);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/PointerBase.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, 2013, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+/**
+ * Marker interface for all {@link WordBase word types} that have the semantic of a pointer (but not
+ * necessarily all the memory access methods defined in {@link Pointer}).
+ */
+public interface PointerBase extends ComparableWord {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/PointerUtils.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+/**
+ * Utility methods on Pointers.
+ */
+public final class PointerUtils {
+
+ private PointerUtils() {
+ // This is a class of static methods, so no need for any instances.
+ }
+
+ /**
+ * The value of a null Pointer.
+ *
+ * @return A null Pointer value.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends PointerBase> T nullPointer() {
+ return (T) WordFactory.zero();
+ }
+
+ /**
+ * Predicate to check for the null Pointer value.
+ *
+ * @return Whether that Pointer is the null Pointer.
+ */
+ public static boolean isNull(ComparableWord that) {
+ return that.equal(nullPointer());
+ }
+
+ /**
+ * Predicate to check for a non-null Pointer value.
+ *
+ * @return Whether that Pointer is not the null Pointer.
+ */
+ public static boolean isNonNull(ComparableWord that) {
+ return that.notEqual(nullPointer());
+ }
+
+ /**
+ * Round a Pointer down to the nearest smaller multiple.
+ *
+ * @param that The Pointer to be rounded up.
+ * @param multiple The multiple to which that Pointer should be decreased.
+ * @return That Pointer, but rounded down.
+ */
+ public static Pointer roundDown(PointerBase that, Unsigned multiple) {
+ return (Pointer) UnsignedUtils.roundDown((Unsigned) that, multiple);
+ }
+
+ /**
+ * Round a Pointer up to the nearest larger multiple.
+ *
+ * @param that The Pointer to be rounded up.
+ * @param multiple The multiple to which that Pointer should be increased.
+ * @return That Pointer, but rounded up.
+ */
+ public static Pointer roundUp(PointerBase that, Unsigned multiple) {
+ return (Pointer) UnsignedUtils.roundUp((Unsigned) that, multiple);
+ }
+
+ /**
+ * Check that a Pointer is an even multiple.
+ *
+ * @param that The Pointer to be verified as a multiple.
+ * @param multiple The multiple against which the Pointer should be verified.
+ * @return true if that Pointer is a multiple, false otherwise.
+ */
+ public static boolean isAMultiple(PointerBase that, Unsigned multiple) {
+ return that.equal(PointerUtils.roundDown(that, multiple));
+ }
+
+ /**
+ * Return the distance between two Pointers.
+ *
+ * @param pointer1 A first Pointer.
+ * @param pointer2 A second Pointer.
+ * @return The distance in bytes between the two Pointers.
+ */
+ public static Unsigned absoluteDifference(PointerBase pointer1, PointerBase pointer2) {
+ Pointer p1 = (Pointer) pointer1;
+ Pointer p2 = (Pointer) pointer2;
+ final Unsigned result;
+ if (p1.aboveOrEqual(p2)) {
+ result = p1.subtract(p2);
+ } else {
+ result = p2.subtract(p1);
+ }
+ return result;
+ }
+
+ /**
+ * The minimum of two Pointers.
+ *
+ * @param x A Pointer.
+ * @param y Another Pointer.
+ * @return The whichever Pointer is smaller.
+ */
+ public static <T extends PointerBase> T min(T x, T y) {
+ return (((Pointer) x).belowOrEqual((Pointer) y)) ? x : y;
+ }
+
+ /**
+ * The maximum of two Pointers.
+ *
+ * @param x A Pointer.
+ * @param y Another Pointer.
+ * @return The whichever Pointer is larger.
+ */
+ public static <T extends PointerBase> T max(T x, T y) {
+ return (((Pointer) x).aboveOrEqual((Pointer) y)) ? x : y;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/Signed.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+public interface Signed extends ComparableWord {
+
+ /**
+ * Returns a Signed whose value is {@code (this + val)}.
+ *
+ * @param val value to be added to this Signed.
+ * @return {@code this + val}
+ */
+ Signed add(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this - val)}.
+ *
+ * @param val value to be subtracted from this Signed.
+ * @return {@code this - val}
+ */
+ Signed subtract(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this * val)}.
+ *
+ * @param val value to be multiplied by this Signed.
+ * @return {@code this * val}
+ */
+ Signed multiply(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this / val)}.
+ *
+ * @param val value by which this Signed is to be divided.
+ * @return {@code this / val}
+ */
+ Signed signedDivide(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this % val)}.
+ *
+ * @param val value by which this Signed is to be divided, and the remainder computed.
+ * @return {@code this % val}
+ */
+ Signed signedRemainder(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this << n)}.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this << n}
+ */
+ Signed shiftLeft(Unsigned n);
+
+ /**
+ * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this >> n}
+ */
+ Signed signedShiftRight(Unsigned n);
+
+ /**
+ * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
+ * if and only if this and val are both negative.)
+ *
+ * @param val value to be AND'ed with this Signed.
+ * @return {@code this & val}
+ */
+ Signed and(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
+ * if and only if either this or val is negative.)
+ *
+ * @param val value to be OR'ed with this Signed.
+ * @return {@code this | val}
+ */
+ Signed or(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
+ * if and only if exactly one of this and val are negative.)
+ *
+ * @param val value to be XOR'ed with this Signed.
+ * @return {@code this ^ val}
+ */
+ Signed xor(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and
+ * only if this Signed is non-negative.)
+ *
+ * @return {@code ~this}
+ */
+ Signed not();
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this == val}
+ */
+ boolean equal(Signed val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this != val}
+ */
+ boolean notEqual(Signed val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this < val}
+ */
+ boolean lessThan(Signed val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this <= val}
+ */
+ boolean lessOrEqual(Signed val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this > val}
+ */
+ boolean greaterThan(Signed val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this >= val}
+ */
+ boolean greaterOrEqual(Signed val);
+
+ /**
+ * Returns a Signed whose value is {@code (this + val)}.
+ *
+ * @param val value to be added to this Signed.
+ * @return {@code this + val}
+ */
+ Signed add(int val);
+
+ /**
+ * Returns a Signed whose value is {@code (this - val)}.
+ *
+ * @param val value to be subtracted from this Signed.
+ * @return {@code this - val}
+ */
+ Signed subtract(int val);
+
+ /**
+ * Returns a Signed whose value is {@code (this * val)}.
+ *
+ * @param val value to be multiplied by this Signed.
+ * @return {@code this * val}
+ */
+ Signed multiply(int val);
+
+ /**
+ * Returns a Signed whose value is {@code (this / val)}.
+ *
+ * @param val value by which this Signed is to be divided.
+ * @return {@code this / val}
+ */
+ Signed signedDivide(int val);
+
+ /**
+ * Returns a Signed whose value is {@code (this % val)}.
+ *
+ * @param val value by which this Signed is to be divided, and the remainder computed.
+ * @return {@code this % val}
+ */
+ Signed signedRemainder(int val);
+
+ /**
+ * Returns a Signed whose value is {@code (this << n)}.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this << n}
+ */
+ Signed shiftLeft(int n);
+
+ /**
+ * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this >> n}
+ */
+ Signed signedShiftRight(int n);
+
+ /**
+ * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
+ * if and only if this and val are both negative.)
+ *
+ * @param val value to be AND'ed with this Signed.
+ * @return {@code this & val}
+ */
+ Signed and(int val);
+
+ /**
+ * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
+ * if and only if either this or val is negative.)
+ *
+ * @param val value to be OR'ed with this Signed.
+ * @return {@code this | val}
+ */
+ Signed or(int val);
+
+ /**
+ * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
+ * if and only if exactly one of this and val are negative.)
+ *
+ * @param val value to be XOR'ed with this Signed.
+ * @return {@code this ^ val}
+ */
+ Signed xor(int val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this == val}
+ */
+ boolean equal(int val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this != val}
+ */
+ boolean notEqual(int val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this < val}
+ */
+ boolean lessThan(int val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this <= val}
+ */
+ boolean lessOrEqual(int val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this > val}
+ */
+ boolean greaterThan(int val);
+
+ /**
+ * Compares this Signed with the specified value.
+ *
+ * @param val value to which this Signed is to be compared.
+ * @return {@code this >= val}
+ */
+ boolean greaterOrEqual(int val);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/Unsigned.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+public interface Unsigned extends ComparableWord {
+
+ /**
+ * Returns a Unsigned whose value is {@code (this + val)}.
+ *
+ * @param val value to be added to this Unsigned.
+ * @return {@code this + val}
+ */
+ Unsigned add(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this - val)}.
+ *
+ * @param val value to be subtracted from this Unsigned.
+ * @return {@code this - val}
+ */
+ Unsigned subtract(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this * val)}.
+ *
+ * @param val value to be multiplied by this Unsigned.
+ * @return {@code this * val}
+ */
+ Unsigned multiply(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this / val)}.
+ *
+ * @param val value by which this Unsigned is to be divided.
+ * @return {@code this / val}
+ */
+ Unsigned unsignedDivide(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this % val)}.
+ *
+ * @param val value by which this Unsigned is to be divided, and the remainder computed.
+ * @return {@code this % val}
+ */
+ Unsigned unsignedRemainder(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this << n)}.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this << n}
+ */
+ Unsigned shiftLeft(Unsigned n);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this >> n}
+ */
+ Unsigned unsignedShiftRight(Unsigned n);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this & val)}.
+ *
+ * @param val value to be AND'ed with this Unsigned.
+ * @return {@code this & val}
+ */
+ Unsigned and(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this | val)}.
+ *
+ * @param val value to be OR'ed with this Unsigned.
+ * @return {@code this | val}
+ */
+ Unsigned or(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this ^ val)}.
+ *
+ * @param val value to be XOR'ed with this Unsigned.
+ * @return {@code this ^ val}
+ */
+ Unsigned xor(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (~this)}.
+ *
+ * @return {@code ~this}
+ */
+ Unsigned not();
+
+ /**
+ * Compares this Unsigned with the specified value.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this == val}
+ */
+ boolean equal(Unsigned val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this != val}
+ */
+ boolean notEqual(Unsigned val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this < val}
+ */
+ boolean belowThan(Unsigned val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this <= val}
+ */
+ boolean belowOrEqual(Unsigned val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this > val}
+ */
+ boolean aboveThan(Unsigned val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this >= val}
+ */
+ boolean aboveOrEqual(Unsigned val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this + val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to be added to this Unsigned.
+ * @return {@code this + val}
+ */
+ Unsigned add(int val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this - val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to be subtracted from this Unsigned.
+ * @return {@code this - val}
+ */
+ Unsigned subtract(int val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this * val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to be multiplied by this Unsigned.
+ * @return {@code this * val}
+ */
+ Unsigned multiply(int val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this / val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value by which this Unsigned is to be divided.
+ * @return {@code this / val}
+ */
+ Unsigned unsignedDivide(int val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this % val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value by which this Unsigned is to be divided, and the remainder computed.
+ * @return {@code this % val}
+ */
+ Unsigned unsignedRemainder(int val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this << n)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this << n}
+ */
+ Unsigned shiftLeft(int n);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param n shift distance, in bits.
+ * @return {@code this >> n}
+ */
+ Unsigned unsignedShiftRight(int n);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this & val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to be AND'ed with this Unsigned.
+ * @return {@code this & val}
+ */
+ Unsigned and(int val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this | val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to be OR'ed with this Unsigned.
+ * @return {@code this | val}
+ */
+ Unsigned or(int val);
+
+ /**
+ * Returns a Unsigned whose value is {@code (this ^ val)}.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to be XOR'ed with this Unsigned.
+ * @return {@code this ^ val}
+ */
+ Unsigned xor(int val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this == val}
+ */
+ boolean equal(int val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this != val}
+ */
+ boolean notEqual(int val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this < val}
+ */
+ boolean belowThan(int val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this <= val}
+ */
+ boolean belowOrEqual(int val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this > val}
+ */
+ boolean aboveThan(int val);
+
+ /**
+ * Compares this Unsigned with the specified value.
+ * <p>
+ * Note that the right operand is a signed value, while the operation is performed unsigned.
+ * Therefore, the result is only well-defined for positive right operands.
+ *
+ * @param val value to which this Unsigned is to be compared.
+ * @return {@code this >= val}
+ */
+ boolean aboveOrEqual(int val);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/UnsignedUtils.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+/**
+ * Utility methods on Unsigned values.
+ */
+public final class UnsignedUtils {
+
+ private UnsignedUtils() {
+ // This is a class of static methods, so no need for any instances.
+ }
+
+ /**
+ * Round an Unsigned down to the nearest smaller multiple.
+ *
+ * @param that The Unsigned to be rounded down.
+ * @param multiple The multiple to which that Unsigned should be decreased.
+ * @return That Unsigned, but rounded down.
+ */
+ public static Unsigned roundDown(Unsigned that, Unsigned multiple) {
+ return that.unsignedDivide(multiple).multiply(multiple);
+ }
+
+ /**
+ * Round an Unsigned up to the nearest larger multiple.
+ *
+ * @param that The Unsigned to be rounded up.
+ * @param multiple The multiple to which that Unsigned should be increased.
+ * @return That Unsigned, but rounded up.
+ */
+ public static Unsigned roundUp(Unsigned that, Unsigned multiple) {
+ return UnsignedUtils.roundDown(that.add(multiple.subtract(1)), multiple);
+ }
+
+ /**
+ * Check that an Unsigned is an even multiple.
+ *
+ * @param that The Unsigned to be verified as a multiple.
+ * @param multiple The multiple against which the Unsigned should be verified.
+ * @return true if that Unsigned is a multiple, false otherwise.
+ */
+ public static boolean isAMultiple(Unsigned that, Unsigned multiple) {
+ return that.equal(UnsignedUtils.roundDown(that, multiple));
+ }
+
+ /**
+ * The minimum of two Unsigneds.
+ *
+ * @param x An Unsigned.
+ * @param y Another Unsigned.
+ * @return The whichever Unsigned is smaller.
+ */
+ public static Unsigned min(Unsigned x, Unsigned y) {
+ return (x.belowOrEqual(y)) ? x : y;
+ }
+
+ /**
+ * The maximum of two Unsigneds.
+ *
+ * @param x An Unsigned.
+ * @param y Another Unsigned.
+ * @return The whichever Unsigned is larger.
+ */
+ public static Unsigned max(Unsigned x, Unsigned y) {
+ return (x.aboveOrEqual(y)) ? x : y;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/WordBase.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+public interface WordBase {
+
+ long rawValue();
+
+ /**
+ * This is deprecated because of the easy to mistype name collision between {@link #equals} and
+ * the other word based equality routines. In general you should never be statically calling
+ * this method anyway.
+ */
+ @Override
+ @Deprecated
+ boolean equals(Object o);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.word/src/org/graalvm/word/WordFactory.java Mon Jun 19 16:31:43 2017 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2012, 2016, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.graalvm.word;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.InvocationTargetException;
+
+public abstract class WordFactory {
+
+ /**
+ * Links a method to a canonical operation represented by an {@link FactoryOpcode} val.
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.METHOD)
+ protected @interface FactoryOperation {
+ FactoryOpcode opcode();
+ }
+
+ /**
+ * The canonical {@link FactoryOperation} represented by a method in a word type.
+ */
+ protected enum FactoryOpcode {
+ ZERO,
+ FROM_UNSIGNED,
+ FROM_SIGNED,
+ }
+
+ protected interface BoxFactory {
+ <T extends WordBase> T box(long val);
+ }
+
+ protected static final BoxFactory boxFactory;
+
+ static {
+ try {
+ /*
+ * We know the implementation class, but cannot reference it statically because we need
+ * to break the dependency between the interface and the implementation.
+ */
+ boxFactory = (BoxFactory) Class.forName("org.graalvm.compiler.word.Word$BoxFactoryImpl").getConstructor().newInstance();
+ } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ throw new ExceptionInInitializerError("Could not find and initialize the word type factory. The Graal compiler needs to be on the class path to use the word type.");
+ }
+ }
+
+ /**
+ * We allow subclassing, because only subclasses can access the protected inner classes that we
+ * use to mark the operations.
+ */
+ protected WordFactory() {
+ }
+
+ /**
+ * The constant 0, i.e., the word with no bits set. There is no difference between a signed and
+ * unsigned zero.
+ *
+ * @return the constant 0.
+ */
+ @FactoryOperation(opcode = FactoryOpcode.ZERO)
+ public static <T extends WordBase> T zero() {
+ return boxFactory.box(0L);
+ }
+
+ /**
+ * Unsafe conversion from a Java long value to a Word. The parameter is treated as an unsigned
+ * 64-bit value (in contrast to the semantics of a Java long).
+ *
+ * @param val a 64 bit unsigned value
+ * @return the value cast to Word
+ */
+ @FactoryOperation(opcode = FactoryOpcode.FROM_UNSIGNED)
+ public static <T extends Unsigned> T unsigned(long val) {
+ return boxFactory.box(val);
+ }
+
+ /**
+ * Unsafe conversion from a Java long value to a {@link PointerBase pointer}. The parameter is
+ * treated as an unsigned 64-bit value (in contrast to the semantics of a Java long).
+ *
+ * @param val a 64 bit unsigned value
+ * @return the value cast to PointerBase
+ */
+ @FactoryOperation(opcode = FactoryOpcode.FROM_UNSIGNED)
+ public static <T extends PointerBase> T pointer(long val) {
+ return boxFactory.box(val);
+ }
+
+ /**
+ * Unsafe conversion from a Java int value to a Word. The parameter is treated as an unsigned
+ * 32-bit value (in contrast to the semantics of a Java int).
+ *
+ * @param val a 32 bit unsigned value
+ * @return the value cast to Word
+ */
+ @FactoryOperation(opcode = FactoryOpcode.FROM_UNSIGNED)
+ public static <T extends Unsigned> T unsigned(int val) {
+ return boxFactory.box(val & 0xffffffffL);
+ }
+
+ /**
+ * Unsafe conversion from a Java long value to a Word. The parameter is treated as a signed
+ * 64-bit value (unchanged semantics of a Java long).
+ *
+ * @param val a 64 bit signed value
+ * @return the value cast to Word
+ */
+ @FactoryOperation(opcode = FactoryOpcode.FROM_SIGNED)
+ public static <T extends Signed> T signed(long val) {
+ return boxFactory.box(val);
+ }
+
+ /**
+ * Unsafe conversion from a Java int value to a Word. The parameter is treated as a signed
+ * 32-bit value (unchanged semantics of a Java int).
+ *
+ * @param val a 32 bit signed value
+ * @return the value cast to Word
+ */
+ @FactoryOperation(opcode = FactoryOpcode.FROM_SIGNED)
+ public static <T extends Signed> T signed(int val) {
+ return boxFactory.box(val);
+ }
+}