Skip to content

Commit

Permalink
Showing 191 changed files with 1,862 additions and 995 deletions.
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>
6 changes: 5 additions & 1 deletion core/src/main/java/org/jruby/RubyObjectSpace.java
Original file line number Diff line number Diff line change
@@ -158,7 +158,11 @@ public Object apply(IRubyObject arg1) {
block.yield(context, attached);
if (attached instanceof RubyClass) {
for (RubyClass child : ((RubyClass)attached).subclasses(true)) {
block.yield(context, child);
if (child instanceof IncludedModule || child.isSingleton()) {
// do nothing for included wrappers or singleton classes
} else {
block.yield(context, child);
}
}
}
} else {
31 changes: 12 additions & 19 deletions core/src/main/java/org/jruby/RubySymbol.java
Original file line number Diff line number Diff line change
@@ -42,12 +42,8 @@
import org.jruby.anno.JRubyMethod;
import org.jruby.ast.util.ArgsUtil;
import org.jruby.compiler.Constantizable;
import org.jruby.RubyEncoding;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.Arity;
import org.jruby.runtime.Binding;
import org.jruby.runtime.Block;
import org.jruby.runtime.Block.Type;
import org.jruby.runtime.BlockBody;
import org.jruby.runtime.CallSite;
import org.jruby.runtime.ClassIndex;
@@ -66,7 +62,6 @@

import java.lang.ref.WeakReference;
import java.util.concurrent.locks.ReentrantLock;
import java.util.Arrays;

import static org.jruby.util.StringSupport.codeLength;
import static org.jruby.util.StringSupport.codePoint;
@@ -469,51 +464,49 @@ public IRubyObject to_proc(ThreadContext context) {
StaticScope scope = context.runtime.getStaticScopeFactory().getDummyScope();
final CallSite site = new FunctionalCachingCallSite(symbol);
BlockBody body = new ContextAwareBlockBody(scope, Signature.OPTIONAL) {
private IRubyObject yieldInner(ThreadContext context, RubyArray array, Block block) {
private IRubyObject yieldInner(ThreadContext context, RubyArray array, Block blockArg) {
if (array.isEmpty()) {
throw context.runtime.newArgumentError("no receiver given");
}

IRubyObject self = array.shift(context);

return site.call(context, self, self, array.toJavaArray(), block);
return site.call(context, self, self, array.toJavaArray(), blockArg);
}

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

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

@Override
protected IRubyObject doYield(ThreadContext context, IRubyObject value, Binding binding, Type type) {
protected IRubyObject doYield(ThreadContext context, Block block, IRubyObject value) {
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, Block block, IRubyObject[] args, IRubyObject self) {
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, Block block, IRubyObject arg0) {
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, Block block, IRubyObject arg0, IRubyObject arg1) {
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, Block block, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) {
return site.call(context, arg0, arg0, arg1, arg2);
}

Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ private IRubyObject INTERPRET_CLASS(InterpreterContext ic, ThreadContext context
private IRubyObject interpretWithBacktrace(InterpreterContext ic, ThreadContext context, IRubyObject self, String name, Block block) {
try {
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());
return ic.engine.interpret(context, self, ic, getImplementationClass().getMethodLocation(), name, block, null);
return ic.engine.interpret(context, null, self, ic, getImplementationClass().getMethodLocation(), name, block);
} finally {
ThreadContext.popBacktrace(context);
}
Original file line number Diff line number Diff line change
@@ -115,11 +115,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, args, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, args, block);
} else {
try {
pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, args, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, args, block);
} finally {
post(ic, context);
}
@@ -144,11 +144,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, block);
} else {
try {
pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, block);
} finally {
post(ic, context);
}
@@ -172,11 +172,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, arg1, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, block);
} else {
try {
pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, arg1, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, block);
} finally {
post(ic, context);
}
@@ -200,11 +200,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, block);
} else {
try {
pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, block);
} finally {
post(ic, context);
}
@@ -228,11 +228,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, arg3, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, arg3, block);
} else {
try {
pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, arg3, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, arg3, block);
} finally {
post(ic, context);
}
Original file line number Diff line number Diff line change
@@ -120,11 +120,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, args, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, args, block);
} else {
try {
this.pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, args, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, args, block);
} finally {
this.post(ic, context);
}
@@ -155,11 +155,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, block);
} else {
try {
this.pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, block);
} finally {
this.post(ic, context);
}
@@ -190,11 +190,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, arg1, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, block);
} else {
try {
this.pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, arg1, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, block);
} finally {
this.post(ic, context);
}
@@ -225,11 +225,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, block);
} else {
try {
this.pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, block);
} finally {
this.post(ic, context);
}
@@ -260,11 +260,11 @@ private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext i
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

if (ic.hasExplicitCallProtocol()) {
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, arg3, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, arg3, block);
} else {
try {
this.pre(ic, context, self, name, block, implClass);
return ic.engine.interpret(context, self, ic, implClass, name, arg1, arg2, arg3, block, null);
return ic.engine.interpret(context, null, self, ic, implClass, name, arg1, arg2, arg3, block);
} finally {
this.post(ic, context);
}
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));
11 changes: 8 additions & 3 deletions core/src/main/java/org/jruby/ir/IRVisitor.java
Original file line number Diff line number Diff line change
@@ -86,14 +86,17 @@ private void error(Object object) {
public void OneOperandArgNoBlockCallInstr(OneOperandArgNoBlockCallInstr oneOperandArgNoBlockCallInstr) { error(oneOperandArgNoBlockCallInstr); }
public void OptArgMultipleAsgnInstr(OptArgMultipleAsgnInstr optargmultipleasgninstr) { error(optargmultipleasgninstr); }
public void PopBindingInstr(PopBindingInstr popbindinginstr) { error(popbindinginstr); }
public void PopFrameInstr(PopFrameInstr popframeinstr) { error(popframeinstr); }
public void PopBlockFrameInstr(PopBlockFrameInstr instr) { error(instr); }
public void PopMethodFrameInstr(PopMethodFrameInstr instr) { error(instr); }
public void ProcessModuleBodyInstr(ProcessModuleBodyInstr processmodulebodyinstr) { error(processmodulebodyinstr); }
public void PutClassVariableInstr(PutClassVariableInstr putclassvariableinstr) { error(putclassvariableinstr); }
public void PutConstInstr(PutConstInstr putconstinstr) { error(putconstinstr); }
public void PutFieldInstr(PutFieldInstr putfieldinstr) { error(putfieldinstr); }
public void PutGlobalVarInstr(PutGlobalVarInstr putglobalvarinstr) { error(putglobalvarinstr); }
public void PushBindingInstr(PushBindingInstr pushbindinginstr) { error(pushbindinginstr); }
public void PushFrameInstr(PushFrameInstr pushframeinstr) { error(pushframeinstr); }
public void PushBlockBindingInstr(PushBlockBindingInstr instr) { error(instr); }
public void PushBlockFrameInstr(PushBlockFrameInstr instr) { error(instr); }
public void PushMethodBindingInstr(PushMethodBindingInstr instr) { error(instr); }
public void PushMethodFrameInstr(PushMethodFrameInstr instr) { error(instr); }
public void RaiseArgumentErrorInstr(RaiseArgumentErrorInstr raiseargumenterrorinstr) { error(raiseargumenterrorinstr); }
public void RaiseRequiredKeywordArgumentErrorInstr(RaiseRequiredKeywordArgumentError instr) { error(instr); }
public void ReifyClosureInstr(ReifyClosureInstr reifyclosureinstr) { error(reifyclosureinstr); }
@@ -109,8 +112,10 @@ private void error(Object object) {
public void ReqdArgMultipleAsgnInstr(ReqdArgMultipleAsgnInstr reqdargmultipleasgninstr) { error(reqdargmultipleasgninstr); }
public void RescueEQQInstr(RescueEQQInstr rescueeqqinstr) { error(rescueeqqinstr); }
public void RestArgMultipleAsgnInstr(RestArgMultipleAsgnInstr restargmultipleasgninstr) { error(restargmultipleasgninstr); }
public void RestoreBindingVisibilityInstr(RestoreBindingVisibilityInstr instr) { error(instr); }
public void ReturnInstr(ReturnInstr returninstr) { error(returninstr); }
public void RuntimeHelperCall(RuntimeHelperCall runtimehelpercall) { error(runtimehelpercall); }
public void SaveBindingVisibilityInstr(SaveBindingVisibilityInstr instr) { error(instr); }
public void SearchConstInstr(SearchConstInstr searchconstinstr) { error(searchconstinstr); }
public void SetCapturedVarInstr(SetCapturedVarInstr instr) { error(instr); }
public void StoreLocalVarInstr(StoreLocalVarInstr storelocalvarinstr) { error(storelocalvarinstr); }
Loading

0 comments on commit 5ced3df

Please sign in to comment.