Created
August 9, 2019 02:37
-
-
Save headius/a7eed3fc8f9870bc2c0ff6b41e892c15 to your computer and use it in GitHub Desktop.
Pooled object array for interpreter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/src/main/java/org/jruby/ir/instructions/AliasInstr.java b/core/src/main/java/org/jruby/ir/instructions/AliasInstr.java | |
index ef1c033c63..afcca68f54 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/AliasInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/AliasInstr.java | |
@@ -44,9 +44,9 @@ public class AliasInstr extends TwoOperandInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject newName = (IRubyObject) getNewName().retrieve(context, self, currScope, currDynScope, temp); | |
- IRubyObject oldName = (IRubyObject) getOldName().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject newName = (IRubyObject) getNewName().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ IRubyObject oldName = (IRubyObject) getOldName().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
IRRuntimeHelpers.defineAlias(context, self, currDynScope, newName, oldName); | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ArgScopeDepthInstr.java b/core/src/main/java/org/jruby/ir/instructions/ArgScopeDepthInstr.java | |
index ab1956bced..365e43517b 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ArgScopeDepthInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ArgScopeDepthInstr.java | |
@@ -27,7 +27,7 @@ public class ArgScopeDepthInstr extends NoOperandResultBaseInstr implements Fixe | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
return IRRuntimeHelpers.getArgScopeDepth(context, currScope); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ArrayDerefInstr.java b/core/src/main/java/org/jruby/ir/instructions/ArrayDerefInstr.java | |
index 0e4abb77c9..b870421738 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ArrayDerefInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ArrayDerefInstr.java | |
@@ -71,9 +71,9 @@ public class ArrayDerefInstr extends OneOperandArgNoBlockCallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- RubyString keyStr = key.retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ RubyString keyStr = key.retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
return IRRuntimeHelpers.callOptimizedAref(context, self, object, keyStr, getCallSite()); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/AsStringInstr.java b/core/src/main/java/org/jruby/ir/instructions/AsStringInstr.java | |
index a4218674f3..09874a7d9c 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/AsStringInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/AsStringInstr.java | |
@@ -1,6 +1,5 @@ | |
package org.jruby.ir.instructions; | |
-import org.jruby.RubyBasicObject; | |
import org.jruby.ir.IRScope; | |
import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.Operation; | |
@@ -72,8 +71,8 @@ public class AsStringInstr extends ZeroOperandArgNoBlockCallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Object receiver = getReceiver().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Object receiver = getReceiver().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
if (isPotentiallyRefined()) { | |
return IRRuntimeHelpers.asString(context, self, (IRubyObject) receiver, getCallSite()); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java b/core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java | |
index 97ca6102c3..ea2d21b3df 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java | |
@@ -57,9 +57,9 @@ public class AttrAssignInstr extends NoResultCallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject[] values = prepareArguments(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject[] values = prepareArguments(context, self, currScope, dynamicScope, temp, tempOff); | |
callSite.call(context, self, object, values); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BFalseInstr.java b/core/src/main/java/org/jruby/ir/instructions/BFalseInstr.java | |
index dfe1465a2a..17102083c2 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BFalseInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BFalseInstr.java | |
@@ -31,8 +31,8 @@ public class BFalseInstr extends OneOperandBranchInstr implements FixedArityInst | |
} | |
@Override | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
- Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
+ Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return !((IRubyObject)value1).isTrue() ? getJumpTarget().getTargetPC() : ipc; | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BNEInstr.java b/core/src/main/java/org/jruby/ir/instructions/BNEInstr.java | |
index 6f19cb4c2f..9b5abc360a 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BNEInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BNEInstr.java | |
@@ -35,9 +35,9 @@ public class BNEInstr extends TwoOperandBranchInstr implements FixedArityInstr { | |
} | |
@Override | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
- Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
- Object value2 = getArg2().retrieve(context, self, currScope, currDynScope, temp); | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
+ Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ Object value2 = getArg2().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? | |
value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); | |
return !eql ? getJumpTarget().getTargetPC() : ipc; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BNilInstr.java b/core/src/main/java/org/jruby/ir/instructions/BNilInstr.java | |
index 1e46f7df32..f5c64ab0c0 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BNilInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BNilInstr.java | |
@@ -31,8 +31,8 @@ public class BNilInstr extends OneOperandBranchInstr implements FixedArityInstr | |
} | |
@Override | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
- Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
+ Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return value1 == context.nil ? getJumpTarget().getTargetPC() : ipc; | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BSwitchInstr.java b/core/src/main/java/org/jruby/ir/instructions/BSwitchInstr.java | |
index 777d57bea5..5eba933f21 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BSwitchInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BSwitchInstr.java | |
@@ -95,8 +95,8 @@ public class BSwitchInstr extends MultiBranchInstr { | |
@Override | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
- Object result = operand.retrieve(context, self, currScope, currDynScope, temp); | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
+ Object result = operand.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
if (!(result instanceof RubyFixnum)) { | |
// not a fixnum, fall back on old case logic | |
return rubyCase.getTargetPC(); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BTrueInstr.java b/core/src/main/java/org/jruby/ir/instructions/BTrueInstr.java | |
index e683b2d7b3..1e0e51d242 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BTrueInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BTrueInstr.java | |
@@ -31,8 +31,8 @@ public class BTrueInstr extends OneOperandBranchInstr implements FixedArityInstr | |
} | |
@Override | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
- Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
+ Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return ((IRubyObject)value1).isTrue() ? getJumpTarget().getTargetPC() : ipc; | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BUndefInstr.java b/core/src/main/java/org/jruby/ir/instructions/BUndefInstr.java | |
index a8daf22fde..6b7566accc 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BUndefInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BUndefInstr.java | |
@@ -27,8 +27,8 @@ public class BUndefInstr extends OneOperandBranchInstr implements FixedArityIns | |
} | |
@Override | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
- Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
+ Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return value1 == UndefinedValue.UNDEFINED ? getJumpTarget().getTargetPC() : ipc; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BlockGivenInstr.java b/core/src/main/java/org/jruby/ir/instructions/BlockGivenInstr.java | |
index de1671fdc2..2fe6a42d52 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BlockGivenInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BlockGivenInstr.java | |
@@ -44,8 +44,8 @@ public class BlockGivenInstr extends OneOperandResultBaseInstr implements FixedA | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Object blk = getBlockArg().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Object blk = getBlockArg().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.isBlockGiven(context, blk); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BuildBackrefInstr.java b/core/src/main/java/org/jruby/ir/instructions/BuildBackrefInstr.java | |
index e87d812b66..f52da2364f 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BuildBackrefInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BuildBackrefInstr.java | |
@@ -6,7 +6,6 @@ import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.Operation; | |
import org.jruby.ir.operands.Variable; | |
import org.jruby.RubyRegexp; | |
-import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.persistence.IRReaderDecoder; | |
import org.jruby.ir.persistence.IRWriterEncoder; | |
import org.jruby.ir.transformations.inlining.CloneInfo; | |
@@ -45,7 +44,7 @@ public class BuildBackrefInstr extends NoOperandResultBaseInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
IRubyObject backref = context.getBackRef(); | |
switch (type) { | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BuildCompoundArrayInstr.java b/core/src/main/java/org/jruby/ir/instructions/BuildCompoundArrayInstr.java | |
index 561c4ba9f0..85db442dd2 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BuildCompoundArrayInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BuildCompoundArrayInstr.java | |
@@ -1,6 +1,5 @@ | |
package org.jruby.ir.instructions; | |
-import org.jruby.RubyArray; | |
import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.Operation; | |
import org.jruby.ir.operands.Operand; | |
@@ -55,9 +54,9 @@ public class BuildCompoundArrayInstr extends TwoOperandResultBaseInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject v1 = (IRubyObject)getAppendingArg().retrieve(context, self, currScope, currDynScope, temp); | |
- IRubyObject v2 = (IRubyObject)getAppendedArg().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject v1 = (IRubyObject)getAppendingArg().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ IRubyObject v2 = (IRubyObject)getAppendedArg().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return isArgsPush ? Helpers.argsPush(v1, v2) : Helpers.argsCat(context, v1, v2); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BuildCompoundStringInstr.java b/core/src/main/java/org/jruby/ir/instructions/BuildCompoundStringInstr.java | |
index 3f2aa8bbdb..0758db545f 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BuildCompoundStringInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BuildCompoundStringInstr.java | |
@@ -71,7 +71,7 @@ public class BuildCompoundStringInstr extends NOperandResultBaseInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
ByteList bytes = new ByteList(); | |
bytes.setEncoding(encoding); | |
RubyString str = RubyString.newStringShared(context.runtime, bytes, StringSupport.CR_7BIT); | |
@@ -80,7 +80,7 @@ public class BuildCompoundStringInstr extends NOperandResultBaseInstr { | |
str.getByteList().append(((StringLiteral)p).getByteList()); | |
str.setCodeRange(((StringLiteral)p).getCodeRange()); | |
} else { | |
- IRubyObject pval = (IRubyObject)p.retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject pval = (IRubyObject)p.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
str.append19(pval); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BuildDynRegExpInstr.java b/core/src/main/java/org/jruby/ir/instructions/BuildDynRegExpInstr.java | |
index 1cec633190..fb84d1c818 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BuildDynRegExpInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BuildDynRegExpInstr.java | |
@@ -78,12 +78,12 @@ public class BuildDynRegExpInstr extends NOperandResultBaseInstr { | |
return new BuildDynRegExpInstr(ii.getRenamedVariable(result), cloneOperands(ii), options, this.reCache); | |
} | |
- private RubyString[] retrievePieces(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ private RubyString[] retrievePieces(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
Operand[] operands = getOperands(); | |
int length = operands.length; | |
RubyString[] strings = new RubyString[length]; | |
for (int i = 0; i < length; i++) { | |
- strings[i] = (RubyString) operands[i].retrieve(context, self, currScope, currDynScope, temp); | |
+ strings[i] = (RubyString) operands[i].retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
} | |
return strings; | |
} | |
@@ -101,11 +101,11 @@ public class BuildDynRegExpInstr extends NOperandResultBaseInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
// FIXME (from RegexpNode.java): 1.9 should care about internal or external encoding and not kcode. | |
// If we have a constant regexp string or if the regexp patterns asks for caching, cache the regexp | |
if (reCache.rubyRegexp == null || !options.isOnce() || context.runtime.getKCode() != reCache.rubyRegexp.getKCode()) { | |
- RubyString[] pieces = retrievePieces(context, self, currScope, currDynScope, temp); | |
+ RubyString[] pieces = retrievePieces(context, self, currScope, currDynScope, temp, tempOff); | |
RubyString pattern = RubyRegexp.preprocessDRegexp(context.runtime, pieces, options); | |
RubyRegexp re = RubyRegexp.newDRegexp(context.runtime, pattern, options); | |
re.setLiteral(); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BuildLambdaInstr.java b/core/src/main/java/org/jruby/ir/instructions/BuildLambdaInstr.java | |
index 2ce8bf4da3..8c9ec6e7ac 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BuildLambdaInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BuildLambdaInstr.java | |
@@ -71,7 +71,7 @@ public class BuildLambdaInstr extends OneOperandResultBaseInstr implements Fixed | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
// SSS FIXME: Copied this from ast/LambdaNode ... Is this required here as well? | |
// | |
// JRUBY-5686: do this before executing so first time sets cref module | |
@@ -80,7 +80,7 @@ public class BuildLambdaInstr extends OneOperandResultBaseInstr implements Fixed | |
// CON: This must not be happening, because nil would never cast to Block | |
// IRClosure body = getLambdaBody().getClosure(); | |
// Block block = (Block) (body == null ? context.runtime.getIRManager().getNil() : getLambdaBody()).retrieve(context, self, currScope, currDynScope, temp); | |
- Block block = (Block)getLambdaBody().retrieve(context, self, currScope, currDynScope, temp); | |
+ Block block = (Block)getLambdaBody().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
// ENEBO: Now can live nil be passed as block reference? | |
// SSS FIXME: Should we do the same %self retrieval as in the case of WrappedIRClosure? Or are lambdas special?? | |
return RubyProc.newProc(context.runtime, block, Block.Type.LAMBDA, getFile(), getLine()); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BuildRangeInstr.java b/core/src/main/java/org/jruby/ir/instructions/BuildRangeInstr.java | |
index c5c625a8fa..a8e08bf135 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BuildRangeInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BuildRangeInstr.java | |
@@ -63,10 +63,10 @@ public class BuildRangeInstr extends TwoOperandResultBaseInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
return RubyRange.newRange(context, | |
- (IRubyObject) getBegin().retrieve(context, self, currScope, currDynScope, temp), | |
- (IRubyObject) getEnd().retrieve(context, self, currScope, currDynScope, temp), exclusive); | |
+ (IRubyObject) getBegin().retrieve(context, self, currScope, currDynScope, temp, tempOff), | |
+ (IRubyObject) getEnd().retrieve(context, self, currScope, currDynScope, temp, tempOff), exclusive); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/BuildSplatInstr.java b/core/src/main/java/org/jruby/ir/instructions/BuildSplatInstr.java | |
index 2ef85aefb3..d88603bb08 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/BuildSplatInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/BuildSplatInstr.java | |
@@ -38,9 +38,9 @@ public class BuildSplatInstr extends OneOperandResultBaseInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
return IRRuntimeHelpers.splatArray(context, | |
- (IRubyObject) getArray().retrieve(context, self, currScope, currDynScope, temp), getDup()); | |
+ (IRubyObject) getArray().retrieve(context, self, currScope, currDynScope, temp, tempOff), getDup()); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/CallBase.java b/core/src/main/java/org/jruby/ir/instructions/CallBase.java | |
index fafd77ec5b..f38fc3d57a 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/CallBase.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/CallBase.java | |
@@ -528,10 +528,10 @@ public abstract class CallBase extends NOperandInstr implements ClosureAccepting | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject[] values = prepareArguments(context, self, currScope, dynamicScope, temp); | |
- Block preparedBlock = prepareBlock(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject[] values = prepareArguments(context, self, currScope, dynamicScope, temp, tempOff); | |
+ Block preparedBlock = prepareBlock(context, self, currScope, dynamicScope, temp, tempOff); | |
if (hasLiteralClosure()) { | |
return callSite.callIter(context, self, object, values, preparedBlock); | |
@@ -540,23 +540,23 @@ public abstract class CallBase extends NOperandInstr implements ClosureAccepting | |
return callSite.call(context, self, object, values, preparedBlock); | |
} | |
- protected IRubyObject[] prepareArguments(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope dynamicScope, Object[] temp) { | |
+ protected IRubyObject[] prepareArguments(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope dynamicScope, Object[] temp, int tempOff) { | |
return splatMap != null ? | |
- prepareArgumentsComplex(context, self, currScope, dynamicScope, temp) : | |
- prepareArgumentsSimple(context, self, currScope, dynamicScope, temp); | |
+ prepareArgumentsComplex(context, self, currScope, dynamicScope, temp, tempOff) : | |
+ prepareArgumentsSimple(context, self, currScope, dynamicScope, temp, tempOff); | |
} | |
- protected IRubyObject[] prepareArgumentsSimple(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ protected IRubyObject[] prepareArgumentsSimple(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
IRubyObject[] newArgs = new IRubyObject[argsCount]; | |
for (int i = 0; i < argsCount; i++) { // receiver is operands[0] | |
- newArgs[i] = (IRubyObject) operands[i+1].retrieve(context, self, currScope, currDynScope, temp); | |
+ newArgs[i] = (IRubyObject) operands[i+1].retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
} | |
return newArgs; | |
} | |
- protected IRubyObject[] prepareArgumentsComplex(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ protected IRubyObject[] prepareArgumentsComplex(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
// ENEBO: we can probably do this more efficiently than using ArrayList | |
// SSS: For regular calls, IR builder never introduces splats except as the first argument | |
// But when zsuper is converted to SuperInstr with known args, splats can appear anywhere | |
@@ -566,17 +566,17 @@ public abstract class CallBase extends NOperandInstr implements ClosureAccepting | |
// CON: Using same logic as super splatting, but this will at least only allocate at | |
// most two "carrier" arrays. | |
return IRRuntimeHelpers.splatArguments( | |
- prepareArgumentsSimple(context, self, currScope, currDynScope, temp), | |
+ prepareArgumentsSimple(context, self, currScope, currDynScope, temp, tempOff), | |
splatMap); | |
} | |
- public Block prepareBlock(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Block prepareBlock(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
if (getClosureArg() == null) return Block.NULL_BLOCK; | |
if (potentiallyRefined) { | |
- return IRRuntimeHelpers.getRefinedBlockFromObject(context, currScope, getClosureArg().retrieve(context, self, currScope, currDynScope, temp)); | |
+ return IRRuntimeHelpers.getRefinedBlockFromObject(context, currScope, getClosureArg().retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
} else { | |
- return IRRuntimeHelpers.getBlockFromObject(context, getClosureArg().retrieve(context, self, currScope, currDynScope, temp)); | |
+ return IRRuntimeHelpers.getBlockFromObject(context, getClosureArg().retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
} | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/CheckArgsArrayArityInstr.java b/core/src/main/java/org/jruby/ir/instructions/CheckArgsArrayArityInstr.java | |
index 1431d2d190..abfc146310 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/CheckArgsArrayArityInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/CheckArgsArrayArityInstr.java | |
@@ -54,8 +54,8 @@ public class CheckArgsArrayArityInstr extends OneOperandInstr implements FixedAr | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- RubyArray args = (RubyArray) getArgsArray().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ RubyArray args = (RubyArray) getArgsArray().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
Helpers.irCheckArgsArrayArity(context, args, required, opt, rest); | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ClassSuperInstr.java b/core/src/main/java/org/jruby/ir/instructions/ClassSuperInstr.java | |
index 107d5bb43f..415b1ef430 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ClassSuperInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ClassSuperInstr.java | |
@@ -1,7 +1,6 @@ | |
package org.jruby.ir.instructions; | |
import org.jruby.RubyInstanceConfig; | |
-import org.jruby.RubyModule; | |
import org.jruby.RubySymbol; | |
import org.jruby.ir.IRFlags; | |
import org.jruby.ir.IRScope; | |
@@ -79,9 +78,9 @@ public class ClassSuperInstr extends CallInstr { | |
*/ | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp); | |
- Block block = prepareBlock(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp, tempOff); | |
+ Block block = prepareBlock(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.unresolvedSuper(context, self, args, block); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ConstMissingInstr.java b/core/src/main/java/org/jruby/ir/instructions/ConstMissingInstr.java | |
index bc586c769f..1c6299a2d2 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ConstMissingInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ConstMissingInstr.java | |
@@ -77,8 +77,8 @@ public class ConstMissingInstr extends CallInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- RubyModule module = (RubyModule) getReceiver().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ RubyModule module = (RubyModule) getReceiver().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return module.callMethod(context, "const_missing", missingConst); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/DefineClassInstr.java b/core/src/main/java/org/jruby/ir/instructions/DefineClassInstr.java | |
index edffec4371..9304b63d89 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/DefineClassInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/DefineClassInstr.java | |
@@ -1,8 +1,6 @@ | |
package org.jruby.ir.instructions; | |
-import org.jruby.RubyClass; | |
import org.jruby.RubyModule; | |
-import org.jruby.internal.runtime.methods.InterpretedIRBodyMethod; | |
import org.jruby.ir.IRClassBody; | |
import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.Operation; | |
@@ -67,9 +65,9 @@ public class DefineClassInstr extends TwoOperandResultBaseInstr implements Fixed | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Object container = getContainer().retrieve(context, self, currScope, currDynScope, temp); | |
- Object superClass = getSuperClass().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Object container = getContainer().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ Object superClass = getSuperClass().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
RubyModule clazz = IRRuntimeHelpers.newRubyClassFromIR(context.runtime, body, superClass, container); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/DefineClassMethodInstr.java b/core/src/main/java/org/jruby/ir/instructions/DefineClassMethodInstr.java | |
index c8076c4775..3f0b0be51c 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/DefineClassMethodInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/DefineClassMethodInstr.java | |
@@ -53,8 +53,8 @@ public class DefineClassMethodInstr extends OneOperandInstr implements FixedArit | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject obj = (IRubyObject) getContainer().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject obj = (IRubyObject) getContainer().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
IRRuntimeHelpers.defInterpretedClassMethod(context, method, obj); | |
return null; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/DefineInstanceMethodInstr.java b/core/src/main/java/org/jruby/ir/instructions/DefineInstanceMethodInstr.java | |
index 519cfeba75..84c9b7393c 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/DefineInstanceMethodInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/DefineInstanceMethodInstr.java | |
@@ -52,7 +52,7 @@ public class DefineInstanceMethodInstr extends NoOperandInstr implements FixedAr | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
IRRuntimeHelpers.defInterpretedInstanceMethod(context, method, currDynScope, self); | |
return null; // unused; symbol is propagated | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/DefineMetaClassInstr.java b/core/src/main/java/org/jruby/ir/instructions/DefineMetaClassInstr.java | |
index e90e237bd9..8ff4f18402 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/DefineMetaClassInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/DefineMetaClassInstr.java | |
@@ -65,10 +65,10 @@ public class DefineMetaClassInstr extends OneOperandResultBaseInstr implements F | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
Ruby runtime = context.runtime; | |
- IRubyObject obj = (IRubyObject) getObject().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject obj = (IRubyObject) getObject().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.newInterpretedMetaClass(runtime, metaClassBody, obj); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/DefineModuleInstr.java b/core/src/main/java/org/jruby/ir/instructions/DefineModuleInstr.java | |
index c4a254d8c1..4831908049 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/DefineModuleInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/DefineModuleInstr.java | |
@@ -59,8 +59,8 @@ public class DefineModuleInstr extends OneOperandResultBaseInstr implements Fixe | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Object container = getContainer().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Object container = getContainer().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
RubyModule clazz = IRRuntimeHelpers.newRubyModuleFromIR(context, body, container); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/EQQInstr.java b/core/src/main/java/org/jruby/ir/instructions/EQQInstr.java | |
index e98cba605d..07f3e9c68d 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/EQQInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/EQQInstr.java | |
@@ -82,9 +82,9 @@ public class EQQInstr extends CallInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject recv = (IRubyObject) getReceiver().retrieve(context, self, currScope, currDynScope, temp); | |
- IRubyObject value = (IRubyObject) getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject recv = (IRubyObject) getReceiver().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ IRubyObject value = (IRubyObject) getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.isEQQ(context, recv, value, callSite, isSplattedValue()); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/GVarAliasInstr.java b/core/src/main/java/org/jruby/ir/instructions/GVarAliasInstr.java | |
index 2dc918fe28..07932d0e1b 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/GVarAliasInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/GVarAliasInstr.java | |
@@ -41,9 +41,9 @@ public class GVarAliasInstr extends TwoOperandInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- String newNameString = getNewName().retrieve(context, self, currScope, currDynScope, temp).toString(); | |
- String oldNameString = getOldName().retrieve(context, self, currScope, currDynScope, temp).toString(); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ String newNameString = getNewName().retrieve(context, self, currScope, currDynScope, temp, tempOff).toString(); | |
+ String oldNameString = getOldName().retrieve(context, self, currScope, currDynScope, temp, tempOff).toString(); | |
context.runtime.getGlobalVariables().alias(newNameString, oldNameString); | |
return null; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/GetClassVarContainerModuleInstr.java b/core/src/main/java/org/jruby/ir/instructions/GetClassVarContainerModuleInstr.java | |
index 778a1b2170..fc7a4cd745 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/GetClassVarContainerModuleInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/GetClassVarContainerModuleInstr.java | |
@@ -54,10 +54,10 @@ public class GetClassVarContainerModuleInstr extends NOperandResultBaseInstr imp | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- StaticScope scope = (StaticScope) getStartingScope().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ StaticScope scope = (StaticScope) getStartingScope().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
Operand object = getObject(); | |
- IRubyObject arg = object == null ? null : (IRubyObject) object.retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject arg = object == null ? null : (IRubyObject) object.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.getModuleFromScope(context, scope, arg); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/GetClassVariableInstr.java b/core/src/main/java/org/jruby/ir/instructions/GetClassVariableInstr.java | |
index 4f4f28280f..8193313cd4 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/GetClassVariableInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/GetClassVariableInstr.java | |
@@ -29,8 +29,8 @@ public class GetClassVariableInstr extends GetInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- return ((RubyModule) getSource().retrieve(context, self, currScope, currDynScope, temp)).getClassVar(getId()); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ return ((RubyModule) getSource().retrieve(context, self, currScope, currDynScope, temp, tempOff)).getClassVar(getId()); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/GetEncodingInstr.java b/core/src/main/java/org/jruby/ir/instructions/GetEncodingInstr.java | |
index 6722f8d662..a3a8dbbd9f 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/GetEncodingInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/GetEncodingInstr.java | |
@@ -36,7 +36,7 @@ public class GetEncodingInstr extends NoOperandResultBaseInstr implements FixedA | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
return context.runtime.getEncodingService().getEncoding(encoding); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/GetFieldInstr.java b/core/src/main/java/org/jruby/ir/instructions/GetFieldInstr.java | |
index 3bd3088cc9..8983bb3c22 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/GetFieldInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/GetFieldInstr.java | |
@@ -48,8 +48,8 @@ public class GetFieldInstr extends GetInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getSource().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getSource().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
VariableAccessor a = getAccessor(object); | |
Object result = a == null ? null : (IRubyObject)a.get(object); | |
if (result == null) { | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/GetGlobalVariableInstr.java b/core/src/main/java/org/jruby/ir/instructions/GetGlobalVariableInstr.java | |
index cec5c63ec8..961e94bf2b 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/GetGlobalVariableInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/GetGlobalVariableInstr.java | |
@@ -59,8 +59,8 @@ public class GetGlobalVariableInstr extends OneOperandResultBaseInstr implement | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- return getTarget().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ return getTarget().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/InheritanceSearchConstInstr.java b/core/src/main/java/org/jruby/ir/instructions/InheritanceSearchConstInstr.java | |
index ea843cb22f..a984f001b2 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/InheritanceSearchConstInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/InheritanceSearchConstInstr.java | |
@@ -87,8 +87,8 @@ public class InheritanceSearchConstInstr extends OneOperandResultBaseInstr imple | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Object cmVal = getCurrentModule().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Object cmVal = getCurrentModule().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
if (!(cmVal instanceof RubyModule)) throw context.runtime.newTypeError(cmVal + " is not a type/class"); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/InstanceSuperInstr.java b/core/src/main/java/org/jruby/ir/instructions/InstanceSuperInstr.java | |
index 003db26669..d3f4a14ce7 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/InstanceSuperInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/InstanceSuperInstr.java | |
@@ -76,10 +76,10 @@ public class InstanceSuperInstr extends CallInstr { | |
*/ | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp); | |
- Block block = prepareBlock(context, self, currScope, currDynScope, temp); | |
- RubyModule definingModule = ((RubyModule) getDefiningModule().retrieve(context, self, currScope, currDynScope, temp)); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp, tempOff); | |
+ Block block = prepareBlock(context, self, currScope, currDynScope, temp, tempOff); | |
+ RubyModule definingModule = ((RubyModule) getDefiningModule().retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
return IRRuntimeHelpers.instanceSuper(context, self, getId(), definingModule, args, block); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/Instr.java b/core/src/main/java/org/jruby/ir/instructions/Instr.java | |
index 835654ce67..c4a480f2f7 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/Instr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/Instr.java | |
@@ -284,12 +284,12 @@ public abstract class Instr { | |
} | |
@Interp | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
throw new RuntimeException(this.getClass().getSimpleName() + " should not be directly interpreted"); | |
} | |
@Interp | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
throw new RuntimeException(this.getClass().getSimpleName() + " should not be directly interpreted"); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/LexicalSearchConstInstr.java b/core/src/main/java/org/jruby/ir/instructions/LexicalSearchConstInstr.java | |
index b9606ae366..e63eb496fc 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/LexicalSearchConstInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/LexicalSearchConstInstr.java | |
@@ -68,8 +68,8 @@ public class LexicalSearchConstInstr extends OneOperandResultBaseInstr implement | |
return new LexicalSearchConstInstr(d.decodeVariable(), d.decodeOperand(), d.decodeSymbol()); | |
} | |
- private Object cache(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- StaticScope staticScope = (StaticScope) getDefiningScope().retrieve(context, self, currScope, currDynScope, temp); | |
+ private Object cache(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ StaticScope staticScope = (StaticScope) getDefiningScope().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
String id = getId(); | |
IRubyObject constant = staticScope.getConstantDefined(id); | |
@@ -86,9 +86,9 @@ public class LexicalSearchConstInstr extends OneOperandResultBaseInstr implement | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
ConstantCache cache = this.cache; // Store to temp so it does null out on us mid-stream | |
- if (!ConstantCache.isCached(cache)) return cache(context, currScope, currDynScope, self, temp); | |
+ if (!ConstantCache.isCached(cache)) return cache(context, currScope, currDynScope, self, temp, tempOff); | |
return cache.value; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/LoadLocalVarInstr.java b/core/src/main/java/org/jruby/ir/instructions/LoadLocalVarInstr.java | |
index 7628f051b2..42b6e9f2cc 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/LoadLocalVarInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/LoadLocalVarInstr.java | |
@@ -75,8 +75,8 @@ public class LoadLocalVarInstr extends OneOperandResultBaseInstr implements Fixe | |
@Interp | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- return getLocalVar().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ return getLocalVar().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ModuleVersionGuardInstr.java b/core/src/main/java/org/jruby/ir/instructions/ModuleVersionGuardInstr.java | |
index ed9b3212de..cac87ed372 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ModuleVersionGuardInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ModuleVersionGuardInstr.java | |
@@ -56,8 +56,8 @@ public class ModuleVersionGuardInstr extends TwoOperandInstr implements FixedAri | |
ii.getRenamedLabel(getFailurePathLabel())); | |
} | |
- private boolean versionMatches(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject receiver = (IRubyObject) getCandidateObject().retrieve(context, self, currScope, currDynScope, temp); | |
+ private boolean versionMatches(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject receiver = (IRubyObject) getCandidateObject().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
// if (module.getGeneration() != expectedVersion) ... replace this instr with a direct jump | |
// | |
// SSS FIXME: This is not always correct. Implementation class is not always receiver.getMetaClass() | |
@@ -67,8 +67,8 @@ public class ModuleVersionGuardInstr extends TwoOperandInstr implements FixedAri | |
} | |
@Override | |
- public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { | |
- return versionMatches(context, currScope, currDynScope, self, temp) ? ipc : getFailurePathLabel().getTargetPC(); | |
+ public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int tempOff, int ipc) { | |
+ return versionMatches(context, currScope, currDynScope, self, temp, tempOff) ? ipc : getFailurePathLabel().getTargetPC(); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/NopInstr.java b/core/src/main/java/org/jruby/ir/instructions/NopInstr.java | |
index 10466e0b11..689b32b338 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/NopInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/NopInstr.java | |
@@ -22,7 +22,7 @@ public class NopInstr extends NoOperandInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/OptArgMultipleAsgnInstr.java b/core/src/main/java/org/jruby/ir/instructions/OptArgMultipleAsgnInstr.java | |
index 7377428bad..291626888d 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/OptArgMultipleAsgnInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/OptArgMultipleAsgnInstr.java | |
@@ -54,9 +54,9 @@ public class OptArgMultipleAsgnInstr extends MultipleAsgnBase implements FixedAr | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
// ENEBO: Can I assume since IR figured this is an internal array it will be RubyArray like this? | |
- RubyArray rubyArray = (RubyArray) getArray().retrieve(context, self, currScope, currDynScope, temp); | |
+ RubyArray rubyArray = (RubyArray) getArray().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.extractOptionalArgument(rubyArray, minArgsLength, index); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ProcessModuleBodyInstr.java b/core/src/main/java/org/jruby/ir/instructions/ProcessModuleBodyInstr.java | |
index 369b533863..9d0efc3037 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ProcessModuleBodyInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ProcessModuleBodyInstr.java | |
@@ -48,9 +48,9 @@ public class ProcessModuleBodyInstr extends TwoOperandResultBaseInstr implements | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- InterpretedIRBodyMethod bodyMethod = (InterpretedIRBodyMethod) getModuleBody().retrieve(context, self, currScope, currDynScope, temp); | |
- Block b = (Block) getBlock().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ InterpretedIRBodyMethod bodyMethod = (InterpretedIRBodyMethod) getModuleBody().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ Block b = (Block) getBlock().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
RubyModule implClass = bodyMethod.getImplementationClass(); | |
return bodyMethod.call(context, implClass, implClass, null, b); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/PutClassVariableInstr.java b/core/src/main/java/org/jruby/ir/instructions/PutClassVariableInstr.java | |
index 19c6f32d95..d1316a2eef 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/PutClassVariableInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/PutClassVariableInstr.java | |
@@ -25,9 +25,9 @@ public class PutClassVariableInstr extends PutInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- RubyModule module = (RubyModule) getTarget().retrieve(context, self, currScope, currDynScope, temp); | |
- IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ RubyModule module = (RubyModule) getTarget().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
assert module != null : "MODULE should always be something"; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/PutConstInstr.java b/core/src/main/java/org/jruby/ir/instructions/PutConstInstr.java | |
index 32d01b1715..d12432b7a9 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/PutConstInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/PutConstInstr.java | |
@@ -24,9 +24,9 @@ public class PutConstInstr extends PutInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp); | |
- RubyModule module = (RubyModule) getTarget().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ RubyModule module = (RubyModule) getTarget().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
assert module != null : "MODULE should always be something"; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/PutFieldInstr.java b/core/src/main/java/org/jruby/ir/instructions/PutFieldInstr.java | |
index c7638e3096..d4906dad2d 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/PutFieldInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/PutFieldInstr.java | |
@@ -37,11 +37,11 @@ public class PutFieldInstr extends PutInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getTarget().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getTarget().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
VariableAccessor a = getAccessor(object); | |
- Object value = getValue().retrieve(context, self, currScope, currDynScope, temp); | |
+ Object value = getValue().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
a.set(object, value); | |
return null; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/PutGlobalVarInstr.java b/core/src/main/java/org/jruby/ir/instructions/PutGlobalVarInstr.java | |
index b1cca8dfac..658aa57315 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/PutGlobalVarInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/PutGlobalVarInstr.java | |
@@ -65,9 +65,9 @@ public class PutGlobalVarInstr extends TwoOperandInstr implements FixedArityInst | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
GlobalVariable target = getTarget(); | |
- IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
context.runtime.getGlobalVariables().set(target.getId(), value); | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/RaiseArgumentErrorInstr.java b/core/src/main/java/org/jruby/ir/instructions/RaiseArgumentErrorInstr.java | |
index 3ca0ad30fd..5fdf23e64d 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/RaiseArgumentErrorInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/RaiseArgumentErrorInstr.java | |
@@ -66,7 +66,7 @@ public class RaiseArgumentErrorInstr extends NoOperandInstr implements FixedArit | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
Arity.raiseArgumentError(context.runtime, numArgs, required, required + opt); | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/RaiseRequiredKeywordArgumentError.java b/core/src/main/java/org/jruby/ir/instructions/RaiseRequiredKeywordArgumentError.java | |
index 6069145398..88ff7af18e 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/RaiseRequiredKeywordArgumentError.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/RaiseRequiredKeywordArgumentError.java | |
@@ -46,7 +46,7 @@ public class RaiseRequiredKeywordArgumentError extends NoOperandInstr implements | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
throw IRRuntimeHelpers.newRequiredKeywordArgumentError(context, name.idString()); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/RecordEndBlockInstr.java b/core/src/main/java/org/jruby/ir/instructions/RecordEndBlockInstr.java | |
index 20b39a052c..efcb76b86d 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/RecordEndBlockInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/RecordEndBlockInstr.java | |
@@ -56,8 +56,8 @@ public class RecordEndBlockInstr extends OneOperandInstr implements FixedArityIn | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Block blk = (Block) getEndBlockClosure().retrieve(context, self, currScope, context.getCurrentScope(), temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Block blk = (Block) getEndBlockClosure().retrieve(context, self, currScope, context.getCurrentScope(), temp, tempOff); | |
IRRuntimeHelpers.pushExitBlock(context, blk); | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ReifyClosureInstr.java b/core/src/main/java/org/jruby/ir/instructions/ReifyClosureInstr.java | |
index 7610ca30cd..7f12536ec2 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ReifyClosureInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ReifyClosureInstr.java | |
@@ -5,7 +5,6 @@ import org.jruby.ir.IRScope; | |
import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.Operation; | |
import org.jruby.ir.operands.Variable; | |
-import org.jruby.ir.operands.WrappedIRClosure; | |
import org.jruby.ir.persistence.IRReaderDecoder; | |
import org.jruby.ir.persistence.IRWriterEncoder; | |
import org.jruby.ir.runtime.IRRuntimeHelpers; | |
@@ -56,8 +55,8 @@ public class ReifyClosureInstr extends OneOperandResultBaseInstr implements Fixe | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Block block = (Block) getSource().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Block block = (Block) getSource().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.newProc(context.runtime, block); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ReqdArgMultipleAsgnInstr.java b/core/src/main/java/org/jruby/ir/instructions/ReqdArgMultipleAsgnInstr.java | |
index d15388df18..cfcbf2015a 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ReqdArgMultipleAsgnInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ReqdArgMultipleAsgnInstr.java | |
@@ -73,9 +73,9 @@ public class ReqdArgMultipleAsgnInstr extends MultipleAsgnBase implements FixedA | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
// ENEBO: Can I assume since IR figured this is an internal array it will be RubyArray like this? | |
- RubyArray rubyArray = (RubyArray) getArray().retrieve(context, self, currScope, currDynScope, temp); | |
+ RubyArray rubyArray = (RubyArray) getArray().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.irReqdArgMultipleAsgn(context, rubyArray, preArgsCount, index, postArgsCount); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/RescueEQQInstr.java b/core/src/main/java/org/jruby/ir/instructions/RescueEQQInstr.java | |
index 5fa8e103b8..3233f25bfd 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/RescueEQQInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/RescueEQQInstr.java | |
@@ -51,9 +51,9 @@ public class RescueEQQInstr extends TwoOperandResultBaseInstr implements FixedAr | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject excType = (IRubyObject) getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
- Object excObj = getArg2().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject excType = (IRubyObject) getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ Object excObj = getArg2().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.isExceptionHandled(context, excType, excObj); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/RestArgMultipleAsgnInstr.java b/core/src/main/java/org/jruby/ir/instructions/RestArgMultipleAsgnInstr.java | |
index ac174b5154..eca2cff69f 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/RestArgMultipleAsgnInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/RestArgMultipleAsgnInstr.java | |
@@ -60,9 +60,9 @@ public class RestArgMultipleAsgnInstr extends MultipleAsgnBase implements FixedA | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
// ENEBO: Can I assume since IR figured this is an internal array it will be RubyArray like this? | |
- RubyArray rubyArray = (RubyArray) getArray().retrieve(context, self, currScope, currDynScope, temp); | |
+ RubyArray rubyArray = (RubyArray) getArray().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return Helpers.viewArgsArray(context, rubyArray, preArgsCount, postArgsCount); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/RuntimeHelperCall.java b/core/src/main/java/org/jruby/ir/instructions/RuntimeHelperCall.java | |
index b9501f6d28..1c87cb3357 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/RuntimeHelperCall.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/RuntimeHelperCall.java | |
@@ -1,8 +1,6 @@ | |
package org.jruby.ir.instructions; | |
import org.jruby.RubyModule; | |
-import org.jruby.ir.runtime.IRReturnJump; | |
-import org.jruby.ir.runtime.IRBreakJump; | |
import org.jruby.ir.IRScope; | |
import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.Operation; | |
@@ -88,13 +86,13 @@ public class RuntimeHelperCall extends NOperandResultBaseInstr { | |
return new String[] { "method: " + helperMethod}; | |
} | |
- public IRubyObject callHelper(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { | |
+ public IRubyObject callHelper(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff, Block block) { | |
Operand[] operands = getOperands(); | |
if (helperMethod == Methods.IS_DEFINED_BACKREF) { | |
return IRRuntimeHelpers.isDefinedBackref( | |
context, | |
- (IRubyObject) operands[0].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[0].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
} | |
switch (helperMethod) { | |
@@ -102,15 +100,15 @@ public class RuntimeHelperCall extends NOperandResultBaseInstr { | |
return IRRuntimeHelpers.isDefinedNthRef( | |
context, | |
(int) ((Fixnum) operands[0]).getValue(), | |
- (IRubyObject) operands[1].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[1].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case IS_DEFINED_GLOBAL: | |
return IRRuntimeHelpers.isDefinedGlobal( | |
context, | |
((Stringable) operands[0]).getString(), | |
- (IRubyObject) operands[1].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[1].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
} | |
- Object arg1 = operands[0].retrieve(context, self, currScope, currDynScope, temp); | |
+ Object arg1 = operands[0].retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
switch (helperMethod) { | |
case HANDLE_PROPAGATED_BREAK: | |
@@ -125,39 +123,39 @@ public class RuntimeHelperCall extends NOperandResultBaseInstr { | |
self, | |
(IRubyObject) arg1, | |
((Stringable) operands[1]).getString(), | |
- (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case IS_DEFINED_CONSTANT_OR_METHOD: | |
return IRRuntimeHelpers.isDefinedConstantOrMethod( | |
context, | |
(IRubyObject) arg1, | |
((FrozenString) operands[1]).getString(), | |
- (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp), | |
- (IRubyObject) operands[3].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp, tempOff), | |
+ (IRubyObject) operands[3].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case IS_DEFINED_INSTANCE_VAR: | |
return IRRuntimeHelpers.isDefinedInstanceVar( | |
context, | |
(IRubyObject) arg1, | |
((Stringable) operands[1]).getString(), | |
- (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case IS_DEFINED_CLASS_VAR: | |
return IRRuntimeHelpers.isDefinedClassVar( | |
context, | |
(RubyModule) arg1, | |
((Stringable) operands[1]).getString(), | |
- (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[2].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case IS_DEFINED_SUPER: | |
return IRRuntimeHelpers.isDefinedSuper( | |
context, | |
(IRubyObject) arg1, | |
- (IRubyObject) operands[1].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[1].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case IS_DEFINED_METHOD: | |
return IRRuntimeHelpers.isDefinedMethod(context, (IRubyObject) arg1, | |
((Stringable) operands[1]).getString(), | |
((Boolean) operands[2]).isTrue(), | |
- (IRubyObject) operands[3].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) operands[3].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case MERGE_KWARGS: | |
return IRRuntimeHelpers.mergeKeywordArguments(context, (IRubyObject) arg1, | |
- (IRubyObject) getArgs()[1].retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) getArgs()[1].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
} | |
throw new RuntimeException("Unknown IR runtime helper method: " + helperMethod + "; INSTR: " + this); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/SearchConstInstr.java b/core/src/main/java/org/jruby/ir/instructions/SearchConstInstr.java | |
index d4cd7799e5..2149ec100a 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/SearchConstInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/SearchConstInstr.java | |
@@ -80,12 +80,12 @@ public class SearchConstInstr extends OneOperandResultBaseInstr implements Fixed | |
return cache; | |
} | |
- public Object cache(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object cache(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
// Lexical lookup | |
Ruby runtime = context.getRuntime(); | |
RubyModule object = runtime.getObject(); | |
String id = getId(); | |
- StaticScope staticScope = (StaticScope) getStartingScope().retrieve(context, self, currScope, currDynScope, temp); | |
+ StaticScope staticScope = (StaticScope) getStartingScope().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
Object constant = (staticScope == null) ? object.getConstant(id) : staticScope.getConstantInner(id); | |
// Inheritance lookup | |
@@ -109,9 +109,9 @@ public class SearchConstInstr extends OneOperandResultBaseInstr implements Fixed | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
ConstantCache cache = this.cache; | |
- if (!ConstantCache.isCached(cache)) return cache(context, currScope, currDynScope, self, temp); | |
+ if (!ConstantCache.isCached(cache)) return cache(context, currScope, currDynScope, self, temp, tempOff); | |
return cache.value; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/SearchModuleForConstInstr.java b/core/src/main/java/org/jruby/ir/instructions/SearchModuleForConstInstr.java | |
index 18947f3004..bee82b6872 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/SearchModuleForConstInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/SearchModuleForConstInstr.java | |
@@ -99,8 +99,8 @@ public class SearchModuleForConstInstr extends OneOperandResultBaseInstr impleme | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Object cmVal = getCurrentModule().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Object cmVal = getCurrentModule().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
if (!(cmVal instanceof RubyModule)) throw context.runtime.newTypeError(cmVal + " is not a type/class"); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/SetCapturedVarInstr.java b/core/src/main/java/org/jruby/ir/instructions/SetCapturedVarInstr.java | |
index dc6e3f7a31..662f16fa5f 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/SetCapturedVarInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/SetCapturedVarInstr.java | |
@@ -61,8 +61,8 @@ public class SetCapturedVarInstr extends OneOperandResultBaseInstr implements Fi | |
@Interp | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject matchRes = (IRubyObject) getMatch2Result().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject matchRes = (IRubyObject) getMatch2Result().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
// FIXME: Add ByteList helper | |
return IRRuntimeHelpers.setCapturedVar(context, matchRes, getId()); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/StoreLocalVarInstr.java b/core/src/main/java/org/jruby/ir/instructions/StoreLocalVarInstr.java | |
index 64966920ce..75961e5d1d 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/StoreLocalVarInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/StoreLocalVarInstr.java | |
@@ -78,8 +78,8 @@ public class StoreLocalVarInstr extends TwoOperandInstr implements FixedArityIns | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Object varValue = getValue().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Object varValue = getValue().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
currDynScope.setValue((IRubyObject)varValue, getLocalVar().getLocation(), getLocalVar().getScopeDepth()); | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ThreadPollInstr.java b/core/src/main/java/org/jruby/ir/instructions/ThreadPollInstr.java | |
index 38c834e85a..6c2b01dbe9 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ThreadPollInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ThreadPollInstr.java | |
@@ -45,7 +45,7 @@ public class ThreadPollInstr extends NoOperandInstr implements FixedArityInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
if (IRRuntimeHelpers.inProfileMode()) Profiler.clockTick(); | |
context.callThreadPoll(); | |
return null; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ThrowExceptionInstr.java b/core/src/main/java/org/jruby/ir/instructions/ThrowExceptionInstr.java | |
index d1d8f9cb8a..d59a21ae05 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ThrowExceptionInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ThrowExceptionInstr.java | |
@@ -42,12 +42,12 @@ public class ThrowExceptionInstr extends OneOperandInstr implements FixedArityIn | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
if (getException() instanceof IRException) { | |
throw ((IRException) getException()).getException(context.runtime); | |
} | |
- Object excObj = getException().retrieve(context, self, currScope, currDynScope, temp); | |
+ Object excObj = getException().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
if (excObj instanceof IRubyObject) { | |
RubyKernel.raise(context, context.runtime.getKernel(), new IRubyObject[] {(IRubyObject)excObj}, Block.NULL_BLOCK); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ToAryInstr.java b/core/src/main/java/org/jruby/ir/instructions/ToAryInstr.java | |
index 4b520b7233..41eb42a5df 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ToAryInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ToAryInstr.java | |
@@ -60,9 +60,9 @@ public class ToAryInstr extends OneOperandResultBaseInstr implements FixedArityI | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
return IRRuntimeHelpers.irToAry(context, | |
- (IRubyObject) getArray().retrieve(context, self, currScope, currDynScope, temp)); | |
+ (IRubyObject) getArray().retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/TraceInstr.java b/core/src/main/java/org/jruby/ir/instructions/TraceInstr.java | |
index a792bd2ab7..849809f3c9 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/TraceInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/TraceInstr.java | |
@@ -77,7 +77,7 @@ public class TraceInstr extends NoOperandInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
IRRuntimeHelpers.callTrace(context, getEvent(), getName(), getFilename(), getLinenumber()); | |
return null; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/UndefMethodInstr.java b/core/src/main/java/org/jruby/ir/instructions/UndefMethodInstr.java | |
index 0f931f6ca6..81df89b81f 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/UndefMethodInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/UndefMethodInstr.java | |
@@ -48,9 +48,9 @@ public class UndefMethodInstr extends OneOperandResultBaseInstr implements Fixed | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
RubyModule module = IRRuntimeHelpers.findInstanceMethodContainer(context, currDynScope, self); | |
- Object nameArg = getMethodName().retrieve(context, self, currScope, currDynScope, temp); | |
+ Object nameArg = getMethodName().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
String name = (nameArg instanceof String) ? (String) nameArg : nameArg.toString(); | |
module.undef(context, name); | |
return context.nil; | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/UnresolvedSuperInstr.java b/core/src/main/java/org/jruby/ir/instructions/UnresolvedSuperInstr.java | |
index 1d34eb615c..7736de03a7 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/UnresolvedSuperInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/UnresolvedSuperInstr.java | |
@@ -96,9 +96,9 @@ public class UnresolvedSuperInstr extends CallInstr { | |
*/ | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp); | |
- Block block = prepareBlock(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp, tempOff); | |
+ Block block = prepareBlock(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.unresolvedSuper(context, self, args, block); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/YieldInstr.java b/core/src/main/java/org/jruby/ir/instructions/YieldInstr.java | |
index 98ddc35b63..0d7d026fff 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/YieldInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/YieldInstr.java | |
@@ -70,8 +70,8 @@ public class YieldInstr extends TwoOperandResultBaseInstr implements FixedArityI | |
@Interp | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- Block blk = (Block)getBlockArg().retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ Block blk = (Block)getBlockArg().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
if (getYieldArg() == UndefinedValue.UNDEFINED) { | |
return IRRuntimeHelpers.yieldSpecific(context, blk); | |
} else { | |
@@ -79,9 +79,9 @@ public class YieldInstr extends TwoOperandResultBaseInstr implements FixedArityI | |
if (unwrapArray && yieldOp instanceof Array && ((Array)yieldOp).size() > 1) { | |
// Special case this path! | |
// Don't build a RubyArray. | |
- return blk.yieldValues(context, ((Array)yieldOp).retrieveArrayElts(context, self, currScope, currDynScope, temp)); | |
+ return blk.yieldValues(context, ((Array)yieldOp).retrieveArrayElts(context, self, currScope, currDynScope, temp, tempOff)); | |
} else { | |
- IRubyObject yieldVal = (IRubyObject) yieldOp.retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject yieldVal = (IRubyObject) yieldOp.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.yield(context, blk, yieldVal, unwrapArray); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/ZSuperInstr.java b/core/src/main/java/org/jruby/ir/instructions/ZSuperInstr.java | |
index 9b20aa4f2e..7735b07b64 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/ZSuperInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/ZSuperInstr.java | |
@@ -71,9 +71,9 @@ public class ZSuperInstr extends UnresolvedSuperInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp); | |
- Block block = prepareBlock(context, self, currScope, currDynScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp, tempOff); | |
+ Block block = prepareBlock(context, self, currScope, currDynScope, temp, tempOff); | |
return IRRuntimeHelpers.zSuper(context, self, args, block); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/defined/GetErrorInfoInstr.java b/core/src/main/java/org/jruby/ir/instructions/defined/GetErrorInfoInstr.java | |
index 2b6dd546a4..1679ef84d3 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/defined/GetErrorInfoInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/defined/GetErrorInfoInstr.java | |
@@ -24,7 +24,7 @@ public class GetErrorInfoInstr extends NOperandResultBaseInstr implements FixedA | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
return context.getErrorInfo(); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/defined/RestoreErrorInfoInstr.java b/core/src/main/java/org/jruby/ir/instructions/defined/RestoreErrorInfoInstr.java | |
index f5fa52edb9..b1b3e6484a 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/defined/RestoreErrorInfoInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/defined/RestoreErrorInfoInstr.java | |
@@ -39,8 +39,8 @@ public class RestoreErrorInfoInstr extends OneOperandInstr implements FixedArity | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { | |
- context.setErrorInfo((IRubyObject) getArg().retrieve(context, self, currScope, currDynScope, temp)); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ context.setErrorInfo((IRubyObject) getArg().retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
return null; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/OneArgOperandAttrAssignInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/OneArgOperandAttrAssignInstr.java | |
index dbad2df22e..f96ccc1968 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/OneArgOperandAttrAssignInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/OneArgOperandAttrAssignInstr.java | |
@@ -2,7 +2,6 @@ package org.jruby.ir.instructions.specialized; | |
import org.jruby.RubySymbol; | |
import org.jruby.ir.IRScope; | |
-import org.jruby.ir.Operation; | |
import org.jruby.ir.instructions.AttrAssignInstr; | |
import org.jruby.ir.instructions.Instr; | |
import org.jruby.ir.operands.Operand; | |
@@ -30,9 +29,9 @@ public class OneArgOperandAttrAssignInstr extends AttrAssignInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject value = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject value = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
callSite.call(context, self, object, value); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/OneFixnumArgNoBlockCallInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/OneFixnumArgNoBlockCallInstr.java | |
index bde65470c5..070d344d32 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/OneFixnumArgNoBlockCallInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/OneFixnumArgNoBlockCallInstr.java | |
@@ -48,8 +48,8 @@ public class OneFixnumArgNoBlockCallInstr extends CallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
return getCallSite().call(context, self, object, fixNum); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/OneFloatArgNoBlockCallInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/OneFloatArgNoBlockCallInstr.java | |
index c5685080ff..e1985fc862 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/OneFloatArgNoBlockCallInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/OneFloatArgNoBlockCallInstr.java | |
@@ -49,8 +49,8 @@ public class OneFloatArgNoBlockCallInstr extends CallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
return getCallSite().call(context, self, object, flote); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgBlockCallInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgBlockCallInstr.java | |
index 1f3673e3c5..2820cfb974 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgBlockCallInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgBlockCallInstr.java | |
@@ -39,11 +39,11 @@ public class OneOperandArgBlockCallInstr extends CallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
// NOTE: This logic shouod always match the CALL_10B logic in InterpreterEngine.processCall | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp); | |
- Block preparedBlock = prepareBlock(context, self, currScope, dynamicScope, temp); | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ Block preparedBlock = prepareBlock(context, self, currScope, dynamicScope, temp, tempOff); | |
if (hasLiteralClosure()) { | |
return getCallSite().callIter(context, self, object, arg1, preparedBlock); | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockCallInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockCallInstr.java | |
index bb8867619b..2ca1da35aa 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockCallInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockCallInstr.java | |
@@ -42,9 +42,9 @@ public class OneOperandArgNoBlockCallInstr extends CallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
return getCallSite().call(context, self, object, arg1); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockNoResultCallInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockNoResultCallInstr.java | |
index 7f1ad06abf..db72117138 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockNoResultCallInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/OneOperandArgNoBlockNoResultCallInstr.java | |
@@ -35,9 +35,9 @@ public class OneOperandArgNoBlockNoResultCallInstr extends NoResultCallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
return getCallSite().call(context, self, object, arg1); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/TwoOperandArgNoBlockCallInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/TwoOperandArgNoBlockCallInstr.java | |
index ca19eb6a16..178d4d076c 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/TwoOperandArgNoBlockCallInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/TwoOperandArgNoBlockCallInstr.java | |
@@ -39,10 +39,10 @@ public class TwoOperandArgNoBlockCallInstr extends CallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp); | |
- IRubyObject arg2 = (IRubyObject) getArg2().retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
+ IRubyObject arg2 = (IRubyObject) getArg2().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
return getCallSite().call(context, self, object, arg1, arg2); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/instructions/specialized/ZeroOperandArgNoBlockCallInstr.java b/core/src/main/java/org/jruby/ir/instructions/specialized/ZeroOperandArgNoBlockCallInstr.java | |
index 5ebbd6b057..924c14eb71 100644 | |
--- a/core/src/main/java/org/jruby/ir/instructions/specialized/ZeroOperandArgNoBlockCallInstr.java | |
+++ b/core/src/main/java/org/jruby/ir/instructions/specialized/ZeroOperandArgNoBlockCallInstr.java | |
@@ -41,8 +41,8 @@ public class ZeroOperandArgNoBlockCallInstr extends CallInstr { | |
} | |
@Override | |
- public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { | |
- IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); | |
+ public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp, int tempOff) { | |
+ IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp, tempOff); | |
return getCallSite().call(context, self, object); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/interpreter/InterpreterEngine.java b/core/src/main/java/org/jruby/ir/interpreter/InterpreterEngine.java | |
index 9eaaddf72b..c75ba5b3ee 100644 | |
--- a/core/src/main/java/org/jruby/ir/interpreter/InterpreterEngine.java | |
+++ b/core/src/main/java/org/jruby/ir/interpreter/InterpreterEngine.java | |
@@ -65,7 +65,6 @@ import org.jruby.runtime.Helpers; | |
import org.jruby.runtime.ThreadContext; | |
import org.jruby.runtime.Visibility; | |
import org.jruby.runtime.builtin.IRubyObject; | |
-import org.jruby.runtime.callsite.ProfilingCachingCallSite; | |
import org.jruby.runtime.opto.ConstantCache; | |
/** | |
@@ -108,121 +107,131 @@ public class InterpreterEngine { | |
InterpreterContext interpreterContext, RubyModule implClass, | |
String name, IRubyObject[] args, Block blockArg) { | |
Instr[] instrs = interpreterContext.getInstructions(); | |
- Object[] temp = interpreterContext.allocateTemporaryVariables(); | |
- double[] floats = interpreterContext.allocateTemporaryFloatVariables(); | |
- long[] fixnums = interpreterContext.allocateTemporaryFixnumVariables(); | |
- boolean[] booleans = interpreterContext.allocateTemporaryBooleanVariables(); | |
- int n = instrs.length; | |
- int ipc = 0; | |
- Object exception = null; | |
- boolean acceptsKeywordArgument = interpreterContext.receivesKeywordArguments(); | |
- | |
- if (acceptsKeywordArgument) { | |
- args = IRRuntimeHelpers.frobnicateKwargsArgument(context, args, interpreterContext.getRequiredArgsCount()); | |
- } | |
- | |
- StaticScope currScope = interpreterContext.getStaticScope(); | |
- DynamicScope currDynScope = context.getCurrentScope(); | |
- | |
- // Init profiling this scope | |
- boolean debug = IRRuntimeHelpers.isDebug(); | |
- boolean profile = IRRuntimeHelpers.inProfileMode(); | |
- Integer scopeVersion = profile ? Profiler.initProfiling(interpreterContext.getScope()) : 0; | |
- | |
- // Enter the looooop! | |
- while (ipc < n) { | |
- Instr instr = instrs[ipc]; | |
- | |
- Operation operation = instr.getOperation(); | |
- if (debug) { | |
- Interpreter.LOG.info("I: {" + ipc + "} " + instr); | |
- Interpreter.interpInstrsCount++; | |
- } else if (profile) { | |
- Profiler.instrTick(operation); | |
- Interpreter.interpInstrsCount++; | |
+ Object[] tempX = context.getPooledTemps(); | |
+ int tempOff = context.takePooledTemps(interpreterContext.temporaryVariablecount); | |
+ | |
+ try { | |
+ double[] floats = interpreterContext.allocateTemporaryFloatVariables(); | |
+ long[] fixnums = interpreterContext.allocateTemporaryFixnumVariables(); | |
+ boolean[] booleans = interpreterContext.allocateTemporaryBooleanVariables(); | |
+ int n = instrs.length; | |
+ int ipc = 0; | |
+ Object exception = null; | |
+ boolean acceptsKeywordArgument = interpreterContext.receivesKeywordArguments(); | |
+ | |
+ if (acceptsKeywordArgument) { | |
+ args = IRRuntimeHelpers.frobnicateKwargsArgument(context, args, interpreterContext.getRequiredArgsCount()); | |
} | |
- ipc++; | |
- | |
- try { | |
- switch (operation.opClass) { | |
- case INT_OP: | |
- interpretIntOp((AluInstr) instr, operation, fixnums, booleans); | |
- break; | |
- case FLOAT_OP: | |
- interpretFloatOp((AluInstr) instr, operation, floats, booleans); | |
- break; | |
- case ARG_OP: | |
- receiveArg(context, instr, operation, args, acceptsKeywordArgument, currDynScope, temp, exception, blockArg); | |
- break; | |
- case CALL_OP: | |
- if (profile) Profiler.updateCallSite(instr, interpreterContext.getScope(), scopeVersion); | |
- processCall(context, instr, operation, currDynScope, currScope, temp, self); | |
- break; | |
- case RET_OP: | |
- return processReturnOp(context, block, instr, operation, currDynScope, temp, self, currScope); | |
- case BRANCH_OP: | |
- switch (operation) { | |
- case JUMP: ipc = ((JumpInstr)instr).getJumpTarget().getTargetPC(); break; | |
- default: ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, ipc); break; | |
- } | |
- break; | |
- case BOOK_KEEPING_OP: | |
- // IMPORTANT: Preserve these update to currDynScope, self, and args. | |
- // They affect execution of all following instructions in this scope. | |
- switch (operation) { | |
- case PUSH_METHOD_BINDING: | |
- currDynScope = interpreterContext.newDynamicScope(context); | |
- context.pushScope(currDynScope); | |
- break; | |
- case PUSH_BLOCK_BINDING: | |
- currDynScope = IRRuntimeHelpers.pushBlockDynamicScopeIfNeeded(context, block, interpreterContext.pushNewDynScope(), interpreterContext.reuseParentDynScope()); | |
+ StaticScope currScope = interpreterContext.getStaticScope(); | |
+ DynamicScope currDynScope = context.getCurrentScope(); | |
+ | |
+ // Init profiling this scope | |
+ boolean debug = IRRuntimeHelpers.isDebug(); | |
+ boolean profile = IRRuntimeHelpers.inProfileMode(); | |
+ Integer scopeVersion = profile ? Profiler.initProfiling(interpreterContext.getScope()) : 0; | |
+ | |
+ // Enter the looooop! | |
+ while (ipc < n) { | |
+ Instr instr = instrs[ipc]; | |
+ | |
+ Operation operation = instr.getOperation(); | |
+ if (debug) { | |
+ Interpreter.LOG.info("I: {" + ipc + "} " + instr); | |
+ Interpreter.interpInstrsCount++; | |
+ } else if (profile) { | |
+ Profiler.instrTick(operation); | |
+ Interpreter.interpInstrsCount++; | |
+ } | |
+ | |
+ ipc++; | |
+ | |
+ try { | |
+ switch (operation.opClass) { | |
+ case INT_OP: | |
+ interpretIntOp((AluInstr) instr, operation, fixnums, booleans); | |
break; | |
- case UPDATE_BLOCK_STATE: | |
- self = IRRuntimeHelpers.updateBlockState(block, self); | |
+ case FLOAT_OP: | |
+ interpretFloatOp((AluInstr) instr, operation, floats, booleans); | |
break; | |
- case PREPARE_NO_BLOCK_ARGS: | |
- args = IRRuntimeHelpers.prepareNoBlockArgs(context, block, args); | |
+ case ARG_OP: | |
+ receiveArg(context, instr, operation, args, acceptsKeywordArgument, currDynScope, tempX, tempOff, exception, blockArg); | |
break; | |
- case PREPARE_SINGLE_BLOCK_ARG: | |
- args = IRRuntimeHelpers.prepareSingleBlockArgs(context, block, args); | |
+ case CALL_OP: | |
+ if (profile) Profiler.updateCallSite(instr, interpreterContext.getScope(), scopeVersion); | |
+ processCall(context, instr, operation, currDynScope, currScope, tempX, tempOff, self); | |
break; | |
- case PREPARE_FIXED_BLOCK_ARGS: | |
- args = IRRuntimeHelpers.prepareFixedBlockArgs(context, block, args); | |
+ case RET_OP: | |
+ return processReturnOp(context, block, instr, operation, currDynScope, tempX, tempOff, self, currScope); | |
+ case BRANCH_OP: | |
+ switch (operation) { | |
+ case JUMP: | |
+ ipc = ((JumpInstr) instr).getJumpTarget().getTargetPC(); | |
+ break; | |
+ default: | |
+ ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, tempX, tempOff, ipc); | |
+ break; | |
+ } | |
break; | |
- case PREPARE_BLOCK_ARGS: | |
- args = IRRuntimeHelpers.prepareBlockArgs(context, block, args, acceptsKeywordArgument); | |
+ case BOOK_KEEPING_OP: | |
+ // IMPORTANT: Preserve these update to currDynScope, self, and args. | |
+ // They affect execution of all following instructions in this scope. | |
+ switch (operation) { | |
+ case PUSH_METHOD_BINDING: | |
+ currDynScope = interpreterContext.newDynamicScope(context); | |
+ context.pushScope(currDynScope); | |
+ break; | |
+ case PUSH_BLOCK_BINDING: | |
+ currDynScope = IRRuntimeHelpers.pushBlockDynamicScopeIfNeeded(context, block, interpreterContext.pushNewDynScope(), interpreterContext.reuseParentDynScope()); | |
+ break; | |
+ case UPDATE_BLOCK_STATE: | |
+ self = IRRuntimeHelpers.updateBlockState(block, self); | |
+ break; | |
+ case PREPARE_NO_BLOCK_ARGS: | |
+ args = IRRuntimeHelpers.prepareNoBlockArgs(context, block, args); | |
+ break; | |
+ case PREPARE_SINGLE_BLOCK_ARG: | |
+ args = IRRuntimeHelpers.prepareSingleBlockArgs(context, block, args); | |
+ break; | |
+ case PREPARE_FIXED_BLOCK_ARGS: | |
+ args = IRRuntimeHelpers.prepareFixedBlockArgs(context, block, args); | |
+ break; | |
+ case PREPARE_BLOCK_ARGS: | |
+ args = IRRuntimeHelpers.prepareBlockArgs(context, block, args, acceptsKeywordArgument); | |
+ break; | |
+ default: | |
+ processBookKeepingOp(context, block, instr, operation, name, args, self, blockArg, implClass, currDynScope, tempX, tempOff, currScope); | |
+ break; | |
+ } | |
break; | |
- default: | |
- processBookKeepingOp(context, block, instr, operation, name, args, self, blockArg, implClass, currDynScope, temp, currScope); | |
+ case OTHER_OP: | |
+ processOtherOp(context, block, instr, operation, currDynScope, currScope, tempX, tempOff, self, floats, fixnums, booleans); | |
break; | |
- } | |
- break; | |
- case OTHER_OP: | |
- processOtherOp(context, block, instr, operation, currDynScope, currScope, temp, self, floats, fixnums, booleans); | |
- break; | |
- } | |
- } catch (Throwable t) { | |
- if (debug) extractToMethodToAvoidC2Crash(instr, t); | |
- | |
- // StartupInterpreterEngine never calls this method so we know it is a full build. | |
- ipc = ((FullInterpreterContext) interpreterContext).determineRPC(ipc); | |
- | |
- if (debug) { | |
- Interpreter.LOG.info("in : " + interpreterContext.getScope() + ", caught Java throwable: " + t + "; excepting instr: " + instr); | |
- Interpreter.LOG.info("ipc for rescuer: " + ipc); | |
- } | |
- | |
- if (ipc == -1) { | |
- Helpers.throwException(t); | |
- } else { | |
- exception = t; | |
+ } | |
+ } catch (Throwable t) { | |
+ if (debug) extractToMethodToAvoidC2Crash(instr, t); | |
+ | |
+ // StartupInterpreterEngine never calls this method so we know it is a full build. | |
+ ipc = ((FullInterpreterContext) interpreterContext).determineRPC(ipc); | |
+ | |
+ if (debug) { | |
+ Interpreter.LOG.info("in : " + interpreterContext.getScope() + ", caught Java throwable: " + t + "; excepting instr: " + instr); | |
+ Interpreter.LOG.info("ipc for rescuer: " + ipc); | |
+ } | |
+ | |
+ if (ipc == -1) { | |
+ Helpers.throwException(t); | |
+ } else { | |
+ exception = t; | |
+ } | |
} | |
} | |
- } | |
- // Control should never get here! | |
- throw context.runtime.newRuntimeError("BUG: interpreter fell through to end unexpectedly"); | |
+ // Control should never get here! | |
+ throw context.runtime.newRuntimeError("BUG: interpreter fell through to end unexpectedly"); | |
+ } finally { | |
+ context.returnPooledTemps(interpreterContext.temporaryVariablecount); | |
+ } | |
} | |
protected static void interpretIntOp(AluInstr instr, Operation op, long[] fixnums, boolean[] booleans) { | |
@@ -262,7 +271,7 @@ public class InterpreterEngine { | |
} | |
} | |
- protected static void receiveArg(ThreadContext context, Instr i, Operation operation, IRubyObject[] args, boolean acceptsKeywordArgument, DynamicScope currDynScope, Object[] temp, Object exception, Block blockArg) { | |
+ protected static void receiveArg(ThreadContext context, Instr i, Operation operation, IRubyObject[] args, boolean acceptsKeywordArgument, DynamicScope currDynScope, Object[] tempX, int tempOff, Object exception, Block blockArg) { | |
Object result; | |
ResultInstr instr = (ResultInstr)i; | |
@@ -270,117 +279,117 @@ public class InterpreterEngine { | |
case RECV_PRE_REQD_ARG: | |
int argIndex = ((ReceivePreReqdArgInstr)instr).getArgIndex(); | |
result = IRRuntimeHelpers.getPreArgSafe(context, args, argIndex); | |
- setResult(temp, currDynScope, instr.getResult(), result); | |
+ setResult(tempX, tempOff, currDynScope, instr.getResult(), result); | |
return; | |
case RECV_POST_REQD_ARG: | |
result = ((ReceivePostReqdArgInstr)instr).receivePostReqdArg(context, args, acceptsKeywordArgument); | |
- setResult(temp, currDynScope, instr.getResult(), result); | |
+ setResult(tempX, tempOff, currDynScope, instr.getResult(), result); | |
return; | |
case RECV_RUBY_EXC: | |
- setResult(temp, currDynScope, instr.getResult(), IRRuntimeHelpers.unwrapRubyException(exception)); | |
+ setResult(tempX, tempOff, currDynScope, instr.getResult(), IRRuntimeHelpers.unwrapRubyException(exception)); | |
return; | |
case RECV_JRUBY_EXC: | |
- setResult(temp, currDynScope, instr.getResult(), exception); | |
+ setResult(tempX, tempOff, currDynScope, instr.getResult(), exception); | |
return; | |
case LOAD_IMPLICIT_CLOSURE: | |
- setResult(temp, currDynScope, instr.getResult(), blockArg); | |
+ setResult(tempX, tempOff, currDynScope, instr.getResult(), blockArg); | |
return; | |
default: | |
result = ((ReceiveArgBase)instr).receiveArg(context, args, acceptsKeywordArgument); | |
- setResult(temp, currDynScope, instr.getResult(), result); | |
+ setResult(tempX, tempOff, currDynScope, instr.getResult(), result); | |
} | |
} | |
- protected static void processCall(ThreadContext context, Instr instr, Operation operation, DynamicScope currDynScope, StaticScope currScope, Object[] temp, IRubyObject self) { | |
+ protected static void processCall(ThreadContext context, Instr instr, Operation operation, DynamicScope currDynScope, StaticScope currScope, Object[] temp, int tempOff, IRubyObject self) { | |
Object result; | |
switch(operation) { | |
case CALL_1F: { | |
OneFixnumArgNoBlockCallInstr call = (OneFixnumArgNoBlockCallInstr)instr; | |
- IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | |
+ IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp, tempOff); | |
result = call.getCallSite().call(context, self, r, call.getFixnumArg()); | |
- setResult(temp, currDynScope, call.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, call.getResult(), result); | |
break; | |
} | |
case CALL_1D: { | |
OneFloatArgNoBlockCallInstr call = (OneFloatArgNoBlockCallInstr)instr; | |
- IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | |
+ IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp, tempOff); | |
result = call.getCallSite().call(context, self, r, call.getFloatArg()); | |
- setResult(temp, currDynScope, call.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, call.getResult(), result); | |
break; | |
} | |
case CALL_1O: { | |
OneOperandArgNoBlockCallInstr call = (OneOperandArgNoBlockCallInstr)instr; | |
- IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | |
- IRubyObject o = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp, tempOff); | |
+ IRubyObject o = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
result = call.getCallSite().call(context, self, r, o); | |
- setResult(temp, currDynScope, call.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, call.getResult(), result); | |
break; | |
} | |
case CALL_2O: { | |
TwoOperandArgNoBlockCallInstr call = (TwoOperandArgNoBlockCallInstr)instr; | |
- IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | |
- IRubyObject o1 = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
- IRubyObject o2 = (IRubyObject)call.getArg2().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp, tempOff); | |
+ IRubyObject o1 = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ IRubyObject o2 = (IRubyObject)call.getArg2().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
result = call.getCallSite().call(context, self, r, o1, o2); | |
- setResult(temp, currDynScope, call.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, call.getResult(), result); | |
break; | |
} | |
case CALL_1OB: { | |
// NOTE: This logic shouod always match OneOperandArgBlockCallInstr | |
OneOperandArgBlockCallInstr call = (OneOperandArgBlockCallInstr)instr; | |
- IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | |
- IRubyObject o = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
- Block preparedBlock = call.prepareBlock(context, self, currScope, currDynScope, temp); | |
+ IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp, tempOff); | |
+ IRubyObject o = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ Block preparedBlock = call.prepareBlock(context, self, currScope, currDynScope, temp, tempOff); | |
CallSite callSite = call.getCallSite(); | |
result = call.hasLiteralClosure() ? | |
callSite.callIter(context, self, r, o, preparedBlock) : | |
callSite.call(context, self, r, o, preparedBlock); | |
- setResult(temp, currDynScope, call.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, call.getResult(), result); | |
break; | |
} | |
case CALL_0O: { | |
ZeroOperandArgNoBlockCallInstr call = (ZeroOperandArgNoBlockCallInstr)instr; | |
- IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | |
+ IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp, tempOff); | |
result = call.getCallSite().call(context, self, r); | |
- setResult(temp, currDynScope, call.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, call.getResult(), result); | |
break; | |
} | |
case NORESULT_CALL_1O: { | |
OneOperandArgNoBlockNoResultCallInstr call = (OneOperandArgNoBlockNoResultCallInstr)instr; | |
- IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | |
- IRubyObject o = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject r = (IRubyObject)retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp, tempOff); | |
+ IRubyObject o = (IRubyObject)call.getArg1().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
call.getCallSite().call(context, self, r, o); | |
break; | |
} | |
case NORESULT_CALL: | |
- instr.interpret(context, currScope, currDynScope, self, temp); | |
+ instr.interpret(context, currScope, currDynScope, self, temp, tempOff); | |
break; | |
case CALL: | |
default: | |
- result = instr.interpret(context, currScope, currDynScope, self, temp); | |
- setResult(temp, currDynScope, instr, result); | |
+ result = instr.interpret(context, currScope, currDynScope, self, temp, tempOff); | |
+ setResult(temp, tempOff, currDynScope, instr, result); | |
break; | |
} | |
} | |
protected static void processBookKeepingOp(ThreadContext context, Block block, Instr instr, Operation operation, | |
- String name, IRubyObject[] args, IRubyObject self, Block blockArg, RubyModule implClass, | |
- DynamicScope currDynScope, Object[] temp, StaticScope currScope) { | |
+ String name, IRubyObject[] args, IRubyObject self, Block blockArg, RubyModule implClass, | |
+ DynamicScope currDynScope, Object[] temp, int tempOff, StaticScope currScope) { | |
switch(operation) { | |
case LABEL: | |
break; | |
case SAVE_BINDING_VIZ: | |
- setResult(temp, currDynScope, ((SaveBindingVisibilityInstr) instr).getResult(), block.getBinding().getFrame().getVisibility()); | |
+ setResult(temp, tempOff, currDynScope, ((SaveBindingVisibilityInstr) instr).getResult(), block.getBinding().getFrame().getVisibility()); | |
break; | |
case RESTORE_BINDING_VIZ: | |
- block.getBinding().getFrame().setVisibility((Visibility) retrieveOp(((RestoreBindingVisibilityInstr) instr).getVisibility(), context, self, currDynScope, currScope, temp)); | |
+ block.getBinding().getFrame().setVisibility((Visibility) retrieveOp(((RestoreBindingVisibilityInstr) instr).getVisibility(), context, self, currDynScope, currScope, temp, tempOff)); | |
break; | |
case PUSH_BLOCK_FRAME: | |
- setResult(temp, currDynScope, ((PushBlockFrameInstr) instr).getResult(), context.preYieldNoScope(block.getBinding())); | |
+ setResult(temp, tempOff, currDynScope, ((PushBlockFrameInstr) instr).getResult(), context.preYieldNoScope(block.getBinding())); | |
break; | |
case POP_BLOCK_FRAME: | |
- context.postYieldNoScope((Frame) retrieveOp(((PopBlockFrameInstr)instr).getFrame(), context, self, currDynScope, currScope, temp)); | |
+ context.postYieldNoScope((Frame) retrieveOp(((PopBlockFrameInstr)instr).getFrame(), context, self, currDynScope, currScope, temp, tempOff)); | |
break; | |
case PUSH_METHOD_FRAME: | |
context.preMethodFrameOnly(implClass, name, self, blockArg); | |
@@ -426,16 +435,16 @@ public class InterpreterEngine { | |
} | |
protected static IRubyObject processReturnOp(ThreadContext context, Block block, Instr instr, Operation operation, | |
- DynamicScope currDynScope, Object[] temp, IRubyObject self, | |
+ DynamicScope currDynScope, Object[] temp, int tempOff, IRubyObject self, | |
StaticScope currScope) { | |
switch(operation) { | |
// --------- Return flavored instructions -------- | |
case RETURN: { | |
- return (IRubyObject)retrieveOp(((ReturnBase)instr).getReturnValue(), context, self, currDynScope, currScope, temp); | |
+ return (IRubyObject)retrieveOp(((ReturnBase)instr).getReturnValue(), context, self, currDynScope, currScope, temp, tempOff); | |
} | |
case BREAK: { | |
BreakInstr bi = (BreakInstr)instr; | |
- IRubyObject rv = (IRubyObject)bi.getReturnValue().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject rv = (IRubyObject)bi.getReturnValue().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
// This also handles breaks in lambdas -- by converting them to a return | |
// | |
// This assumes that scopes with break instr. have a frame / dynamic scope | |
@@ -445,11 +454,11 @@ public class InterpreterEngine { | |
} | |
case NONLOCAL_RETURN: { | |
NonlocalReturnInstr ri = (NonlocalReturnInstr)instr; | |
- IRubyObject rv = (IRubyObject)retrieveOp(ri.getReturnValue(), context, self, currDynScope, currScope, temp); | |
+ IRubyObject rv = (IRubyObject)retrieveOp(ri.getReturnValue(), context, self, currDynScope, currScope, temp, tempOff); | |
return IRRuntimeHelpers.initiateNonLocalReturn(currDynScope, block, rv); | |
} | |
case RETURN_OR_RETHROW_SAVED_EXC: { | |
- IRubyObject retVal = (IRubyObject) retrieveOp(((ReturnBase) instr).getReturnValue(), context, self, currDynScope, currScope, temp); | |
+ IRubyObject retVal = (IRubyObject) retrieveOp(((ReturnBase) instr).getReturnValue(), context, self, currDynScope, currScope, temp, tempOff); | |
return IRRuntimeHelpers.returnOrRethrowSavedException(context, retVal); | |
} | |
} | |
@@ -457,7 +466,7 @@ public class InterpreterEngine { | |
} | |
protected static void processOtherOp(ThreadContext context, Block block, Instr instr, Operation operation, DynamicScope currDynScope, | |
- StaticScope currScope, Object[] temp, IRubyObject self, | |
+ StaticScope currScope, Object[] temp, int tempOff, IRubyObject self, | |
double[] floats, long[] fixnums, boolean[] booleans) { | |
Object result; | |
switch(operation) { | |
@@ -472,7 +481,7 @@ public class InterpreterEngine { | |
} else if (res instanceof TemporaryFixnumVariable) { | |
setFixnumVar(fixnums, (TemporaryFixnumVariable)res, getFixnumArg(fixnums, src)); | |
} else { | |
- setResult(temp, currDynScope, res, retrieveOp(src, context, self, currDynScope, currScope, temp)); | |
+ setResult(temp, tempOff, currDynScope, res, retrieveOp(src, context, self, currDynScope, currScope, temp, tempOff)); | |
} | |
break; | |
} | |
@@ -481,18 +490,18 @@ public class InterpreterEngine { | |
SearchConstInstr sci = (SearchConstInstr)instr; | |
ConstantCache cache = sci.getConstantCache(); | |
if (!ConstantCache.isCached(cache)) { | |
- result = sci.cache(context, currScope, currDynScope, self, temp); | |
+ result = sci.cache(context, currScope, currDynScope, self, temp, tempOff); | |
} else { | |
result = cache.value; | |
} | |
- setResult(temp, currDynScope, sci.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, sci.getResult(), result); | |
break; | |
} | |
case RUNTIME_HELPER: { | |
RuntimeHelperCall rhc = (RuntimeHelperCall)instr; | |
- setResult(temp, currDynScope, rhc.getResult(), | |
- rhc.callHelper(context, currScope, currDynScope, self, temp, block)); | |
+ setResult(temp, tempOff, currDynScope, rhc.getResult(), | |
+ rhc.callHelper(context, currScope, currDynScope, self, temp, tempOff, block)); | |
break; | |
} | |
@@ -502,25 +511,25 @@ public class InterpreterEngine { | |
case BOX_FLOAT: { | |
RubyFloat f = context.runtime.newFloat(getFloatArg(floats, ((BoxFloatInstr)instr).getValue())); | |
- setResult(temp, currDynScope, ((BoxInstr)instr).getResult(), f); | |
+ setResult(temp, tempOff, currDynScope, ((BoxInstr)instr).getResult(), f); | |
break; | |
} | |
case BOX_FIXNUM: { | |
RubyFixnum f = context.runtime.newFixnum(getFixnumArg(fixnums, ((BoxFixnumInstr) instr).getValue())); | |
- setResult(temp, currDynScope, ((BoxInstr)instr).getResult(), f); | |
+ setResult(temp, tempOff, currDynScope, ((BoxInstr)instr).getResult(), f); | |
break; | |
} | |
case BOX_BOOLEAN: { | |
RubyBoolean f = context.runtime.newBoolean(getBooleanArg(booleans, ((BoxBooleanInstr) instr).getValue())); | |
- setResult(temp, currDynScope, ((BoxInstr)instr).getResult(), f); | |
+ setResult(temp, tempOff, currDynScope, ((BoxInstr)instr).getResult(), f); | |
break; | |
} | |
case UNBOX_FLOAT: { | |
UnboxInstr ui = (UnboxInstr)instr; | |
- Object val = retrieveOp(ui.getValue(), context, self, currDynScope, currScope, temp); | |
+ Object val = retrieveOp(ui.getValue(), context, self, currDynScope, currScope, temp, tempOff); | |
if (val instanceof RubyFloat) { | |
floats[((TemporaryLocalVariable)ui.getResult()).offset] = ((RubyFloat)val).getValue(); | |
} else { | |
@@ -531,7 +540,7 @@ public class InterpreterEngine { | |
case UNBOX_FIXNUM: { | |
UnboxInstr ui = (UnboxInstr)instr; | |
- Object val = retrieveOp(ui.getValue(), context, self, currDynScope, currScope, temp); | |
+ Object val = retrieveOp(ui.getValue(), context, self, currDynScope, currScope, temp, tempOff); | |
if (val instanceof RubyFloat) { | |
fixnums[((TemporaryLocalVariable)ui.getResult()).offset] = ((RubyFloat)val).getLongValue(); | |
} else { | |
@@ -541,13 +550,13 @@ public class InterpreterEngine { | |
} | |
case LOAD_FRAME_CLOSURE: | |
- setResult(temp, currDynScope, instr, context.getFrameBlock()); | |
+ setResult(temp, tempOff, currDynScope, instr, context.getFrameBlock()); | |
return; | |
// ---------- All the rest --------- | |
default: | |
- result = instr.interpret(context, currScope, currDynScope, self, temp); | |
- setResult(temp, currDynScope, instr, result); | |
+ result = instr.interpret(context, currScope, currDynScope, self, temp, tempOff); | |
+ setResult(temp, tempOff, currDynScope, instr, result); | |
break; | |
} | |
} | |
@@ -562,7 +571,7 @@ public class InterpreterEngine { | |
} | |
} | |
- protected static void setResult(Object[] temp, DynamicScope currDynScope, Variable resultVar, Object result) { | |
+ protected static void setResult(Object[] temp, int tempOff, DynamicScope currDynScope, Variable resultVar, Object result) { | |
if (resultVar instanceof TemporaryVariable) { | |
// Unboxed Java primitives (float/double/int/long) don't come here because result is an Object | |
// So, it is safe to use offset directly without any correction as long as IRScope uses | |
@@ -570,32 +579,32 @@ public class InterpreterEngine { | |
// * one for LOCAL, BOOLEAN, CURRENT_SCOPE, CURRENT_MODULE, CLOSURE tmpvars | |
// * one for FIXNUM | |
// * one for FLOAT | |
- temp[((TemporaryLocalVariable)resultVar).offset] = result; | |
+ temp[tempOff + ((TemporaryLocalVariable)resultVar).offset] = result; | |
} else { | |
LocalVariable lv = (LocalVariable)resultVar; | |
currDynScope.setValueVoid((IRubyObject) result, lv.getLocation(), lv.getScopeDepth()); | |
} | |
} | |
- protected static void setResult(Object[] temp, DynamicScope currDynScope, Instr instr, Object result) { | |
+ protected static void setResult(Object[] temp, int tempOff, DynamicScope currDynScope, Instr instr, Object result) { | |
if (instr instanceof ResultInstr) { | |
- setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, ((ResultInstr) instr).getResult(), result); | |
} | |
} | |
- protected static Object retrieveOp(Operand r, ThreadContext context, IRubyObject self, DynamicScope currDynScope, StaticScope currScope, Object[] temp) { | |
+ protected static Object retrieveOp(Operand r, ThreadContext context, IRubyObject self, DynamicScope currDynScope, StaticScope currScope, Object[] temp, int tempOff) { | |
Object res; | |
if (r instanceof Self) { | |
return self; | |
} else if (r instanceof TemporaryLocalVariable) { | |
- res = temp[((TemporaryLocalVariable)r).offset]; | |
+ res = temp[tempOff + ((TemporaryLocalVariable)r).offset]; | |
return res == null ? context.nil : res; | |
} else if (r instanceof LocalVariable) { | |
LocalVariable lv = (LocalVariable)r; | |
res = currDynScope.getValue(lv.getLocation(), lv.getScopeDepth()); | |
return res == null ? context.nil : res; | |
} else { | |
- return r.retrieve(context, self, currScope, currDynScope, temp); | |
+ return r.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/interpreter/StartupInterpreterEngine.java b/core/src/main/java/org/jruby/ir/interpreter/StartupInterpreterEngine.java | |
index 57d9274181..ef09adbd85 100644 | |
--- a/core/src/main/java/org/jruby/ir/interpreter/StartupInterpreterEngine.java | |
+++ b/core/src/main/java/org/jruby/ir/interpreter/StartupInterpreterEngine.java | |
@@ -31,116 +31,123 @@ public class StartupInterpreterEngine extends InterpreterEngine { | |
InterpreterContext interpreterContext, RubyModule implClass, | |
String name, IRubyObject[] args, Block blockArg) { | |
Instr[] instrs = interpreterContext.getInstructions(); | |
- Object[] temp = interpreterContext.allocateTemporaryVariables(); | |
- int n = instrs.length; | |
- int ipc = 0; | |
- Object exception = null; | |
- | |
- if (interpreterContext.receivesKeywordArguments()) args = IRRuntimeHelpers.frobnicateKwargsArgument(context, args, interpreterContext.getRequiredArgsCount()); | |
- | |
- StaticScope currScope = interpreterContext.getStaticScope(); | |
- DynamicScope currDynScope = context.getCurrentScope(); | |
- boolean acceptsKeywordArgument = interpreterContext.receivesKeywordArguments(); | |
- | |
- int[] rescuePCs = interpreterContext.getRescueIPCs(); | |
- | |
- // Init profiling this scope | |
- boolean debug = IRRuntimeHelpers.isDebug(); | |
- boolean profile = IRRuntimeHelpers.inProfileMode(); | |
- Integer scopeVersion = profile ? Profiler.initProfiling(interpreterContext.getScope()) : 0; | |
- | |
- // Enter the looooop! | |
- while (ipc < n) { | |
- Instr instr = instrs[ipc]; | |
- | |
- Operation operation = instr.getOperation(); | |
- if (debug) { | |
- Interpreter.LOG.info("I: " + ipc + ", R: " + rescuePCs[ipc] + " - " + instr + ">"); | |
- Interpreter.interpInstrsCount++; | |
- } else if (profile) { | |
- Profiler.instrTick(operation); | |
- Interpreter.interpInstrsCount++; | |
- } | |
+ Object[] temp = context.getPooledTemps(); | |
+ int tempOff = context.takePooledTemps(interpreterContext.temporaryVariablecount); | |
- try { | |
- switch (operation.opClass) { | |
- case ARG_OP: | |
- receiveArg(context, instr, operation, args, acceptsKeywordArgument, currDynScope, temp, exception, blockArg); | |
- break; | |
- case CALL_OP: | |
- if (profile) Profiler.updateCallSite(instr, interpreterContext.getScope(), scopeVersion); | |
- processCall(context, instr, operation, currDynScope, currScope, temp, self); | |
- break; | |
- case RET_OP: | |
- return processReturnOp(context, block, instr, operation, currDynScope, temp, self, currScope); | |
- case BRANCH_OP: | |
- switch (operation) { | |
- case JUMP: | |
- JumpInstr jump = ((JumpInstr)instr); | |
- ipc = jump.getJumpTarget().getTargetPC(); | |
- break; | |
- default: | |
- ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, ipc + 1); | |
- break; | |
- | |
- } | |
- continue; | |
- case BOOK_KEEPING_OP: | |
- switch (operation) { | |
- case PUSH_METHOD_BINDING: | |
- // IMPORTANT: Preserve this update of currDynScope. | |
- // This affects execution of all instructions in this scope | |
- // which will now use the updated value of currDynScope. | |
- currDynScope = interpreterContext.newDynamicScope(context); | |
- context.pushScope(currDynScope); | |
- case EXC_REGION_START: | |
- case EXC_REGION_END: | |
- break; | |
- default: | |
- processBookKeepingOp(context, block, instr, operation, name, args, self, blockArg, implClass, currDynScope, temp, currScope); | |
- } | |
- break; | |
- case OTHER_OP: | |
- processOtherOp(context, block, instr, operation, currDynScope, currScope, temp, self); | |
- break; | |
- } | |
+ try { | |
+ int n = instrs.length; | |
+ int ipc = 0; | |
+ Object exception = null; | |
+ | |
+ if (interpreterContext.receivesKeywordArguments()) | |
+ args = IRRuntimeHelpers.frobnicateKwargsArgument(context, args, interpreterContext.getRequiredArgsCount()); | |
+ | |
+ StaticScope currScope = interpreterContext.getStaticScope(); | |
+ DynamicScope currDynScope = context.getCurrentScope(); | |
+ boolean acceptsKeywordArgument = interpreterContext.receivesKeywordArguments(); | |
- ipc++; | |
- } catch (Throwable t) { | |
- if (debug) extractToMethodToAvoidC2Crash(instr, t); | |
+ int[] rescuePCs = interpreterContext.getRescueIPCs(); | |
- ipc = rescuePCs == null ? -1 : rescuePCs[ipc]; | |
+ // Init profiling this scope | |
+ boolean debug = IRRuntimeHelpers.isDebug(); | |
+ boolean profile = IRRuntimeHelpers.inProfileMode(); | |
+ Integer scopeVersion = profile ? Profiler.initProfiling(interpreterContext.getScope()) : 0; | |
+ // Enter the looooop! | |
+ while (ipc < n) { | |
+ Instr instr = instrs[ipc]; | |
+ | |
+ Operation operation = instr.getOperation(); | |
if (debug) { | |
- Interpreter.LOG.info("in : " + interpreterContext.getScope() + ", caught Java throwable: " + t + "; excepting instr: " + instr); | |
- Interpreter.LOG.info("ipc for rescuer: " + ipc); | |
+ Interpreter.LOG.info("I: " + ipc + ", R: " + rescuePCs[ipc] + " - " + instr + ">"); | |
+ Interpreter.interpInstrsCount++; | |
+ } else if (profile) { | |
+ Profiler.instrTick(operation); | |
+ Interpreter.interpInstrsCount++; | |
} | |
- if (ipc == -1) { | |
- Helpers.throwException(t); | |
- } else { | |
- exception = t; | |
+ try { | |
+ switch (operation.opClass) { | |
+ case ARG_OP: | |
+ receiveArg(context, instr, operation, args, acceptsKeywordArgument, currDynScope, temp, tempOff, exception, blockArg); | |
+ break; | |
+ case CALL_OP: | |
+ if (profile) Profiler.updateCallSite(instr, interpreterContext.getScope(), scopeVersion); | |
+ processCall(context, instr, operation, currDynScope, currScope, temp, tempOff, self); | |
+ break; | |
+ case RET_OP: | |
+ return processReturnOp(context, block, instr, operation, currDynScope, temp, tempOff, self, currScope); | |
+ case BRANCH_OP: | |
+ switch (operation) { | |
+ case JUMP: | |
+ JumpInstr jump = ((JumpInstr) instr); | |
+ ipc = jump.getJumpTarget().getTargetPC(); | |
+ break; | |
+ default: | |
+ ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, tempOff, ipc + 1); | |
+ break; | |
+ | |
+ } | |
+ continue; | |
+ case BOOK_KEEPING_OP: | |
+ switch (operation) { | |
+ case PUSH_METHOD_BINDING: | |
+ // IMPORTANT: Preserve this update of currDynScope. | |
+ // This affects execution of all instructions in this scope | |
+ // which will now use the updated value of currDynScope. | |
+ currDynScope = interpreterContext.newDynamicScope(context); | |
+ context.pushScope(currDynScope); | |
+ case EXC_REGION_START: | |
+ case EXC_REGION_END: | |
+ break; | |
+ default: | |
+ processBookKeepingOp(context, block, instr, operation, name, args, self, blockArg, implClass, currDynScope, temp, tempOff, currScope); | |
+ } | |
+ break; | |
+ case OTHER_OP: | |
+ processOtherOp(context, block, instr, operation, currDynScope, currScope, temp, tempOff, self); | |
+ break; | |
+ } | |
+ | |
+ ipc++; | |
+ } catch (Throwable t) { | |
+ if (debug) extractToMethodToAvoidC2Crash(instr, t); | |
+ | |
+ ipc = rescuePCs == null ? -1 : rescuePCs[ipc]; | |
+ | |
+ if (debug) { | |
+ Interpreter.LOG.info("in : " + interpreterContext.getScope() + ", caught Java throwable: " + t + "; excepting instr: " + instr); | |
+ Interpreter.LOG.info("ipc for rescuer: " + ipc); | |
+ } | |
+ | |
+ if (ipc == -1) { | |
+ Helpers.throwException(t); | |
+ } else { | |
+ exception = t; | |
+ } | |
} | |
} | |
- } | |
- // Control should never get here! | |
- throw context.runtime.newRuntimeError("BUG: interpreter fell through to end unexpectedly"); | |
+ // Control should never get here! | |
+ throw context.runtime.newRuntimeError("BUG: interpreter fell through to end unexpectedly"); | |
+ } finally { | |
+ context.returnPooledTemps(interpreterContext.temporaryVariablecount); | |
+ } | |
} | |
protected static void processOtherOp(ThreadContext context, Block block, Instr instr, Operation operation, DynamicScope currDynScope, | |
- StaticScope currScope, Object[] temp, IRubyObject self) { | |
+ StaticScope currScope, Object[] temp, int tempOff, IRubyObject self) { | |
switch(operation) { | |
case RECV_SELF: | |
break; | |
case COPY: { | |
CopyInstr c = (CopyInstr)instr; | |
- setResult(temp, currDynScope, c.getResult(), retrieveOp(c.getSource(), context, self, currDynScope, currScope, temp)); | |
+ setResult(temp, tempOff, currDynScope, c.getResult(), retrieveOp(c.getSource(), context, self, currDynScope, currScope, temp, tempOff)); | |
break; | |
} | |
case GET_FIELD: { | |
GetFieldInstr gfi = (GetFieldInstr)instr; | |
- IRubyObject object = (IRubyObject)gfi.getSource().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject object = (IRubyObject)gfi.getSource().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
VariableAccessor a = gfi.getAccessor(object); | |
Object result = a == null ? null : (IRubyObject)a.get(object); | |
if (result == null) { | |
@@ -150,32 +157,32 @@ public class StartupInterpreterEngine extends InterpreterEngine { | |
} | |
result = context.nil; | |
} | |
- setResult(temp, currDynScope, gfi.getResult(), result); | |
+ setResult(temp, tempOff, currDynScope, gfi.getResult(), result); | |
break; | |
} | |
case SEARCH_CONST: { | |
SearchConstInstr sci = (SearchConstInstr)instr; | |
ConstantCache cache = sci.getConstantCache(); | |
Object result = !ConstantCache.isCached(cache) ? | |
- sci.cache(context, currScope, currDynScope, self, temp) : cache.value; | |
- setResult(temp, currDynScope, sci.getResult(), result); | |
+ sci.cache(context, currScope, currDynScope, self, temp, tempOff) : cache.value; | |
+ setResult(temp, tempOff, currDynScope, sci.getResult(), result); | |
break; | |
} | |
case RUNTIME_HELPER: { | |
RuntimeHelperCall rhc = (RuntimeHelperCall)instr; | |
- setResult(temp, currDynScope, rhc.getResult(), | |
- rhc.callHelper(context, currScope, currDynScope, self, temp, block)); | |
+ setResult(temp, tempOff, currDynScope, rhc.getResult(), | |
+ rhc.callHelper(context, currScope, currDynScope, self, temp, tempOff, block)); | |
break; | |
} | |
case CHECK_FOR_LJE: | |
((CheckForLJEInstr) instr).check(context, currDynScope, block); | |
break; | |
case LOAD_FRAME_CLOSURE: | |
- setResult(temp, currDynScope, instr, context.getFrameBlock()); | |
+ setResult(temp, tempOff, currDynScope, instr, context.getFrameBlock()); | |
return; | |
// ---------- All the rest --------- | |
default: | |
- setResult(temp, currDynScope, instr, instr.interpret(context, currScope, currDynScope, self, temp)); | |
+ setResult(temp, tempOff, currDynScope, instr, instr.interpret(context, currScope, currDynScope, self, temp, tempOff)); | |
break; | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/Array.java b/core/src/main/java/org/jruby/ir/operands/Array.java | |
index 5503305365..0322448bb6 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/Array.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/Array.java | |
@@ -110,27 +110,27 @@ public class Array extends Operand implements Iterable<Operand> { | |
return new Array(d.decodeOperandArray()); | |
} | |
- public IRubyObject[] retrieveArrayElts(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public IRubyObject[] retrieveArrayElts(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
IRubyObject[] elements = new IRubyObject[elts.length]; | |
for (int i = 0; i < elements.length; i++) { | |
- elements[i] = (IRubyObject) elts[i].retrieve(context, self, currScope, currDynScope, temp); | |
+ elements[i] = (IRubyObject) elts[i].retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
} | |
return elements; | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
switch (elts.length) { | |
case 0: | |
return context.runtime.newEmptyArray(); | |
case 1: | |
- return context.runtime.newArray((IRubyObject) elts[0].retrieve(context, self, currScope, currDynScope, temp)); | |
+ return context.runtime.newArray((IRubyObject) elts[0].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
case 2: | |
- return context.runtime.newArray((IRubyObject) elts[0].retrieve(context, self, currScope, currDynScope, temp), | |
- (IRubyObject) elts[1].retrieve(context, self, currScope, currDynScope, temp)); | |
+ return context.runtime.newArray((IRubyObject) elts[0].retrieve(context, self, currScope, currDynScope, temp, tempOff), | |
+ (IRubyObject) elts[1].retrieve(context, self, currScope, currDynScope, temp, tempOff)); | |
default: | |
- return RubyArray.newArrayMayCopy(context.runtime, retrieveArrayElts(context, self, currScope, currDynScope, temp)); | |
+ return RubyArray.newArrayMayCopy(context.runtime, retrieveArrayElts(context, self, currScope, currDynScope, temp, tempOff)); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/CurrentScope.java b/core/src/main/java/org/jruby/ir/operands/CurrentScope.java | |
index c05dc52264..fd52b78474 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/CurrentScope.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/CurrentScope.java | |
@@ -48,7 +48,7 @@ public class CurrentScope extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return currScope; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/DynamicSymbol.java b/core/src/main/java/org/jruby/ir/operands/DynamicSymbol.java | |
index c2fa22db07..4e780e7e37 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/DynamicSymbol.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/DynamicSymbol.java | |
@@ -49,8 +49,8 @@ public class DynamicSymbol extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
- IRubyObject obj = (IRubyObject) symbolName.retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
+ IRubyObject obj = (IRubyObject) symbolName.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
String str = obj.asJavaString(); | |
Encoding encoding = obj.asString().getByteList().getEncoding(); | |
return context.runtime.newSymbol(str, encoding); | |
diff --git a/core/src/main/java/org/jruby/ir/operands/Filename.java b/core/src/main/java/org/jruby/ir/operands/Filename.java | |
index d961c19115..0ac590c4cd 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/Filename.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/Filename.java | |
@@ -47,7 +47,7 @@ public class Filename extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return IRRuntimeHelpers.getFileNameStringFromScope(context, currScope); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/GlobalVariable.java b/core/src/main/java/org/jruby/ir/operands/GlobalVariable.java | |
index 949de42c4c..75e2afc3cd 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/GlobalVariable.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/GlobalVariable.java | |
@@ -28,7 +28,7 @@ public class GlobalVariable extends Reference { | |
@Interp | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return context.runtime.getGlobalVariables().get(getId()); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/Hash.java b/core/src/main/java/org/jruby/ir/operands/Hash.java | |
index a61f85e7dd..a7abe00102 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/Hash.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/Hash.java | |
@@ -110,7 +110,7 @@ public class Hash extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
Ruby runtime = context.runtime; | |
RubyHash hash; | |
KeyValuePair<Operand, Operand>[] pairs = this.pairs; | |
@@ -118,7 +118,7 @@ public class Hash extends Operand { | |
if (isKWArgsHash && pairs[0].getKey().equals(Symbol.KW_REST_ARG_DUMMY)) { | |
// Dup the rest args hash and use that as the basis for inserting the non-rest args | |
- hash = ((RubyHash) pairs[0].getValue().retrieve(context, self, currScope, currDynScope, temp)).dupFast(context); | |
+ hash = ((RubyHash) pairs[0].getValue().retrieve(context, self, currScope, currDynScope, temp, tempOff)).dupFast(context); | |
// Skip the first pair | |
index++; | |
} else { | |
@@ -127,8 +127,8 @@ public class Hash extends Operand { | |
for (int i = index; i < pairs.length; i++) { | |
KeyValuePair<Operand, Operand> pair = pairs[i]; | |
- IRubyObject key = (IRubyObject) pair.getKey().retrieve(context, self, currScope, currDynScope, temp); | |
- IRubyObject value = (IRubyObject) pair.getValue().retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject key = (IRubyObject) pair.getKey().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
+ IRubyObject value = (IRubyObject) pair.getValue().retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
hash.fastASetCheckString(runtime, key, value); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/ImmutableLiteral.java b/core/src/main/java/org/jruby/ir/operands/ImmutableLiteral.java | |
index fc2a79daef..9838463c96 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/ImmutableLiteral.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/ImmutableLiteral.java | |
@@ -80,7 +80,7 @@ public abstract class ImmutableLiteral<T> extends Operand { | |
* assume the cost of constructing literals which may never be used. | |
*/ | |
@Override | |
- public T retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public T retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return cachedObject(context); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/LocalVariable.java b/core/src/main/java/org/jruby/ir/operands/LocalVariable.java | |
index ab76b3b924..22fefda6b4 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/LocalVariable.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/LocalVariable.java | |
@@ -98,7 +98,7 @@ public class LocalVariable extends Variable implements DepthCloneable { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
IRubyObject value = currDynScope.getValue(offset, scopeDepth); | |
if (value == null) value = context.nil; | |
return value; | |
diff --git a/core/src/main/java/org/jruby/ir/operands/NthRef.java b/core/src/main/java/org/jruby/ir/operands/NthRef.java | |
index b2c0e2dbc1..9b31e1612c 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/NthRef.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/NthRef.java | |
@@ -28,7 +28,7 @@ public class NthRef extends Reference { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return IRRuntimeHelpers.nthMatch(context, matchNumber); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/ObjectClass.java b/core/src/main/java/org/jruby/ir/operands/ObjectClass.java | |
index 2daa835cb4..a57a92f45b 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/ObjectClass.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/ObjectClass.java | |
@@ -40,7 +40,7 @@ public class ObjectClass extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return context.runtime.getObject(); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/Operand.java b/core/src/main/java/org/jruby/ir/operands/Operand.java | |
index bb979155f7..fb70685f14 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/Operand.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/Operand.java | |
@@ -85,7 +85,7 @@ public abstract class Operand { | |
} | |
@Interp | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
throw new RuntimeException(this.getClass().getSimpleName() + " should not be directly retrieved."); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/SValue.java b/core/src/main/java/org/jruby/ir/operands/SValue.java | |
index 85e10ee009..daaa9a419b 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/SValue.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/SValue.java | |
@@ -74,8 +74,8 @@ public class SValue extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
- Object val = array.retrieve(context, self, currScope, currDynScope, temp); | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
+ Object val = array.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
return (val instanceof RubyArray) ? val : context.nil; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/Scope.java b/core/src/main/java/org/jruby/ir/operands/Scope.java | |
index 3c3dec34a0..18180c1d72 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/Scope.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/Scope.java | |
@@ -51,7 +51,7 @@ public class Scope extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return scope.getStaticScope(); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/ScopeModule.java b/core/src/main/java/org/jruby/ir/operands/ScopeModule.java | |
index c28b9fc6ee..5cc3f5574d 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/ScopeModule.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/ScopeModule.java | |
@@ -73,7 +73,7 @@ public class ScopeModule extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return Helpers.getNthScopeModule(currScope, scopeModuleDepth); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/Self.java b/core/src/main/java/org/jruby/ir/operands/Self.java | |
index c62642dbcb..05510aa309 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/Self.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/Self.java | |
@@ -37,7 +37,7 @@ public class Self extends Variable { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return self; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/Splat.java b/core/src/main/java/org/jruby/ir/operands/Splat.java | |
index e677f28d31..704eddccf4 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/Splat.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/Splat.java | |
@@ -66,7 +66,7 @@ public class Splat extends Operand implements DepthCloneable { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
// Splat is now only used in call arg lists where it is guaranteed that | |
// the splat-arg is an array. | |
// | |
@@ -81,7 +81,7 @@ public class Splat extends Operand implements DepthCloneable { | |
// a java array. So, a dup is not required either. | |
// | |
// So, besides retrieving the array, nothing more to be done here! | |
- return array.retrieve(context, self, currScope, currDynScope, temp); | |
+ return array.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/operands/StandardError.java b/core/src/main/java/org/jruby/ir/operands/StandardError.java | |
index d9a8da14a5..169a64eff9 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/StandardError.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/StandardError.java | |
@@ -42,7 +42,7 @@ public class StandardError extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return context.runtime.getStandardError(); | |
} | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/StringLiteral.java b/core/src/main/java/org/jruby/ir/operands/StringLiteral.java | |
index 8971658ff4..1a9bb9cdc9 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/StringLiteral.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/StringLiteral.java | |
@@ -1,6 +1,5 @@ | |
package org.jruby.ir.operands; | |
-import org.jruby.RubyString; | |
import org.jruby.RubySymbol; | |
import org.jruby.ir.IRVisitor; | |
import org.jruby.ir.persistence.IRReaderDecoder; | |
@@ -8,13 +7,10 @@ import org.jruby.ir.persistence.IRWriterEncoder; | |
import org.jruby.ir.transformations.inlining.CloneInfo; | |
import org.jruby.parser.StaticScope; | |
import org.jruby.runtime.DynamicScope; | |
-import org.jruby.runtime.Helpers; | |
import org.jruby.runtime.ThreadContext; | |
import org.jruby.runtime.builtin.IRubyObject; | |
import org.jruby.util.ByteList; | |
-import org.jruby.util.StringSupport; | |
-import java.nio.charset.UnsupportedCharsetException; | |
import java.util.List; | |
/** | |
@@ -81,8 +77,8 @@ public class StringLiteral extends Operand implements Stringable { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
- return frozenString.retrieve(context, self, currScope, currDynScope, temp).strDup(context.runtime); | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
+ return frozenString.retrieve(context, self, currScope, currDynScope, temp, tempOff).strDup(context.runtime); | |
} | |
@Override | |
diff --git a/core/src/main/java/org/jruby/ir/operands/TemporaryLocalVariable.java b/core/src/main/java/org/jruby/ir/operands/TemporaryLocalVariable.java | |
index 5958bf3926..04180c232d 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/TemporaryLocalVariable.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/TemporaryLocalVariable.java | |
@@ -46,7 +46,7 @@ public class TemporaryLocalVariable extends TemporaryVariable { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
// SSS FIXME: When AddLocalVarLoadStoreInstructions pass is not enabled, we don't need this check. | |
// We only need these because Ruby code can have local vars used before being defined. | |
// | |
@@ -71,7 +71,7 @@ public class TemporaryLocalVariable extends TemporaryVariable { | |
* The interpreter pays for this null check even in the "full" IR because they share this instruction. | |
*/ | |
- Object o = temp[offset]; | |
+ Object o = temp[tempOff + offset]; | |
return o == null ? context.nil : o; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/UndefinedValue.java b/core/src/main/java/org/jruby/ir/operands/UndefinedValue.java | |
index 4052dcf423..cf303c7440 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/UndefinedValue.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/UndefinedValue.java | |
@@ -50,7 +50,7 @@ public class UndefinedValue extends Operand implements IRubyObject { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
return this; | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/UnexecutableNil.java b/core/src/main/java/org/jruby/ir/operands/UnexecutableNil.java | |
index fb418d3c28..77a39c4f64 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/UnexecutableNil.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/UnexecutableNil.java | |
@@ -30,7 +30,7 @@ public class UnexecutableNil extends Nil { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
throw new RuntimeException(this.getClass().getSimpleName() + " should not be directly interpreted"); | |
} | |
diff --git a/core/src/main/java/org/jruby/ir/operands/WrappedIRClosure.java b/core/src/main/java/org/jruby/ir/operands/WrappedIRClosure.java | |
index b3f9374047..cdcf8d778a 100644 | |
--- a/core/src/main/java/org/jruby/ir/operands/WrappedIRClosure.java | |
+++ b/core/src/main/java/org/jruby/ir/operands/WrappedIRClosure.java | |
@@ -2,7 +2,6 @@ package org.jruby.ir.operands; | |
import org.jruby.ir.IRClosure; | |
import org.jruby.ir.IRVisitor; | |
-import org.jruby.ir.instructions.CopyInstr; | |
import org.jruby.ir.persistence.IRReaderDecoder; | |
import org.jruby.ir.persistence.IRWriterEncoder; | |
import org.jruby.ir.transformations.inlining.CloneInfo; | |
@@ -71,14 +70,14 @@ public class WrappedIRClosure extends Operand { | |
} | |
@Override | |
- public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | |
+ public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp, int tempOff) { | |
BlockBody body = closure.getBlockBody(); | |
closure.getStaticScope().determineModule(); | |
// In non-inlining scenarios, this.self will always be %self. | |
// However, in inlined scenarios, this.self will be the self in the original scope where the closure | |
// was present before inlining. | |
- IRubyObject selfVal = (this.self instanceof Self) ? self : (IRubyObject)this.self.retrieve(context, self, currScope, currDynScope, temp); | |
+ IRubyObject selfVal = (this.self instanceof Self) ? self : (IRubyObject)this.self.retrieve(context, self, currScope, currDynScope, temp, tempOff); | |
Binding binding = context.currentBinding(selfVal, currDynScope); | |
return new Block(body, binding); | |
diff --git a/core/src/main/java/org/jruby/runtime/Helpers.java b/core/src/main/java/org/jruby/runtime/Helpers.java | |
index 7929db46f4..2eb6d15e17 100644 | |
--- a/core/src/main/java/org/jruby/runtime/Helpers.java | |
+++ b/core/src/main/java/org/jruby/runtime/Helpers.java | |
@@ -1932,6 +1932,23 @@ public class Helpers { | |
ArraySupport.copy(nils, arr, i, to - i); | |
} | |
+ private static final int NULL_PREFILLED_ARRAY_SIZE = 1000; | |
+ private static final Object[] NULL_PREFILLED_ARRAY = new Object[NULL_PREFILLED_ARRAY_SIZE]; | |
+ | |
+ public static void fillNull(final Object[] arr, int from, int to) { | |
+ if (arr.length == 0) return; | |
+ Object nils[] = NULL_PREFILLED_ARRAY; | |
+ int i; | |
+ | |
+ // NOTE: seems that Arrays.fill(arr, runtime.getNil()) won't do better ... on Java 8 | |
+ // Object[] array doesn't get the same optimizations as e.g. byte[] int[] | |
+ | |
+ for (i = from; i + NULL_PREFILLED_ARRAY_SIZE < to; i += NULL_PREFILLED_ARRAY_SIZE) { | |
+ System.arraycopy(nils, 0, arr, i, NULL_PREFILLED_ARRAY_SIZE); | |
+ } | |
+ ArraySupport.copy(nils, arr, i, to - i); | |
+ } | |
+ | |
public static void fillNil(IRubyObject[] arr, Ruby runtime) { | |
fillNil(arr, 0, arr.length, runtime); | |
} | |
diff --git a/core/src/main/java/org/jruby/runtime/ThreadContext.java b/core/src/main/java/org/jruby/runtime/ThreadContext.java | |
index a078bcf8a5..098142cb89 100644 | |
--- a/core/src/main/java/org/jruby/runtime/ThreadContext.java | |
+++ b/core/src/main/java/org/jruby/runtime/ThreadContext.java | |
@@ -70,6 +70,7 @@ import org.jruby.util.log.LoggerFactory; | |
import java.lang.ref.WeakReference; | |
import java.security.SecureRandom; | |
+import java.util.Arrays; | |
import java.util.HashMap; | |
import java.util.IdentityHashMap; | |
import java.util.Locale; | |
@@ -158,6 +159,26 @@ public final class ThreadContext { | |
public final JavaSites sites; | |
+ private volatile Object[] pooledTemps = new Object[20000]; | |
+ private volatile int pooledTempsOffset = 0; | |
+ | |
+ public Object[] getPooledTemps() { | |
+ return pooledTemps; | |
+ } | |
+ | |
+ public int takePooledTemps(int size) { | |
+ int tempOff = pooledTempsOffset; | |
+ pooledTempsOffset = tempOff + size; | |
+ return tempOff; | |
+ } | |
+ | |
+ public void returnPooledTemps(int size) { | |
+ int pooledTempsOffset = this.pooledTempsOffset; | |
+ int tempOff = pooledTempsOffset - size; | |
+ Helpers.fillNull(pooledTemps, tempOff, pooledTempsOffset); | |
+ this.pooledTempsOffset = tempOff; | |
+ } | |
+ | |
@SuppressWarnings("deprecation") | |
public SecureRandom getSecureRandom() { | |
SecureRandom secureRandom = this.secureRandom; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment