IRBytecodeAdapter m = jvm.method();
jvmLoadLocal(DYNAMIC_SCOPE);
int depth = storelocalvarinstr.getLocalVar().getScopeDepth();
// TODO should not have to subtract 1
int location = storelocalvarinstr.getLocalVar().getLocation() - 1;
Operand storeValue = storelocalvarinstr.getValue();
switch (depth) {
case 0:
switch (location) {
case 0:
storeValue.visit(this);
m.adapter.invokevirtual(p(DynamicScope.class), "setValueZeroDepthZero", sig(IRubyObject.class, IRubyObject.class));
m.adapter.pop();
return;
case 1:
storeValue.visit(this);
m.adapter.invokevirtual(p(DynamicScope.class), "setValueOneDepthZero", sig(IRubyObject.class, IRubyObject.class));
m.adapter.pop();
return;
case 2:
storeValue.visit(this);
m.adapter.invokevirtual(p(DynamicScope.class), "setValueTwoDepthZero", sig(IRubyObject.class, IRubyObject.class));
m.adapter.pop();
return;
case 3:
storeValue.visit(this);
m.adapter.invokevirtual(p(DynamicScope.class), "setValueThreeDepthZero", sig(IRubyObject.class, IRubyObject.class));
m.adapter.pop();
return;
default:
storeValue.visit(this);
m.adapter.pushInt(location);
m.adapter.invokevirtual(p(DynamicScope.class), "setValueDepthZero", sig(IRubyObject.class, IRubyObject.class, int.class));
m.adapter.pop();
return;
}
default:
m.adapter.pushInt(depth);
storeValue.visit(this);
m.adapter.pushInt(location);
m.adapter.invokevirtual(p(DynamicScope.class), "setValue", sig(IRubyObject.class, int.class, IRubyObject.class, int.class));
m.adapter.pop();
}
}