-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New {Closure,}InterpreterContext with all state interpreter needs to …
…execute. This should eliminate nearly all contention between JIT and intepreter. There is still one remaining bug involving label operands cloning when we don't want them to so instr cloning (last bit) is disabled atm.
- Loading branch information
Showing
5 changed files
with
112 additions
and
30 deletions.
There are no files selected for viewing
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
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
47 changes: 47 additions & 0 deletions
47
core/src/main/java/org/jruby/ir/operands/ClosureInterpreterContext.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.jruby.ir.operands; | ||
|
||
import java.util.EnumSet; | ||
import org.jruby.ir.IRFlags; | ||
import org.jruby.ir.instructions.Instr; | ||
import org.jruby.ir.transformations.inlining.CloneInfo; | ||
import org.jruby.parser.StaticScope; | ||
import org.jruby.runtime.Binding; | ||
import org.jruby.runtime.Block; | ||
import org.jruby.runtime.BlockBody; | ||
import org.jruby.runtime.DynamicScope; | ||
import org.jruby.runtime.ThreadContext; | ||
import org.jruby.runtime.builtin.IRubyObject; | ||
|
||
/** | ||
* Created by enebo on 10/14/14. | ||
*/ | ||
public class ClosureInterpreterContext extends InterpreterContext { | ||
private Operand self; | ||
private StaticScope staticScope; | ||
private BlockBody body; | ||
|
||
public ClosureInterpreterContext(int temporaryVariablecount, int temporaryBooleanVariablecount, | ||
int temporaryFixnumVariablecount, int temporaryFloatVariablecount, | ||
EnumSet<IRFlags> flags, Instr[] instructions, | ||
Operand self, StaticScope staticScope, BlockBody body) { | ||
super(temporaryVariablecount, temporaryBooleanVariablecount, temporaryFixnumVariablecount, | ||
temporaryFloatVariablecount, flags, instructions); | ||
|
||
this.self = self; | ||
this.staticScope = staticScope; | ||
this.body = body; | ||
} | ||
|
||
@Override | ||
public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { | ||
staticScope.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); | ||
Binding binding = context.currentBinding(selfVal, currDynScope); | ||
|
||
return new Block(body, binding); | ||
} | ||
} |
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
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