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: bf4bacb6081b
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 56ca99e46e68
Choose a head ref
  • 16 commits
  • 30 files changed
  • 4 contributors

Commits on May 13, 2015

  1. Copy the full SHA
    bea748a View commit details
  2. Copy the full SHA
    80af1a2 View commit details
  3. Copy the full SHA
    ad3e354 View commit details
  4. Copy the full SHA
    5376cb4 View commit details
  5. Copy the full SHA
    8f62197 View commit details

Commits on May 14, 2015

  1. Copy the full SHA
    da24a36 View commit details
  2. 5
    Copy the full SHA
    a7cf015 View commit details
  3. Copy the full SHA
    5a87b02 View commit details
  4. Attempt towards fixing/simplifying block yield parm binding. Separate…

    … lambda/non-lambda doYield
    enebo committed May 14, 2015
    Copy the full SHA
    31cab2e View commit details
  5. Copy the full SHA
    49bf2c1 View commit details
  6. Tag out now passing tests and fix Method#original_name to return name…

    … as symbol instead of string
    enebo committed May 14, 2015
    Copy the full SHA
    0ca1046 View commit details
  7. Copy the full SHA
    6465d03 View commit details
  8. [build] fix problem with parent pom in ./maven

    [skip ci]
    mkristian committed May 14, 2015
    Copy the full SHA
    8091cfe View commit details
  9. Copy the full SHA
    b510646 View commit details
  10. Copy the full SHA
    c966b40 View commit details
  11. Copy the full SHA
    56ca99e View commit details
Showing with 364 additions and 260 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 core/src/main/java/org/jruby/RubyMethod.java
  3. +1 −5 core/src/main/java/org/jruby/RubyModule.java
  4. +6 −0 core/src/main/java/org/jruby/internal/runtime/methods/WrapperMethod.java
  5. +23 −11 core/src/main/java/org/jruby/runtime/IRBlockBody.java
  6. +4 −2 maven/pom.rb
  7. +0 −1 spec/tags/ruby/core/method/eql_tags.txt
  8. +0 −1 spec/tags/ruby/core/method/equal_value_tags.txt
  9. +0 −3 spec/truffle/tags/core/io/close_tags.txt
  10. +0 −1 spec/truffle/tags/core/io/closed_tags.txt
  11. +0 −2 spec/truffle/tags/core/io/dup_tags.txt
  12. +0 −19 spec/truffle/tags/core/io/reopen_tags.txt
  13. +0 −3 test/mri/excludes/TestMethod.rb
  14. +13 −20 test/mri/excludes_truffle/TestPack.rb
  15. +0 −1 test/mri/excludes_truffle/TestString.rb
  16. +1 −1 tool/jt.rb
  17. +5 −0 truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  18. +24 −0 truffle/src/main/java/org/jruby/truffle/nodes/objects/DefineOrGetClassNode.java
  19. +142 −4 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/IOPrimitiveNodes.java
  20. +76 −100 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PointerPrimitiveNodes.java
  21. +34 −20 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PosixNodes.java
  22. +2 −0 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/RubiniusPrimitiveNode.java
  23. +6 −3 truffle/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  24. +1 −4 truffle/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  25. +10 −5 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyClass.java
  26. +0 −10 truffle/src/main/java/org/jruby/truffle/runtime/object/RubyObjectType.java
  27. +6 −4 truffle/src/main/java/org/jruby/truffle/runtime/subsystems/RubiniusConfiguration.java
  28. +4 −3 truffle/src/main/ruby/core/library.rb
  29. +4 −33 truffle/src/main/ruby/core/truffle/cext/cext.rb
  30. +0 −3 truffle/src/main/ruby/core/truffle/cext/require.rb
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@ maven/jruby/src/it/osgi_*
maven/jruby/src/it/j2ee_wlp
maven/jruby-complete/src/it/osgi*
maven/jruby-complete/pom.xml
maven/pom.xml

# IntelliJ project files
.idea
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyMethod.java
Original file line number Diff line number Diff line change
@@ -308,7 +308,7 @@ public IRubyObject super_method(ThreadContext context) {
@JRubyMethod
public IRubyObject original_name(ThreadContext context) {
if (method instanceof AliasMethod) {
return context.runtime.newString(((AliasMethod)method).getOldName());
return context.runtime.newSymbol(((AliasMethod)method).getOldName());
}
return name(context);
}
6 changes: 1 addition & 5 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -1774,7 +1774,6 @@ public IRubyObject define_method(ThreadContext context, IRubyObject arg0, Block
@JRubyMethod(name = "define_method", visibility = PRIVATE, reads = VISIBILITY)
public IRubyObject define_method(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
Ruby runtime = context.runtime;
IRubyObject body;
String name = TypeConverter.convertToIdentifier(arg0);
DynamicMethod newMethod = null;
Visibility visibility = PUBLIC;
@@ -1788,17 +1787,14 @@ public IRubyObject define_method(ThreadContext context, IRubyObject arg0, IRubyO
if (runtime.getProc().isInstance(arg1)) {
// double-testing args.length here, but it avoids duplicating the proc-setup code in two places
RubyProc proc = (RubyProc)arg1;
body = proc;

newMethod = createProcMethod(name, visibility, proc);
} else if (arg1 instanceof AbstractRubyMethod) {
AbstractRubyMethod method = (AbstractRubyMethod)arg1;
body = method;

checkValidBindTargetFrom(context, (RubyModule)method.owner(context));

newMethod = method.getMethod().dup();
newMethod.setImplementationClass(this);
newMethod = new WrapperMethod(this, method.getMethod(), visibility);
} else {
throw runtime.newTypeError("wrong argument type " + arg1.getType().getName() + " (expected Proc/Method)");
}
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
package org.jruby.internal.runtime.methods;

import org.jruby.RubyModule;
import org.jruby.runtime.Arity;
import org.jruby.runtime.Block;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
@@ -101,4 +102,9 @@ public long getSerialNumber() {
public DynamicMethod getRealMethod() {
return method;
}

@Override
public Arity getArity() {
return method.getArity();
}
}
34 changes: 23 additions & 11 deletions core/src/main/java/org/jruby/runtime/IRBlockBody.java
Original file line number Diff line number Diff line change
@@ -102,26 +102,38 @@ public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyO
return yieldSpecificMultiArgsCommon(context, new IRubyObject[] { arg0, arg1, arg2 }, binding, type);
}

private IRubyObject[] toAry(ThreadContext context, IRubyObject value) {
IRubyObject val0 = Helpers.aryToAry(value);

if (!(val0 instanceof RubyArray)) {
throw context.runtime.newTypeError(value.getType().getName() + "#to_ary should return Array");
}

return ((RubyArray)val0).toJavaArray();
}

protected IRubyObject doYieldLambda(ThreadContext context, IRubyObject value, Binding binding, Type type) {
// Lambda does not splat arrays even if a rest arg is present when it wants a single parameter filled.
IRubyObject[] args = signature.required() == 1 ? new IRubyObject[] { value } : toAry(context, value);

signature.checkArity(context.runtime, args);

return commonYieldPath(context, args, null, binding, type, Block.NULL_BLOCK);
}

@Override
public IRubyObject doYield(ThreadContext context, IRubyObject value, Binding binding, Type type) {
IRubyObject[] args;
if (type == Type.LAMBDA) return doYieldLambda(context, value, binding, type);

int blockArity = getSignature().arityValue();

// For lambdas, independent of whether there is a REST arg or not, if # required args is 1,
// the value is passed through unmodified even when it is an array!
if ((type == Type.LAMBDA && signature.required() == 1) || (blockArity >= -1 && blockArity <= 1)) {
IRubyObject[] args;
if (blockArity >= -1 && blockArity <= 1) {
args = new IRubyObject[] { value };
} else {
IRubyObject val0 = Helpers.aryToAry(value);
if (!(val0 instanceof RubyArray)) {
throw context.runtime.newTypeError(value.getType().getName() + "#to_ary should return Array");
}
args = ((RubyArray)val0).toJavaArray();
args = toAry(context, value);
}

if (type == Type.LAMBDA) signature.checkArity(context.runtime, args);

return commonYieldPath(context, args, null, binding, type, Block.NULL_BLOCK);
}

6 changes: 4 additions & 2 deletions maven/pom.rb
Original file line number Diff line number Diff line change
@@ -7,8 +7,10 @@
inherit 'org.jruby:jruby-parent', version
packaging 'pom'

properties( 'tesla.dump.pom' => 'pom.xml',
'tesla.dump.readonly' => true )
# it looks like some people have problems with this artifact as parent
# TODO set the parent pom to pom.rb inside the children
properties( 'polyglot.dump.pom' => 'pom.xml',
'polyglot.dump.readonly' => true )

plugin_management do
plugin 'org.codehaus.mojo:build-helper-maven-plugin' do
1 change: 0 additions & 1 deletion spec/tags/ruby/core/method/eql_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/tags/ruby/core/method/equal_value_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/io/close_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
fails:IO#close closes the stream
fails:IO#close raises an IOError writing to a closed IO
fails:IO#close raises an IOError if closed
fails:IO#close on an IO.popen stream clears #pid
fails:IO#close on an IO.popen stream sets $?
fails:IO#close on an IO.popen stream waits for the child to exit
1 change: 0 additions & 1 deletion spec/truffle/tags/core/io/closed_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/io/dup_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fails:IO#dup returns a new IO instance
fails:IO#dup sets a new descriptor on the returned object
fails:IO#dup allows closing the new IO without affecting the original
fails:IO#dup allows closing the original IO without affecting the new one
fails:IO#dup raises IOError on closed stream
19 changes: 0 additions & 19 deletions spec/truffle/tags/core/io/reopen_tags.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
fails:IO#reopen calls #to_io to convert an object
fails:IO#reopen changes the class of the instance to the class of the object returned by #to_io
fails:IO#reopen raises an IOError if the object returned by #to_io is closed
fails:IO#reopen raises a TypeError if #to_io does not return an IO instance
fails:IO#reopen raises an IOError when called on a closed stream with an object
fails:IO#reopen raises an IOError if the IO argument is closed
fails:IO#reopen raises an IOError when called on a closed stream with an IO
fails:IO#reopen with a String does not raise an exception when called on a closed stream with a path
fails:IO#reopen with a String returns self
fails:IO#reopen with a String positions a newly created instance at the beginning of the new stream
fails:IO#reopen with a String positions an instance that has been read from at the beginning of the new stream
fails:IO#reopen with a String passes all mode flags through
fails:IO#reopen with a String effects exec/system/fork performed after it
fails:IO#reopen with a String calls #to_path on non-String arguments
fails:IO#reopen with a String opens a path after writing to the original file descriptor
fails:IO#reopen with a String creates the file if it doesn't exist if the IO is opened in write mode
fails:IO#reopen with a String raises an Errno::ENOENT if the file does not exist and the IO is not opened in write mode
fails:IO#reopen with an IO does not call #to_io
fails:IO#reopen with an IO does not change the object_id
fails:IO#reopen with an IO reads from the beginning if the other IO has not been read from
fails:IO#reopen with an IO reads from the current position of the other IO's stream
fails:IO#reopen with an IO associates the IO instance with the other IO's stream
fails:IO#reopen with an IO may change the class of the instance
fails:IO#reopen with an IO sets path equals to the other IO's path if other IO is File
3 changes: 0 additions & 3 deletions test/mri/excludes/TestMethod.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
exclude :test___dir__, "needs investigation"
exclude :test_alias_owner, "needs investigation"
exclude :test_arity, "needs investigation"
exclude :test_body, "needs investigation"
exclude :test_callee, "needs investigation"
exclude :test_clone, "needs investigation"
@@ -9,8 +8,6 @@
exclude :test_eq, "needs investigation"
exclude :test_hash, "needs investigation"
exclude :test_inspect, "needs investigation"
exclude :test_public_methods_with_extended, "needs investigation"
exclude :test_receiver_name_owner, "needs investigation"
exclude :test_singleton_method, "needs investigation"
exclude :test_super_in_proc_from_define_method, "needs investigation"
exclude :test_super_method_removed, "finds super method when super method has been undef (#2155)"
33 changes: 13 additions & 20 deletions test/mri/excludes_truffle/TestPack.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
exclude :test_format_string_modified, "needs investigation"
exclude :test_length_too_big, "needs investigation"
exclude :test_pack, "needs investigation"
exclude :test_pack_P, "needs investigation"
exclude :test_pack_U, "needs investigation"
exclude :test_pack_garbage, "needs investigation"
exclude :test_pack_p, "needs investigation"
exclude :test_pack_unpack_M, "needs investigation"
exclude :test_pack_unpack_P2, "needs investigation"
exclude :test_pack_unpack_Z, "needs investigation"
exclude :test_pack_unpack_aA, "needs investigation"
exclude :test_pack_unpack_atmark, "needs investigation"
exclude :test_pack_unpack_bB, "needs investigation"
exclude :test_pack_unpack_hH, "needs investigation"
exclude :test_pack_unpack_m, "needs investigation"
exclude :test_pack_unpack_m0, "needs investigation"
exclude :test_pack_unpack_qQ, "needs investigation"
exclude :test_pack_unpack_u, "needs investigation"
exclude :test_short_string, "needs investigation"
exclude :test_short_with_block, "needs investigation"
exclude :test_unpack_garbage, "needs investigation"
exclude :"test_format_string_modified", "needs investigation"
exclude :"test_length_too_big", "needs investigation"
exclude :"test_pack_P", "needs investigation"
exclude :"test_pack_garbage", "needs investigation"
exclude :"test_pack_p", "needs investigation"
exclude :"test_pack_unpack_M", "needs investigation"
exclude :"test_pack_unpack_P2", "needs investigation"
exclude :"test_pack_unpack_bB", "needs investigation"
exclude :"test_pack_unpack_hH", "needs investigation"
exclude :"test_pack_unpack_m", "needs investigation"
exclude :"test_pack_unpack_qQ", "needs investigation"
exclude :"test_pack_unpack_u", "needs investigation"
exclude :"test_short_with_block", "needs investigation"
1 change: 0 additions & 1 deletion test/mri/excludes_truffle/TestString.rb
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@
exclude :test_to_i, "needs investigation"
exclude :test_to_id, "needs investigation"
exclude :test_to_str, "needs investigation"
exclude :test_unpack, "needs investigation"
exclude :test_upto_nonalnum, "needs investigation"
exclude :test_upto_numeric, "needs investigation"
exclude :test_ASET, "needs investigation"
2 changes: 1 addition & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ def sh(*args)
end

def mvn(*args)
sh 'mvn', *args
sh './mvnw', *args
end

def mspec(command, *args)
5 changes: 5 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.source.SourceSection;
import jnr.ffi.provider.MemoryManager;
import jnr.posix.POSIX;
import org.jruby.truffle.nodes.instrument.RubyWrapperNode;
import org.jruby.truffle.runtime.RubyArguments;
@@ -269,6 +270,10 @@ public RubyContext getContext() {
return context;
}

public MemoryManager getMemoryManager() {
return jnr.ffi.Runtime.getSystemRuntime().getMemoryManager();
}

// ruby() helper

protected Object ruby(VirtualFrame frame, String expression, Object... arguments) {
Original file line number Diff line number Diff line change
@@ -11,14 +11,17 @@

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.core.KernelNodes;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.nodes.rubinius.PointerPrimitiveNodes;
import org.jruby.truffle.runtime.RubyConstant;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyClass;
import org.jruby.truffle.runtime.core.RubyModule;

@@ -70,6 +73,27 @@ public Object execute(VirtualFrame frame) {
}
}

/*
* We need to intercept Rubinius::FFI::Pointer so that it allocates the
* right DynamicObject. We can't do this after the core is loaded as
* it's too late by then.
*
* I don't pretend this is an ideal solution.
*/

if (name.equals("Pointer") && getEncapsulatingSourceSection().getSource().getPath().endsWith("core/rubinius/platform/pointer.rb")) {

definingClass.unsafeSetAllocator(new Allocator() {

@Override
public RubyBasicObject allocate(RubyContext context, RubyClass rubyClass, Node currentNode) {
return PointerPrimitiveNodes.createPointer(rubyClass, jnr.ffi.Runtime.getSystemRuntime().getMemoryManager().newOpaquePointer(0));
}


});
}

return definingClass;
}

Loading