Mercurial > hg > graal-jvmci-8
changeset 15840:e6f93283387a
Merge
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 21 May 2014 10:08:39 -0700 |
parents | 2838203d4231 (diff) 9acad98567dc (current diff) |
children | cb87019df5aa |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java |
diffstat | 35 files changed, 1567 insertions(+), 445 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Wed May 21 10:08:39 2014 -0700 @@ -460,7 +460,6 @@ private int totalFrameSize = -1; private int customStackAreaOffset = -1; - private int registerRestoreEpilogueOffset = -1; private final String name; @@ -641,26 +640,6 @@ } /** - * Allows a method to specify the offset of the epilogue that restores the callee saved - * registers. Must be called iff the method is a callee saved method and stores callee registers - * on the stack. - * - * @param registerRestoreEpilogueOffset the offset in the machine code where the epilogue begins - */ - public void setRegisterRestoreEpilogueOffset(int registerRestoreEpilogueOffset) { - assert this.registerRestoreEpilogueOffset == -1; - this.registerRestoreEpilogueOffset = registerRestoreEpilogueOffset; - } - - /** - * @return the code offset of the start of the epilogue that restores all callee saved - * registers, or -1 if this is not a callee saved method - */ - public int getRegisterRestoreEpilogueOffset() { - return registerRestoreEpilogueOffset; - } - - /** * Offset in bytes for the custom stack area (relative to sp). * * @return the offset in bytes
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ReferenceMap.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ReferenceMap.java Wed May 21 10:08:39 2014 -0700 @@ -29,8 +29,6 @@ void setRegister(int idx, PlatformKind kind); - PlatformKind getRegister(int idx); - void setStackSlot(int offset, PlatformKind kind); boolean hasRegisterRefMap();
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java Wed May 21 10:08:39 2014 -0700 @@ -109,14 +109,20 @@ if (result.size() == 0) { return new JavaTypeProfile(newNullSeen, 1.0, EMPTY_ARRAY); } - double probabilitySum = 0.0; - for (int i = 0; i < result.size(); i++) { - probabilitySum += result.get(i).getProbability(); + double factor; + if (result.size() == this.getItems().length) { + /* List of types did not change, no need to recompute probabilities. */ + factor = 1.0; + } else { + double probabilitySum = 0.0; + for (int i = 0; i < result.size(); i++) { + probabilitySum += result.get(i).getProbability(); + } + probabilitySum += newNotRecorded; + + factor = 1.0 / probabilitySum; // Normalize to 1.0 + assert factor >= 1.0; } - probabilitySum += newNotRecorded; - - double factor = 1.0 / probabilitySum; // Normalize to 1.0 - assert factor >= 1.0; ProfiledType[] newResult = new ProfiledType[result.size()]; for (int i = 0; i < newResult.length; ++i) { ProfiledType curType = result.get(i);
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Wed May 21 10:08:39 2014 -0700 @@ -247,6 +247,14 @@ ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses); /** + * Returns the static fields of this class, including + * {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned + * for array and primitive types. The order of fields returned by this method is stable. That + * is, for a single JVM execution the same order is returned each time this method is called. + */ + ResolvedJavaField[] getStaticFields(); + + /** * Returns the annotation for the specified type of this class, if such an annotation is * present. *
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java Wed May 21 10:08:39 2014 -0700 @@ -137,7 +137,7 @@ FrameMap frameMap = backend.newFrameMap(null); TargetDescription target = backend.getTarget(); CallingConvention cc = CodeUtil.getCallingConvention(backend.getProviders().getCodeCache(), CallingConvention.Type.JavaCallee, method, false); - this.lirGenRes = backend.newLIRGenerationResult(lir, frameMap, null); + this.lirGenRes = backend.newLIRGenerationResult(lir, frameMap, method, null); this.gen = backend.newLIRGenerator(cc, lirGenRes); this.lirBuilder = backend.newBytecodeLIRBuilder(gen, this); @@ -441,13 +441,13 @@ } @Override - protected Value genCheckCast(ResolvedJavaType type, Value object, JavaTypeProfile profileForTypeCheck, boolean b) { + protected Value createCheckCast(ResolvedJavaType type, Value object, JavaTypeProfile profileForTypeCheck, boolean b) { // TODO Auto-generated method stub throw GraalInternalError.unimplemented("Auto-generated method stub"); } @Override - protected Value genInstanceOf(ResolvedJavaType type, Value object, JavaTypeProfile profileForTypeCheck) { + protected Value createInstanceOf(ResolvedJavaType type, Value object, JavaTypeProfile profileForTypeCheck) { // TODO Auto-generated method stub throw GraalInternalError.unimplemented("Auto-generated method stub"); }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed May 21 10:08:39 2014 -0700 @@ -241,7 +241,7 @@ } try (Scope ds = Debug.scope("BackEnd", lir)) { FrameMap frameMap = backend.newFrameMap(registerConfig); - LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(lir, frameMap, stub); + LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(lir, frameMap, graph.method(), stub); LIRGeneratorTool lirGen = backend.newLIRGenerator(cc, lirGenRes); NodeLIRBuilderTool nodeLirGen = backend.newNodeLIRBuilder(graph, lirGen);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Wed May 21 10:08:39 2014 -0700 @@ -101,14 +101,14 @@ public NodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool gen) { this.gen = gen; this.nodeOperands = graph.createNodeMap(); - this.debugInfoBuilder = createDebugInfoBuilder(nodeOperands); + this.debugInfoBuilder = createDebugInfoBuilder(graph, nodeOperands); if (MatchExpressions.getValue()) { matchRules = MatchRuleRegistry.lookup(getClass()); } } - @SuppressWarnings("hiding") - protected DebugInfoBuilder createDebugInfoBuilder(NodeMap<Value> nodeOperands) { + @SuppressWarnings({"unused", "hiding"}) + protected DebugInfoBuilder createDebugInfoBuilder(StructuredGraph graph, NodeMap<Value> nodeOperands) { return new DebugInfoBuilder(nodeOperands); }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Wed May 21 10:08:39 2014 -0700 @@ -95,31 +95,7 @@ if (result == null) { NodeClassLookup lookup = new DefaultNodeClassLookup(); - HashMap<Class<? extends NodeLIRBuilder>, List<MatchStatement>> localRules = new HashMap<>(); - ServiceLoader<MatchStatementSet> sl = ServiceLoader.loadInstalled(MatchStatementSet.class); - for (MatchStatementSet rules : sl) { - localRules.put(rules.forClass(), rules.statements(lookup)); - } - - // Walk the class hierarchy collecting lists and merge them together. The subclass - // rules are first which gives them preference over earlier rules. - Map<Class<? extends ValueNode>, List<MatchStatement>> rules = new HashMap<>(); - Class<?> currentClass = theClass; - do { - List<MatchStatement> statements = localRules.get(currentClass); - if (statements != null) { - for (MatchStatement statement : statements) { - Class<? extends ValueNode> nodeClass = statement.getPattern().nodeClass(); - List<MatchStatement> current = rules.get(nodeClass); - if (current == null) { - current = new ArrayList<>(); - rules.put(nodeClass, current); - } - current.add(statement); - } - } - currentClass = currentClass.getSuperclass(); - } while (currentClass != NodeLIRBuilder.class); + Map<Class<? extends ValueNode>, List<MatchStatement>> rules = createRules(theClass, lookup); registry.put(theClass, rules); assert registry.get(theClass) == rules; result = rules; @@ -142,4 +118,38 @@ } return result; } + + /* + * This is a separate, public method so that external clients can create rules with a custom + * lookup and without the default caching behavior. + */ + public static Map<Class<? extends ValueNode>, List<MatchStatement>> createRules(Class<? extends NodeLIRBuilder> theClass, NodeClassLookup lookup) { + HashMap<Class<? extends NodeLIRBuilder>, MatchStatementSet> matchSets = new HashMap<>(); + ServiceLoader<MatchStatementSet> sl = ServiceLoader.loadInstalled(MatchStatementSet.class); + for (MatchStatementSet rules : sl) { + matchSets.put(rules.forClass(), rules); + } + + // Walk the class hierarchy collecting lists and merge them together. The subclass + // rules are first which gives them preference over earlier rules. + Map<Class<? extends ValueNode>, List<MatchStatement>> rules = new HashMap<>(); + Class<?> currentClass = theClass; + do { + MatchStatementSet matchSet = matchSets.get(currentClass); + if (matchSet != null) { + List<MatchStatement> statements = matchSet.statements(lookup); + for (MatchStatement statement : statements) { + Class<? extends ValueNode> nodeClass = statement.getPattern().nodeClass(); + List<MatchStatement> current = rules.get(nodeClass); + if (current == null) { + current = new ArrayList<>(); + rules.put(nodeClass, current); + } + current.add(statement); + } + } + currentClass = currentClass.getSuperclass(); + } while (currentClass != NodeLIRBuilder.class); + return rules; + } }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Wed May 21 10:08:39 2014 -0700 @@ -75,7 +75,7 @@ public abstract LIRGeneratorTool newLIRGenerator(CallingConvention cc, LIRGenerationResult lirGenRes); - public abstract LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, Object stub); + public abstract LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, ResolvedJavaMethod method, Object stub); public abstract NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen);
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Wed May 21 10:08:39 2014 -0700 @@ -142,13 +142,17 @@ */ private Node usage0; private Node usage1; - private Node[] extraUsages = NO_NODES; + private Node[] extraUsages; private Node predecessor; public Node() { - this.graph = null; - this.id = INITIAL_ID; + init(); + } + + final void init() { + id = INITIAL_ID; + extraUsages = NO_NODES; } int id() { @@ -953,7 +957,11 @@ * @param map */ public Map<Object, Object> getDebugProperties(Map<Object, Object> map) { - getNodeClass().getDebugProperties(this, map); + NodeClass nodeClass = getNodeClass(); + for (Integer pos : nodeClass.getPropertyPositions()) { + map.put(nodeClass.getPropertyName(pos), nodeClass.getProperty(this, pos)); + + } return map; }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Wed May 21 10:08:39 2014 -0700 @@ -755,43 +755,6 @@ return number; } - /** - * Populates a given map with the names and values of all data fields. - * - * @param node the node from which to take the values. - * @param properties a map that will be populated. - */ - public void getDebugProperties(Node node, Map<Object, Object> properties) { - for (int i = 0; i < dataOffsets.length; ++i) { - Class<?> type = fieldTypes.get(dataOffsets[i]); - Object value = null; - if (type.isPrimitive()) { - if (type == Integer.TYPE) { - value = unsafe.getInt(node, dataOffsets[i]); - } else if (type == Long.TYPE) { - value = unsafe.getLong(node, dataOffsets[i]); - } else if (type == Boolean.TYPE) { - value = unsafe.getBoolean(node, dataOffsets[i]); - } else if (type == Float.TYPE) { - value = unsafe.getFloat(node, dataOffsets[i]); - } else if (type == Double.TYPE) { - value = unsafe.getDouble(node, dataOffsets[i]); - } else if (type == Short.TYPE) { - value = unsafe.getShort(node, dataOffsets[i]); - } else if (type == Character.TYPE) { - value = unsafe.getChar(node, dataOffsets[i]); - } else if (type == Byte.TYPE) { - value = unsafe.getByte(node, dataOffsets[i]); - } else { - assert false : "unhandled property type: " + type; - } - } else { - value = unsafe.getObject(node, dataOffsets[i]); - } - properties.put(fieldNames.get(dataOffsets[i]), value); - } - } - private static boolean deepEquals0(Object e1, Object e2) { assert e1 != null; boolean eq; @@ -933,6 +896,73 @@ return fieldNames.get(pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]); } + public String getPropertyName(int pos) { + return fieldNames.get(dataOffsets[pos]); + } + + public Class<?> getPropertyType(int pos) { + return fieldTypes.get(dataOffsets[pos]); + } + + public Object getProperty(Node node, int pos) { + long dataOffset = dataOffsets[pos]; + Class<?> type = fieldTypes.get(dataOffset); + Object value = null; + if (type.isPrimitive()) { + if (type == Integer.TYPE) { + value = unsafe.getInt(node, dataOffset); + } else if (type == Long.TYPE) { + value = unsafe.getLong(node, dataOffset); + } else if (type == Boolean.TYPE) { + value = unsafe.getBoolean(node, dataOffset); + } else if (type == Float.TYPE) { + value = unsafe.getFloat(node, dataOffset); + } else if (type == Double.TYPE) { + value = unsafe.getDouble(node, dataOffset); + } else if (type == Short.TYPE) { + value = unsafe.getShort(node, dataOffset); + } else if (type == Character.TYPE) { + value = unsafe.getChar(node, dataOffset); + } else if (type == Byte.TYPE) { + value = unsafe.getByte(node, dataOffset); + } else { + assert false : "unhandled property type: " + type; + } + } else { + value = unsafe.getObject(node, dataOffset); + } + return value; + } + + public void setProperty(Node node, int pos, Object value) { + long dataOffset = dataOffsets[pos]; + Class<?> type = fieldTypes.get(dataOffset); + if (type.isPrimitive()) { + if (type == Integer.TYPE) { + unsafe.putInt(node, dataOffset, (Integer) value); + } else if (type == Long.TYPE) { + unsafe.putLong(node, dataOffset, (Long) value); + } else if (type == Boolean.TYPE) { + unsafe.putBoolean(node, dataOffset, (Boolean) value); + } else if (type == Float.TYPE) { + unsafe.putFloat(node, dataOffset, (Float) value); + } else if (type == Double.TYPE) { + unsafe.putDouble(node, dataOffset, (Double) value); + } else if (type == Short.TYPE) { + unsafe.putShort(node, dataOffset, (Short) value); + } else if (type == Character.TYPE) { + unsafe.putChar(node, dataOffset, (Character) value); + } else if (type == Byte.TYPE) { + unsafe.putByte(node, dataOffset, (Byte) value); + } else { + assert false : "unhandled property type: " + type; + } + } else { + assert value == null || !value.getClass().isPrimitive(); + unsafe.putObject(node, dataOffset, value); + } + } + void updateInputSuccInPlace(Node node, InplaceUpdateClosure duplicationReplacement) { int index = 0; while (index < directInputCount) { @@ -1031,7 +1061,7 @@ if (pos.getSubIndex() < list.size()) { list.set(pos.getSubIndex(), x); } else { - while (pos.getSubIndex() < list.size() - 1) { + while (list.size() < pos.getSubIndex()) { list.add(null); } list.add(x); @@ -1353,6 +1383,54 @@ }; } + public Collection<Integer> getPropertyPositions() { + return new AbstractCollection<Integer>() { + @Override + public Iterator<Integer> iterator() { + return new Iterator<Integer>() { + int i = 0; + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + public Integer next() { + Integer pos = i++; + return pos; + } + + public boolean hasNext() { + return i < dataOffsets.length; + } + }; + } + + @Override + public int size() { + return dataOffsets.length; + } + }; + } + + /** + * Initializes a fresh allocated node for which no constructor is called yet. Needed to + * implement node factories in svm. + */ + public void initRawNode(Node node) { + node.init(); + for (int inputPos = directInputCount; inputPos < inputOffsets.length; inputPos++) { + if (getNodeList(node, inputOffsets[inputPos]) == null) { + putNodeList(node, inputOffsets[inputPos], new NodeInputList<>(node)); + } + } + for (int successorPos = directSuccessorCount; successorPos < successorOffsets.length; successorPos++) { + if (getNodeList(node, successorOffsets[successorPos]) == null) { + putNodeList(node, successorOffsets[successorPos], new NodeSuccessorList<>(node)); + } + } + } + public Class<?> getJavaClass() { return getClazz(); }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Wed May 21 10:08:39 2014 -0700 @@ -26,6 +26,7 @@ import static com.oracle.graal.api.code.CallingConvention.Type.*; import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.compiler.common.GraalOptions.*; + import java.util.*; import sun.misc.*; @@ -77,7 +78,7 @@ } @Override - public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, Object stub) { + public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, ResolvedJavaMethod method, Object stub) { return new AMD64HotSpotLIRGenerationResult(lir, frameMap, stub); } @@ -190,7 +191,6 @@ CalleeSaveLayout csl = crb.frameMap.registerConfig.getCalleeSaveLayout(); if (csl != null && csl.size != 0) { - crb.compilationResult.setRegisterRestoreEpilogueOffset(asm.position()); // saved all registers, restore all registers int frameToCSA = crb.frameMap.offsetToCalleeSaveArea(); asm.restore(csl, frameToCSA);
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java Wed May 21 10:08:39 2014 -0700 @@ -131,7 +131,7 @@ } @Override - protected DebugInfoBuilder createDebugInfoBuilder(NodeMap<Value> nodeOperands) { + protected DebugInfoBuilder createDebugInfoBuilder(StructuredGraph graph, NodeMap<Value> nodeOperands) { HotSpotLockStack lockStack = new HotSpotLockStack(gen.getResult().getFrameMap(), Kind.Long); return new HotSpotDebugInfoBuilder(nodeOperands, lockStack); }
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Wed May 21 10:08:39 2014 -0700 @@ -316,7 +316,6 @@ // from host code result.setTotalFrameSize(hostCode.getTotalFrameSize()); result.setCustomStackAreaOffset(hostCode.getCustomStackAreaOffset()); - result.setRegisterRestoreEpilogueOffset(hostCode.getRegisterRestoreEpilogueOffset()); result.setTargetCode(hostCode.getTargetCode(), hostCode.getTargetCodeSize()); for (CodeAnnotation annotation : hostCode.getAnnotations()) { result.addAnnotation(annotation); @@ -409,7 +408,7 @@ } @Override - public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, Object stub) { + public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, ResolvedJavaMethod method, Object stub) { return new HSAILHotSpotLIRGenerationResult(lir, frameMap); }
--- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Wed May 21 10:08:39 2014 -0700 @@ -346,7 +346,7 @@ } @Override - public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, Object stub) { + public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, ResolvedJavaMethod method, Object stub) { return new LIRGenerationResultBase(lir, frameMap); }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Wed May 21 10:08:39 2014 -0700 @@ -26,6 +26,7 @@ import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.graal.sparc.SPARC.*; + import java.util.*; import sun.misc.*; @@ -83,7 +84,7 @@ } @Override - public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, Object stub) { + public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, ResolvedJavaMethod method, Object stub) { return new SPARCHotSpotLIRGenerationResult(lir, frameMap, stub); }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java Wed May 21 10:08:39 2014 -0700 @@ -51,7 +51,7 @@ } @Override - protected DebugInfoBuilder createDebugInfoBuilder(NodeMap<Value> nodeOperands) { + protected DebugInfoBuilder createDebugInfoBuilder(StructuredGraph graph, NodeMap<Value> nodeOperands) { HotSpotLockStack lockStack = new HotSpotLockStack(gen.getResult().getFrameMap(), Kind.Long); return new HotSpotDebugInfoBuilder(nodeOperands, lockStack); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Wed May 21 10:08:39 2014 -0700 @@ -56,6 +56,7 @@ private final HotSpotSignature signature; private HotSpotMethodData methodData; private byte[] code; + private Member toJavaCache; /** * Gets the holder of a HotSpot metaspace method native object. @@ -505,16 +506,26 @@ } private Method toJava() { + if (toJavaCache != null) { + return (Method) toJavaCache; + } try { - return holder.mirror().getDeclaredMethod(name, signatureToTypes()); + Method result = holder.mirror().getDeclaredMethod(name, signatureToTypes()); + toJavaCache = result; + return result; } catch (NoSuchMethodException e) { return null; } } private Constructor<?> toJavaConstructor() { + if (toJavaCache != null) { + return (Constructor<?>) toJavaCache; + } try { - return holder.mirror().getDeclaredConstructor(signatureToTypes()); + Constructor<?> result = holder.mirror().getDeclaredConstructor(signatureToTypes()); + toJavaCache = result; + return result; } catch (NoSuchMethodException e) { return null; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Wed May 21 10:08:39 2014 -0700 @@ -607,6 +607,29 @@ return instanceFields; } + @Override + public ResolvedJavaField[] getStaticFields() { + if (isArray()) { + return new HotSpotResolvedJavaField[0]; + } else { + final int fieldCount = getFieldCount(); + ArrayList<HotSpotResolvedJavaField> fieldsArray = new ArrayList<>(fieldCount); + + for (int i = 0; i < fieldCount; i++) { + FieldInfo field = new FieldInfo(i); + + // We are only interested in static fields. + if (field.isStatic()) { + HotSpotResolvedJavaField resolvedJavaField = createField(field.getName(), field.getType(), field.getOffset(), field.getAccessFlags()); + fieldsArray.add(resolvedJavaField); + } + } + + fieldsArray.sort(new OffsetComparator()); + return fieldsArray.toArray(new HotSpotResolvedJavaField[fieldsArray.size()]); + } + } + /** * Returns the actual field count of this class's internal {@code InstanceKlass::_fields} array * by walking the array and discounting the generic signature slots at the end of the array.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Wed May 21 10:08:39 2014 -0700 @@ -39,7 +39,7 @@ /** * Gets the Graal mirror for a {@link Kind}. - * + * * @return the {@link HotSpotResolvedObjectType} corresponding to {@code kind} */ public static ResolvedJavaType fromKind(Kind kind) { @@ -49,12 +49,12 @@ /** * Creates the Graal mirror for a primitive {@link Kind}. - * + * * <p> * <b>NOTE</b>: Creating an instance of this class does not install the mirror for the * {@link Class} type. Use {@link #fromKind(Kind)} or {@link #fromClass(Class)} instead. * </p> - * + * * @param kind the Kind to create the mirror for */ public HotSpotResolvedPrimitiveType(Kind kind) { @@ -188,6 +188,11 @@ } @Override + public ResolvedJavaField[] getStaticFields() { + return new ResolvedJavaField[0]; + } + + @Override public <T extends Annotation> T getAnnotation(Class<T> annotationClass) { return null; }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Wed May 21 10:08:39 2014 -0700 @@ -583,7 +583,7 @@ } } - protected abstract T genCheckCast(ResolvedJavaType type, T object, JavaTypeProfile profileForTypeCheck, boolean b); + protected abstract T createCheckCast(ResolvedJavaType type, T object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck); private void genCheckCast() { int cpi = getStream().readCPI(); @@ -591,14 +591,14 @@ T object = frameState.apop(); if (type instanceof ResolvedJavaType) { JavaTypeProfile profileForTypeCheck = getProfileForTypeCheck((ResolvedJavaType) type); - T checkCastNode = append(genCheckCast((ResolvedJavaType) type, object, profileForTypeCheck, false)); + T checkCastNode = append(createCheckCast((ResolvedJavaType) type, object, profileForTypeCheck, false)); frameState.apush(checkCastNode); } else { handleUnresolvedCheckCast(type, object); } } - protected abstract T genInstanceOf(ResolvedJavaType type, T object, JavaTypeProfile profileForTypeCheck); + protected abstract T createInstanceOf(ResolvedJavaType type, T object, JavaTypeProfile profileForTypeCheck); protected abstract T genConditional(T x); @@ -608,7 +608,7 @@ T object = frameState.apop(); if (type instanceof ResolvedJavaType) { ResolvedJavaType resolvedType = (ResolvedJavaType) type; - T instanceOfNode = genInstanceOf((ResolvedJavaType) type, object, getProfileForTypeCheck(resolvedType)); + T instanceOfNode = createInstanceOf((ResolvedJavaType) type, object, getProfileForTypeCheck(resolvedType)); frameState.ipush(append(genConditional(genUnique(instanceOfNode)))); } else { handleUnresolvedInstanceOf(type, object);
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractFrameStateBuilder.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractFrameStateBuilder.java Wed May 21 10:08:39 2014 -0700 @@ -160,6 +160,10 @@ return lockedObjects[i]; } + public void storeLock(int i, T lock) { + lockedObjects[i] = lock; + } + /** * Loads the local variable at the specified index, checking that the returned value is non-null * and that two-stack values are properly handled.
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed May 21 10:08:39 2014 -0700 @@ -150,7 +150,7 @@ methodSynchronizedObject = null; this.currentGraph = graph; HIRFrameStateBuilder frameState = new HIRFrameStateBuilder(method, graph, graphBuilderConfig.eagerResolving()); - this.parser = new BytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, new BytecodeStream(method.getCode()), profilingInfo, method.getConstantPool(), + this.parser = createBytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, new BytecodeStream(method.getCode()), profilingInfo, method.getConstantPool(), entryBCI); TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); try { @@ -163,6 +163,12 @@ ComputeLoopFrequenciesClosure.compute(graph); } + @SuppressWarnings("hiding") + protected BytecodeParser createBytecodeParser(MetaAccessProvider metaAccess, ResolvedJavaMethod method, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts, + HIRFrameStateBuilder frameState, BytecodeStream stream, ProfilingInfo profilingInfo, ConstantPool constantPool, int entryBCI) { + return new BytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, stream, profilingInfo, constantPool, entryBCI); + } + @Override protected String getDetailedName() { return getName() + " " + MetaUtil.format("%H.%n(%p):%r", parser.getMethod()); @@ -190,7 +196,7 @@ } } - class BytecodeParser extends AbstractBytecodeParser<ValueNode, HIRFrameStateBuilder> { + public class BytecodeParser extends AbstractBytecodeParser<ValueNode, HIRFrameStateBuilder> { private BciBlock[] loopHeaders; private LocalLiveness liveness; @@ -433,12 +439,13 @@ dispatchBegin.setStateAfter(dispatchState.create(bci)); } else { dispatchBegin = currentGraph.add(new DispatchBeginNode()); + dispatchState.apush(exceptionObject); dispatchBegin.setStateAfter(dispatchState.create(bci)); - dispatchState.apush(exceptionObject); dispatchState.setRethrowException(true); } + FixedWithNextNode finishedDispatch = finishInstruction(dispatchBegin, dispatchState); FixedNode target = createTarget(dispatchBlock, dispatchState); - finishInstruction(dispatchBegin, dispatchState).setNext(target); + finishedDispatch.setNext(target); return dispatchBegin; } @@ -600,12 +607,12 @@ } @Override - protected ValueNode genCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean b) { - return new CheckCastNode(type, object, profileForTypeCheck, b); + protected ValueNode createCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck) { + return new CheckCastNode(type, object, profileForTypeCheck, forStoreCheck); } @Override - protected ValueNode genInstanceOf(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck) { + protected ValueNode createInstanceOf(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck) { return new InstanceOfNode(type, object, profileForTypeCheck); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Wed May 21 10:08:39 2014 -0700 @@ -93,6 +93,10 @@ @Override public Node canonical(CanonicalizerTool tool) { + if (stamp() == StampFactory.forNodeIntrinsic()) { + /* The actual stamp has not been set yet. */ + return this; + } inferStamp(); if (stamp().equals(object().stamp())) { return object();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Wed May 21 10:08:39 2014 -0700 @@ -50,7 +50,6 @@ public LoadHubNode(ValueNode object, Kind kind, ValueNode guard) { super(getKind(kind), (GuardingNode) guard); assert object != guard; - assert guard != null; this.object = object; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Wed May 21 10:08:39 2014 -0700 @@ -39,7 +39,7 @@ /** * Implements a type check against a compile-time known type. */ -public final class CheckCastNode extends FixedWithNextNode implements Canonicalizable, Lowerable, Virtualizable, ValueProxy { +public class CheckCastNode extends FixedWithNextNode implements Canonicalizable, Lowerable, Virtualizable, ValueProxy { @Input private ValueNode object; private final ResolvedJavaType type;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Wed May 21 10:08:39 2014 -0700 @@ -34,7 +34,7 @@ /** * The {@code InstanceOfNode} represents an instanceof test. */ -public final class InstanceOfNode extends UnaryOpLogicNode implements Canonicalizable, Lowerable, Virtualizable { +public class InstanceOfNode extends UnaryOpLogicNode implements Canonicalizable, Lowerable, Virtualizable { private final ResolvedJavaType type; private JavaTypeProfile profile;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Wed May 21 10:08:39 2014 -0700 @@ -137,12 +137,10 @@ return this; } - assert targetMethod.getDeclaringClass().asExactType() == null : "should have been handled by canBeStaticallyBound"; - // check if the type of the receiver can narrow the result ValueNode receiver = receiver(); ResolvedJavaType type = StampTool.typeOrNull(receiver); - if (type != null) { + if (type != null && (invoke().stateAfter() != null || invoke().stateDuring() != null)) { // either the holder class is exact, or the receiver object has an exact type ResolvedJavaMethod resolvedMethod = type.resolveMethod(targetMethod, invoke().getContextType()); if (resolvedMethod != null && (resolvedMethod.canBeStaticallyBound() || StampTool.isExactType(receiver))) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Wed May 21 10:08:39 2014 -0700 @@ -223,7 +223,7 @@ private boolean check(String name, boolean constParam, boolean varargsParam) { assert nextParamIdx < info.getParameterCount() : "too many parameters: " + name + " " + this; - assert info.names[nextParamIdx].equals(name) : "wrong parameter name: " + name + " " + this; + assert info.names[nextParamIdx] == null || info.names[nextParamIdx].equals(name) : "wrong parameter name: " + name + " " + this; assert constParam == info.isConstantParameter(nextParamIdx) : "Parameter " + (constParam ? "not " : "") + "annotated with @" + ConstantParameter.class.getSimpleName() + ": " + name + " " + this; assert varargsParam == info.isVarargsParameter(nextParamIdx) : "Parameter " + (varargsParam ? "not " : "") + "annotated with @" + VarargsParameter.class.getSimpleName() + ": " + name +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java Wed May 21 10:08:39 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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); +}
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java Wed May 21 10:08:39 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); }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Wed May 21 10:08:39 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. + * <p> + * 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 */
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Wed May 21 10:08:39 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); }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Wed May 21 10:08:39 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;
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Wed May 21 17:57:41 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Wed May 21 10:08:39 2014 -0700 @@ -47,6 +47,8 @@ public interface FieldOffsetProvider { long objectFieldOffset(Field field); + + int getTypeSize(Class<?> clazz); } private static final FieldOffsetProvider unsafeFieldOffsetProvider = new FieldOffsetProvider() { @@ -55,6 +57,17 @@ public long objectFieldOffset(Field field) { return unsafe.objectFieldOffset(field); } + + @Override + public int getTypeSize(Class<?> clazz) { + if (!clazz.isPrimitive()) { + return Unsafe.ARRAY_OBJECT_INDEX_SCALE; + } else if (clazz == int.class) { + return Unsafe.ARRAY_INT_INDEX_SCALE; + } else { + throw new UnsupportedOperationException("unsupported field type: " + clazz); + } + } }; public static enum NodeFieldKind {