public AsString(Operand source) { if (source == null) source = new StringLiteral(""); this.source = source; }
@Override public void StringLiteral(StringLiteral stringliteral) { jvmMethod().pushString(stringliteral.getByteList(), stringliteral.getCodeRange()); }
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 = getId(); // 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. // CON: eval forms with no arguments are block or block pass, and do not need to deopt if (getArgsCount() != 0 && (mname.equals("eval") || mname.equals("module_eval") || mname.equals("class_eval") || mname.equals("instance_eval"))) { return true; } // Calls to 'send' where the first arg is either unknown or is eval or send (any others?) if (potentiallySend(mname, argsCount)) { Operand meth = getArg1(); if (!(meth instanceof StringLiteral)) return true; // We don't know String name = ((StringLiteral) meth).getString(); // FIXME: ENEBO - Half of these are name and half mname? return name.equals("call") || name.equals("eval") || mname.equals("module_eval") || mname.equals("class_eval") || mname.equals("instance_eval") || name.equals("send") || name.equals("__send__"); } return false; // All checks passed }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { IRubyObject value = (IRubyObject) getObject().retrieve(context, self, currDynScope, temp); String name = getName().string; RubyString definedType = Helpers.getDefinedConstantOrBoundMethod(value, name); return definedType == null ? context.nil : new StringLiteral(definedType.getByteList()).retrieve(context, self, currDynScope, temp); }
public void StringLiteral(StringLiteral stringliteral) { print(stringliteral.getByteList()); } public void SValue(SValue svalue) { visit(svalue.getArray()); }
@Override public Instr cloneForInlining(InlinerInfo inlinerInfo) { return new GetDefinedConstantOrMethodInstr((Variable) getResult().cloneForInlining(inlinerInfo), getObject().cloneForInlining(inlinerInfo), (StringLiteral) getName().cloneForInlining(inlinerInfo)); }
case SPLAT: return Splat.decode(this); case STANDARD_ERROR: return new StandardError(); case STRING_LITERAL: return StringLiteral.decode(this); case SVALUE: return SValue.decode(this); case SYMBOL: return Symbol.decode(this);
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { IRubyObject value = (IRubyObject) getObject().retrieve(context, self, currDynScope, temp); String name = getName().string; RubyString definedType = Helpers.getDefinedConstantOrBoundMethod(value, name); return definedType == null ? context.nil : new StringLiteral(definedType.getByteList()).retrieve(context, self, currDynScope, temp); }
public void StringLiteral(StringLiteral stringliteral) { print(stringliteral.getByteList()); } public void SValue(SValue svalue) { visit(svalue.getArray()); }
@Override public Instr cloneForInlining(InlinerInfo inlinerInfo) { return new MethodIsPublicInstr((Variable) getResult().cloneForInlining(inlinerInfo), getObject().cloneForInlining(inlinerInfo), (StringLiteral) getName().cloneForInlining(inlinerInfo)); }
case SPLAT: return Splat.decode(this); case STANDARD_ERROR: return new StandardError(); case STRING_LITERAL: return StringLiteral.decode(this); case SVALUE: return SValue.decode(this); case SYMBOL: return Symbol.decode(this);
public AsString(Operand source) { if (source == null) source = new StringLiteral(""); this.source = source; }
public boolean isSameEncodingAndCodeRange(RubyString str, StringLiteral newStr) { return newStr.getByteList().getEncoding() == encoding && newStr.getCodeRange() == str.getCodeRange(); }
@Override public void StringLiteral(StringLiteral stringliteral) { jvm.method().pushString(stringliteral.getByteList()); }
@Override public Instr cloneForInlining(InlinerInfo inlinerInfo) { return new ClassVarIsDefinedInstr((Variable) getResult().cloneForInlining(inlinerInfo), getObject().cloneForInlining(inlinerInfo), (StringLiteral) getName().cloneForInlining(inlinerInfo)); }
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 = getId(); // 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. // CON: eval forms with no arguments are block or block pass, and do not need to deopt if (getArgsCount() != 0 && (mname.equals("eval") || mname.equals("module_eval") || mname.equals("class_eval") || mname.equals("instance_eval"))) { return true; } // Calls to 'send' where the first arg is either unknown or is eval or send (any others?) if (potentiallySend(mname, argsCount)) { Operand meth = getArg1(); if (!(meth instanceof StringLiteral)) return true; // We don't know String name = ((StringLiteral) meth).getString(); // FIXME: ENEBO - Half of these are name and half mname? return name.equals("call") || name.equals("eval") || mname.equals("module_eval") || mname.equals("class_eval") || mname.equals("instance_eval") || name.equals("send") || name.equals("__send__"); } return false; // All checks passed }
public Operand run(Object[] args) { build((Node)args[0], (IRScope)args[1]); // always an expression as long as we get through here without an exception! return new StringLiteral("expression"); } };
@Override public void StringLiteral(StringLiteral stringliteral) { jvmMethod().pushString(stringliteral.getByteList(), stringliteral.getCodeRange()); }
@Override public void StringLiteral(StringLiteral stringliteral) { jvm.method().pushString(stringliteral.getByteList()); }
@Override public Instr cloneForInlining(InlinerInfo inlinerInfo) { return new GetDefinedConstantOrMethodInstr((Variable) getResult().cloneForInlining(inlinerInfo), getObject().cloneForInlining(inlinerInfo), (StringLiteral) getName().cloneForInlining(inlinerInfo)); }