Skip to content

Commit

Permalink
Merge branch 'master' into ruby-2.3
Browse files Browse the repository at this point in the history
* master: (29 commits)
  [travis-ci] revert jdk 9 testing from 2fa04aa
  Eliminate Block.Type arg in BlockBody yield/call signatures
  Pass Block instead of Binding in BlockBody.yield/call
  Minor: fix typo in name of runtime helper instr method name
  Update to jnr-unixsocket 0.10.
  Improve CamelCase package splitting. Fixes #3493.
  Update to jnr-unixsocket 0.10-SNAPSHOT for forFD.
  [Truffle] j+tr: support for passing any extra ruby options
  each_object(cls.singleton_class) should not walk special classes.
  This test has been moved to RubySpec.
  [Truffle] Typo.
  [Truffle] Tag failing regex specs.
  [Truffle] Tag failing Time.at spec.
  The bin200 distribution has grown in size.
  [Truffle] Fixed two typos of the same word on the same line of code.
  [Truffle] Simplified the fix in 5446cc2.
  [Truffle] Fixed an NPE when a SharedMethodInfo has a null argumentsDescriptors.
  [Truffle] Fixed the interpreter_path when the root JRuby distribution directory is not named "jruby."
  Fixes #3483. define_method with empty body throws RuntimeError in interpreter
  Test main on Java 9
  ...
kares committed Nov 25, 2015
2 parents 23f4d15 + a915eeb commit f7f0818
Showing 33 changed files with 280 additions and 225 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -76,6 +76,12 @@ matrix:
jdk: oraclejdk8
- env: COMMAND=test/truffle/integration-tests.sh
jdk: oraclejdk8
# NOTE: build seems to never start (waited for any to finish for more than a day) - probably a travis-ci bug
#- env: PHASE='-Pmain'
# sudo: required
# dist: trusty
# group: edge
# jdk: oraclejdk9

branches:
only:
3 changes: 2 additions & 1 deletion bin/jruby+truffle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
#!/usr/bin/env bash
"exec" "`dirname $BASH_SOURCE[0]`/jruby" "$0" "$@"

require File.join(JRuby.runtime.instance_config.jruby_home, 'lib/ruby/truffle/jruby+truffle/runner')

2 changes: 1 addition & 1 deletion core/pom.rb
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@
jar 'com.github.jnr:jnr-netdb:1.1.5', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-enxio:0.10', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-x86asm:1.0.2', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-unixsocket:0.9', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-unixsocket:0.10', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-posix:3.0.23', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-constants:0.9.0', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-ffi:2.0.7'
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
<version>0.9</version>
<version>0.10</version>
<exclusions>
<exclusion>
<artifactId>jnr-ffi</artifactId>
14 changes: 14 additions & 0 deletions core/src/main/java/org/jruby/RubyObjectSpace.java
Original file line number Diff line number Diff line change
@@ -151,6 +151,20 @@ public Object apply(IRubyObject arg1) {
for (IRubyObject arg : modules) {
block.yield(context, arg);
}
} else if (args[0].getClass() == MetaClass.class) {
// each_object(Cls.singleton_class) is basically a walk of Cls and all descendants of Cls.
// In other words, this is walking all instances of Cls's singleton class and its subclasses.
IRubyObject attached = ((MetaClass)args[0]).getAttached();
block.yield(context, attached);
if (attached instanceof RubyClass) {
for (RubyClass child : ((RubyClass)attached).subclasses(true)) {
if (child instanceof IncludedModule || child.isSingleton()) {
// do nothing for included wrappers or singleton classes
} else {
block.yield(context, child);
}
}
}
} else {
if (!runtime.isObjectSpaceEnabled()) {
throw runtime.newRuntimeError("ObjectSpace is disabled; each_object will only work with Class, pass -X+O to enable");
17 changes: 8 additions & 9 deletions core/src/main/java/org/jruby/RubySymbol.java
Original file line number Diff line number Diff line change
@@ -480,40 +480,39 @@ private IRubyObject yieldInner(ThreadContext context, RubyArray array, Block blo
}

@Override
public IRubyObject yield(ThreadContext context, IRubyObject[] args, IRubyObject self,
Binding binding, Type type, Block block) {
RubyProc.prepareArgs(context, type, block.getBody(), args);
public IRubyObject yield(ThreadContext context, IRubyObject[] args, IRubyObject self, Block b, Block block) {
RubyProc.prepareArgs(context, b.type, block.getBody(), args);
return yieldInner(context, context.runtime.newArrayNoCopyLight(args), block);
}

@Override
public IRubyObject yield(ThreadContext context, IRubyObject value,
Binding binding, Block.Type type, Block block) {
Block b, Block block) {
return yieldInner(context, ArgsUtil.convertToRubyArray(context.runtime, value, false), block);
}

@Override
protected IRubyObject doYield(ThreadContext context, IRubyObject value, Binding binding, Type type) {
protected IRubyObject doYield(ThreadContext context, IRubyObject value, Block b) {
return yieldInner(context, ArgsUtil.convertToRubyArray(context.runtime, value, false), Block.NULL_BLOCK);
}

@Override
protected IRubyObject doYield(ThreadContext context, IRubyObject[] args, IRubyObject self, Binding binding, Type type) {
protected IRubyObject doYield(ThreadContext context, IRubyObject[] args, IRubyObject self, Block b) {
return yieldInner(context, context.runtime.newArrayNoCopyLight(args), Block.NULL_BLOCK);
}

@Override
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, Binding binding, Block.Type type) {
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, Block b) {
return site.call(context, arg0, arg0);
}

@Override
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Binding binding, Block.Type type) {
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block b) {
return site.call(context, arg0, arg0, arg1);
}

@Override
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Binding binding, Block.Type type) {
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block b) {
return site.call(context, arg0, arg0, arg1, arg2);
}

2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ast/IterNode.java
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ public IterNode(ISourcePosition position, ArgsNode args, Node body, StaticScope
super(position, args != null && args.containsVariableAssignment || body != null && body.containsVariableAssignment);

this.varNode = args;
this.bodyNode = body;
this.bodyNode = body == null ? NilImplicitNode.NIL : body;
this.scope = scope;
}

2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -974,7 +974,7 @@ private Operand receiveBreakException(Operand block, CodeBlock codeBlock) {

// Handle break using runtime helper
// --> IRRuntimeHelpers.handlePropagatedBreak(context, scope, bj, blockType)
addInstr(new RuntimeHelperCall(callResult, HANDLE_PROPAGATE_BREAK, new Operand[]{exc} ));
addInstr(new RuntimeHelperCall(callResult, HANDLE_PROPAGATED_BREAK, new Operand[]{exc} ));

// End
addInstr(new LabelInstr(rEndLabel));
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@

public class RuntimeHelperCall extends NOperandResultBaseInstr {
public enum Methods {
HANDLE_PROPAGATE_BREAK, HANDLE_NONLOCAL_RETURN, HANDLE_BREAK_AND_RETURNS_IN_LAMBDA,
HANDLE_PROPAGATED_BREAK, HANDLE_NONLOCAL_RETURN, HANDLE_BREAK_AND_RETURNS_IN_LAMBDA,
IS_DEFINED_BACKREF, IS_DEFINED_NTH_REF, IS_DEFINED_GLOBAL, IS_DEFINED_INSTANCE_VAR,
IS_DEFINED_CLASS_VAR, IS_DEFINED_SUPER, IS_DEFINED_METHOD, IS_DEFINED_CALL,
IS_DEFINED_CONSTANT_OR_METHOD, MERGE_KWARGS, RESTORE_EXCEPTION_VAR;
@@ -104,7 +104,7 @@ public IRubyObject callHelper(ThreadContext context, StaticScope currScope, Dyna
Object arg1 = operands[0].retrieve(context, self, currScope, currDynScope, temp);

switch (helperMethod) {
case HANDLE_PROPAGATE_BREAK:
case HANDLE_PROPAGATED_BREAK:
return IRRuntimeHelpers.handlePropagatedBreak(context, currDynScope, arg1, blockType);
case HANDLE_NONLOCAL_RETURN:
return IRRuntimeHelpers.handleNonlocalReturn(scope, currDynScope, arg1, blockType);
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -1623,7 +1623,7 @@ public void RestArgMultipleAsgnInstr(RestArgMultipleAsgnInstr restargmultipleasg
@Override
public void RuntimeHelperCall(RuntimeHelperCall runtimehelpercall) {
switch (runtimehelpercall.getHelperMethod()) {
case HANDLE_PROPAGATE_BREAK:
case HANDLE_PROPAGATED_BREAK:
jvmMethod().loadContext();
jvmLoadLocal(DYNAMIC_SCOPE);
visit(runtimehelpercall.getArgs()[0]);
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
@@ -766,7 +766,7 @@ private static RubyModule createPackageModule(final Ruby runtime,
return packageModule;
}

private static final Pattern CAMEL_CASE_PACKAGE_SPLITTER = Pattern.compile("([a-z][0-9]*)([A-Z])");
private static final Pattern CAMEL_CASE_PACKAGE_SPLITTER = Pattern.compile("([a-z0-9_]+)([A-Z])");

private static RubyModule getPackageModule(final Ruby runtime, final String name) {
final RubyModule javaModule = runtime.getJavaSupport().getJavaModule();
34 changes: 17 additions & 17 deletions core/src/main/java/org/jruby/runtime/Block.java
Original file line number Diff line number Diff line change
@@ -99,56 +99,56 @@ public void setEvalType(EvalType evalType) {
}

public IRubyObject call(ThreadContext context, IRubyObject[] args) {
return body.call(context, args, binding, type);
return body.call(context, args, this);
}

public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
return body.call(context, args, binding, type, block);
return body.call(context, args, this, block);
}

public IRubyObject call(ThreadContext context) {
return body.call(context, binding, type);
return body.call(context, this);
}
public IRubyObject call(ThreadContext context, Block block) {
return body.call(context, binding, type, block);
return body.call(context, this, block);
}
public IRubyObject yieldSpecific(ThreadContext context) {
return body.yieldSpecific(context, binding, type);
return body.yieldSpecific(context, this);
}
public IRubyObject call(ThreadContext context, IRubyObject arg0) {
return body.call(context, arg0, binding, type);
return body.call(context, arg0, this);
}
public IRubyObject call(ThreadContext context, IRubyObject arg0, Block block) {
return body.call(context, arg0, binding, type, block);
return body.call(context, arg0, this, block);
}
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0) {
return body.yieldSpecific(context, arg0, binding, type);
return body.yieldSpecific(context, arg0, this);
}
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
return body.call(context, arg0, arg1, binding, type);
return body.call(context, arg0, arg1, this);
}
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return body.call(context, arg0, arg1, binding, type, block);
return body.call(context, arg0, arg1, this, block);
}
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
return body.yieldSpecific(context, arg0, arg1, binding, type);
return body.yieldSpecific(context, arg0, arg1, this);
}
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) {
return body.call(context, arg0, arg1, arg2, binding, type);
return body.call(context, arg0, arg1, arg2, this);
}
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {
return body.call(context, arg0, arg1, arg2, binding, type, block);
return body.call(context, arg0, arg1, arg2, this, block);
}
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) {
return body.yieldSpecific(context, arg0, arg1, arg2, binding, type);
return body.yieldSpecific(context, arg0, arg1, arg2, this);
}

public IRubyObject yield(ThreadContext context, IRubyObject value) {
return body.yield(context, value, binding, type);
return body.yield(context, value, this);
}

public IRubyObject yieldNonArray(ThreadContext context, IRubyObject value, IRubyObject self) {
return body.yield(context, new IRubyObject[] { value }, self, binding, type);
return body.yield(context, new IRubyObject[] { value }, self, this);
}

public IRubyObject yieldArray(ThreadContext context, IRubyObject value, IRubyObject self) {
@@ -158,7 +158,7 @@ public IRubyObject yieldArray(ThreadContext context, IRubyObject value, IRubyObj
} else {
args = value.convertToArray().toJavaArray();
}
return body.yield(context, args, self, binding, type);
return body.yield(context, args, self, this);
}

public Block cloneBlock() {
Loading

0 comments on commit f7f0818

Please sign in to comment.