Skip to content

Conversation

@cocolato
Copy link
Contributor

@cocolato cocolato commented Jan 11, 2026

@python-cla-bot
Copy link

python-cla-bot bot commented Jan 11, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@cocolato
Copy link
Contributor Author

@Fidget-Spinner There may be many details that need fixing, and I hope you can give me some suggestions.

@cocolato
Copy link
Contributor Author

cocolato commented Jan 11, 2026

I haven't yet removed the cases of REPLACE_OP((inst+1),...), perhaps there's a better way to achieve this.

REPLACE_OP((this_instr+1), _EXIT_TRACE, 0, 0);

Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is really valuable work. We definitely need this.

Comment on lines 444 to 449
int last_opcode = ctx->out_buffer[ctx->out_len - 1].opcode;
if (last_opcode != _EXIT_TRACE &&
last_opcode != _JUMP_TO_TOP &&
last_opcode != _DYNAMIC_EXIT &&
last_opcode != _DEOPT) {
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use is_terminator.

Also, instead of return 0, you should insert an _EXIT_TRACE there pointing to the current target.


op(_GUARD_TOS_INT, (value -- value)) {
if (sym_is_compact_int(value)) {
REPLACE_OP(this_instr, _NOP, 0, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these REPLACE_OP should be left untouched. As you already have a mechanism to copy over the current op if there's no ADD_OP called right :) ?

bool insert_mode)
{
if (sym_matches_type(value, &PyBool_Type)) {
REPLACE_OP(this_instr, _NOP, 0, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these REPLACE_OP should be left untouched as well. They should stay the same.

@cocolato
Copy link
Contributor Author

cocolato commented Jan 11, 2026

Thanks for taking the time to review this! I will rewrite them later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants