GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-41463: Generate information about jumps from 'opcode.py' rather than duplicating it in 'compile.c' by markshannon · Pull Request #21714 · python/cpython Conversation
|
| int i_lineno; | ||
| }; | ||
|
|
||
| static int |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| static int | |
| static inline int |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return (_PyOpcode_RelativeJump[opcode>>5]>>(opcode&31))&1; | ||
| } | ||
|
|
||
| static int |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| static int | |
| static inline int |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| is_relative_jump(struct instr *i) | ||
| { | ||
| int opcode = i->i_opcode; | ||
| return (_PyOpcode_RelativeJump[opcode>>5]>>(opcode&31))&1; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you define 5 and 31 as globals with a name (using #define or with static variables). That way this will read a bit better
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Look great, I left some minor comments
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| int oparg = inst->i_oparg; | ||
| int nextop = i+1 < bb->b_iused ? bb->b_instr[i+1].i_opcode : 0; | ||
| if (inst->i_jabs || inst->i_jrel) { | ||
| if (is_jump(inst)) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Great!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| static inline int | ||
| is_relative_jump(struct instr *i) | ||
| { | ||
| int opcode = i->i_opcode; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Apologies for insisting a bit but it still took me a minute to parse the expression to follow how the function is determining if is a relative jump. I would suggest to maybe add a comment here briefly explaining the process as someone with less context will certainly struggle
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I left a comment, feel free to address it before landing
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…han duplicating it in 'compile.c' (pythonGH-21714) Generate information about jumps from 'opcode.py' rather than duplicate it in 'compile.c'
…han duplicating it in 'compile.c' (pythonGH-21714) Generate information about jumps from 'opcode.py' rather than duplicate it in 'compile.c'
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.