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: e6a1e3af4101
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ede37ea17bf2
Choose a head ref
  • 4 commits
  • 5 files changed
  • 1 contributor

Commits on Jan 5, 2018

  1. Copy the full SHA
    68c66a8 View commit details
  2. Align naming.

    headius committed Jan 5, 2018
    Copy the full SHA
    2e6bbb6 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e29f1a3 View commit details
  4. Clean up imports.

    headius committed Jan 5, 2018
    Copy the full SHA
    ede37ea View commit details
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/ir/Compiler.java
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@
import org.jruby.ir.targets.JVMVisitorMethodContext;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.Block;
import org.jruby.runtime.DynamicScope;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/IRScriptBody.java
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ public DynamicScope getToplevelScope() {
return toplevelScope;
}

public void setTopLevelBindingScope(DynamicScope tlbScope) {
public void setTopLevelScope(DynamicScope tlbScope) {
this.toplevelScope = tlbScope;
}

2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/IRTranslator.java
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public R execute(Ruby runtime, ParseResult result, S specificObject) {
// FIXME: In terms of writing and reading we should emit enough to rebuild IC + minimal IRScope state
InterpreterContext ic = IRBuilder.buildRoot(runtime.getIRManager(), (RootNode) result);
scope = (IRScriptBody) ic.getScope();
scope.setTopLevelBindingScope(((RootNode) result).getScope());
scope.setTopLevelScope(((RootNode) result).getScope());

if (RubyInstanceConfig.IR_WRITING) {
try {
31 changes: 25 additions & 6 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -1692,12 +1692,31 @@ public void PushBlockFrameInstr(PushBlockFrameInstr instr) {

@Override
public void PushMethodBindingInstr(PushMethodBindingInstr pushbindinginstr) {
jvmMethod().loadContext();
jvmMethod().loadStaticScope();
jvmAdapter().invokestatic(p(DynamicScope.class), "newDynamicScope", sig(DynamicScope.class, StaticScope.class));
jvmAdapter().dup();
jvmStoreLocal(DYNAMIC_SCOPE);
jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void pushScope(org.jruby.runtime.DynamicScope)"));
IRScope scope = jvm.methodData().scope;
if (scope.isScriptScope() &&
scope.getTopLevelScope() != null) {
// script scope, so we don't push a new scope; instead we push the top-level scope it provides
jvmMethod().loadContext();

jvmMethod().loadStaticScope();
jvmAdapter().invokevirtual(p(StaticScope.class), "getScope", sig(IRScope.class));
jvmAdapter().invokevirtual(p(IRScope.class), "getTopLevelScope", sig(DynamicScope.class));

jvmAdapter().dup();
jvmStoreLocal(DYNAMIC_SCOPE);

jvmAdapter().dup_x1();
jvmAdapter().invokevirtual(p(DynamicScope.class), "growIfNeeded", sig(void.class));

jvmAdapter().invokevirtual(p(ThreadContext.class), "preScopedBody", sig(void.class, DynamicScope.class));
} else {
jvmMethod().loadContext();
jvmMethod().loadStaticScope();
jvmAdapter().invokestatic(p(DynamicScope.class), "newDynamicScope", sig(DynamicScope.class, StaticScope.class));
jvmAdapter().dup();
jvmStoreLocal(DYNAMIC_SCOPE);
jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void pushScope(org.jruby.runtime.DynamicScope)"));
}
}

@Override
1 change: 1 addition & 0 deletions test/mri/excludes/TestRipper/ParserEvents.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude :test_block_variables, "RLIMITing causes crash without JVM heap tweaking"