Skip to content

Commit 50753e8

Browse files
committed
Skip checking the eval breaker for fast calls
1 parent c84beef commit 50753e8

10 files changed

Lines changed: 164 additions & 57 deletions

Include/internal/pycore_opcode_metadata.h

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_optimizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ typedef struct _JitOptContext {
293293
char done;
294294
char out_of_space;
295295
bool contradiction;
296+
bool can_skip_periodic;
296297
// The current "executing" frame.
297298
_Py_UOpsAbstractFrame *frame;
298299
_Py_UOpsAbstractFrame frames[MAX_ABSTRACT_FRAME_DEPTH];

Include/internal/pycore_uop_ids.h

Lines changed: 31 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,12 +2979,12 @@ dummy_func(
29792979

29802980
macro(JUMP_BACKWARD_NO_JIT) =
29812981
unused/1 +
2982-
_GUARD_CHECK_PERIODIC +
2982+
CHECK_PERIODIC +
29832983
JUMP_BACKWARD_NO_INTERRUPT;
29842984

29852985
macro(JUMP_BACKWARD_JIT) =
29862986
unused/1 +
2987-
_GUARD_CHECK_PERIODIC +
2987+
CHECK_PERIODIC +
29882988
JUMP_BACKWARD_NO_INTERRUPT +
29892989
_JIT;
29902990

@@ -4033,12 +4033,21 @@ dummy_func(
40334033
PyStackRef_CLOSE(arg);
40344034
}
40354035

4036+
op(_SKIP_CHECK_PERIODIC, ( -- )) {
4037+
#if TIER_ONE
4038+
// Skip the following CHECK_PERIODIC.
4039+
assert(next_instr->op.code == CHECK_PERIODIC);
4040+
SKIP_OVER(1);
4041+
#endif
4042+
}
4043+
40364044
macro(CALL_TYPE_1) =
40374045
unused/1 +
40384046
unused/2 +
40394047
_GUARD_NOS_NULL +
40404048
_GUARD_CALLABLE_TYPE_1 +
4041-
_CALL_TYPE_1;
4049+
_CALL_TYPE_1 +
4050+
_SKIP_CHECK_PERIODIC;
40424051

40434052
op(_GUARD_CALLABLE_STR_1, (callable, unused, unused -- callable, unused, unused)) {
40444053
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
@@ -4065,7 +4074,8 @@ dummy_func(
40654074
unused/2 +
40664075
_GUARD_NOS_NULL +
40674076
_GUARD_CALLABLE_STR_1 +
4068-
_CALL_STR_1;
4077+
_CALL_STR_1 +
4078+
_SKIP_CHECK_PERIODIC;
40694079

40704080
op(_GUARD_CALLABLE_TUPLE_1, (callable, unused, unused -- callable, unused, unused)) {
40714081
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
@@ -4092,7 +4102,8 @@ dummy_func(
40924102
unused/2 +
40934103
_GUARD_NOS_NULL +
40944104
_GUARD_CALLABLE_TUPLE_1 +
4095-
_CALL_TUPLE_1;
4105+
_CALL_TUPLE_1 +
4106+
_SKIP_CHECK_PERIODIC;
40964107

40974108
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
40984109
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
@@ -4299,7 +4310,8 @@ dummy_func(
42994310
unused/2 +
43004311
_GUARD_NOS_NULL +
43014312
_GUARD_CALLABLE_LEN +
4302-
_CALL_LEN;
4313+
_CALL_LEN +
4314+
_SKIP_CHECK_PERIODIC;
43034315

43044316
op(_GUARD_CALLABLE_LEN, (callable, unused, unused -- callable, unused, unused)){
43054317
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
@@ -4349,6 +4361,11 @@ dummy_func(
43494361
PyStackRef_CLOSE(callable);
43504362
res = retval ? PyStackRef_True : PyStackRef_False;
43514363
assert((!PyStackRef_IsNull(res)) ^ (_PyErr_Occurred(tstate) != NULL));
4364+
#if TIER_ONE
4365+
// Skip the following CHECK_PERIODIC.
4366+
assert(next_instr->op.code == CHECK_PERIODIC);
4367+
SKIP_OVER(1);
4368+
#endif
43524369
}
43534370

43544371
macro(CALL_ISINSTANCE) =

Python/executor_cases.c.h

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)