Skip to content

Commit

Permalink
Showing 24 changed files with 165 additions and 474 deletions.
38 changes: 19 additions & 19 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -830,7 +830,7 @@ private Operand buildAttrAssign(final AttrAssignNode attrAssignNode, IRScope s)
List<Operand> args = new ArrayList<>();
Node argsNode = attrAssignNode.getArgsNode();
Operand lastArg = (argsNode == null) ? manager.getNil() : buildCallArgs(args, argsNode, s);
addInstr(s, new AttrAssignInstr(obj, new MethAddr(attrAssignNode.getName()), args.toArray(new Operand[args.size()])));
addInstr(s, new AttrAssignInstr(obj, attrAssignNode.getName(), args.toArray(new Operand[args.size()])));
return lastArg;
}

@@ -839,7 +839,7 @@ public Operand buildAttrAssignAssignment(Node node, IRScope s, Operand value) {
Operand obj = build(attrAssignNode.getReceiverNode(), s);
List<Operand> args = setupCallArgs(attrAssignNode.getArgsNode(), s);
args.add(value);
addInstr(s, new AttrAssignInstr(obj, new MethAddr(attrAssignNode.getName()), args.toArray(new Operand[args.size()])));
addInstr(s, new AttrAssignInstr(obj, attrAssignNode.getName(), args.toArray(new Operand[args.size()])));
return value;
}

@@ -987,7 +987,7 @@ public Operand buildCall(CallNode callNode, IRScope s) {
List<Operand> args = setupCallArgs(callArgsNode, s);
Operand block = setupCallClosure(callNode.getIterNode(), s);
Variable callResult = s.createTemporaryVariable();
CallInstr callInstr = CallInstr.create(callResult, new MethAddr(callNode.getName()), receiver, args.toArray(new Operand[args.size()]), block);
CallInstr callInstr = CallInstr.create(callResult, callNode.getName(), receiver, args.toArray(new Operand[args.size()]), block);

// This is to support the ugly Proc.new with no block, which must see caller's frame
if (
@@ -2204,7 +2204,7 @@ public Operand buildFCall(FCallNode fcallNode, IRScope s) {
List<Operand> args = setupCallArgs(callArgsNode, s);
Operand block = setupCallClosure(fcallNode.getIterNode(), s);
Variable callResult = s.createTemporaryVariable();
CallInstr callInstr = CallInstr.create(CallType.FUNCTIONAL, callResult, new MethAddr(fcallNode.getName()), s.getSelf(), args.toArray(new Operand[args.size()]), block);
CallInstr callInstr = CallInstr.create(CallType.FUNCTIONAL, callResult, fcallNode.getName(), s.getSelf(), args.toArray(new Operand[args.size()]), block);
receiveBreakException(s, block, callInstr);
return callResult;
}
@@ -2321,7 +2321,7 @@ public Operand buildFor(ForNode forNode, IRScope s) {
Variable result = s.createTemporaryVariable();
Operand receiver = build(forNode.getIterNode(), s);
Operand forBlock = buildForIter(forNode, s);
CallInstr callInstr = new CallInstr(CallType.NORMAL, result, new MethAddr("each"), receiver, NO_ARGS, forBlock);
CallInstr callInstr = new CallInstr(CallType.NORMAL, result, "each", receiver, NO_ARGS, forBlock);
receiveBreakException(s, forBlock, callInstr);

return result;
@@ -2711,7 +2711,7 @@ public Operand buildOpAsgn(OpAsgnNode opAsgnNode, IRScope s) {

// get attr
Operand v1 = build(opAsgnNode.getReceiverNode(), s);
addInstr(s, CallInstr.create(readerValue, new MethAddr(opAsgnNode.getVariableName()), v1, NO_ARGS, null));
addInstr(s, CallInstr.create(readerValue, opAsgnNode.getVariableName(), v1, NO_ARGS, null));

// Ex: e.val ||= n
// e.val &&= n
@@ -2722,7 +2722,7 @@ public Operand buildOpAsgn(OpAsgnNode opAsgnNode, IRScope s) {

// compute value and set it
Operand v2 = build(opAsgnNode.getValueNode(), s);
addInstr(s, CallInstr.create(writerValue, new MethAddr(opAsgnNode.getVariableNameAsgn()), v1, new Operand[] {v2}, null));
addInstr(s, CallInstr.create(writerValue, opAsgnNode.getVariableNameAsgn(), v1, new Operand[] {v2}, null));
// It is readerValue = v2.
// readerValue = writerValue is incorrect because the assignment method
// might return something else other than the value being set!
@@ -2736,10 +2736,10 @@ public Operand buildOpAsgn(OpAsgnNode opAsgnNode, IRScope s) {
// call operator
Operand v2 = build(opAsgnNode.getValueNode(), s);
Variable setValue = s.createTemporaryVariable();
addInstr(s, CallInstr.create(setValue, new MethAddr(opAsgnNode.getOperatorName()), readerValue, new Operand[]{v2}, null));
addInstr(s, CallInstr.create(setValue, opAsgnNode.getOperatorName(), readerValue, new Operand[]{v2}, null));

// set attr
addInstr(s, CallInstr.create(writerValue, new MethAddr(opAsgnNode.getVariableNameAsgn()), v1, new Operand[] {setValue}, null));
addInstr(s, CallInstr.create(writerValue, opAsgnNode.getVariableNameAsgn(), v1, new Operand[] {setValue}, null));
// Returning writerValue is incorrect becuase the assignment method
// might return something else other than the value being set!
return setValue;
@@ -2823,11 +2823,11 @@ public Operand buildOpElementAsgnWithOr(OpElementAsgnNode opElementAsgnNode, IRS
Label l = s.getNewLabel();
Variable elt = s.createTemporaryVariable();
List<Operand> argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
addInstr(s, CallInstr.create(elt, new MethAddr("[]"), array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, CallInstr.create(elt, "[]", array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, BEQInstr.create(elt, manager.getTrue(), l));
Operand value = build(opElementAsgnNode.getValueNode(), s);
argList.add(value);
addInstr(s, CallInstr.create(elt, new MethAddr("[]="), array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, CallInstr.create(elt, "[]=", array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, new CopyInstr(elt, value));
addInstr(s, new LabelInstr(l));
return elt;
@@ -2839,11 +2839,11 @@ public Operand buildOpElementAsgnWithAnd(OpElementAsgnNode opElementAsgnNode, IR
Label l = s.getNewLabel();
Variable elt = s.createTemporaryVariable();
List<Operand> argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
addInstr(s, CallInstr.create(elt, new MethAddr("[]"), array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, CallInstr.create(elt, "[]", array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, BEQInstr.create(elt, manager.getFalse(), l));
Operand value = build(opElementAsgnNode.getValueNode(), s);
argList.add(value);
addInstr(s, CallInstr.create(elt, new MethAddr("[]="), array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, CallInstr.create(elt, "[]=", array, argList.toArray(new Operand[argList.size()]), null));
addInstr(s, new CopyInstr(elt, value));
addInstr(s, new LabelInstr(l));
return elt;
@@ -2860,15 +2860,15 @@ public Operand buildOpElementAsgnWithMethod(OpElementAsgnNode opElementAsgnNode,
Operand array = build(opElementAsgnNode.getReceiverNode(), s);
List<Operand> argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
Variable elt = s.createTemporaryVariable();
addInstr(s, CallInstr.create(elt, new MethAddr("[]"), array, argList.toArray(new Operand[argList.size()]), null)); // elt = a[args]
addInstr(s, CallInstr.create(elt, "[]", array, argList.toArray(new Operand[argList.size()]), null)); // elt = a[args]
Operand value = build(opElementAsgnNode.getValueNode(), s); // Load 'value'
String operation = opElementAsgnNode.getOperatorName();
addInstr(s, CallInstr.create(elt, new MethAddr(operation), elt, new Operand[] { value }, null)); // elt = elt.OPERATION(value)
addInstr(s, CallInstr.create(elt, operation, elt, new Operand[] { value }, null)); // elt = elt.OPERATION(value)
// SSS: do not load the call result into 'elt' to eliminate the RAW dependency on the call
// We already know what the result is going be .. we are just storing it back into the array
Variable tmp = s.createTemporaryVariable();
argList.add(elt);
addInstr(s, CallInstr.create(tmp, new MethAddr("[]="), array, argList.toArray(new Operand[argList.size()]), null)); // a[args] = elt
addInstr(s, CallInstr.create(tmp, "[]=", array, argList.toArray(new Operand[argList.size()]), null)); // a[args] = elt
return elt;
}

@@ -3264,9 +3264,9 @@ private Operand buildSuperInstr(IRScope s, Operand block, Operand[] args) {
if ((s instanceof IRMethod) && (s.getLexicalParent() instanceof IRClassBody)) {
IRMethod m = (IRMethod)s;
if (m.isInstanceMethod) {
superInstr = new InstanceSuperInstr(ret, s.getCurrentModuleVariable(), new MethAddr(s.getName()), args, block);
superInstr = new InstanceSuperInstr(ret, s.getCurrentModuleVariable(), s.getName(), args, block);
} else {
superInstr = new ClassSuperInstr(ret, s.getCurrentModuleVariable(), new MethAddr(s.getName()), args, block);
superInstr = new ClassSuperInstr(ret, s.getCurrentModuleVariable(), s.getName(), args, block);
}
} else {
// We dont always know the method name we are going to be invoking if the super occurs in a closure.
@@ -3378,7 +3378,7 @@ public Operand buildVAlias(VAliasNode valiasNode, IRScope s) {

public Operand buildVCall(VCallNode node, IRScope s) {
Variable callResult = s.createTemporaryVariable();
Instr callInstr = CallInstr.create(CallType.VARIABLE, callResult, new MethAddr(node.getName()), s.getSelf(), NO_ARGS, null);
Instr callInstr = CallInstr.create(CallType.VARIABLE, callResult, node.getName(), s.getSelf(), NO_ARGS, null);
addInstr(s, callInstr);
return callResult;
}
3 changes: 0 additions & 3 deletions core/src/main/java/org/jruby/ir/IRVisitor.java
Original file line number Diff line number Diff line change
@@ -71,7 +71,6 @@ private void error(Object object) {
public void Match2Instr(Match2Instr match2instr) { error(match2instr); }
public void Match3Instr(Match3Instr match3instr) { error(match3instr); }
public void MatchInstr(MatchInstr matchinstr) { error(matchinstr); }
public void MethodLookupInstr(MethodLookupInstr methodlookupinstr) { error(methodlookupinstr); }
public void ModuleVersionGuardInstr(ModuleVersionGuardInstr moduleversionguardinstr) { error(moduleversionguardinstr); }
public void NonlocalReturnInstr(NonlocalReturnInstr nonlocalreturninstr) { error(nonlocalreturninstr); }
public void NopInstr(NopInstr nopinstr) { error(nopinstr); }
@@ -153,8 +152,6 @@ private void error(Object object) {
public void IRException(IRException irexception) { error(irexception); }
public void Label(Label label) { error(label); }
public void LocalVariable(LocalVariable localvariable) { error(localvariable); }
public void MethAddr(MethAddr methaddr) { error(methaddr); }
public void MethodHandle(MethodHandle methodhandle) { error(methodhandle); }
public void Nil(Nil nil) { error(nil); }
public void NthRef(NthRef nthref) { error(nthref); }
public void ObjectClass(ObjectClass objectclass) { error(objectclass); }
3 changes: 1 addition & 2 deletions core/src/main/java/org/jruby/ir/Operation.java
Original file line number Diff line number Diff line change
@@ -204,8 +204,7 @@ public enum Operation {
PUSH_FRAME(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
PUSH_BINDING(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
POP_FRAME(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
POP_BINDING(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
METHOD_LOOKUP(0); /* for splitting calls into method-lookup and call -- unused **/
POP_BINDING(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect);

public final OpClass opClass;
private int flags;
Original file line number Diff line number Diff line change
@@ -242,10 +242,10 @@ public void applyTransferFunction(Instr i) {
// Process calls specially -- these are what we want to optimize!
if (i instanceof CallBase && o == null) {
CallBase c = (CallBase)i;
MethAddr m = c.getMethodAddr();
String m = c.getName();
Operand r = c.getReceiver();
Operand[] args = c.getCallArgs();
if (dst != null && args.length == 1 && m.resemblesALUOp()) {
if (dst != null && args.length == 1 && resemblesALUOp(m)) {
Operand a = args[0];
Class receiverType = getOperandType(tmpState, r);
Class argType = getOperandType(tmpState, a);
@@ -255,7 +255,7 @@ public void applyTransferFunction(Instr i) {
{
dirtied = true;

Class dstType = m.getUnboxedResultType(Float.class);
Class dstType = getUnboxedResultType(Float.class, m);
setOperandType(tmpState, dst, dstType);
tmpState.unboxedVars.put(dst, dstType);

@@ -272,7 +272,7 @@ public void applyTransferFunction(Instr i) {
{
dirtied = true;

Class dstType = m.getUnboxedResultType(Fixnum.class);
Class dstType = getUnboxedResultType(Fixnum.class, m);
setOperandType(tmpState, dst, dstType);
tmpState.unboxedVars.put(dst, dstType);

@@ -641,21 +641,21 @@ public void unbox(Map<Variable, TemporaryLocalVariable> unboxMap) {
Operand o = ((ClosureAcceptingInstr)i).getClosureArg();
if (i instanceof CallBase && o == null) {
CallBase c = (CallBase)i;
MethAddr m = c.getMethodAddr();
String m = c.getName();
Operand r = c.getReceiver();
Operand[] args = c.getCallArgs();
if (dst != null && args.length == 1 && m.resemblesALUOp()) {
if (dst != null && args.length == 1 && resemblesALUOp(m)) {
Operand a = args[0];
Class receiverType = getOperandType(tmpState, r);
Class argType = getOperandType(tmpState, a);
// Optimistically assume that call is an ALU op
Operation unboxedOp;
if ((receiverType == Float.class || (receiverType == Fixnum.class && argType == Float.class)) &&
(unboxedOp = m.getUnboxedOp(Float.class)) != null)
(unboxedOp = getUnboxedOp(Float.class, m)) != null)
{
dirtied = true;

Class dstType = m.getUnboxedResultType(Float.class);
Class dstType = getUnboxedResultType(Float.class, m);
setOperandType(tmpState, dst, dstType);
tmpState.unboxedVars.put(dst, dstType);

@@ -664,11 +664,11 @@ public void unbox(Map<Variable, TemporaryLocalVariable> unboxMap) {
a = unboxOperand(tmpState, Float.class, unboxMap, a, newInstrs);
newInstrs.add(new AluInstr(unboxedOp, unboxedDst, r, a));
} else if ((receiverType == Float.class || (receiverType == Fixnum.class && argType == Fixnum.class)) &&
(unboxedOp = m.getUnboxedOp(Fixnum.class)) != null)
(unboxedOp = getUnboxedOp(Fixnum.class, m)) != null)
{
dirtied = true;

Class dstType = m.getUnboxedResultType(Fixnum.class);
Class dstType = getUnboxedResultType(Fixnum.class, m);
setOperandType(tmpState, dst, dstType);
tmpState.unboxedVars.put(dst, dstType);

@@ -755,6 +755,66 @@ public void unbox(Map<Variable, TemporaryLocalVariable> unboxMap) {
basicBlock.replaceInstrs(newInstrs);
}

private boolean resemblesALUOp(String name) {
return name.equals("+") || name.equals("-") || name.equals("*") || name.equals("/") ||
name.equals("|") || name.equals("&") || name.equals(">>") || name.equals("<<") ||
name.equals(">") || name.equals("<") || name.equals("==") || name.equals("!=");
}

private Class getUnboxedResultType(Class operandType, String name) {
if (name.length() == 1) {
switch (name.charAt(0)) {
case '+' :
case '-' :
case '*' :
case '/' : return operandType == Float.class ? Float.class : operandType == Fixnum.class ? Fixnum.class : null;
case '>' :
case '<' : return operandType == Float.class || operandType == Fixnum.class ? UnboxedBoolean.class : null;
}
}
return null;
}

public Operation getUnboxedOp(Class unboxedType, String name) {
if (unboxedType == Float.class) {
if (name.length() == 1) {
switch (name.charAt(0)) {
case '+' : return Operation.FADD;
case '-' : return Operation.FSUB;
case '*' : return Operation.FMUL;
case '/' : return Operation.FDIV;
case '>' : return Operation.FGT;
case '<' : return Operation.FLT;
}
} else if (name.length() == 2) {
if (name.equals("==")) return Operation.FEQ;
} else if (name.equals("===")) {
return Operation.FEQ;
}
} else if (unboxedType == Fixnum.class) {
if (name.length() == 1) {
switch (name.charAt(0)) {
case '+' : return Operation.IADD;
case '-' : return Operation.ISUB;
case '*' : return Operation.IMUL;
case '/' : return Operation.IDIV;
case '>' : return Operation.IGT;
case '<' : return Operation.ILT;
case '|' : return Operation.IOR;
case '&' : return Operation.IAND;
case '^' : return Operation.IXOR;
}
} else if (name.length() == 2) {
if (name.equals(">>")) return Operation.ISHR;
if (name.equals("<<")) return Operation.ISHL;
if (name.equals("==")) return Operation.IEQ;
} else if (name.equals("===")) {
return Operation.IEQ;
}
}
return null;
}

@Override
public String toString() {
return "";
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.instructions.specialized.OneArgOperandAttrAssignInstr;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
@@ -16,12 +15,12 @@
// Instruction representing Ruby code of the form: "a[i] = 5"
// which is equivalent to: a.[](i,5)
public class AttrAssignInstr extends NoResultCallInstr {
public AttrAssignInstr(Operand obj, MethAddr attr, Operand[] args) {
public AttrAssignInstr(Operand obj, String attr, Operand[] args) {
super(Operation.ATTR_ASSIGN, CallType.UNKNOWN, attr, obj, args, null);
}

public AttrAssignInstr(AttrAssignInstr instr) {
this(instr.getReceiver(), instr.getMethodAddr(), instr.getCallArgs());
this(instr.getReceiver(), instr.getName(), instr.getCallArgs());
}

@Override
@@ -37,8 +36,7 @@ public boolean computeScopeFlags(IRScope scope) {

@Override
public Instr clone(CloneInfo ii) {
return new AttrAssignInstr(receiver.cloneForInlining(ii),
(MethAddr)getMethodAddr().cloneForInlining(ii), cloneCallArgs(ii));
return new AttrAssignInstr(receiver.cloneForInlining(ii), getName(), cloneCallArgs(ii));
}

@Override
@@ -59,7 +57,7 @@ public Object interpret(ThreadContext context, StaticScope currScope, DynamicSco
IRubyObject[] values = prepareArguments(context, self, getCallArgs(), currScope, dynamicScope, temp);

CallType callType = self == object ? CallType.FUNCTIONAL : CallType.NORMAL;
Helpers.invoke(context, object, getMethodAddr().getName(), values, callType, Block.NULL_BLOCK);
Helpers.invoke(context, object, getName(), values, callType, Block.NULL_BLOCK);
return null;
}

42 changes: 19 additions & 23 deletions core/src/main/java/org/jruby/ir/instructions/CallBase.java
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public abstract class CallBase extends Instr implements Specializeable, ClosureA
protected Operand receiver;
protected Operand[] arguments;
protected Operand closure;
protected MethAddr methAddr;
protected String name;
protected CallSite callSite;

private boolean flagsComputed;
@@ -36,16 +36,16 @@ public abstract class CallBase extends Instr implements Specializeable, ClosureA
private boolean containsArgSplat;
private boolean procNew;

protected CallBase(Operation op, CallType callType, MethAddr methAddr, Operand receiver, Operand[] args, Operand closure) {
protected CallBase(Operation op, CallType callType, String name, Operand receiver, Operand[] args, Operand closure) {
super(op);

this.callSiteId = callSiteCounter++;
this.receiver = receiver;
this.arguments = args;
this.closure = closure;
this.methAddr = methAddr;
this.name = name;
this.callType = callType;
this.callSite = getCallSiteFor(callType, methAddr);
this.callSite = getCallSiteFor(callType, name);
containsArgSplat = containsArgSplat(args);
flagsComputed = false;
canBeEval = true;
@@ -59,11 +59,11 @@ protected CallBase(Operation op, CallType callType, MethAddr methAddr, Operand r
public Operand[] getOperands() {
// -0 is not possible so we add 1 to arguments with closure so we get a valid negative value.
Fixnum arity = new Fixnum(closure != null ? -1*(arguments.length + 1) : arguments.length);
return buildAllArgs(new Fixnum(callType.ordinal()), getMethodAddr(), receiver, arity, arguments, closure);
return buildAllArgs(new Fixnum(callType.ordinal()), receiver, arity, arguments, closure);
}

public MethAddr getMethodAddr() {
return methAddr;
public String getName() {
return name;
}

/** From interface ClosureAcceptingInstr */
@@ -111,11 +111,9 @@ public boolean inliningBlocked() {
return dontInline;
}

private static CallSite getCallSiteFor(CallType callType, MethAddr methAddr) {
private static CallSite getCallSiteFor(CallType callType, String name) {
assert callType != null: "Calltype should never be null";

String name = methAddr.getName();

switch (callType) {
case NORMAL: return MethodIndex.getCallSite(name);
case FUNCTIONAL: return MethodIndex.getFunctionalCallSite(name);
@@ -181,7 +179,7 @@ public boolean computeScopeFlags(IRScope scope) {
// and JRuby implementation uses dyn-scope to access the static-scope
// to output the local variables => we cannot strip dynscope in those cases.
// FIXME: We need to decouple static-scope and dyn-scope.
String mname = getMethodAddr().getName();
String mname = getName();
if (mname.equals("local_variables")) {
scope.getFlags().add(REQUIRES_DYNSCOPE);
} else if (mname.equals("send") || mname.equals("__send__")) {
@@ -210,7 +208,7 @@ public CallBase specializeForInterpretation() {
public void simplifyOperands(Map<Operand, Operand> valueMap, boolean force) {
// FIXME: receiver should never be null (checkArity seems to be one culprit)
if (receiver != null) receiver = receiver.getSimplifiedOperand(valueMap, force);
methAddr = (MethAddr)methAddr.getSimplifiedOperand(valueMap, force);

for (int i = 0; i < arguments.length; i++) {
arguments[i] = arguments[i].getSimplifiedOperand(valueMap, force);
}
@@ -222,7 +220,7 @@ public void simplifyOperands(Map<Operand, Operand> valueMap, boolean force) {
flagsComputed = false; // Forces recomputation of flags

// recompute whenever instr operands change! (can this really change though?)
callSite = getCallSiteFor(callType, methAddr);
callSite = getCallSiteFor(callType, name);
}

public Operand[] cloneCallArgs(CloneInfo ii) {
@@ -248,7 +246,7 @@ public boolean isStaticCallTarget() {
// How about aliasing of 'call', 'eval', 'send', 'module_eval', 'class_eval', 'instance_eval'?
private boolean computeEvalFlag() {
// ENEBO: This could be made into a recursive two-method thing so then: send(:send, :send, :send, :send, :eval, "Hosed") works
String mname = getMethodAddr().getName();
String mname = getName();
// checking for "call" is conservative. It can be eval only if the receiver is a Method
// CON: Removed "call" check because we didn't do it in 1.7 and it deopts all callers of Method or Proc objects.
if (/*mname.equals("call") ||*/ mname.equals("eval") || mname.equals("module_eval") || mname.equals("class_eval") || mname.equals("instance_eval")) return true;
@@ -280,7 +278,7 @@ private boolean computeRequiresCallersBindingFlag() {
// literal closures can be used to capture surrounding binding
if (hasLiteralClosure()) return true;

String mname = getMethodAddr().getName();
String mname = getName();
if (MethodIndex.SCOPE_AWARE_METHODS.contains(mname)) {
return true;
} else if (mname.equals("send") || mname.equals("__send__")) {
@@ -339,7 +337,7 @@ private boolean computeRequiresCallersFrameFlag() {

if (procNew) return true;

String mname = getMethodAddr().getName();
String mname = getName();
if (MethodIndex.FRAME_AWARE_METHODS.contains(mname)) {
// Known frame-aware methods.
return true;
@@ -389,7 +387,7 @@ public boolean targetRequiresCallersFrame() {

@Override
public String toString() {
return "" + getOperation() + "(" + callType + ", " + getMethodAddr() + ", " + receiver +
return "" + getOperation() + "(" + callType + ", " + getName() + ", " + receiver +
", " + Arrays.toString(getCallArgs()) +
(closure == null ? "" : ", &" + closure) + ")";
}
@@ -402,20 +400,18 @@ public static boolean containsArgSplat(Operand[] arguments) {
return false;
}

private final static int REQUIRED_OPERANDS = 4;
private static Operand[] buildAllArgs(Operand callType, Operand methAddr, Operand receiver,
private final static int REQUIRED_OPERANDS = 3;
private static Operand[] buildAllArgs(Operand callType, Operand receiver,
Fixnum argsCount, Operand[] callArgs, Operand closure) {
Operand[] allArgs = new Operand[callArgs.length + REQUIRED_OPERANDS + (closure != null ? 1 : 0)];

assert methAddr != null : "METHADDR is null";
assert receiver != null : "RECEIVER is null";


allArgs[0] = callType;
allArgs[1] = methAddr;
allArgs[2] = receiver;
allArgs[1] = receiver;
// -0 not possible so if closure exists we are negative and we subtract one to get real arg count.
allArgs[3] = argsCount;
allArgs[2] = argsCount;
for (int i = 0; i < callArgs.length; i++) {
assert callArgs[i] != null : "ARG " + i + " is null";

27 changes: 12 additions & 15 deletions core/src/main/java/org/jruby/ir/instructions/CallInstr.java
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
import org.jruby.ir.instructions.specialized.OneOperandArgBlockCallInstr;
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockCallInstr;
import org.jruby.ir.instructions.specialized.ZeroOperandArgNoBlockCallInstr;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.transformations.inlining.CloneInfo;
@@ -18,21 +17,21 @@
public class CallInstr extends CallBase implements ResultInstr {
protected Variable result;

public static CallInstr create(Variable result, MethAddr methAddr, Operand receiver, Operand[] args, Operand closure) {
return new CallInstr(CallType.NORMAL, result, methAddr, receiver, args, closure);
public static CallInstr create(Variable result, String name, Operand receiver, Operand[] args, Operand closure) {
return new CallInstr(CallType.NORMAL, result, name, receiver, args, closure);
}

public static CallInstr create(CallType callType, Variable result, MethAddr methAddr, Operand receiver, Operand[] args, Operand closure) {
return new CallInstr(callType, result, methAddr, receiver, args, closure);
public static CallInstr create(CallType callType, Variable result, String name, Operand receiver, Operand[] args, Operand closure) {
return new CallInstr(callType, result, name, receiver, args, closure);
}


public CallInstr(CallType callType, Variable result, MethAddr methAddr, Operand receiver, Operand[] args, Operand closure) {
this(Operation.CALL, callType, result, methAddr, receiver, args, closure);
public CallInstr(CallType callType, Variable result, String name, Operand receiver, Operand[] args, Operand closure) {
this(Operation.CALL, callType, result, name, receiver, args, closure);
}

protected CallInstr(Operation op, CallType callType, Variable result, MethAddr methAddr, Operand receiver, Operand[] args, Operand closure) {
super(op, callType, methAddr, receiver, args, closure);
protected CallInstr(Operation op, CallType callType, Variable result, String name, Operand receiver, Operand[] args, Operand closure) {
super(op, callType, name, receiver, args, closure);

assert result != null;

@@ -41,7 +40,7 @@ protected CallInstr(Operation op, CallType callType, Variable result, MethAddr m

public CallInstr(Operation op, CallInstr ordinary) {
this(op, ordinary.getCallType(), ordinary.getResult(),
ordinary.getMethodAddr(), ordinary.getReceiver(), ordinary.getCallArgs(),
ordinary.getName(), ordinary.getReceiver(), ordinary.getCallArgs(),
ordinary.getClosureArg(null));
}

@@ -70,15 +69,13 @@ public CallBase specializeForInterpretation() {
}

public Instr discardResult() {
return new NoResultCallInstr(Operation.NORESULT_CALL, getCallType(), getMethodAddr(), getReceiver(), getCallArgs(), closure);
return new NoResultCallInstr(Operation.NORESULT_CALL, getCallType(), getName(), getReceiver(), getCallArgs(), closure);
}

@Override
public Instr clone(CloneInfo ii) {
return new CallInstr(getCallType(), ii.getRenamedVariable(result),
(MethAddr) getMethodAddr().cloneForInlining(ii),
receiver.cloneForInlining(ii), cloneCallArgs(ii),
closure == null ? null : closure.cloneForInlining(ii));
return new CallInstr(getCallType(), ii.getRenamedVariable(result), getName(), receiver.cloneForInlining(ii),
cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii));
}

@Override
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
import org.jruby.RubyModule;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.runtime.IRRuntimeHelpers;
@@ -13,8 +12,8 @@
import org.jruby.runtime.builtin.IRubyObject;

public class ClassSuperInstr extends CallInstr {
public ClassSuperInstr(Variable result, Operand definingModule, MethAddr superMeth, Operand[] args, Operand closure) {
super(Operation.CLASS_SUPER, CallType.SUPER, result, superMeth, definingModule, args, closure);
public ClassSuperInstr(Variable result, Operand definingModule, String name, Operand[] args, Operand closure) {
super(Operation.CLASS_SUPER, CallType.SUPER, result, name, definingModule, args, closure);
}

public Operand getDefiningModule() {
@@ -23,7 +22,7 @@ public Operand getDefiningModule() {

@Override
public Instr clone(CloneInfo ii) {
return new ClassSuperInstr(ii.getRenamedVariable(getResult()), getDefiningModule().cloneForInlining(ii), (MethAddr)getMethodAddr().cloneForInlining(ii),
return new ClassSuperInstr(ii.getRenamedVariable(getResult()), getDefiningModule().cloneForInlining(ii), name,
cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii));
}

@@ -42,9 +41,9 @@ public CallBase specializeForInterpretation() {
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
IRubyObject[] args = prepareArguments(context, self, getCallArgs(), currScope, currDynScope, temp);
Block block = prepareBlock(context, self, currScope, currDynScope, temp);
String methodName = methAddr.getName();
RubyModule definingModule = (RubyModule) getDefiningModule().retrieve(context, self, currScope, currDynScope, temp);
return IRRuntimeHelpers.classSuper(context, self, methodName, definingModule, args, block);

return IRRuntimeHelpers.classSuper(context, self, getName(), definingModule, args, block);
}

@Override
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
import org.jruby.RubyModule;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Symbol;
import org.jruby.ir.operands.Variable;
@@ -22,7 +21,7 @@ public class ConstMissingInstr extends CallInstr implements ResultInstr, FixedAr

public ConstMissingInstr(Variable result, Operand currentModule, String missingConst) {
// FIXME: Missing encoding knowledge of the constant name.
super(Operation.CONST_MISSING, CallType.FUNCTIONAL, result, new MethAddr("const_missing"), currentModule, new Operand[]{new Symbol(missingConst, USASCIIEncoding.INSTANCE)}, null);
super(Operation.CONST_MISSING, CallType.FUNCTIONAL, result, "const_missing", currentModule, new Operand[]{new Symbol(missingConst, USASCIIEncoding.INSTANCE)}, null);

this.missingConst = missingConst;
}
Original file line number Diff line number Diff line change
@@ -3,22 +3,20 @@
import org.jruby.RubyModule;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.Block;
import org.jruby.runtime.CallType;
import org.jruby.runtime.DynamicScope;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class InstanceSuperInstr extends CallInstr {
public InstanceSuperInstr(Variable result, Operand definingModule, MethAddr superMeth, Operand[] args, Operand closure) {
super(Operation.INSTANCE_SUPER, CallType.SUPER, result, superMeth, definingModule, args, closure);
public InstanceSuperInstr(Variable result, Operand definingModule, String name, Operand[] args, Operand closure) {
super(Operation.INSTANCE_SUPER, CallType.SUPER, result, name, definingModule, args, closure);
}

public Operand getDefiningModule() {
@@ -27,7 +25,7 @@ public Operand getDefiningModule() {

@Override
public Instr clone(CloneInfo ii) {
return new InstanceSuperInstr(ii.getRenamedVariable(getResult()), getDefiningModule().cloneForInlining(ii), (MethAddr)getMethodAddr().cloneForInlining(ii),
return new InstanceSuperInstr(ii.getRenamedVariable(getResult()), getDefiningModule().cloneForInlining(ii), getName(),
cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii));
}

@@ -47,8 +45,8 @@ public Object interpret(ThreadContext context, StaticScope currScope, DynamicSco
IRubyObject[] args = prepareArguments(context, self, getCallArgs(), currScope, currDynScope, temp);
Block block = prepareBlock(context, self, currScope, currDynScope, temp);
RubyModule definingModule = ((RubyModule) getDefiningModule().retrieve(context, self, currScope, currDynScope, temp)).getMethodLocation();
String methodName = methAddr.getName();
return IRRuntimeHelpers.instanceSuper(context, self, methodName, definingModule, args, block);

return IRRuntimeHelpers.instanceSuper(context, self, getName(), definingModule, args, block);
}

@Override

This file was deleted.

Original file line number Diff line number Diff line change
@@ -3,25 +3,23 @@
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockNoResultCallInstr;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.runtime.CallType;

public class NoResultCallInstr extends CallBase {
public NoResultCallInstr(Operation op, CallType callType, MethAddr methAddr,
Operand receiver, Operand[] args, Operand closure) {
super(op, callType, methAddr, receiver, args, closure);
public NoResultCallInstr(Operation op, CallType callType, String name, Operand receiver, Operand[] args, Operand closure) {
super(op, callType, name, receiver, args, closure);
}

public NoResultCallInstr(Operation op, NoResultCallInstr instr) {
this(op, instr.getCallType(), instr.methAddr, instr.receiver, instr.arguments, instr.closure);
this(op, instr.getCallType(), instr.getName(), instr.receiver, instr.arguments, instr.closure);
}

@Override
public Instr clone(CloneInfo ii) {
return new NoResultCallInstr(getOperation(), getCallType(), (MethAddr) getMethodAddr().cloneForInlining(ii),
receiver.cloneForInlining(ii), cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii));
return new NoResultCallInstr(getOperation(), getCallType(), getName(), receiver.cloneForInlining(ii),
cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii));
}

@Override
Original file line number Diff line number Diff line change
@@ -2,25 +2,24 @@

import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.ir.transformations.inlining.SimpleCloneInfo;

public class PushFrameInstr extends Instr implements FixedArityInstr {
private final MethAddr frameName;
public PushFrameInstr(MethAddr frameName) {
private final String frameName;
public PushFrameInstr(String frameName) {
super(Operation.PUSH_FRAME);

this.frameName = frameName;
}

@Override
public Operand[] getOperands() {
return new Operand[]{frameName};
return EMPTY_OPERANDS;
}

public MethAddr getFrameName() {
public String getFrameName() {
return frameName;
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
import org.jruby.ir.IRScope;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.runtime.IRRuntimeHelpers;
@@ -17,9 +16,11 @@
import org.jruby.runtime.builtin.IRubyObject;

public class UnresolvedSuperInstr extends CallInstr {
public static final String UNKNOWN_SUPER_TARGET = "-unknown-super-target-";

// SSS FIXME: receiver is never used -- being passed in only to meet requirements of CallInstr
public UnresolvedSuperInstr(Operation op, Variable result, Operand receiver, Operand[] args, Operand closure) {
super(op, CallType.SUPER, result, MethAddr.UNKNOWN_SUPER_TARGET, receiver, args, closure);
super(op, CallType.SUPER, result, UNKNOWN_SUPER_TARGET, receiver, args, closure);
}

public UnresolvedSuperInstr(Variable result, Operand receiver, Operand[] args, Operand closure) {
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ public Object interpret(ThreadContext context, StaticScope currScope, DynamicSco
IRubyObject value = (IRubyObject) args[0].retrieve(context, self, currScope, dynamicScope, temp);

CallType callType = self == object ? CallType.FUNCTIONAL : CallType.NORMAL;
Helpers.invoke(context, object, getMethodAddr().getName(), value, callType, Block.NULL_BLOCK);
Helpers.invoke(context, object, getName(), value, callType, Block.NULL_BLOCK);
return null;
}
}
113 changes: 0 additions & 113 deletions core/src/main/java/org/jruby/ir/operands/MethAddr.java

This file was deleted.

120 changes: 0 additions & 120 deletions core/src/main/java/org/jruby/ir/operands/MethodHandle.java

This file was deleted.

2 changes: 0 additions & 2 deletions core/src/main/java/org/jruby/ir/operands/OperandType.java
Original file line number Diff line number Diff line change
@@ -25,8 +25,6 @@ public enum OperandType {
HASH((byte) '{'),
IR_EXCEPTION((byte) '!'),
LABEL((byte) 'L'),
METH_ADDR((byte) 'M'),
METHOD_HANDLE((byte) 'm'),
NIL((byte) 'N'),
NTH_REF((byte) '1'),
OBJECT_CLASS((byte) 'O'),
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
import org.jruby.ir.dataflow.analyses.StoreLocalVarPlacementProblem;
import org.jruby.ir.instructions.*;
import org.jruby.ir.operands.Label;
import org.jruby.ir.operands.MethAddr;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.representations.BasicBlock;
import org.jruby.ir.representations.CFG;
@@ -60,7 +59,7 @@ public Object execute(IRScope scope, Object... data) {
if (requireBinding || requireFrame) {
BasicBlock entryBB = cfg.getEntryBB();
// Push
if (requireFrame) entryBB.addInstr(new PushFrameInstr(new MethAddr(scope.getName())));
if (requireFrame) entryBB.addInstr(new PushFrameInstr(scope.getName()));
if (requireBinding) entryBB.addInstr(new PushBindingInstr());

// SSS FIXME: We are doing this conservatively.
11 changes: 5 additions & 6 deletions core/src/main/java/org/jruby/ir/persistence/InstrDecoderMap.java
Original file line number Diff line number Diff line change
@@ -85,7 +85,6 @@ public Instr decodeInner(Operation operation) {
case MATCH: return new MatchInstr(d.decodeVariable(), d.decodeOperand());
case MATCH2: return new Match2Instr(d.decodeVariable(), d.decodeOperand(), d.decodeOperand());
case MATCH3: return new Match3Instr(d.decodeVariable(), d.decodeOperand(), d.decodeOperand());
case METHOD_LOOKUP: return new MethodLookupInstr(d.decodeVariable(), d.decodeOperand(), d.decodeOperand());
case NONLOCAL_RETURN: return new NonlocalReturnInstr(d.decodeOperand(), d.decodeString());
case NOP: return NopInstr.NOP;
case NORESULT_CALL: return decodeNoResultCall();
@@ -140,7 +139,7 @@ private Instr decodeAttrAssignInstr() {
args[i] = d.decodeOperand();
}

return new AttrAssignInstr(op, new MethAddr(methAddr), args);
return new AttrAssignInstr(op, methAddr, args);
}

private Instr decodeCall() {
@@ -164,12 +163,12 @@ private Instr decodeCall() {

Operand closure = hasClosureArg ? d.decodeOperand() : null;

return CallInstr.create(CallType.fromOrdinal(callTypeOrdinal), result, new MethAddr(methAddr), receiver, args, closure);
return CallInstr.create(CallType.fromOrdinal(callTypeOrdinal), result, methAddr, receiver, args, closure);
}

private Instr decodeFrame() {
String methAddr = d.decodeString();
return new PushFrameInstr(new MethAddr(methAddr));
return new PushFrameInstr(methAddr);
}

private Instr decodeConstMissingInstr() {
@@ -201,7 +200,7 @@ private Instr decodeNoResultCall() {

Operand closure = hasClosureArg ? d.decodeOperand() : null;

return new NoResultCallInstr(Operation.NORESULT_CALL, CallType.fromOrdinal(callTypeOrdinal), new MethAddr(methAddr), receiver, args, closure);
return new NoResultCallInstr(Operation.NORESULT_CALL, CallType.fromOrdinal(callTypeOrdinal), methAddr, receiver, args, closure);
}

private Instr decodeCopy() {
@@ -280,7 +279,7 @@ private Instr decodeSuperInstr(Operation operation) {
if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("decoding super, result: "+ result);
int callTypeOrdinal = d.decodeInt();
if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("decoding super, calltype(ord): "+ callTypeOrdinal);
MethAddr methAddr = new MethAddr(d.decodeString());
String methAddr = d.decodeString();
if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("decoding super, methaddr: "+ methAddr);
Operand receiver = d.decodeOperand();
int argsCount = d.decodeInt();
Original file line number Diff line number Diff line change
@@ -78,7 +78,6 @@ public void encode(Instr instr) {
case MATCH: encodeMatchInstr((MatchInstr) instr); break;
case MATCH2: encodeMatch2Instr((Match2Instr) instr); break;
case MATCH3: encodeMatch3Instr((Match3Instr) instr); break;
case METHOD_LOOKUP: encodeMethodLookupInstr((MethodLookupInstr) instr); break;
case NONLOCAL_RETURN: encodeNonlocalReturnInstr((NonlocalReturnInstr) instr); break;
case NOP: /* no state */ break;
case NORESULT_CALL: encodeCallBaseInstr((NoResultCallInstr) instr); break;
@@ -128,7 +127,7 @@ private void encodeAliasInstr(AliasInstr instr) {

private void encodeAttrAssignInstr(AttrAssignInstr instr) {
e.encode(instr.getReceiver());
e.encode(instr.getMethodAddr().getName());
e.encode(instr.getName());
Operand[] args = instr.getCallArgs();

e.encode(args.length);
@@ -349,10 +348,6 @@ private void encodeMatch3Instr(Match3Instr instr) {
e.encode(instr.getArg());
}

private void encodeMethodLookupInstr(MethodLookupInstr instr) {
e.encode(instr.getMethodHandle());
}

private void encodeNonlocalReturnInstr(NonlocalReturnInstr instr) {
e.encode(instr.getReturnValue());
e.encode(instr.methodName);
@@ -362,7 +357,7 @@ private void encodeCallBaseInstr(CallBase instr) {
boolean hasClosure = instr.getClosureArg(null) != null;

e.encode(instr.getCallType().ordinal());
e.encode(instr.getMethodAddr().getName());
e.encode(instr.getName());
e.encode(instr.getReceiver());
e.encode(calculateArity(instr.getCallArgs(), hasClosure));

Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package org.jruby.ir.persistence;

import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.USASCIIEncoding;
import org.jruby.RubyInstanceConfig;
import org.jruby.ir.IRClosure;
import org.jruby.ir.IRManager;
import org.jruby.ir.operands.*;
import org.jruby.ir.persistence.read.parser.NonIRObjectFactory;
import org.jruby.util.KeyValuePair;
import org.jruby.util.RegexpOptions;

@@ -46,8 +44,6 @@ public Operand decode(OperandType type) {
case IR_EXCEPTION: return IRException.getExceptionFromOrdinal(d.decodeByte());
case LABEL: return decodeLabel();
case LOCAL_VARIABLE: return d.getCurrentScope().getLocalVariable(d.decodeString(), d.decodeInt());
case METHOD_HANDLE: return new MethodHandle(d.decodeOperand(), d.decodeOperand());
case METH_ADDR: return new MethAddr(d.decodeString());
case NIL: return manager.getNil();
case NTH_REF: return new NthRef(d.decodeInt());
case OBJECT_CLASS: return new ObjectClass();
10 changes: 0 additions & 10 deletions core/src/main/java/org/jruby/ir/persistence/OperandEncoderMap.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package org.jruby.ir.persistence;

import org.jcodings.Encoding;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.operands.*;
import org.jruby.ir.operands.Boolean;
import org.jruby.ir.operands.Float;
import org.jruby.util.KeyValuePair;

import java.util.List;

/**
* Can cycles develop or will IR output guarantee non-cyclical nested operands?
*/
@@ -80,13 +77,6 @@ public void encode(Operand operand) {
encoder.encode(variable.getScopeDepth());
}

@Override public void MethAddr(MethAddr methaddr) { encoder.encode(methaddr.getName()); }

@Override public void MethodHandle(MethodHandle methodhandle) {
encoder.encode(methodhandle.getReceiver());
encoder.encode(methodhandle.getMethodNameOperand());
}

@Override public void Nil(Nil nil) {} // No data

@Override public void NthRef(NthRef nthref) { encoder.encode(nthref.matchNumber); }
34 changes: 8 additions & 26 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
import org.jruby.ir.operands.Float;
import org.jruby.ir.operands.GlobalVariable;
import org.jruby.ir.operands.Label;
import org.jruby.ir.operands.MethodHandle;
import org.jruby.ir.representations.BasicBlock;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.parser.StaticScope;
@@ -421,7 +420,7 @@ public void AliasInstr(AliasInstr aliasInstr) {
public void AttrAssignInstr(AttrAssignInstr attrAssignInstr) {
compileCallCommon(
jvmMethod(),
attrAssignInstr.getMethodAddr().getName(),
attrAssignInstr.getName(),
attrAssignInstr.getCallArgs(),
attrAssignInstr.getReceiver(),
attrAssignInstr.getCallArgs().length,
@@ -783,7 +782,7 @@ public void BuildRangeInstr(BuildRangeInstr instr) {
@Override
public void CallInstr(CallInstr callInstr) {
IRBytecodeAdapter m = jvmMethod();
String name = callInstr.getMethodAddr().getName();
String name = callInstr.getName();
Operand[] args = callInstr.getCallArgs();
Operand receiver = callInstr.getReceiver();
int numArgs = args.length;
@@ -865,7 +864,7 @@ public void CheckArityInstr(CheckArityInstr checkarityinstr) {

@Override
public void ClassSuperInstr(ClassSuperInstr classsuperinstr) {
String name = classsuperinstr.getMethodAddr().getName();
String name = classsuperinstr.getName();
Operand[] args = classsuperinstr.getCallArgs();
Operand definingModule = classsuperinstr.getDefiningModule();
boolean containsArgSplat = classsuperinstr.containsArgSplat();
@@ -1105,7 +1104,7 @@ public void InheritanceSearchConstInstr(InheritanceSearchConstInstr inheritances

@Override
public void InstanceSuperInstr(InstanceSuperInstr instancesuperinstr) {
String name = instancesuperinstr.getMethodAddr().getName();
String name = instancesuperinstr.getName();
Operand[] args = instancesuperinstr.getCallArgs();
Operand definingModule = instancesuperinstr.getDefiningModule();
boolean containsArgSplat = instancesuperinstr.containsArgSplat();
@@ -1259,12 +1258,6 @@ public void MatchInstr(MatchInstr matchinstr) {
jvmStoreLocal(matchinstr.getResult());
}

@Override
public void MethodLookupInstr(MethodLookupInstr methodlookupinstr) {
// SSS FIXME: Unused at this time
throw new NotCompilableException("Unsupported instruction: " + methodlookupinstr);
}

@Override
public void ModuleVersionGuardInstr(ModuleVersionGuardInstr moduleversionguardinstr) {
// SSS FIXME: Unused at this time
@@ -1279,7 +1272,7 @@ public void NopInstr(NopInstr nopinstr) {
@Override
public void NoResultCallInstr(NoResultCallInstr noResultCallInstr) {
IRBytecodeAdapter m = jvmMethod();
String name = noResultCallInstr.getMethodAddr().getName();
String name = noResultCallInstr.getName();
Operand[] args = noResultCallInstr.getCallArgs();
Operand receiver = noResultCallInstr.getReceiver();
int numArgs = args.length;
@@ -1342,7 +1335,7 @@ public void RaiseRequiredKeywordArgumentErrorInstr(RaiseRequiredKeywordArgumentE
public void PushFrameInstr(PushFrameInstr pushframeinstr) {
jvmMethod().loadContext();
jvmMethod().loadFrameClass();
jvmAdapter().ldc(pushframeinstr.getFrameName().getName());
jvmAdapter().ldc(pushframeinstr.getFrameName());
jvmMethod().loadSelf();
jvmMethod().loadBlock();
jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void preMethodFrameOnly(org.jruby.RubyModule, String, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.Block)"));
@@ -1753,7 +1746,7 @@ public void UndefMethodInstr(UndefMethodInstr undefmethodinstr) {

@Override
public void UnresolvedSuperInstr(UnresolvedSuperInstr unresolvedsuperinstr) {
String name = unresolvedsuperinstr.getMethodAddr().getName();
String name = unresolvedsuperinstr.getName();
Operand[] args = unresolvedsuperinstr.getCallArgs();
// this would be getDefiningModule but that is not used for unresolved super
Operand definingModule = UndefinedValue.UNDEFINED;
@@ -1781,7 +1774,7 @@ public void YieldInstr(YieldInstr yieldinstr) {

@Override
public void ZSuperInstr(ZSuperInstr zsuperinstr) {
String name = zsuperinstr.getMethodAddr().getName();
String name = zsuperinstr.getName();
Operand[] args = zsuperinstr.getCallArgs();
// this would be getDefiningModule but that is not used for unresolved super
Operand definingModule = UndefinedValue.UNDEFINED;
@@ -1978,17 +1971,6 @@ public void LocalVariable(LocalVariable localvariable) {
jvmAdapter().invokevirtual(p(DynamicScope.class), "getValueOrNil", sig(IRubyObject.class, int.class, int.class, IRubyObject.class));
}

@Override
public void MethAddr(MethAddr methaddr) {
jvmAdapter().ldc(methaddr.getName());
}

@Override
public void MethodHandle(MethodHandle methodhandle) {
// SSS FIXME: Unused at this time
throw new NotCompilableException("Unsupported operand: " + methodhandle);
}

@Override
public void Nil(Nil nil) {
jvmMethod().pushNil();

0 comments on commit d56d246

Please sign in to comment.