Skip to content

Commit

Permalink
Fix moved field reference and clean up imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Sep 28, 2016
1 parent f261580 commit 60241ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
9 changes: 5 additions & 4 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jruby.runtime.*;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.callsite.RefinedCachingCallSite;
import org.jruby.runtime.scope.DynamicScopeGenerator;
import org.jruby.util.ByteList;
import org.jruby.util.ClassDefiningClassLoader;
import org.jruby.util.JavaNameMangler;
Expand Down Expand Up @@ -440,8 +441,8 @@ private void genSetValue(LocalVariable localvariable) {

if (depth == 0) {

if (location < DynamicScope.SPECIALIZED_SETS.size()) {
jvmAdapter().invokevirtual(baseName, DynamicScope.SPECIALIZED_SETS.get(location), sig(IRubyObject.class));
if (location < DynamicScopeGenerator.SPECIALIZED_SETS.size()) {
jvmAdapter().invokevirtual(baseName, DynamicScopeGenerator.SPECIALIZED_SETS.get(location), sig(IRubyObject.class));
} else {
jvmAdapter().pushInt(location);
jvmAdapter().invokevirtual(baseName, "setValueDepthZeroVoid", sig(void.class, IRubyObject.class, int.class));
Expand Down Expand Up @@ -2330,8 +2331,8 @@ public void LocalVariable(LocalVariable localvariable) {
int location = localvariable.getLocation();
OUTER: switch (depth) {
case 0:
if (location < DynamicScope.SPECIALIZED_GETS.size()) {
m.adapter.invokevirtual(p(DynamicScope.class), DynamicScope.SPECIALIZED_GETS.get(location), sig(IRubyObject.class));
if (location < DynamicScopeGenerator.SPECIALIZED_GETS.size()) {
m.adapter.invokevirtual(p(DynamicScope.class), DynamicScopeGenerator.SPECIALIZED_GETS.get(location), sig(IRubyObject.class));
} else {
m.adapter.pushInt(location);
m.adapter.invokevirtual(p(DynamicScope.class), "getValueDepthZero", sig(IRubyObject.class, int.class));
Expand Down
19 changes: 0 additions & 19 deletions core/src/main/java/org/jruby/runtime/DynamicScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,10 @@

package org.jruby.runtime;

import me.qmx.jitescript.CodeBlock;
import me.qmx.jitescript.JDKVersion;
import me.qmx.jitescript.JiteClass;
import me.qmx.jitescript.internal.org.objectweb.asm.Label;
import me.qmx.jitescript.internal.org.objectweb.asm.tree.LabelNode;
import org.jruby.EvalType;
import org.jruby.Ruby;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.builtin.IRubyObject;

import static org.jruby.util.CodegenUtils.*;

import org.jruby.runtime.scope.ManyVarsDynamicScope;
import org.jruby.util.OneShotClassLoader;
import org.jruby.util.collections.NonBlockingHashMapLong;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public abstract class DynamicScope implements Cloneable {
// Static scoping information for this scope
protected final StaticScope staticScope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.jruby.Ruby;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.DynamicScope;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.ClassDefiningClassLoader;
import org.jruby.util.OneShotClassLoader;
Expand Down
9 changes: 5 additions & 4 deletions core/src/test/java/org/jruby/runtime/TestDynamicScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import junit.framework.TestCase;
import org.jruby.RubyBasicObject;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.scope.DynamicScopeGenerator;
import org.junit.Assert;
import org.junit.Test;

Expand All @@ -12,7 +13,7 @@ public class TestDynamicScope extends TestCase {
@Test
public void testScopeGeneration() throws Throwable {
for (int i = 0; i < 100; i++) {
DynamicScope scope = (DynamicScope) DynamicScope.generate(i).invoke(null, null);
DynamicScope scope = (DynamicScope) DynamicScopeGenerator.generate(i).invoke(null, null);

for (int j = 0; j < 100; j++) {
try {
Expand All @@ -39,16 +40,16 @@ public void testScopeGeneration() throws Throwable {
} catch (Throwable t) {
if (j < i) throw t;
}
if (j < DynamicScope.SPECIALIZED_SETS.size()) {
if (j < DynamicScopeGenerator.SPECIALIZED_SETS.size()) {
try {
String set = DynamicScope.SPECIALIZED_SETS.get(j);
String set = DynamicScopeGenerator.SPECIALIZED_SETS.get(j);
scope.getClass().getMethod(set, IRubyObject.class).invoke(scope, RubyBasicObject.UNDEF);
if (j >= i) Assert.fail("expected scope of size " + i + " to raise for " + set);
} catch (Throwable t) {
if (j < i) throw t;
}
try {
String get = DynamicScope.SPECIALIZED_GETS.get(j);
String get = DynamicScopeGenerator.SPECIALIZED_GETS.get(j);
Assert.assertEquals(RubyBasicObject.UNDEF, scope.getClass().getMethod(get).invoke(scope));
if (j >= i) Assert.fail("expected scope of size " + i + " to raise for " + get);
} catch (Throwable t) {
Expand Down

0 comments on commit 60241ad

Please sign in to comment.