-
Notifications
You must be signed in to change notification settings - Fork 5.4k
ZJIT: Guide WB skipping for Insn::SetLocal using HIR type info #13978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
zjit/src/codegen.rs
Outdated
@@ -353,7 +353,7 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio | |||
Insn::SetGlobal { id, val, state: _ } => return Some(gen_setglobal(asm, *id, opnd!(val))), | |||
Insn::GetGlobal { id, state: _ } => gen_getglobal(asm, *id), | |||
&Insn::GetLocal { ep_offset, level } => gen_getlocal_with_ep(asm, ep_offset, level)?, | |||
Insn::SetLocal { val, ep_offset, level } => return gen_setlocal_with_ep(asm, opnd!(val), *ep_offset, *level), | |||
&Insn::SetLocal { val, ep_offset, level } => return gen_setlocal_with_ep(asm, opnd!(val), function.is_a(val, types::Immediate), ep_offset, level), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function.is_a(val, types::Immediate)
I feel like this kind of type checking (not just fetching the type, but checking that it's "immediate") should be part of the codegen logic (i.e. live inside gen_setlocal_with_ep()
). You generally wouldn't want to go back and forth between gen_insn()
and gen_setlocal_with_ep()
too often when you read/write the logic of codegen.
One way to do that would be to give val_type: Type
as an argument. Another way would be to just pass around a reference to function
(which seems fine to me) if we want to use the Function::is_a
API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice improvement on opnd!
👍
Now this crashes when marking an Iseq:
This could be some bad HIR optimization or some other GC bug... |
Also tweak the opnd!() macro so that it works with both an
&InsnId
andan
InsnId
.Following discussions in #13977