OpenJDK / graal / graal-jvmci-8
changeset 8280:2ddf84436009
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 14 Mar 2013 13:13:59 +0100 |
parents | cc83fc474fd5 0269ef50021f |
children | 8fde1be81b2d 89006c76f737 |
files | |
diffstat | 16 files changed, 68 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/GRAAL_AUTHORS Thu Mar 14 13:13:27 2013 +0100 +++ b/GRAAL_AUTHORS Thu Mar 14 13:13:59 2013 +0100 @@ -1,9 +1,12 @@ Gilles Duboscq (gdub) Peter Hofer +Christian Haeubl (chaeubl) +Christian Humer (chumer) +Roland Schatz +Doug Simon (dnsimon) +Lukas Stadler (lstadler) Alexander Stipsits Katrin Strassl -Christian Humer (chumer) Christian Wimmer (cwimmer) -Doug Simon (dnsimon) -Lukas Stadler (lstadler) +Andreas Woess (aw) Thomas Wuerthinger (thomaswue)
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Mar 14 13:13:59 2013 +0100 @@ -149,6 +149,10 @@ new PartialEscapeAnalysisPhase(runtime, assumptions, true).apply(graph); } + if (GraalOptions.OptConvertDeoptsToGuards) { + new ConvertDeoptimizeToGuardPhase().apply(graph); + } + new LockEliminationPhase().apply(graph); if (GraalOptions.OptLoopTransform) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_idea.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_idea.java Thu Mar 14 13:13:59 2013 +0100 @@ -372,7 +372,7 @@ /* * private int mul(int a, int b) throws ArithmeticException { long p; // Large enough to catch 16-bit multiply // - * without hitting sign bit. if (a != 0) { if(b != 0) { p = (long) a * b; b = (int) p & 0xFFFF; // Lower 16 bits. a + * without hitting sign bit. if (a != 0) { if (b != 0) { p = (long) a * b; b = (int) p & 0xFFFF; // Lower 16 bits. a * = (int) p >>> 16; // Upper 16 bits. * * return (b - a + (b < a ? 1 : 0) & 0xFFFF); } else return ((1 - a) & 0xFFFF); // If b = 0, then same as // 0x10001
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/CFGVerifier.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/CFGVerifier.java Thu Mar 14 13:13:59 2013 +0100 @@ -67,6 +67,7 @@ if (!(block.isLoopHeader() && block.getLoop() == loop)) { for (Block pred : block.getPredecessors()) { if (!loop.blocks.contains(pred)) { + assert false : "Loop " + loop + " does not contain " + pred; return false; } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Thu Mar 14 13:13:59 2013 +0100 @@ -80,7 +80,7 @@ @Override public boolean verify() { for (Node usage : usages()) { - assertTrue(usage instanceof IfNode || usage instanceof ConditionalNode, "unsupported usage: ", usage); + assertTrue(usage instanceof IfNode || usage instanceof ConditionalNode, "unsupported usage: %s", usage); } return super.verify(); }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Thu Mar 14 13:13:59 2013 +0100 @@ -28,7 +28,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; -import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.*; public class ConvertDeoptimizeToGuardPhase extends Phase { @@ -80,26 +79,23 @@ IfNode ifNode = (IfNode) deoptBegin.predecessor(); BeginNode otherBegin = ifNode.trueSuccessor(); LogicNode conditionNode = ifNode.condition(); - if (conditionNode instanceof InstanceOfNode) { + if (conditionNode instanceof InstanceOfNode || conditionNode instanceof InstanceOfDynamicNode) { // TODO The lowering currently does not support a FixedGuard as the usage of an // InstanceOfNode. Relax this restriction. return; } - boolean negated = false; + FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), deoptBegin == ifNode.trueSuccessor())); + FixedWithNextNode pred = (FixedWithNextNode) ifNode.predecessor(); if (deoptBegin == ifNode.trueSuccessor()) { - negated = true; - otherBegin = ifNode.falseSuccessor(); + graph.removeSplitPropagate(ifNode, ifNode.falseSuccessor()); + } else { + graph.removeSplitPropagate(ifNode, ifNode.trueSuccessor()); } - BeginNode ifBlockBegin = findBeginNode(ifNode); - Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s. IfBegin=%s", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin, - ifBlockBegin); - FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), negated)); - otherBegin.replaceAtUsages(ifBlockBegin); - FixedNode next = otherBegin.next(); - otherBegin.setNext(null); + Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s.", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin); + FixedNode next = pred.next(); + pred.setNext(guard); guard.setNext(next); - ifNode.replaceAtPredecessor(guard); - GraphUtil.killCFG(ifNode); + Debug.dump(graph, "After introducing fixed guard %s", guard); } } }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Thu Mar 14 13:13:59 2013 +0100 @@ -83,8 +83,8 @@ public ValueNode createGuard(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { if (GraalOptions.OptEliminateGuards) { for (Node usage : condition.usages()) { - if (!activeGuards.isNew(usage) && activeGuards.isMarked(usage)) { - return (ValueNode) usage; + if (!activeGuards.isNew(usage) && activeGuards.isMarked(usage) && ((GuardNode) usage).negated() == negated && ((GuardNode) usage).dependencies().contains(guardAnchor)) { + return (GuardNode) usage; } } }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Thu Mar 14 13:13:59 2013 +0100 @@ -185,6 +185,7 @@ public static boolean SupportJsrBytecodes = true; public static boolean OptAssumptions = true; + public static boolean OptConvertDeoptsToGuards = true; public static boolean OptReadElimination = true; public static boolean OptCanonicalizer = true; public static boolean OptScheduleOutOfLoops = true;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Thu Mar 14 13:13:59 2013 +0100 @@ -247,15 +247,17 @@ } else { comparison = new IntegerLessThanNode(a, b); } - ConditionalNode materialize = graph.unique(new ConditionalNode(graph.unique(comparison), ConstantNode.forInt(1, graph), ConstantNode.forInt(0, graph))); - ValueNode op; + ConstantNode trueValue = ConstantNode.forInt(1, graph); + ConstantNode falseValue = ConstantNode.forInt(0, graph); + if (condition.canonicalNegate()) { - op = (ValueNode) materialize.negate(); - } else { - op = materialize; + ConstantNode temp = trueValue; + trueValue = falseValue; + falseValue = temp; } - return op; + ConditionalNode materialize = graph.unique(new ConditionalNode(graph.unique(comparison), trueValue, falseValue)); + return materialize; } private static ValueNode readOp(StructuredGraph graph, ValueNode base, ValueNode offset, Invoke invoke, Kind readKind, Object locationIdentity) {
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java Thu Mar 14 13:13:27 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java Thu Mar 14 13:13:59 2013 +0100 @@ -38,7 +38,7 @@ * should be speculated on. When the speculation fails and the child node cannot return the * appropriate type of value, it can use an {@link UnexpectedResultException} to still pass the * result to the caller. In such a case, the caller must rewrite itself to a more general version in - * oder to avoid future failures of this kind. + * order to avoid future failures of this kind. * </p> */ public class ReturnTypeSpecializationTest {
--- a/make/windows/makefiles/projectcreator.make Thu Mar 14 13:13:27 2013 +0100 +++ b/make/windows/makefiles/projectcreator.make Thu Mar 14 13:13:59 2013 +0100 @@ -145,8 +145,10 @@ -ignorePath_TARGET c1_ ProjectCreatorIDEOptionsIgnoreGraal=\ - -ignorePath_TARGET graal - + -ignorePath_TARGET src/share/vm/graal \ + -ignorePath_TARGET graal/generated \ + -ignorePath_TARGET vm/graal + ProjectCreatorIDEOptionsIgnoreCompiler2=\ -ignorePath_TARGET compiler2 \ -ignorePath_TARGET tiered \ @@ -175,7 +177,6 @@ ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ -define_compiler1 COMPILER1 \ -ignorePath_compiler1 core \ - -ignorePath_compiler1 src/share/vm/graal \ $(ProjectCreatorIDEOptionsIgnoreGraal:TARGET=compiler1) \ $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1) @@ -185,7 +186,6 @@ ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ -define_graal GRAAL \ -ignorePath_graal core \ - -ignorePath_graal src/share/vm/c1 \ $(ProjectCreatorIDEOptionsIgnoreCompiler1:TARGET=graal) \ $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=graal) @@ -195,8 +195,9 @@ #NOTE! This list must be kept in sync with GENERATED_NAMES in adlc.make. ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ -define_compiler2 COMPILER2 \ + -define_compiler2 GRAAL \ -ignorePath_compiler2 core \ - -ignorePath_compiler2 src/share/vm/graal \ + -ignorePath_compiler2 graal/generated \ -additionalFile_compiler2 $(Platform_arch_model).ad \ -additionalFile_compiler2 ad_$(Platform_arch_model).cpp \ -additionalFile_compiler2 ad_$(Platform_arch_model).hpp \ @@ -209,7 +210,6 @@ -additionalFile_compiler2 ad_$(Platform_arch_model)_pipeline.cpp \ -additionalFile_compiler2 adGlobals_$(Platform_arch_model).hpp \ -additionalFile_compiler2 dfa_$(Platform_arch_model).cpp \ - $(ProjectCreatorIDEOptionsIgnoreGraal:TARGET=compiler2) \ $(ProjectCreatorIDEOptionsIgnoreCompiler1:TARGET=compiler2) # Add in the jvmti (JSR-163) options
--- a/mx/commands.py Thu Mar 14 13:13:27 2013 +0100 +++ b/mx/commands.py Thu Mar 14 13:13:59 2013 +0100 @@ -316,7 +316,7 @@ return join(jdk, 'jre', 'lib', _arch(), 'jvm.cfg') return join(_vmLibDirInJdk(jdk), 'jvm.cfg') -def _jdk(build='product', create=False): +def _jdk(build='product', vmToCheck=None, create=False): """ Get the JDK into which Graal is installed, creating it first if necessary. """ @@ -344,7 +344,6 @@ if not exists(jvmCfg): mx.abort(jvmCfg + ' does not exist') - lines = [] defaultVM = None with open(jvmCfg) as f: for line in f: @@ -353,17 +352,14 @@ assert len(parts) == 2, parts assert parts[1] == 'KNOWN', parts[1] defaultVM = parts[0][1:] - lines.append('-' + defaultVM + '0 KNOWN\n') - lines.append(line) assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg if mx.get_os() != 'windows': chmodRecursive(jdk, 0755) shutil.copytree(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), defaultVM + '0')) - with open(jvmCfg, 'w') as f: - for line in lines: - f.write(line) + with open(jvmCfg, 'w') as fp: + print >> fp, '-' + defaultVM + '0 KNOWN' # Install a copy of the disassembler library try: @@ -372,10 +368,21 @@ pass else: if not exists(jdk): - mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx build ' + build + '\'') + mx.abort('The ' + build + ' VM has not been created - run "mx build ' + build + '"') _installGraalJarInJdks(mx.distribution('GRAAL')) + if vmToCheck is not None: + jvmCfg = _vmCfgInJdk(jdk) + found = False + with open(jvmCfg) as f: + for line in f: + if line.strip() == '-' + vmToCheck + ' KNOWN': + found = True + break + if not found: + mx.abort('The ' + build + ' ' + vmToCheck + ' VM has not been created - run "mx --vm ' + vmToCheck + ' build ' + build + '"') + return jdk def _installGraalJarInJdks(graalDist): @@ -588,23 +595,18 @@ mx.abort(jvmCfg + ' does not exist') prefix = '-' + vm - vmKnown = prefix + ' KNOWN\n' - lines = [] + vmKnown = prefix + ' KNOWN' with open(jvmCfg) as f: for line in f: - if vmKnown in line: + if vmKnown == line.strip(): found = True break - if not line.startswith(prefix): - lines.append(line) if not found: mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg) - lines.append(vmKnown) if mx.get_os() != 'windows': os.chmod(jvmCfg, 0755) - with open(jvmCfg, 'w') as f: - for line in lines: - f.write(line) + with open(jvmCfg, 'a') as f: + print >> f, vmKnown if exists(timestampFile): os.utime(timestampFile, None) @@ -626,7 +628,7 @@ vm = _vm build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' - jdk = _jdk(build) + jdk = _jdk(build, vmToCheck=vm) mx.expand_project_in_args(args) if _make_eclipse_launch: mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Mar 14 13:13:27 2013 +0100 +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Mar 14 13:13:59 2013 +0100 @@ -2058,7 +2058,7 @@ } // !defined(COMPILER2) is because of stupid core builds -#if !defined(_LP64) || defined(COMPILER1) || !defined(COMPILER2) +#if !defined(_LP64) || defined(COMPILER1) || !defined(COMPILER2) || defined(GRAAL) void MacroAssembler::empty_FPU_stack() { if (VM_Version::supports_mmx()) { emms();
--- a/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java Thu Mar 14 13:13:27 2013 +0100 +++ b/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java Thu Mar 14 13:13:59 2013 +0100 @@ -50,7 +50,8 @@ if (addFile.equals(fileName)) { // supress any ignore // TODO - may need some adjustments - if (file.toAbsolutePath().toString().contains(cfg.get("Flavour"))) { + String relativePath = startDir.toUri().relativize(file.toUri()).getPath(); + if (relativePath.contains(cfg.get("Flavour"))) { currentFileAttr.removeFromIgnored(cfg); } }
--- a/src/share/vm/code/nmethod.cpp Thu Mar 14 13:13:27 2013 +0100 +++ b/src/share/vm/code/nmethod.cpp Thu Mar 14 13:13:59 2013 +0100 @@ -1923,7 +1923,7 @@ } #ifdef GRAAL - if(_graal_installed_code != NULL) { + if (_graal_installed_code != NULL) { f->do_oop((oop*) &_graal_installed_code); } if (_triggered_deoptimizations != NULL) {
--- a/src/share/vm/graal/graalCompilerToVM.cpp Thu Mar 14 13:13:27 2013 +0100 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Thu Mar 14 13:13:59 2013 +0100 @@ -85,7 +85,7 @@ memcpy(reconstituted_code, (jbyte *) method->code_base(), code_size); } BytecodeStream s(method); - while(!s.is_last_bytecode()) { + while (!s.is_last_bytecode()) { s.next(); Bytecodes::Code opcode = s.raw_code(); if (!Bytecodes::is_java_code(opcode)) { @@ -962,7 +962,7 @@ // XXX: Attention: it seEms that the line number table of a method just contains lines that are important, means that // empty lines are left out or lines that can't have a breakpoint on it; eg int a; or try { Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); - if(!method->has_linenumber_table()) { + if (!method->has_linenumber_table()) { return NULL; } u2 num_entries = 0; @@ -991,7 +991,7 @@ ResourceMark rm; Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); - if(!method->has_localvariable_table()) { + if (!method->has_localvariable_table()) { return NULL; } int localvariable_table_length = method->localvariable_table_length();