Breaking up and refactoring ISEQCompiler #105
Unanswered
tenderlove
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think ISEQCompiler is getting a bit too large. I like that we have compile time / runtime handlers for each instruction, but we should probably put them in different files. Another somewhat awkward complication that should probably drive our design is that each ISEQCompiler instance has a
temp_stack
ivar, but that particular temp stack doesn't make sense when the runtime handlers are called. Runtime handlers need to use the temp stack that is stored in the compile request object for that handler.I think there's a few things we need to sort out.
def handle_*
def compile_*
@temp_stack
"Context free" means it doesn't need to know any runtime information, so no peeking at the stack. Handlers that need runtime info probably shouldn't be called
compile_*
since that doesn't really indicate what they are. I've been bitten by accidentally using@temp_stack
in a runtime handler, and I'm sure anyone else hacking on this would run in to the same problem.I would also like to standardize on an interface for runtime patching. Then we can embed that in to the "Runtime" class DSL. Right now we have
rt.patchable_jump
which sets up the "caller" side, but we're still copy / pasting mostly the same@jit.deferred_call
"callee" side.I don't have a super concrete plan yet, but I think we should have separate modules or classes for each instruction, and then separate classes for the "context free" and "runtime peeking" components of those instructions. Any thoughts would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions