# HG changeset patch # User Michael Van De Vanter # Date 1389919436 28800 # Node ID 434b86962d0d5a1d52f7709892ac43d51ae2dfb6 # Parent 91eebfc42e9f19891303d48d3ad90f63c687bd3a# Parent d2976008ce631154918becdeda6ca54101f202c6 Merge with d2976008ce631154918becdeda6ca54101f202c6 diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Jan 16 16:43:56 2014 -0800 @@ -519,12 +519,7 @@ @Override public void compileMethod(long metaspaceMethod, final int entryBCI, final boolean blocking) { - HotSpotVMConfig config = runtime().getConfig(); - final long metaspaceConstMethod = unsafe.getAddress(metaspaceMethod + config.methodConstMethodOffset); - final long metaspaceConstantPool = unsafe.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset); - final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + config.constantPoolHolderOffset); - final HotSpotResolvedObjectType holder = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromMetaspaceKlass(metaspaceKlass); - final HotSpotResolvedJavaMethod method = holder.createMethod(metaspaceMethod); + final HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethod.fromMetaspace(metaspaceMethod); // We have to use a privileged action here because compilations are enqueued from user code // which very likely contains unprivileged frames. AccessController.doPrivileged(new PrivilegedAction() { diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java Thu Jan 16 16:43:56 2014 -0800 @@ -705,6 +705,9 @@ } private static GuardingNode createNullCheck(ValueNode object, FixedNode before, LoweringTool tool) { + if (ObjectStamp.isObjectNonNull(object)) { + return null; + } return tool.createGuard(before, before.graph().unique(new IsNullNode(object)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true); } diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AbstractMethodHandleNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AbstractMethodHandleNode.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AbstractMethodHandleNode.java Thu Jan 16 16:43:56 2014 -0800 @@ -176,9 +176,9 @@ // Create a method from the vmtarget pointer Class c = (Class) clazz.asObject(); HotSpotResolvedObjectType holderClass = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromClass(c); - HotSpotResolvedJavaMethod targetMethod = holderClass.createMethod(vmtarget.asLong()); + HotSpotResolvedJavaMethod targetMethod = HotSpotResolvedJavaMethod.fromMetaspace(vmtarget.asLong()); - // In lamda forms we erase signature types to avoid resolving issues + // In lambda forms we erase signature types to avoid resolving issues // involving class loaders. When we optimize a method handle invoke // to a direct call we must cast the receiver and arguments to its // actual types. diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/KernelNodes.java --- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/KernelNodes.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/KernelNodes.java Thu Jan 16 16:43:56 2014 -0800 @@ -629,13 +629,6 @@ @Specialization(order = 3) public Object raise(VirtualFrame frame, RubyClass exceptionClass, RubyString message) { - final RubyContext context = getContext(); - - if (context.getConfiguration().getPrintRubyExceptions()) { - context.implementationMessage("Ruby raise: %s", message); - new Exception().printStackTrace(); - } - final RubyBasicObject exception = exceptionClass.newInstance(); initialize.dispatch(frame, exception, null, message); throw new RaiseException(exception); diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/literal/HashLiteralNode.java --- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/literal/HashLiteralNode.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/literal/HashLiteralNode.java Thu Jan 16 16:43:56 2014 -0800 @@ -41,4 +41,9 @@ return hash; } + @Override + public Object isDefined(VirtualFrame frame) { + return getContext().makeString("expression"); + } + } diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/CatchNextNode.java --- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/CatchNextNode.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/CatchNextNode.java Thu Jan 16 16:43:56 2014 -0800 @@ -39,4 +39,5 @@ return e.getResult(); } } + } diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/MethodDefinitionNode.java --- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/MethodDefinitionNode.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/MethodDefinitionNode.java Thu Jan 16 16:43:56 2014 -0800 @@ -91,4 +91,8 @@ return name; } + public CallTarget getCallTarget() { + return callTarget; + } + } diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyContext.java --- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyContext.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyContext.java Thu Jan 16 16:43:56 2014 -0800 @@ -169,10 +169,6 @@ } public Object execute(RubyContext context, Source source, RubyParser.ParserContext parserContext, Object self, MaterializedFrame parentFrame) { - if (configuration.getPrintExecutedFiles()) { - implementationMessage("executing: %s", source.getName()); - } - try { final RubyParserResult parseResult = parser.parse(context, source, parserContext, parentFrame); final RubyArguments arguments = new RubyArguments(parentFrame, self, null); diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/Configuration.java --- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/Configuration.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/Configuration.java Thu Jan 16 16:43:56 2014 -0800 @@ -32,11 +32,8 @@ private final boolean fullObjectSpace; private final boolean printParseTree; - private final boolean printExecutedFiles; - private final boolean printSpiltInstanceVariables; private final boolean printUninitializedCalls; private final boolean printJavaExceptions; - private final boolean printRubyExceptions; private final PrintStream standardOut; private final InputReader inputReader; @@ -58,11 +55,8 @@ fullObjectSpace = builder.getFullObjectSpace(); printParseTree = builder.getPrintParseTree(); - printExecutedFiles = builder.getPrintExecutedFiles(); - printSpiltInstanceVariables = builder.getPrintSpiltInstanceVariables(); printUninitializedCalls = builder.getPrintUninitializedCalls(); printJavaExceptions = builder.getPrintJavaExceptions(); - printRubyExceptions = builder.getPrintRubyExceptions(); standardOut = builder.getStandardOut(); inputReader = builder.getInputReader(); @@ -108,14 +102,6 @@ return printParseTree; } - public boolean getPrintExecutedFiles() { - return printExecutedFiles; - } - - public boolean getPrintSpiltInstanceVariables() { - return printSpiltInstanceVariables; - } - public boolean getPrintUninitializedCalls() { return printUninitializedCalls; } @@ -124,10 +110,6 @@ return printJavaExceptions; } - public boolean getPrintRubyExceptions() { - return printRubyExceptions; - } - public PrintStream getStandardOut() { return standardOut; } diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java --- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java Thu Jan 16 16:43:56 2014 -0800 @@ -37,11 +37,8 @@ private boolean fullObjectSpace = false; private boolean printParseTree = false; - private boolean printExecutedFiles = false; - private boolean printSpiltInstanceVariables = false; private boolean printUninitializedCalls = false; private boolean printJavaExceptions = false; - private boolean printRubyExceptions = false; private PrintStream standardOut = System.out; @@ -77,11 +74,8 @@ fullObjectSpace = configuration.getFullObjectSpace(); printParseTree = configuration.getPrintParseTree(); - printExecutedFiles = configuration.getPrintExecutedFiles(); - printSpiltInstanceVariables = configuration.getPrintSpiltInstanceVariables(); printUninitializedCalls = configuration.getPrintUninitializedCalls(); printJavaExceptions = configuration.getPrintJavaExceptions(); - printRubyExceptions = configuration.getPrintRubyExceptions(); standardOut = configuration.getStandardOut(); } @@ -169,22 +163,6 @@ this.printParseTree = printParseTree; } - public boolean getPrintExecutedFiles() { - return printExecutedFiles; - } - - public void setPrintExecutedFiles(boolean printExecutedFiles) { - this.printExecutedFiles = printExecutedFiles; - } - - public boolean getPrintSpiltInstanceVariables() { - return printSpiltInstanceVariables; - } - - public void setPrintSpiltInstanceVariables(boolean printSpiltInstanceVariables) { - this.printSpiltInstanceVariables = printSpiltInstanceVariables; - } - public boolean getPrintUninitializedCalls() { return printUninitializedCalls; } @@ -201,14 +179,6 @@ this.printJavaExceptions = printJavaExceptions; } - public boolean getPrintRubyExceptions() { - return printRubyExceptions; - } - - public void setPrintRubyExceptions(boolean printRubyExceptions) { - this.printRubyExceptions = printRubyExceptions; - } - public PrintStream getStandardOut() { return standardOut; } diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/core/RubyClass.java --- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/core/RubyClass.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/core/RubyClass.java Thu Jan 16 16:43:56 2014 -0800 @@ -114,7 +114,7 @@ include(superclass); - objectLayoutForInstances = new ObjectLayout(getName(), getContext(), superclass.objectLayoutForInstances); + objectLayoutForInstances = new ObjectLayout(getName(), superclass.objectLayoutForInstances); } public RubyBasicObject newInstance() { @@ -157,7 +157,7 @@ } private void renewObjectLayoutForInstances() { - objectLayoutForInstances = objectLayoutForInstances.renew(getContext(), superclass.objectLayoutForInstances); + objectLayoutForInstances = objectLayoutForInstances.renew(superclass.objectLayoutForInstances); for (RubyClass subClass : subClasses) { subClass.renewObjectLayoutForInstances(); diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/objects/ObjectLayout.java --- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/objects/ObjectLayout.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/objects/ObjectLayout.java Thu Jan 16 16:43:56 2014 -0800 @@ -17,7 +17,6 @@ import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.api.nodes.NodeUtil.*; -import com.oracle.truffle.ruby.runtime.*; /** * Maps names of instance variables to storage locations, which are either the offset of a primitive @@ -49,11 +48,11 @@ objectStorageLocationsUsed = 0; } - public ObjectLayout(String originHint, RubyContext context, ObjectLayout parent) { - this(originHint, context, parent, new HashMap()); + public ObjectLayout(String originHint, ObjectLayout parent) { + this(originHint, parent, new HashMap()); } - public ObjectLayout(String originHint, RubyContext context, ObjectLayout parent, Map storageTypes) { + public ObjectLayout(String originHint, ObjectLayout parent, Map storageTypes) { this.originHint = originHint; this.parent = parent; @@ -105,10 +104,6 @@ storageLocations.put(entry.getKey(), newStorageLocation); primitiveStorageLocationIndex += primitivesNeeded; } else { - if (canStoreInPrimitive && context.getConfiguration().getPrintSpiltInstanceVariables()) { - context.implementationMessage("instance variable %s of type %s spilt due to lack of space", name, type.getName()); - } - final ObjectStorageLocation newStorageLocation = new ObjectStorageLocation(this, objectStorageLocationIndex); storageLocations.put(entry.getKey(), newStorageLocation); objectStorageLocationIndex++; @@ -125,25 +120,25 @@ * comes from the same Ruby class as it did, but it's a new layout because layouts are * immutable, so modifications to the superclass yields a new layout. */ - public ObjectLayout renew(RubyContext context, ObjectLayout newParent) { - return new ObjectLayout(originHint + ".renewed", context, newParent, getStorageTypes()); + public ObjectLayout renew(ObjectLayout newParent) { + return new ObjectLayout(originHint + ".renewed", newParent, getStorageTypes()); } /** * Create a new version of this layout but with a new variable. */ - public ObjectLayout withNewVariable(RubyContext context, String name, Class type) { + public ObjectLayout withNewVariable(String name, Class type) { final Map storageTypes = getStorageTypes(); storageTypes.put(name, type); - return new ObjectLayout(originHint + ".withnew", context, parent, storageTypes); + return new ObjectLayout(originHint + ".withnew", parent, storageTypes); } /** * Create a new version of this layout but with an existing variable generalized to support any * type. */ - public ObjectLayout withGeneralisedVariable(RubyContext context, String name) { - return withNewVariable(context, name, Object.class); + public ObjectLayout withGeneralisedVariable(String name) { + return withNewVariable(name, Object.class); } /** diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/objects/RubyBasicObject.java --- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/objects/RubyBasicObject.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/objects/RubyBasicObject.java Thu Jan 16 16:43:56 2014 -0800 @@ -124,7 +124,7 @@ * the layout of this object. */ - rubyClass.setObjectLayoutForInstances(rubyClass.getObjectLayoutForInstances().withNewVariable(rubyClass.getContext(), name, value.getClass())); + rubyClass.setObjectLayoutForInstances(rubyClass.getObjectLayoutForInstances().withNewVariable(name, value.getClass())); updateLayout(); storageLocation = objectLayout.findStorageLocation(name); @@ -140,7 +140,7 @@ * layout and update the layout of this object. */ - rubyClass.setObjectLayoutForInstances(rubyClass.getObjectLayoutForInstances().withGeneralisedVariable(rubyClass.getContext(), name)); + rubyClass.setObjectLayoutForInstances(rubyClass.getObjectLayoutForInstances().withGeneralisedVariable(name)); updateLayout(); storageLocation = objectLayout.findStorageLocation(name); @@ -315,15 +315,13 @@ } public void switchToPrivateLayout() { - final RubyContext context = getRubyClass().getContext(); - final Map instanceVariables = getInstanceVariables(); hasPrivateLayout = true; objectLayout = ObjectLayout.EMPTY; for (Entry entry : instanceVariables.entrySet()) { - objectLayout = objectLayout.withNewVariable(context, entry.getKey(), entry.getValue().getClass()); + objectLayout = objectLayout.withNewVariable(entry.getKey(), entry.getValue().getClass()); } setInstanceVariables(instanceVariables); diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/subsystems/FeatureManager.java --- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/subsystems/FeatureManager.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/subsystems/FeatureManager.java Thu Jan 16 16:43:56 2014 -0800 @@ -35,11 +35,6 @@ public boolean require(String feature) throws IOException { // Some features are handled specially - if (feature.equals("continuation")) { - // We always load continuations - return true; - } - if (feature.equals("stringio")) { context.implementationMessage("stringio not yet implemented"); return true; diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.shell/src/com/oracle/truffle/ruby/shell/CommandLineParser.java --- a/graal/com.oracle.truffle.ruby.shell/src/com/oracle/truffle/ruby/shell/CommandLineParser.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.shell/src/com/oracle/truffle/ruby/shell/CommandLineParser.java Thu Jan 16 16:43:56 2014 -0800 @@ -217,21 +217,12 @@ case "--print-parse-tree": configurationBuilder.setPrintParseTree(true); break; - case "--print-executed-files": - configurationBuilder.setPrintExecutedFiles(true); - break; - case "--print-spilt-instance-variables": - configurationBuilder.setPrintSpiltInstanceVariables(true); - break; case "--print-uninitialized-calls": configurationBuilder.setPrintUninitializedCalls(true); break; case "--print-java-exceptions": configurationBuilder.setPrintJavaExceptions(true); break; - case "--print-ruby-exceptions": - configurationBuilder.setPrintRubyExceptions(true); - break; default: throw new IllegalArgumentException("unknown flag " + arg); } @@ -337,12 +328,8 @@ out.println(" --no-intrinsic-method-calls don't turn method calls into intrinsic nodes"); out.println(" --no-jline don't use JLine"); out.println(" --print-parse-tree print the result of parsing"); - out.println(" --print-executed-files print the name of files as they are executed"); - out.println(" --print-missing-intrinsics print method calls that don't have intrinsic nodes"); - out.println(" --print-spilt-instance-variables print each time a native-typed instance variable is spilt to the boxed array"); out.println(" --print-uninitialized-calls print each time a method call is uninitialized"); out.println(" --print-java-exceptions print Java exception back traces at the point of translating them to Ruby exceptions"); - out.println(" --print-ruby-exceptions print the Java exception back traces at the point of raising Ruby exceptions"); out.println("Relevant environment variables:"); out.println(" RUBYHOME location of the Ruby Truffle installation"); out.println(" RUBYOPT extra command line arguments"); diff -r 91eebfc42e9f -r 434b86962d0d graal/com.oracle.truffle.ruby.test/src/com/oracle/truffle/ruby/test/core/ContinuationTests.java --- a/graal/com.oracle.truffle.ruby.test/src/com/oracle/truffle/ruby/test/core/ContinuationTests.java Thu Jan 16 16:40:37 2014 -0800 +++ b/graal/com.oracle.truffle.ruby.test/src/com/oracle/truffle/ruby/test/core/ContinuationTests.java Thu Jan 16 16:43:56 2014 -0800 @@ -20,23 +20,23 @@ @Test public void testRequired() { - assertPrints("", "require \"continuation\"; callcc { |c| c.call }"); + assertPrints("", "callcc { |c| c.call }"); } @Test public void testOneShotGoingUpCallstack() { - assertPrints("1\n3\n", "require \"continuation\"; callcc { |c| puts 1; c.call; puts 2 }; puts 3"); + assertPrints("1\n3\n", "callcc { |c| puts 1; c.call; puts 2 }; puts 3"); } @Test public void testOneShotGoingUpCallstackReturnValue() { - assertPrints("14\n", "require \"continuation\"; puts callcc { |c| c.call 14 }"); + assertPrints("14\n", "puts callcc { |c| c.call 14 }"); } @Test public void testNestedOneShotGoingUpCallstack() { - assertPrints("1\n2\n4\n5\n", "require \"continuation\"; callcc { |c1| puts 1; callcc { |c2| puts 2; c2.call; puts 3 }; puts 4 }; puts 5"); - assertPrints("1\n2\n5\n", "require \"continuation\"; callcc { |c1| puts 1; callcc { |c2| puts 2; c1.call; puts 3 }; puts 4 }; puts 5"); + assertPrints("1\n2\n4\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c2.call; puts 3 }; puts 4 }; puts 5"); + assertPrints("1\n2\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c1.call; puts 3 }; puts 4 }; puts 5"); } } diff -r 91eebfc42e9f -r 434b86962d0d src/gpu/ptx/vm/gpu_ptx.cpp --- a/src/gpu/ptx/vm/gpu_ptx.cpp Thu Jan 16 16:40:37 2014 -0800 +++ b/src/gpu/ptx/vm/gpu_ptx.cpp Thu Jan 16 16:43:56 2014 -0800 @@ -417,7 +417,6 @@ } thread->set_vm_result(return_val); } else if (returnTypeSize > 0) { - jlong result; status = gpu::Ptx::_cuda_cu_memcpy_dtoh(&primitiveReturnValue, device_return_value, T_LONG_BYTE_SIZE); if (status != GRAAL_CUDA_SUCCESS) { tty->print_cr("[CUDA] *** Error (%d) Failed to copy value from device argument", status);