# HG changeset patch # User Christian Wirth # Date 1377588895 -7200 # Node ID 6f58979d075582c19e8514128fd459b191a89011 # Parent 51dcddfa25a6d8d2ebb6faf1494034a8bd9ac7d8# Parent ddbeefb142a7bc40c99806ed1cd3e3e01153e621 Merged diff -r 51dcddfa25a6 -r 6f58979d0755 .hgignore --- a/.hgignore Mon Aug 26 18:25:40 2013 +0200 +++ b/.hgignore Tue Aug 27 09:34:55 2013 +0200 @@ -76,3 +76,4 @@ jacoco.exec workingsets.xml .buildbot/ +graal.options diff -r 51dcddfa25a6 -r 6f58979d0755 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Mon Aug 26 18:25:40 2013 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Tue Aug 27 09:34:55 2013 +0200 @@ -239,7 +239,6 @@ } instanceTL.set(newChild); newChild.updateFlags(); - newChild.setLogEnabled(oldContext.isLogEnabled()); try (TimerCloseable a = scopeTime.start()) { return executeScope(runnable, callable); } finally { @@ -282,6 +281,7 @@ meterEnabled = false; timeEnabled = false; dumpEnabled = false; + setLogEnabled(false); // Be pragmatic: provide a default log stream to prevent a crash if the stream is not // set while logging @@ -291,6 +291,7 @@ timeEnabled = config.isTimeEnabled(); dumpEnabled = config.isDumpEnabled(); output = config.output(); + setLogEnabled(config.isLogEnabled()); } } @@ -390,7 +391,6 @@ public void setConfig(DebugConfig newConfig) { configTL.set(newConfig); updateFlags(); - setLogEnabled(newConfig != null && newConfig.isLogEnabled()); } public String getQualifiedName() { diff -r 51dcddfa25a6 -r 6f58979d0755 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameAccessNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameAccessNode.java Mon Aug 26 18:25:40 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameAccessNode.java Tue Aug 27 09:34:55 2013 +0200 @@ -34,6 +34,7 @@ import com.oracle.graal.nodes.type.*; import com.oracle.graal.truffle.*; import com.oracle.graal.truffle.nodes.*; +import com.oracle.graal.truffle.substitutions.*; import com.oracle.truffle.api.frame.*; /** @@ -70,7 +71,7 @@ return getConstantFrameSlot().getIndex(); } - protected boolean isConstantFrameSlot() { + public boolean isConstantFrameSlot() { return slot.isConstant() && !slot.isNullConstant(); } @@ -113,14 +114,17 @@ } protected final boolean isValidAccessKind() { - if (getSlotKind() == Kind.Byte) { - // tag access + if (isTagAccess()) { return true; } return getSlotKind() == getGraalKind(getConstantFrameSlot().getKind()); } + protected final boolean isTagAccess() { + return field == FrameWithoutBoxingSubstitutions.TAGS_FIELD; + } + private static Kind getGraalKind(FrameSlotKind kind) { switch (kind) { case Object: @@ -156,6 +160,9 @@ @Override public Map getDebugProperties(Map map) { Map properties = super.getDebugProperties(map); + if (isTagAccess()) { + properties.put("slotKind", "Tag"); + } if (isConstantFrameSlot()) { properties.put("frameSlot", getConstantFrameSlot().toString()); } diff -r 51dcddfa25a6 -r 6f58979d0755 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java Mon Aug 26 18:25:40 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java Tue Aug 27 09:34:55 2013 +0200 @@ -78,12 +78,12 @@ LoadFieldNode loadFieldNode = graph().add(new LoadFieldNode(getFrame(), field)); structuredGraph.addBeforeFixed(this, loadFieldNode); FixedWithNextNode loadNode; - if (!getSlotKind().isPrimitive()) { + if (isTagAccess()) { + ValueNode slotIndex = getSlotOffset(1, tool.getRuntime()); + loadNode = graph().add(new LoadIndexedNode(loadFieldNode, slotIndex, getSlotKind())); + } else if (!getSlotKind().isPrimitive()) { ValueNode slotIndex = getSlotOffset(1, tool.getRuntime()); loadNode = graph().add(new LoadIndexedNode(loadFieldNode, slotIndex, Kind.Object)); - } else if (getSlotKind() == Kind.Byte) { - ValueNode slotIndex = getSlotOffset(1, tool.getRuntime()); - loadNode = graph().add(new LoadIndexedNode(loadFieldNode, slotIndex, Kind.Byte)); } else { ValueNode slotOffset = getSlotOffset(Unsafe.ARRAY_LONG_INDEX_SCALE, tool.getRuntime()); loadNode = graph().add(new UnsafeLoadNode(loadFieldNode, Unsafe.ARRAY_LONG_BASE_OFFSET, slotOffset, getSlotKind())); diff -r 51dcddfa25a6 -r 6f58979d0755 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java Mon Aug 26 18:25:40 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java Tue Aug 27 09:34:55 2013 +0200 @@ -79,10 +79,10 @@ structuredGraph.addBeforeFixed(this, loadFieldNode); FixedWithNextNode storeNode; ValueNode slotIndex = getSlotOffset(1, tool.getRuntime()); - if (!getSlotKind().isPrimitive()) { + if (isTagAccess()) { + storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, getSlotKind(), value)); + } else if (!getSlotKind().isPrimitive()) { storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, Kind.Object, value)); - } else if (getSlotKind() == Kind.Byte) { - storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, Kind.Byte, value)); } else { storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, Kind.Long, value)); } diff -r 51dcddfa25a6 -r 6f58979d0755 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/VerifyFrameDoesNotEscapePhase.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/VerifyFrameDoesNotEscapePhase.java Mon Aug 26 18:25:40 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/VerifyFrameDoesNotEscapePhase.java Tue Aug 27 09:34:55 2013 +0200 @@ -37,9 +37,8 @@ @Override protected void run(StructuredGraph graph) { - NewFrameNode frame = graph.getNodes(NewFrameNode.class).first(); - if (frame != null) { - for (MethodCallTargetNode callTarget : frame.usages().filter(MethodCallTargetNode.class)) { + for (NewFrameNode virtualFrame : graph.getNodes(NewFrameNode.class)) { + for (MethodCallTargetNode callTarget : virtualFrame.usages().filter(MethodCallTargetNode.class)) { if (callTarget.invoke() != null) { String properties = callTarget.getDebugProperties().toString(); String arguments = callTarget.arguments().toString(); @@ -47,6 +46,12 @@ throw GraphUtil.approxSourceException(callTarget, exception); } } + for (FrameAccessNode frameAccess : virtualFrame.usages().filter(FrameAccessNode.class)) { + if (!frameAccess.isConstantFrameSlot()) { + Throwable exception = new VerificationError("Frame slot must be compile-time constant in virtual frame access at: %s frameSlot=%s", frameAccess, frameAccess.getSlot()); + throw GraphUtil.approxSourceException(frameAccess, exception); + } + } } } } diff -r 51dcddfa25a6 -r 6f58979d0755 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/FrameWithoutBoxingSubstitutions.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/FrameWithoutBoxingSubstitutions.java Mon Aug 26 18:25:40 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/FrameWithoutBoxingSubstitutions.java Tue Aug 27 09:34:55 2013 +0200 @@ -36,7 +36,7 @@ private static final ResolvedJavaField LOCALS_FIELD; private static final ResolvedJavaField PRIMITIVELOCALS_FIELD; - private static final ResolvedJavaField TAGS_FIELD; + public static final ResolvedJavaField TAGS_FIELD; static { try { diff -r 51dcddfa25a6 -r 6f58979d0755 mx/commands.py --- a/mx/commands.py Mon Aug 26 18:25:40 2013 +0200 +++ b/mx/commands.py Tue Aug 27 09:34:55 2013 +0200 @@ -680,7 +680,7 @@ if cwd is None: cwd = _vm_cwd - elif _vm_cwd != cwd: + elif _vm_cwd is not None and _vm_cwd != cwd: mx.abort("conflicting working directories: do not set --vmcwd for this command") build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' diff -r 51dcddfa25a6 -r 6f58979d0755 src/cpu/x86/vm/frame_x86.cpp --- a/src/cpu/x86/vm/frame_x86.cpp Mon Aug 26 18:25:40 2013 +0200 +++ b/src/cpu/x86/vm/frame_x86.cpp Tue Aug 27 09:34:55 2013 +0200 @@ -461,11 +461,11 @@ // This is the sp before any possible extension (adapter/locals). intptr_t* unextended_sp = interpreter_frame_sender_sp(); -#ifdef COMPILER2 +#if defined(COMPILER2) || defined(GRAAL) if (map->update_map()) { update_map_with_saved_link(map, (intptr_t**) addr_at(link_offset)); } -#endif // COMPILER2 +#endif // COMPILER2 || GRAAL return frame(sender_sp, unextended_sp, link(), sender_pc()); } diff -r 51dcddfa25a6 -r 6f58979d0755 src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp --- a/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp Mon Aug 26 18:25:40 2013 +0200 +++ b/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp Tue Aug 27 09:34:55 2013 +0200 @@ -66,7 +66,7 @@ frame ret_frame(ret_sp, ret_fp, addr.pc()); if (!ret_frame.safe_for_sender(jt)) { -#ifdef COMPILER2 +#if defined(COMPILER2) || defined(GRAAL) // C2 uses ebp as a general register see if NULL fp helps frame ret_frame2(ret_sp, NULL, addr.pc()); if (!ret_frame2.safe_for_sender(jt)) { @@ -77,7 +77,7 @@ #else // nothing else to try if the frame isn't good return false; -#endif /* COMPILER2 */ +#endif /* COMPILER2 || GRAAL*/ } *fr_addr = ret_frame; return true; diff -r 51dcddfa25a6 -r 6f58979d0755 src/os_cpu/linux_x86/vm/thread_linux_x86.cpp --- a/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Mon Aug 26 18:25:40 2013 +0200 +++ b/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Tue Aug 27 09:34:55 2013 +0200 @@ -67,7 +67,7 @@ frame ret_frame(ret_sp, ret_fp, addr.pc()); if (!ret_frame.safe_for_sender(jt)) { -#ifdef COMPILER2 +#if defined(COMPILER2) || defined(GRAAL) // C2 uses ebp as a general register see if NULL fp helps frame ret_frame2(ret_sp, NULL, addr.pc()); if (!ret_frame2.safe_for_sender(jt)) { @@ -78,7 +78,7 @@ #else // nothing else to try if the frame isn't good return false; -#endif /* COMPILER2 */ +#endif /* COMPILER2 || GRAAL */ } *fr_addr = ret_frame; return true; diff -r 51dcddfa25a6 -r 6f58979d0755 src/os_cpu/windows_x86/vm/thread_windows_x86.cpp --- a/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Mon Aug 26 18:25:40 2013 +0200 +++ b/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Tue Aug 27 09:34:55 2013 +0200 @@ -74,7 +74,7 @@ frame ret_frame(ret_sp, ret_fp, addr.pc()); if (!ret_frame.safe_for_sender(jt)) { -#ifdef COMPILER2 +#if defined(COMPILER2) || defined(GRAAL) // C2 uses ebp as a general register see if NULL fp helps frame ret_frame2(ret_sp, NULL, addr.pc()); if (!ret_frame2.safe_for_sender(jt)) { @@ -85,7 +85,7 @@ #else // nothing else to try if the frame isn't good return false; -#endif /* COMPILER2 */ +#endif /* COMPILER2 || GRAAL */ } *fr_addr = ret_frame; return true;