Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
126 changes: 63 additions & 63 deletions Include/internal/pycore_opcode_metadata.h

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

8 changes: 4 additions & 4 deletions Lib/test/test_capi/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ def testfunc(n):
ex = get_first_executor(testfunc)
self.assertIsNotNone(ex)
uops = {opname for opname, _, _ in ex}
self.assertIn("_POP_JUMP_IF_FALSE", uops)
self.assertIn("_SIDE_EXIT_IF_FALSE", uops)

def test_pop_jump_if_none(self):
def testfunc(a):
Expand All @@ -2490,7 +2490,7 @@ def testfunc(a):
ex = get_first_executor(testfunc)
self.assertIsNotNone(ex)
uops = {opname for opname, _, _ in ex}
self.assertIn("_POP_JUMP_IF_TRUE", uops)
self.assertIn("_SIDE_EXIT_IF_TRUE", uops)

def test_pop_jump_if_not_none(self):
def testfunc(a):
Expand All @@ -2505,7 +2505,7 @@ def testfunc(a):
ex = get_first_executor(testfunc)
self.assertIsNotNone(ex)
uops = {opname for opname, _, _ in ex}
self.assertIn("_POP_JUMP_IF_FALSE", uops)
self.assertIn("_SIDE_EXIT_IF_FALSE", uops)

def test_pop_jump_if_true(self):
def testfunc(n):
Expand All @@ -2520,7 +2520,7 @@ def testfunc(n):
ex = get_first_executor(testfunc)
self.assertIsNotNone(ex)
uops = {opname for opname, _, _ in ex}
self.assertIn("_POP_JUMP_IF_TRUE", uops)
self.assertIn("_SIDE_EXIT_IF_TRUE", uops)

def test_jump_backward(self):
def testfunc(n):
Expand Down
12 changes: 6 additions & 6 deletions Python/abstract_interp_cases.c.h

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

29 changes: 9 additions & 20 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ dummy_func(
switch (opcode) {

// BEGIN BYTECODES //

op(_SAVE_CURRENT_IP, (--)) {
frame->prev_instr = next_instr - 1;
}

inst(NOP, (--)) {
}

Expand Down Expand Up @@ -790,8 +795,6 @@ dummy_func(
}

macro(RETURN_VALUE) =
SAVE_IP + // Tier 2 only; special-cased oparg
SAVE_CURRENT_IP + // Sets frame->prev_instr
_POP_FRAME;

inst(INSTRUMENTED_RETURN_VALUE, (retval --)) {
Expand All @@ -815,8 +818,6 @@ dummy_func(

macro(RETURN_CONST) =
LOAD_CONST +
SAVE_IP + // Tier 2 only; special-cased oparg
SAVE_CURRENT_IP + // Sets frame->prev_instr
_POP_FRAME;

inst(INSTRUMENTED_RETURN_CONST, (--)) {
Expand Down Expand Up @@ -3022,8 +3023,7 @@ dummy_func(
_CHECK_FUNCTION_EXACT_ARGS +
_CHECK_STACK_SPACE +
_INIT_CALL_PY_EXACT_ARGS +
SAVE_IP + // Tier 2 only; special-cased oparg
SAVE_CURRENT_IP + // Sets frame->prev_instr
_SAVE_CURRENT_IP + // Sets frame->prev_instr
_PUSH_FRAME;

macro(CALL_PY_EXACT_ARGS) =
Expand All @@ -3032,8 +3032,7 @@ dummy_func(
_CHECK_FUNCTION_EXACT_ARGS +
_CHECK_STACK_SPACE +
_INIT_CALL_PY_EXACT_ARGS +
SAVE_IP + // Tier 2 only; special-cased oparg
SAVE_CURRENT_IP + // Sets frame->prev_instr
_SAVE_CURRENT_IP + // Sets frame->prev_instr
_PUSH_FRAME;

inst(CALL_PY_WITH_DEFAULTS, (unused/1, func_version/2, callable, self_or_null, args[oparg] -- unused)) {
Expand Down Expand Up @@ -3776,13 +3775,13 @@ dummy_func(

///////// Tier-2 only opcodes /////////

op(_POP_JUMP_IF_FALSE, (flag -- )) {
op(_SIDE_EXIT_IF_FALSE, (flag -- )) {
if (Py_IsFalse(flag)) {
pc = oparg;
}
}

op(_POP_JUMP_IF_TRUE, (flag -- )) {
op(_SIDE_EXIT_IF_TRUE, (flag -- )) {
if (Py_IsTrue(flag)) {
pc = oparg;
}
Expand All @@ -3797,16 +3796,6 @@ dummy_func(
frame->prev_instr = ip_offset + oparg;
}

op(SAVE_CURRENT_IP, (--)) {
#if TIER_ONE
frame->prev_instr = next_instr - 1;
#endif
#if TIER_TWO
// Relies on a preceding SAVE_IP
frame->prev_instr--;
#endif
}

op(EXIT_TRACE, (--)) {
frame->prev_instr--; // Back up to just before destination
_PyFrame_SetStackPointer(frame, stack_pointer);
Expand Down
Loading