sundbp
8/2/2012 - 11:30 AM

Notes for binding_of_caller jruby support

Notes for binding_of_caller jruby support

- Perhaps can get to it without any java code: https://gist.github.com/1680784 
- Interpreter only flags: https://github.com/quix/boc/blob/master/jext/boc/BocService.java 

Code sections that are relevant:
- Kernel#binding: return RubyBinding.newBinding(context.runtime, context.currentBinding());

- ThreadContext: 
-   1223     public Binding currentBinding(IRubyObject self) {
-   1224         Frame frame = getCurrentFrame();
-   1225         return new Binding(self, frame, frame.getVisibility(), getRubyClass(), getCurrentScope(), backtrace[backtraceIndex].clone());
-   1226     }

- ThreadContext:
-  429     public Frame getCurrentFrame() {
-  430         return frameStack[frameIndex];
-  431     }

ThreaContext:
-  463     public Frame[] getFrames(int delta) {
-  464         int top = frameIndex + delta;
-  465         Frame[] frames = new Frame[top + 1];
-  466         for (int i = 0; i <= top; i++) {
-  467             frames[i] = frameStack[i].duplicateForBacktrace();
-  468         }
-  469         return frames;
-  470     }