Conversation
f72d497 to
24c909d
Compare
- Test 1: verifying the traceguard is correctly activating - Test 2: verifying the runtime guard is activating
24c909d to
f77395f
Compare
cocolato
left a comment
There was a problem hiding this comment.
Please don't force push PRs. We‘ll squash merge commits at the end. And some comments:
cocolato
left a comment
There was a problem hiding this comment.
Thanks for doing this, there are also a few comments
Co-authored-by: Hai Zhu <haiizhu@outlook.com>
cocolato
left a comment
There was a problem hiding this comment.
LGTM, and let's wait a core dev to review this
| if (ctx->frame->globals_checked_version != 0 && ctx->frame->globals_watched) { | ||
| if (ctx->frame->globals_checked_version != 0 && | ||
| ctx->frame->globals_watched && | ||
| uop_buffer_remaining_space(&ctx->out_buffer) >= 2) |
There was a problem hiding this comment.
We always allow enough headroom for small changes like this. No need to check here.
| /* convert_global_to_const already chose the right | ||
| * _LOAD_CONST_INLINE[_BORROW] opcode; reuse it. */ | ||
| ADD_OP(_GUARD_BUILTINS_IS_CANONICAL, 0, 0); | ||
| ADD_OP(this_instr->opcode, 0, (uintptr_t)cnst); |
There was a problem hiding this comment.
Why are you adding the same instruction twice?
My mistake. convert_global_to_const converts the input inplace and relies on its being copied. We should probably update its interface, but that's for a different PR.
There was a problem hiding this comment.
The two ADD_OP calls emit different instructions:
// Rewrite this_instr as a constant load; nothing is emitted yet.
cnst = convert_global_to_const(this_instr, builtins);
if (cnst != NULL) {
// Emit the builtins identity guard.
ADD_OP(_GUARD_BUILTINS_IS_CANONICAL, 0, 0);
// Emit the constant load prepared above.
ADD_OP(this_instr->opcode, 0, this_instr->operand0);
}
This adds the two checks at tracing and at JIT runtime that the builtin dict is the original interpreter's builtins