Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f7c220a
Implement FOR_END
sweeneyde Feb 20, 2022
4178c30
Use jabs, not jrel
sweeneyde Feb 20, 2022
245b43f
Bump magic
sweeneyde Feb 20, 2022
61a85f0
merge with main
sweeneyde Mar 1, 2022
b0030d5
merge with main
sweeneyde Mar 20, 2022
8f3cd5a
Remove FOR_ITER entirely
sweeneyde Mar 20, 2022
4520a5a
Fix some failng tests
sweeneyde Mar 20, 2022
6284f20
exclude test_frozenmain
sweeneyde Mar 20, 2022
3a0d53e
merge with main
sweeneyde Mar 24, 2022
3b328e7
fix some tracing tests
sweeneyde Mar 24, 2022
bdd7f07
fix swap pop/push in frameobject.c
sweeneyde Mar 24, 2022
b20fed8
merge with main
sweeneyde Apr 9, 2022
77d52e6
Get test.test_trace passing
sweeneyde Apr 10, 2022
53a8734
when marking backwards jumps, set todo=1
sweeneyde Apr 10, 2022
7d32011
remove debugging code
sweeneyde Apr 10, 2022
4a2e781
update test_dis
sweeneyde Apr 10, 2022
0af7e1e
make FOR_END a relative jump
sweeneyde Apr 10, 2022
d3552aa
make test.test_bdb and test.test_pdb pass
sweeneyde Apr 10, 2022
563ca00
refactor maybe_call_line_trace logic
sweeneyde Apr 11, 2022
719e756
add blurb
sweeneyde Apr 11, 2022
8626569
FOR_ITER --> FOR_END in dis.rst
sweeneyde Apr 11, 2022
2884727
FOR_ITER --> FOR_END in specialize.c
sweeneyde Apr 11, 2022
44baacc
Update whatsnew
sweeneyde Apr 11, 2022
0adffbd
Merge branch 'main' into for_end
sweeneyde Apr 11, 2022
7a62601
merge with main
sweeneyde Apr 11, 2022
92e8c6d
Merge branch 'for_end' of https://github.com/sweeneyde/cpython into f…
sweeneyde Apr 11, 2022
e4f240e
fix test_dis
sweeneyde Apr 12, 2022
6c2e53d
Merge branch 'main' into for_end
sweeneyde Apr 12, 2022
32bed37
fix opcode.h
sweeneyde Apr 12, 2022
3f7ec88
merge
sweeneyde Apr 20, 2022
577bd89
merge
sweeneyde Apr 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge with main
  • Loading branch information
sweeneyde committed Apr 9, 2022
commit b20fed8b0516c949a65eda9c9efafccb55117e16
103 changes: 52 additions & 51 deletions Include/opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Lib/importlib/_bootstrap_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def _write_atomic(path, data, mode=0o666):
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.

MAGIC_NUMBER = (3493).to_bytes(2, 'little') + b'\r\n'
MAGIC_NUMBER = (3494).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c

_PYCACHE = '__pycache__'
Expand Down
13 changes: 7 additions & 6 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,9 +1443,8 @@ eval_frame_handle_pending(PyThreadState *tstate)

#define JUMP_TO_INSTRUCTION(op) goto PREDICT_ID(op)

#define DEOPT_IF(cond, instname) if (cond) { goto instname ## _miss; }

#define UPDATE_PREV_INSTR_OPARG(instr, oparg) ((uint8_t*)(instr))[-1] = (oparg)
#define DEOPT_IF(cond, instname) if (cond) { goto miss; }


#define GLOBALS() frame->f_globals
Expand Down Expand Up @@ -6774,14 +6773,16 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
}
if (line != -1 && f->f_trace_lines) {
/* Trace backward edges (except in 'yield from') or if line number has changed */
#if 0
// SEND has no quickened forms, so no need to use _PyOpcode_Deopt here.
int opcode1 = _Py_OPCODE(_PyCode_CODE(frame->f_code)[frame->f_lasti]);
int opcode2 = _Py_OPCODE(_PyCode_CODE(frame->f_code)[instr_prev]);

#endif
int trace = line != lastline ||
(frame->f_lasti < instr_prev && opcode1 != SEND &&
opcode2 != FOR_END && opcode2 != FOR_END_QUICK);

(_PyInterpreterFrame_LASTI(frame) < instr_prev &&
// SEND has no quickened forms, so no need to use _PyOpcode_Deopt
// here:
_Py_OPCODE(*frame->prev_instr) != SEND);
if (trace) {
result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None);
}
Expand Down
7 changes: 3 additions & 4 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3064,7 +3064,7 @@ compiler_for(struct compiler *c, stmt_ty s)
VISIT(c, expr, s->v.For.iter);
ADDOP(c, GET_ITER);
compiler_use_next_block(c, start);
ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, back_jump);
ADDOP_JUMP_NOLINE(c, JUMP, back_jump);
compiler_use_next_block(c, body);
VISIT(c, expr, s->v.For.target);
VISIT_SEQ(c, stmt, s->v.For.body);
Expand Down Expand Up @@ -5183,7 +5183,7 @@ compiler_sync_comprehension_generator(struct compiler *c,
if (start) {
depth++;
compiler_use_next_block(c, start);
ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, if_cleanup);
ADDOP_JUMP_NOLINE(c, JUMP, if_cleanup);
compiler_use_next_block(c, body);
}
VISIT(c, expr, gen->target);
Expand Down Expand Up @@ -8869,8 +8869,7 @@ optimize_basic_block(struct compiler *c, basicblock *bb, PyObject *consts)
break;
case FOR_END:
switch (target->i_opcode) {
case JUMP_ABSOLUTE:
case JUMP_FORWARD:
case JUMP:
i -= jump_thread(inst, target, FOR_END);
}
break;
Expand Down
26 changes: 13 additions & 13 deletions Python/opcode_targets.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

You are viewing a condensed version of this merge commit. You can view the full changes here.