# HG changeset patch # User Christian Wimmer # Date 1400637585 25200 # Node ID faebb143dab29143668fd7fa5bff2a6dd2d3a5bb # Parent 187634c8099c20a4b99b0cb36d0dfeb85a15355d Introduce class BarrieredAccess for low-level object access with read and write barriers diff -r 187634c8099c -r faebb143dab2 graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java Tue May 20 18:59:45 2014 -0700 @@ -0,0 +1,937 @@ +/* + * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.word; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.nodes.extended.*; +import com.oracle.graal.word.Word.Opcode; +import com.oracle.graal.word.Word.Operation; + +/** + * Medium-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for + * {@link Pointer} and {@link ObjectAccess}, these methods access the memory without any null + * checks. However, these methods use read- or write barriers. When the VM uses compressed pointers, + * then readObject and writeObject methods access compressed pointers. + */ +public class BarrieredAccess { + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native byte readByte(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native char readChar(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native short readShort(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native int readInt(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native long readLong(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native float readFloat(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native double readDouble(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Word readWord(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Object readObject(Object object, WordBase offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native byte readByte(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native char readChar(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native short readShort(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native int readInt(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native long readLong(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native float readFloat(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native double readDouble(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Word readWord(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the read (see {@link LocationNode}) + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Object readObject(Object object, int offset, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeByte(Object object, WordBase offset, byte val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeChar(Object object, WordBase offset, char val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeShort(Object object, WordBase offset, short val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeInt(Object object, WordBase offset, int val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeLong(Object object, WordBase offset, long val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeFloat(Object object, WordBase offset, float val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeDouble(Object object, WordBase offset, double val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeWord(Object object, WordBase offset, WordBase val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeObject(Object object, WordBase offset, Object val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeByte(Object object, int offset, byte val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeChar(Object object, int offset, char val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeShort(Object object, int offset, short val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeInt(Object object, int offset, int val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeLong(Object object, int offset, long val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeFloat(Object object, int offset, float val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeDouble(Object object, int offset, double val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeWord(Object object, int offset, WordBase val, LocationIdentity locationIdentity); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param locationIdentity the identity of the write (see {@link LocationNode}) + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeObject(Object object, int offset, Object val, LocationIdentity locationIdentity); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native byte readByte(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native char readChar(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native short readShort(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native int readInt(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native long readLong(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native float readFloat(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native double readDouble(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Word readWord(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Object readObject(Object object, WordBase offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native byte readByte(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native char readChar(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native short readShort(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native int readInt(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native long readLong(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native float readFloat(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native double readDouble(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Word readWord(Object object, int offset); + + /** + * Reads the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @return the result of the memory access + */ + @Operation(opcode = Opcode.READ_BARRIERED) + public static native Object readObject(Object object, int offset); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeByte(Object object, WordBase offset, byte val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeChar(Object object, WordBase offset, char val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeShort(Object object, WordBase offset, short val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeInt(Object object, WordBase offset, int val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeLong(Object object, WordBase offset, long val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeFloat(Object object, WordBase offset, float val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeDouble(Object object, WordBase offset, double val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeWord(Object object, WordBase offset, WordBase val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + *

+ * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeObject(Object object, WordBase offset, Object val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeByte(Object object, int offset, byte val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeChar(Object object, int offset, char val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeShort(Object object, int offset, short val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeInt(Object object, int offset, int val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeLong(Object object, int offset, long val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeFloat(Object object, int offset, float val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeDouble(Object object, int offset, double val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeWord(Object object, int offset, WordBase val); + + /** + * Writes the memory at address {@code (object + offset)}. The offset is in bytes. + * + * @param object the base object for the memory access + * @param offset the signed offset for the memory access + * @param val the value to be written to memory + */ + @Operation(opcode = Opcode.WRITE_BARRIERED) + public static native void writeObject(Object object, int offset, Object val); +} diff -r 187634c8099c -r faebb143dab2 graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java Tue May 20 18:58:42 2014 -0700 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java Tue May 20 18:59:45 2014 -0700 @@ -30,7 +30,8 @@ /** * Low-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for * {@link Pointer}, these methods access the raw memory without any null checks, read- or write - * barriers. + * barriers. When the VM uses compressed pointers, then readObject and writeObject methods access + * compressed pointers. */ public final class ObjectAccess { @@ -40,13 +41,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native byte readByte(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -55,13 +56,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native char readChar(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -70,13 +71,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native short readShort(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -85,13 +86,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native int readInt(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -100,13 +101,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native long readLong(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -115,13 +116,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native float readFloat(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -130,13 +131,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native double readDouble(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -145,13 +146,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Word readWord(Object object, WordBase offset, LocationIdentity locationIdentity); /** @@ -160,112 +161,112 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Object readObject(Object object, WordBase offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native byte readByte(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native char readChar(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native short readShort(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native int readInt(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native long readLong(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native float readFloat(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native double readDouble(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Word readWord(Object object, int offset, LocationIdentity locationIdentity); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the read (see {@link LocationNode}) * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Object readObject(Object object, int offset, LocationIdentity locationIdentity); /** @@ -274,13 +275,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeByte(Object object, WordBase offset, byte val, LocationIdentity locationIdentity); /** @@ -289,13 +290,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeChar(Object object, WordBase offset, char val, LocationIdentity locationIdentity); /** @@ -304,13 +305,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeShort(Object object, WordBase offset, short val, LocationIdentity locationIdentity); /** @@ -319,13 +320,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeInt(Object object, WordBase offset, int val, LocationIdentity locationIdentity); /** @@ -334,13 +335,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeLong(Object object, WordBase offset, long val, LocationIdentity locationIdentity); /** @@ -349,13 +350,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeFloat(Object object, WordBase offset, float val, LocationIdentity locationIdentity); /** @@ -364,13 +365,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeDouble(Object object, WordBase offset, double val, LocationIdentity locationIdentity); /** @@ -379,13 +380,13 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeWord(Object object, WordBase offset, WordBase val, LocationIdentity locationIdentity); /** @@ -394,112 +395,112 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeObject(Object object, WordBase offset, Object val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeByte(Object object, int offset, byte val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeChar(Object object, int offset, char val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeShort(Object object, int offset, short val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeInt(Object object, int offset, int val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeLong(Object object, int offset, long val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeFloat(Object object, int offset, float val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeDouble(Object object, int offset, double val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeWord(Object object, int offset, WordBase val, LocationIdentity locationIdentity); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write (see {@link LocationNode}) * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeObject(Object object, int offset, Object val, LocationIdentity locationIdentity); /** @@ -508,12 +509,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native byte readByte(Object object, WordBase offset); /** @@ -522,12 +523,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native char readChar(Object object, WordBase offset); /** @@ -536,12 +537,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native short readShort(Object object, WordBase offset); /** @@ -550,12 +551,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native int readInt(Object object, WordBase offset); /** @@ -564,12 +565,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native long readLong(Object object, WordBase offset); /** @@ -578,12 +579,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native float readFloat(Object object, WordBase offset); /** @@ -592,12 +593,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native double readDouble(Object object, WordBase offset); /** @@ -606,12 +607,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Word readWord(Object object, WordBase offset); /** @@ -620,102 +621,102 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Object readObject(Object object, WordBase offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native byte readByte(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native char readChar(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native short readShort(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native int readInt(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native long readLong(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native float readFloat(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native double readDouble(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Word readWord(Object object, int offset); /** * Reads the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @return the result of the memory access */ - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_OBJECT) public static native Object readObject(Object object, int offset); /** @@ -724,12 +725,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeByte(Object object, WordBase offset, byte val); /** @@ -738,12 +739,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeChar(Object object, WordBase offset, char val); /** @@ -752,12 +753,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeShort(Object object, WordBase offset, short val); /** @@ -766,12 +767,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeInt(Object object, WordBase offset, int val); /** @@ -780,12 +781,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeLong(Object object, WordBase offset, long val); /** @@ -794,12 +795,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeFloat(Object object, WordBase offset, float val); /** @@ -808,12 +809,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeDouble(Object object, WordBase offset, double val); /** @@ -822,12 +823,12 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeWord(Object object, WordBase offset, WordBase val); /** @@ -836,101 +837,101 @@ * The offset is always treated as a {@link Signed} value. However, the static type is * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller * knows that the highest-order bit of the unsigned value is never used). - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeObject(Object object, WordBase offset, Object val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeByte(Object object, int offset, byte val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeChar(Object object, int offset, char val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeShort(Object object, int offset, short val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeInt(Object object, int offset, int val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeLong(Object object, int offset, long val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeFloat(Object object, int offset, float val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeDouble(Object object, int offset, double val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeWord(Object object, int offset, WordBase val); /** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. - * + * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param val the value to be written to memory */ - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_OBJECT) public static native void writeObject(Object object, int offset, Object val); } diff -r 187634c8099c -r faebb143dab2 graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Tue May 20 18:58:42 2014 -0700 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Tue May 20 18:59:45 2014 -0700 @@ -26,13 +26,22 @@ import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; +/** + * Lowest-level memory access of native C memory. 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. + *

+ * Do not use these methods to access Java objects, i.e., do not use + * {@code Word.fromObject(obj).readXxx()}. Instead, use {@link ObjectAccess} or + * {@link BarrieredAccess} to access Java objects. + */ 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(); @@ -44,7 +53,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -58,7 +67,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -72,7 +81,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -86,7 +95,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -100,7 +109,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -114,7 +123,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -128,7 +137,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -142,7 +151,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -156,7 +165,7 @@ * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -166,7 +175,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -176,7 +185,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -186,7 +195,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -196,7 +205,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -206,7 +215,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -216,7 +225,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -226,7 +235,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -236,7 +245,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -246,7 +255,7 @@ /** * 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 (see {@link LocationNode}) * @return the result of the memory access @@ -260,7 +269,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -274,7 +283,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -288,7 +297,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -302,7 +311,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -316,7 +325,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -330,7 +339,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -344,7 +353,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -358,7 +367,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -372,7 +381,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -386,7 +395,7 @@ * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -396,7 +405,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -406,7 +415,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -416,7 +425,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -426,7 +435,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -436,7 +445,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -446,7 +455,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -456,7 +465,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -466,7 +475,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -476,7 +485,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -486,7 +495,7 @@ /** * 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 (see {@link LocationNode}) * @param val the value to be written to memory @@ -500,7 +509,7 @@ * 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 */ @@ -513,7 +522,7 @@ * 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 */ @@ -526,7 +535,7 @@ * 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 */ @@ -539,7 +548,7 @@ * 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 */ @@ -552,7 +561,7 @@ * 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 */ @@ -565,7 +574,7 @@ * 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 */ @@ -578,7 +587,7 @@ * 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 */ @@ -591,7 +600,7 @@ * 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 */ @@ -604,7 +613,7 @@ * 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 */ @@ -618,7 +627,7 @@ * 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 barrierType the type of the read barrier to be added * @return the result of the memory access @@ -628,7 +637,7 @@ /** * 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 */ @@ -637,7 +646,7 @@ /** * 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 */ @@ -646,7 +655,7 @@ /** * 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 */ @@ -655,7 +664,7 @@ /** * 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 */ @@ -664,7 +673,7 @@ /** * 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 */ @@ -673,7 +682,7 @@ /** * 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 */ @@ -682,7 +691,7 @@ /** * 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 */ @@ -691,7 +700,7 @@ /** * 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 */ @@ -700,7 +709,7 @@ /** * 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 */ @@ -710,7 +719,7 @@ * Reads the memory at address {@code (this + offset)}. This access will decompress the oop if * the VM uses compressed oops, and it can be parameterized to allow read barriers (G1 referent * field). - * + * * @param offset the signed offset for the memory access * @param barrierType the type of the read barrier to be added * @return the result of the memory access @@ -724,7 +733,7 @@ * 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 */ @@ -737,7 +746,7 @@ * 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 */ @@ -750,7 +759,7 @@ * 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 */ @@ -763,7 +772,7 @@ * 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 */ @@ -776,7 +785,7 @@ * 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 */ @@ -789,7 +798,7 @@ * 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 */ @@ -802,7 +811,7 @@ * 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 */ @@ -815,7 +824,7 @@ * 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 */ @@ -828,7 +837,7 @@ * 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 */ @@ -837,7 +846,7 @@ /** * 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 */ @@ -846,7 +855,7 @@ /** * 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 */ @@ -855,7 +864,7 @@ /** * 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 */ @@ -864,7 +873,7 @@ /** * 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 */ @@ -873,7 +882,7 @@ /** * 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 */ @@ -882,7 +891,7 @@ /** * 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 */ @@ -891,7 +900,7 @@ /** * 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 */ @@ -900,7 +909,7 @@ /** * 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 */ @@ -909,7 +918,7 @@ /** * 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 */ diff -r 187634c8099c -r faebb143dab2 graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Tue May 20 18:58:42 2014 -0700 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Tue May 20 18:59:45 2014 -0700 @@ -60,9 +60,13 @@ NODE_CLASS, COMPARISON, NOT, - READ, + READ_POINTER, + READ_OBJECT, + READ_BARRIERED, READ_HEAP, - WRITE, + WRITE_POINTER, + WRITE_OBJECT, + WRITE_BARRIERED, INITIALIZE, ZERO, FROM_UNSIGNED, @@ -91,7 +95,7 @@ /** * 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. */ @Operation(opcode = Opcode.ZERO) @@ -102,7 +106,7 @@ /** * 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 */ @@ -114,7 +118,7 @@ /** * 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 */ @@ -127,7 +131,7 @@ /** * 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 */ @@ -139,7 +143,7 @@ /** * 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 */ @@ -151,7 +155,7 @@ /** * 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 */ @@ -634,155 +638,155 @@ } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public byte readByte(WordBase offset, LocationIdentity locationIdentity) { return unsafe.getByte(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public char readChar(WordBase offset, LocationIdentity locationIdentity) { return unsafe.getChar(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public short readShort(WordBase offset, LocationIdentity locationIdentity) { return unsafe.getShort(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public int readInt(WordBase offset, LocationIdentity locationIdentity) { return unsafe.getInt(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public long readLong(WordBase offset, LocationIdentity locationIdentity) { return unsafe.getLong(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public float readFloat(WordBase offset, LocationIdentity locationIdentity) { return unsafe.getFloat(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public double readDouble(WordBase offset, LocationIdentity locationIdentity) { return unsafe.getDouble(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public Word readWord(WordBase offset, LocationIdentity locationIdentity) { return box(unsafe.getAddress(add((Word) offset).unbox())); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public native Object readObject(WordBase offset, LocationIdentity locationIdentity); @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public byte readByte(int offset, LocationIdentity locationIdentity) { return readByte(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public char readChar(int offset, LocationIdentity locationIdentity) { return readChar(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public short readShort(int offset, LocationIdentity locationIdentity) { return readShort(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public int readInt(int offset, LocationIdentity locationIdentity) { return readInt(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public long readLong(int offset, LocationIdentity locationIdentity) { return readLong(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public float readFloat(int offset, LocationIdentity locationIdentity) { return readFloat(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public double readDouble(int offset, LocationIdentity locationIdentity) { return readDouble(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public Word readWord(int offset, LocationIdentity locationIdentity) { return readWord(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public Object readObject(int offset, LocationIdentity locationIdentity) { return readObject(signed(offset), locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeByte(WordBase offset, byte val, LocationIdentity locationIdentity) { unsafe.putByte(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeChar(WordBase offset, char val, LocationIdentity locationIdentity) { unsafe.putChar(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeShort(WordBase offset, short val, LocationIdentity locationIdentity) { unsafe.putShort(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeInt(WordBase offset, int val, LocationIdentity locationIdentity) { unsafe.putInt(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeLong(WordBase offset, long val, LocationIdentity locationIdentity) { unsafe.putLong(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeFloat(WordBase offset, float val, LocationIdentity locationIdentity) { unsafe.putFloat(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeDouble(WordBase offset, double val, LocationIdentity locationIdentity) { unsafe.putDouble(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeWord(WordBase offset, WordBase val, LocationIdentity locationIdentity) { unsafe.putAddress(add((Word) offset).unbox(), ((Word) val).unbox()); } @@ -794,53 +798,53 @@ } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public native void writeObject(WordBase offset, Object val, LocationIdentity locationIdentity); @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeByte(int offset, byte val, LocationIdentity locationIdentity) { writeByte(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeChar(int offset, char val, LocationIdentity locationIdentity) { writeChar(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeShort(int offset, short val, LocationIdentity locationIdentity) { writeShort(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeInt(int offset, int val, LocationIdentity locationIdentity) { writeInt(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeLong(int offset, long val, LocationIdentity locationIdentity) { writeLong(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeFloat(int offset, float val, LocationIdentity locationIdentity) { writeFloat(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeDouble(int offset, double val, LocationIdentity locationIdentity) { writeDouble(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeWord(int offset, WordBase val, LocationIdentity locationIdentity) { writeWord(signed(offset), val, locationIdentity); } @@ -852,116 +856,116 @@ } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeObject(int offset, Object val, LocationIdentity locationIdentity) { writeObject(signed(offset), val, locationIdentity); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public byte readByte(WordBase offset) { return unsafe.getByte(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public char readChar(WordBase offset) { return unsafe.getChar(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public short readShort(WordBase offset) { return unsafe.getShort(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public int readInt(WordBase offset) { return unsafe.getInt(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public long readLong(WordBase offset) { return unsafe.getLong(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public float readFloat(WordBase offset) { return unsafe.getFloat(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public double readDouble(WordBase offset) { return unsafe.getDouble(add((Word) offset).unbox()); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public Word readWord(WordBase offset) { return box(unsafe.getAddress(add((Word) offset).unbox())); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public native Object readObject(WordBase offset); @Operation(opcode = Opcode.READ_HEAP) public native Object readObject(WordBase offset, BarrierType barrierType); @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public byte readByte(int offset) { return readByte(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public char readChar(int offset) { return readChar(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public short readShort(int offset) { return readShort(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public int readInt(int offset) { return readInt(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public long readLong(int offset) { return readLong(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public float readFloat(int offset) { return readFloat(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public double readDouble(int offset) { return readDouble(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public Word readWord(int offset) { return readWord(signed(offset)); } @Override - @Operation(opcode = Opcode.READ) + @Operation(opcode = Opcode.READ_POINTER) public Object readObject(int offset) { return readObject(signed(offset)); } @@ -972,107 +976,107 @@ } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeByte(WordBase offset, byte val) { unsafe.putByte(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeChar(WordBase offset, char val) { unsafe.putChar(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeShort(WordBase offset, short val) { unsafe.putShort(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeInt(WordBase offset, int val) { unsafe.putInt(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeLong(WordBase offset, long val) { unsafe.putLong(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeFloat(WordBase offset, float val) { unsafe.putFloat(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeDouble(WordBase offset, double val) { unsafe.putDouble(add((Word) offset).unbox(), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeWord(WordBase offset, WordBase val) { unsafe.putAddress(add((Word) offset).unbox(), ((Word) val).unbox()); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public native void writeObject(WordBase offset, Object val); @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeByte(int offset, byte val) { writeByte(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeChar(int offset, char val) { writeChar(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeShort(int offset, short val) { writeShort(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeInt(int offset, int val) { writeInt(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeLong(int offset, long val) { writeLong(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeFloat(int offset, float val) { writeFloat(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeDouble(int offset, double val) { writeDouble(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeWord(int offset, WordBase val) { writeWord(signed(offset), val); } @Override - @Operation(opcode = Opcode.WRITE) + @Operation(opcode = Opcode.WRITE_POINTER) public void writeObject(int offset, Object val) { writeObject(signed(offset), val); } diff -r 187634c8099c -r faebb143dab2 graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Tue May 20 18:58:42 2014 -0700 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Tue May 20 18:59:45 2014 -0700 @@ -57,6 +57,7 @@ protected final ResolvedJavaType wordBaseType; protected final ResolvedJavaType wordImplType; protected final ResolvedJavaType objectAccessType; + protected final ResolvedJavaType barrieredAccessType; protected final Kind wordKind; public WordTypeRewriterPhase(MetaAccessProvider metaAccess, SnippetReflectionProvider snippetReflection, Kind wordKind) { @@ -66,6 +67,7 @@ this.wordBaseType = metaAccess.lookupJavaType(WordBase.class); this.wordImplType = metaAccess.lookupJavaType(Word.class); this.objectAccessType = metaAccess.lookupJavaType(ObjectAccess.class); + this.barrieredAccessType = metaAccess.lookupJavaType(BarrieredAccess.class); } @Override @@ -170,10 +172,13 @@ */ protected void rewriteInvoke(StructuredGraph graph, MethodCallTargetNode callTargetNode) { ResolvedJavaMethod targetMethod = callTargetNode.targetMethod(); - if (!wordBaseType.isAssignableFrom(targetMethod.getDeclaringClass()) && !objectAccessType.equals(targetMethod.getDeclaringClass())) { + final boolean isWordBase = wordBaseType.isAssignableFrom(targetMethod.getDeclaringClass()); + final boolean isObjectAccess = objectAccessType.equals(targetMethod.getDeclaringClass()); + final boolean isBarrieredAccess = barrieredAccessType.equals(targetMethod.getDeclaringClass()); + if (!isWordBase && !isObjectAccess && !isBarrieredAccess) { /* * Not a method defined on WordBase or a subclass / subinterface, and not on - * ObjectAccess, so nothing to rewrite. + * ObjectAccess and not on BarrieredAccess, so nothing to rewrite. */ return; } @@ -211,7 +216,9 @@ replace(invoke, graph.unique(new XorNode(StampFactory.forKind(wordKind), arguments.get(0), ConstantNode.forIntegerKind(wordKind, -1, graph)))); break; - case READ: { + case READ_POINTER: + case READ_OBJECT: + case READ_BARRIERED: { assert arguments.size() == 2 || arguments.size() == 3; Kind readKind = asKind(callTargetNode.returnType()); LocationNode location; @@ -220,7 +227,7 @@ } else { location = makeLocation(graph, arguments.get(1), readKind, arguments.get(2)); } - replace(invoke, readOp(graph, arguments.get(0), invoke, location, BarrierType.NONE, false)); + replace(invoke, readOp(graph, arguments.get(0), invoke, location, operation.opcode())); break; } case READ_HEAP: { @@ -231,7 +238,9 @@ replace(invoke, readOp(graph, arguments.get(0), invoke, location, barrierType, true)); break; } - case WRITE: + case WRITE_POINTER: + case WRITE_OBJECT: + case WRITE_BARRIERED: case INITIALIZE: { assert arguments.size() == 3 || arguments.size() == 4; Kind writeKind = asKind(targetMethod.getSignature().getParameterType(targetMethod.isStatic() ? 2 : 1, targetMethod.getDeclaringClass())); @@ -375,6 +384,14 @@ return IndexedLocationNode.create(locationIdentity, readKind, 0, fromSigned(graph, offset), graph, 1); } + protected ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location, Opcode op) { + assert op == Opcode.READ_POINTER || op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED; + final BarrierType barrier = (op == Opcode.READ_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE); + final boolean compressible = (op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED); + + return readOp(graph, base, invoke, location, barrier, compressible); + } + protected ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location, BarrierType barrierType, boolean compressible) { JavaReadNode read = graph.add(new JavaReadNode(base, location, barrierType, compressible)); graph.addBeforeFixed(invoke.asNode(), read); @@ -387,8 +404,11 @@ } protected ValueNode writeOp(StructuredGraph graph, ValueNode base, ValueNode value, Invoke invoke, LocationNode location, Opcode op) { - assert op == Opcode.WRITE || op == Opcode.INITIALIZE; - JavaWriteNode write = graph.add(new JavaWriteNode(base, value, location, BarrierType.NONE, false, op == Opcode.INITIALIZE)); + assert op == Opcode.WRITE_POINTER || op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED || op == Opcode.INITIALIZE; + final BarrierType barrier = (op == Opcode.WRITE_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE); + final boolean compressible = (op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED); + final boolean initialize = (op == Opcode.INITIALIZE); + JavaWriteNode write = graph.add(new JavaWriteNode(base, value, location, barrier, compressible, initialize)); write.setStateAfter(invoke.stateAfter()); graph.addBeforeFixed(invoke.asNode(), write); return write;