Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9a1388d57974
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b9b73dc0790a
Choose a head ref
  • 8 commits
  • 25 files changed
  • 1 contributor

Commits on Apr 28, 2016

  1. [Truffle] Give the Truffle:: modules their Java Truffle prefix back, …

    …as it was getting confusing.
    chrisseaton committed Apr 28, 2016
    Copy the full SHA
    9f1a0d3 View commit details
  2. [Truffle] Truffle::System

    chrisseaton committed Apr 28, 2016
    Copy the full SHA
    3573f41 View commit details
  3. [Truffle] Truffle::Kernel

    chrisseaton committed Apr 28, 2016
    Copy the full SHA
    770c373 View commit details
  4. Copy the full SHA
    002cd90 View commit details
  5. [Truffle] Truffle::Debug

    chrisseaton committed Apr 28, 2016
    Copy the full SHA
    b348f38 View commit details
  6. Copy the full SHA
    98652e9 View commit details
  7. Copy the full SHA
    e582dcb View commit details
  8. Copy the full SHA
    b9b73dc View commit details
Showing with 520 additions and 424 deletions.
  1. +1 −1 spec/truffle/specs/truffle/array/append_spec.rb
  2. +1 −2 spec/truffle/specs/truffle/array/element_set_spec.rb
  3. +4 −4 spec/truffle/specs/truffle/{binding_of_caller_spec.rb → binding/of_caller_spec.rb}
  4. +4 −4 spec/truffle/specs/truffle/{ → boot}/source_of_caller_spec.rb
  5. +9 −9 spec/truffle/specs/truffle/{ → debug}/java_class_of_spec.rb
  6. +2 −2 spec/truffle/specs/truffle/{ → debug}/simple_shell_spec.rb
  7. +7 −7 spec/truffle/specs/truffle/fixnum/and_spec.rb
  8. +3 −3 spec/truffle/specs/truffle/{ → system}/host_os_spec.rb
  9. +1 −0 spec/truffle/tags/core/struct/dup_tags.txt
  10. +17 −7 truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
  11. +1 −1 truffle/src/main/java/org/jruby/truffle/core/{GCNodes.java → TruffleGCNodes.java}
  12. +79 −0 truffle/src/main/java/org/jruby/truffle/core/TruffleProcessNodes.java
  13. +59 −0 truffle/src/main/java/org/jruby/truffle/core/TruffleSystemNodes.java
  14. +65 −0 truffle/src/main/java/org/jruby/truffle/core/binding/TruffleBindingNodes.java
  15. +75 −0 truffle/src/main/java/org/jruby/truffle/core/kernel/TruffleKernelNodes.java
  16. +143 −0 truffle/src/main/java/org/jruby/truffle/debug/TruffleDebugNodes.java
  17. +1 −1 truffle/src/main/java/org/jruby/truffle/extra/{GraalNodes.java → TruffleGraalNodes.java}
  18. +0 −370 truffle/src/main/java/org/jruby/truffle/extra/TruffleNodes.java
  19. +36 −1 truffle/src/main/java/org/jruby/truffle/language/{BootNodes.java → TruffleBootNodes.java}
  20. +1 −1 truffle/src/main/ruby/core/config.rb
  21. +1 −1 truffle/src/main/ruby/core/kernel.rb
  22. +1 −1 truffle/src/main/ruby/core/library.rb
  23. +4 −4 truffle/src/main/ruby/core/rubinius/api/shims/kernel.rb
  24. +1 −1 truffle/src/main/ruby/core/rubinius/primitives.rb
  25. +4 −4 truffle/src/main/ruby/core/shims.rb
2 changes: 1 addition & 1 deletion spec/truffle/specs/truffle/array/append_spec.rb
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

describe "Array#<<" do
def storage(ary)
Truffle.array_storage(ary)
Truffle::Debug.array_storage(ary)
end

before :each do
3 changes: 1 addition & 2 deletions spec/truffle/specs/truffle/array/element_set_spec.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

describe "Array#[]=" do
def storage(ary)
Truffle.array_storage(ary)
Truffle::Debug.array_storage(ary)
end

before :each do
@@ -111,4 +111,3 @@ def storage(ary)
storage(ary).should == "Object[]"
end
end

Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../ruby/spec_helper'
require_relative '../../../../ruby/spec_helper'

describe "Truffle.binding_of_caller" do
describe "Truffle::Binding.of_caller" do

def binding_of_caller
Truffle.binding_of_caller
Truffle::Binding.of_caller
end

#it "returns nil if there is no caller"
@@ -34,7 +34,7 @@ def binding_of_caller

it "works through #send" do
x = 14
Truffle.send(:binding_of_caller).local_variable_get(:x).should == 14
Truffle::Binding.send(:of_caller).local_variable_get(:x).should == 14
end

end
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../ruby/spec_helper'
require_relative '../../../../ruby/spec_helper'

describe "Truffle.source_of_caller" do
describe "Truffle::Boot.source_of_caller" do

def source_of_caller
Truffle.source_of_caller
Truffle::Boot.source_of_caller
end

#it "returns nil if there is no caller"
@@ -27,7 +27,7 @@ def source_of_caller

it "works through #send" do
x = 14
Truffle.send(:source_of_caller).should == __FILE__
Truffle::Boot.send(:source_of_caller).should == __FILE__
end

end
Original file line number Diff line number Diff line change
@@ -6,36 +6,36 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../ruby/spec_helper'
require_relative '../../../../ruby/spec_helper'

describe "Truffle.java_class_of" do
describe "Truffle::Debug.java_class_of" do

it "returns a String" do
Truffle.java_class_of(14).should be_kind_of(String)
Truffle::Debug.java_class_of(14).should be_kind_of(String)
end

it "returns 'Boolean' for true" do
Truffle.java_class_of(true).should == 'Boolean'
Truffle::Debug.java_class_of(true).should == 'Boolean'
end

it "returns 'Boolean' for false" do
Truffle.java_class_of(false).should == 'Boolean'
Truffle::Debug.java_class_of(false).should == 'Boolean'
end

it "returns 'Integer' for a small Fixnum" do
Truffle.java_class_of(14).should == 'Integer'
Truffle::Debug.java_class_of(14).should == 'Integer'
end

it "returns 'Long' for a large Fixnum" do
Truffle.java_class_of(0xffffffffffff).should == 'Long'
Truffle::Debug.java_class_of(0xffffffffffff).should == 'Long'
end

it "returns 'Double' for a Float" do
Truffle.java_class_of(3.14).should == 'Double'
Truffle::Debug.java_class_of(3.14).should == 'Double'
end

it "returns 'DynamicObject*' for a String" do
Truffle.java_class_of('test').start_with?('DynamicObject').should be_true
Truffle::Debug.java_class_of('test').start_with?('DynamicObject').should be_true
end

end
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../ruby/spec_helper'
require_relative '../../../../ruby/spec_helper'

describe "Truffle.simple_shell" do
describe "Truffle::Debug.simple_shell" do

it "needs to be reviewed for spec completeness"

14 changes: 7 additions & 7 deletions spec/truffle/specs/truffle/fixnum/and_spec.rb
Original file line number Diff line number Diff line change
@@ -17,24 +17,24 @@
it "returns an int for (int, int)" do
result = (1 & 3)
result.should == 1
Truffle.java_class_of(result).should == 'Integer'
Truffle::Debug.java_class_of(result).should == 'Integer'
end

it "returns an int for (long, int)" do
Truffle.java_class_of(@long).should == 'Long'
Truffle.java_class_of(@mask).should == 'Integer'
Truffle::Debug.java_class_of(@long).should == 'Long'
Truffle::Debug.java_class_of(@mask).should == 'Integer'

result = (@long & @mask)
result.should == 1
Truffle.java_class_of(result).should == 'Integer'
Truffle::Debug.java_class_of(result).should == 'Integer'
end

it "returns an int for (int, long)" do
Truffle.java_class_of(@long).should == 'Long'
Truffle.java_class_of(@mask).should == 'Integer'
Truffle::Debug.java_class_of(@long).should == 'Long'
Truffle::Debug.java_class_of(@mask).should == 'Integer'

result = (@mask & @long)
result.should == 1
Truffle.java_class_of(result).should == 'Integer'
Truffle::Debug.java_class_of(result).should == 'Integer'
end
end
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../ruby/spec_helper'
require_relative '../../../../ruby/spec_helper'

describe "Truffle.host_os" do
describe "Truffle::System.host_os" do

it "returns a String" do
Truffle.host_os.should be_kind_of(String)
Truffle::System.host_os.should be_kind_of(String)
end

end
1 change: 1 addition & 0 deletions spec/truffle/tags/core/struct/dup_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Struct-based class#dup retains an included module in the ancestor chain for the struct's singleton class
24 changes: 17 additions & 7 deletions truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@
import org.jruby.truffle.core.array.ArrayNodesFactory;
import org.jruby.truffle.core.basicobject.BasicObjectNodesFactory;
import org.jruby.truffle.core.binding.BindingNodesFactory;
import org.jruby.truffle.core.binding.TruffleBindingNodesFactory;
import org.jruby.truffle.core.bool.FalseClassNodesFactory;
import org.jruby.truffle.core.bool.TrueClassNodesFactory;
import org.jruby.truffle.core.encoding.EncodingConverterNodesFactory;
@@ -42,6 +43,7 @@
import org.jruby.truffle.core.fiber.FiberNodesFactory;
import org.jruby.truffle.core.hash.HashNodesFactory;
import org.jruby.truffle.core.kernel.KernelNodesFactory;
import org.jruby.truffle.core.kernel.TruffleKernelNodesFactory;
import org.jruby.truffle.core.klass.ClassNodes;
import org.jruby.truffle.core.klass.ClassNodesFactory;
import org.jruby.truffle.core.method.MethodNodesFactory;
@@ -74,9 +76,9 @@
import org.jruby.truffle.core.thread.ThreadNodesFactory;
import org.jruby.truffle.core.time.TimeNodesFactory;
import org.jruby.truffle.core.tracepoint.TracePointNodesFactory;
import org.jruby.truffle.extra.TruffleNodesFactory;
import org.jruby.truffle.debug.TruffleDebugNodesFactory;
import org.jruby.truffle.extra.AttachmentsNodesFactory;
import org.jruby.truffle.extra.GraalNodesFactory;
import org.jruby.truffle.extra.TruffleGraalNodesFactory;
import org.jruby.truffle.interop.CExtNodesFactory;
import org.jruby.truffle.interop.InteropNodesFactory;
import org.jruby.truffle.language.RubyGuards;
@@ -91,7 +93,7 @@
import org.jruby.truffle.language.methods.DeclarationContext;
import org.jruby.truffle.language.methods.InternalMethod;
import org.jruby.truffle.language.objects.FreezeNode;
import org.jruby.truffle.language.BootNodesFactory;
import org.jruby.truffle.language.TruffleBootNodesFactory;
import org.jruby.truffle.language.objects.FreezeNodeGen;
import org.jruby.truffle.language.objects.SingletonClassNode;
import org.jruby.truffle.language.objects.SingletonClassNodeGen;
@@ -579,6 +581,10 @@ public CoreLibrary(RubyContext context) {
defineModule(truffleModule, "Boot");
defineModule(truffleModule, "Fixnum");
defineModule(truffleModule, "Safe");
defineModule(truffleModule, "System");
defineModule(truffleModule, "Kernel");
defineModule(truffleModule, "Process");
defineModule(truffleModule, "Binding");
psychModule = defineModule("Psych");
psychParserClass = defineClass(psychModule, objectClass, "Parser");
final DynamicObject psychHandlerClass = defineClass(psychModule, objectClass, "Handler");
@@ -704,11 +710,10 @@ public void addCoreMethods() {
coreMethodNodeManager.addCoreMethodNodes(SymbolNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(ThreadNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TrueClassNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(GCNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(BootNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleGCNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleBootNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(AttachmentsNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(GraalNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleGraalNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(EncodingNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(EncodingConverterNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(InteropNodesFactory.getFactories());
@@ -732,6 +737,11 @@ public void addCoreMethods() {
coreMethodNodeManager.addCoreMethodNodes(TruffleRopesNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleFixnumNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleSafeNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleSystemNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleKernelNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleProcessNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleDebugNodesFactory.getFactories());
coreMethodNodeManager.addCoreMethodNodes(TruffleBindingNodesFactory.getFactories());

coreMethodNodeManager.allMethodInstalled();

Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@
import java.util.List;

@CoreClass(name = "Truffle::GC")
public abstract class GCNodes {
public abstract class TruffleGCNodes {

@CoreMethod(names = "count", onSingleton = true)
public abstract static class CountNode extends CoreMethodArrayArgumentsNode {
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.core;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.object.DynamicObject;
import jnr.posix.SpawnFileAction;
import org.jruby.truffle.core.array.ArrayOperations;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.control.RaiseException;
import org.jruby.truffle.platform.UnsafeGroup;

import java.util.Arrays;
import java.util.Collections;

@CoreClass(name = "Truffle::Process")
public abstract class TruffleProcessNodes {

@CoreMethod(names = "spawn", onSingleton = true, required = 3, unsafe = UnsafeGroup.PROCESSES)
public abstract static class SpawnNode extends CoreMethodArrayArgumentsNode {

@Specialization(guards = {
"isRubyString(command)",
"isRubyArray(arguments)",
"isRubyArray(environmentVariables)" })
public int spawn(DynamicObject command,
DynamicObject arguments,
DynamicObject environmentVariables) {

final long longPid = call(
StringOperations.getString(getContext(), command),
toStringArray(arguments),
toStringArray(environmentVariables));
assert longPid <= Integer.MAX_VALUE;
// VMWaitPidPrimitiveNode accepts only int
final int pid = (int) longPid;

if (pid == -1) {
// TODO (pitr 07-Sep-2015): needs compatibility improvements
throw new RaiseException(coreExceptions().errnoError(getContext().getNativePlatform().getPosix().errno(), this));
}

return pid;
}

private String[] toStringArray(DynamicObject rubyStrings) {
final int size = Layouts.ARRAY.getSize(rubyStrings);
final Object[] unconvertedStrings = ArrayOperations.toObjectArray(rubyStrings);
final String[] strings = new String[size];

for (int i = 0; i < size; i++) {
assert Layouts.STRING.isString(unconvertedStrings[i]);
strings[i] = StringOperations.getString(getContext(), (DynamicObject) unconvertedStrings[i]);
}

return strings;
}

@TruffleBoundary
private long call(String command, String[] arguments, String[] environmentVariables) {
// TODO (pitr 04-Sep-2015): only simple implementation, does not support file actions or other options
return getContext().getNativePlatform().getPosix().posix_spawnp(
command,
Collections.<SpawnFileAction>emptyList(),
Arrays.asList(arguments),
Arrays.asList(environmentVariables));

}
}

}
Loading