mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-115999: Disable the specializing adaptive interpreter in free-threaded builds (#116013)
For now, disable all specialization when the GIL might be disabled.
This commit is contained in:
parent
2e94a6687c
commit
339c8e1c13
9 changed files with 96 additions and 3 deletions
|
@ -245,7 +245,12 @@ extern int _PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
|
||||||
/** API for executors */
|
/** API for executors */
|
||||||
extern void _PyCode_Clear_Executors(PyCodeObject *code);
|
extern void _PyCode_Clear_Executors(PyCodeObject *code);
|
||||||
|
|
||||||
|
#ifdef Py_GIL_DISABLED
|
||||||
|
// gh-115999 tracks progress on addressing this.
|
||||||
|
#define ENABLE_SPECIALIZATION 0
|
||||||
|
#else
|
||||||
#define ENABLE_SPECIALIZATION 1
|
#define ENABLE_SPECIALIZATION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Specialization functions */
|
/* Specialization functions */
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import os
|
||||||
|
|
||||||
import _testinternalcapi
|
import _testinternalcapi
|
||||||
|
|
||||||
from test.support import script_helper
|
from test.support import script_helper, requires_specialization
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
@ -31,6 +31,7 @@ def clear_executors(func):
|
||||||
func.__code__ = func.__code__.replace()
|
func.__code__ = func.__code__.replace()
|
||||||
|
|
||||||
|
|
||||||
|
@requires_specialization
|
||||||
class TestOptimizerAPI(unittest.TestCase):
|
class TestOptimizerAPI(unittest.TestCase):
|
||||||
|
|
||||||
def test_new_counter_optimizer_dealloc(self):
|
def test_new_counter_optimizer_dealloc(self):
|
||||||
|
@ -133,6 +134,7 @@ def get_opnames(ex):
|
||||||
return set(iter_opnames(ex))
|
return set(iter_opnames(ex))
|
||||||
|
|
||||||
|
|
||||||
|
@requires_specialization
|
||||||
class TestExecutorInvalidation(unittest.TestCase):
|
class TestExecutorInvalidation(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -211,6 +213,7 @@ class TestExecutorInvalidation(unittest.TestCase):
|
||||||
self.assertIsNone(exe)
|
self.assertIsNone(exe)
|
||||||
|
|
||||||
|
|
||||||
|
@requires_specialization
|
||||||
@unittest.skipIf(os.getenv("PYTHON_UOPS_OPTIMIZE") == "0", "Needs uop optimizer to run.")
|
@unittest.skipIf(os.getenv("PYTHON_UOPS_OPTIMIZE") == "0", "Needs uop optimizer to run.")
|
||||||
class TestUops(unittest.TestCase):
|
class TestUops(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -572,6 +575,7 @@ class TestUops(unittest.TestCase):
|
||||||
self.assertLessEqual(count, 2)
|
self.assertLessEqual(count, 2)
|
||||||
|
|
||||||
|
|
||||||
|
@requires_specialization
|
||||||
@unittest.skipIf(os.getenv("PYTHON_UOPS_OPTIMIZE") == "0", "Needs uop optimizer to run.")
|
@unittest.skipIf(os.getenv("PYTHON_UOPS_OPTIMIZE") == "0", "Needs uop optimizer to run.")
|
||||||
class TestUopsOptimization(unittest.TestCase):
|
class TestUopsOptimization(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -350,12 +350,15 @@ class TestGeneratedCases(unittest.TestCase):
|
||||||
output = """
|
output = """
|
||||||
TARGET(OP) {
|
TARGET(OP) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 4;
|
next_instr += 4;
|
||||||
INSTRUCTION_STATS(OP);
|
INSTRUCTION_STATS(OP);
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
uint32_t extra = read_u32(&this_instr[2].cache);
|
uint32_t extra = read_u32(&this_instr[2].cache);
|
||||||
|
(void)extra;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
@ -399,6 +402,7 @@ class TestGeneratedCases(unittest.TestCase):
|
||||||
INSTRUCTION_STATS(OP);
|
INSTRUCTION_STATS(OP);
|
||||||
PREDICTED(OP);
|
PREDICTED(OP);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 6;
|
_Py_CODEUNIT *this_instr = next_instr - 6;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *right;
|
PyObject *right;
|
||||||
PyObject *left;
|
PyObject *left;
|
||||||
PyObject *arg2;
|
PyObject *arg2;
|
||||||
|
@ -408,6 +412,7 @@ class TestGeneratedCases(unittest.TestCase):
|
||||||
left = stack_pointer[-2];
|
left = stack_pointer[-2];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
op1(left, right);
|
op1(left, right);
|
||||||
}
|
}
|
||||||
/* Skip 2 cache entries */
|
/* Skip 2 cache entries */
|
||||||
|
@ -415,6 +420,7 @@ class TestGeneratedCases(unittest.TestCase):
|
||||||
arg2 = stack_pointer[-3];
|
arg2 = stack_pointer[-3];
|
||||||
{
|
{
|
||||||
uint32_t extra = read_u32(&this_instr[4].cache);
|
uint32_t extra = read_u32(&this_instr[4].cache);
|
||||||
|
(void)extra;
|
||||||
res = op2(arg2, left, right);
|
res = op2(arg2, left, right);
|
||||||
}
|
}
|
||||||
stack_pointer[-3] = res;
|
stack_pointer[-3] = res;
|
||||||
|
@ -424,6 +430,7 @@ class TestGeneratedCases(unittest.TestCase):
|
||||||
|
|
||||||
TARGET(OP1) {
|
TARGET(OP1) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(OP1);
|
INSTRUCTION_STATS(OP1);
|
||||||
PyObject *right;
|
PyObject *right;
|
||||||
|
@ -431,6 +438,7 @@ class TestGeneratedCases(unittest.TestCase):
|
||||||
right = stack_pointer[-1];
|
right = stack_pointer[-1];
|
||||||
left = stack_pointer[-2];
|
left = stack_pointer[-2];
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
op1(left, right);
|
op1(left, right);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import textwrap
|
||||||
import types
|
import types
|
||||||
import unittest
|
import unittest
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from test.support import requires_specialization
|
||||||
|
|
||||||
PAIR = (0,1)
|
PAIR = (0,1)
|
||||||
|
|
||||||
|
@ -815,6 +816,9 @@ class ExceptionMonitoringTest(CheckEvents):
|
||||||
|
|
||||||
self.check_events(func1, [("raise", KeyError)])
|
self.check_events(func1, [("raise", KeyError)])
|
||||||
|
|
||||||
|
# gh-116090: This test doesn't really require specialization, but running
|
||||||
|
# it without specialization exposes a monitoring bug.
|
||||||
|
@requires_specialization
|
||||||
def test_implicit_stop_iteration(self):
|
def test_implicit_stop_iteration(self):
|
||||||
|
|
||||||
def gen():
|
def gen():
|
||||||
|
@ -963,6 +967,7 @@ class ExceptionMonitoringTest(CheckEvents):
|
||||||
)
|
)
|
||||||
self.assertEqual(events[0], ("throw", IndexError))
|
self.assertEqual(events[0], ("throw", IndexError))
|
||||||
|
|
||||||
|
@requires_specialization
|
||||||
def test_no_unwind_for_shim_frame(self):
|
def test_no_unwind_for_shim_frame(self):
|
||||||
|
|
||||||
class B:
|
class B:
|
||||||
|
|
|
@ -4,7 +4,7 @@ import dis
|
||||||
import threading
|
import threading
|
||||||
import types
|
import types
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import threading_helper, check_impl_detail
|
from test.support import threading_helper, check_impl_detail, requires_specialization
|
||||||
|
|
||||||
# Skip this module on other interpreters, it is cpython specific:
|
# Skip this module on other interpreters, it is cpython specific:
|
||||||
if check_impl_detail(cpython=False):
|
if check_impl_detail(cpython=False):
|
||||||
|
@ -506,6 +506,7 @@ class TestCallCache(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
@threading_helper.requires_working_threading()
|
@threading_helper.requires_working_threading()
|
||||||
|
@requires_specialization
|
||||||
class TestRacesDoNotCrash(unittest.TestCase):
|
class TestRacesDoNotCrash(unittest.TestCase):
|
||||||
# Careful with these. Bigger numbers have a higher chance of catching bugs,
|
# Careful with these. Bigger numbers have a higher chance of catching bugs,
|
||||||
# but you can also burn through a *ton* of type/dict/function versions:
|
# but you can also burn through a *ton* of type/dict/function versions:
|
||||||
|
@ -1021,6 +1022,7 @@ class TestRacesDoNotCrash(unittest.TestCase):
|
||||||
class C:
|
class C:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@requires_specialization
|
||||||
class TestInstanceDict(unittest.TestCase):
|
class TestInstanceDict(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
import dis
|
import dis
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import import_helper
|
from test.support import import_helper, requires_specialization
|
||||||
try:
|
try:
|
||||||
from sys import _clear_type_cache
|
from sys import _clear_type_cache
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -94,6 +94,7 @@ class TypeCacheTests(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
@support.cpython_only
|
@support.cpython_only
|
||||||
|
@requires_specialization
|
||||||
class TypeCacheWithSpecializationTests(unittest.TestCase):
|
class TypeCacheWithSpecializationTests(unittest.TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
_clear_type_cache()
|
_clear_type_cache()
|
||||||
|
|
|
@ -296,11 +296,19 @@ GETITEM(PyObject *v, Py_ssize_t i) {
|
||||||
#define ADAPTIVE_COUNTER_IS_MAX(COUNTER) \
|
#define ADAPTIVE_COUNTER_IS_MAX(COUNTER) \
|
||||||
(((COUNTER) >> ADAPTIVE_BACKOFF_BITS) == ((1 << MAX_BACKOFF_VALUE) - 1))
|
(((COUNTER) >> ADAPTIVE_BACKOFF_BITS) == ((1 << MAX_BACKOFF_VALUE) - 1))
|
||||||
|
|
||||||
|
#ifdef Py_GIL_DISABLED
|
||||||
|
#define DECREMENT_ADAPTIVE_COUNTER(COUNTER) \
|
||||||
|
do { \
|
||||||
|
/* gh-115999 tracks progress on addressing this. */ \
|
||||||
|
static_assert(0, "The specializing interpreter is not yet thread-safe"); \
|
||||||
|
} while (0);
|
||||||
|
#else
|
||||||
#define DECREMENT_ADAPTIVE_COUNTER(COUNTER) \
|
#define DECREMENT_ADAPTIVE_COUNTER(COUNTER) \
|
||||||
do { \
|
do { \
|
||||||
assert(!ADAPTIVE_COUNTER_IS_ZERO((COUNTER))); \
|
assert(!ADAPTIVE_COUNTER_IS_ZERO((COUNTER))); \
|
||||||
(COUNTER) -= (1 << ADAPTIVE_BACKOFF_BITS); \
|
(COUNTER) -= (1 << ADAPTIVE_BACKOFF_BITS); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INCREMENT_ADAPTIVE_COUNTER(COUNTER) \
|
#define INCREMENT_ADAPTIVE_COUNTER(COUNTER) \
|
||||||
do { \
|
do { \
|
||||||
|
|
55
Python/generated_cases.c.h
generated
55
Python/generated_cases.c.h
generated
|
@ -104,6 +104,7 @@
|
||||||
INSTRUCTION_STATS(BINARY_OP);
|
INSTRUCTION_STATS(BINARY_OP);
|
||||||
PREDICTED(BINARY_OP);
|
PREDICTED(BINARY_OP);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *rhs;
|
PyObject *rhs;
|
||||||
PyObject *lhs;
|
PyObject *lhs;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
@ -112,6 +113,7 @@
|
||||||
lhs = stack_pointer[-2];
|
lhs = stack_pointer[-2];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -419,6 +421,7 @@
|
||||||
INSTRUCTION_STATS(BINARY_SUBSCR);
|
INSTRUCTION_STATS(BINARY_SUBSCR);
|
||||||
PREDICTED(BINARY_SUBSCR);
|
PREDICTED(BINARY_SUBSCR);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *sub;
|
PyObject *sub;
|
||||||
PyObject *container;
|
PyObject *container;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
@ -427,6 +430,7 @@
|
||||||
container = stack_pointer[-2];
|
container = stack_pointer[-2];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -747,6 +751,7 @@
|
||||||
INSTRUCTION_STATS(CALL);
|
INSTRUCTION_STATS(CALL);
|
||||||
PREDICTED(CALL);
|
PREDICTED(CALL);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 4;
|
_Py_CODEUNIT *this_instr = next_instr - 4;
|
||||||
|
(void)this_instr;
|
||||||
PyObject **args;
|
PyObject **args;
|
||||||
PyObject *self_or_null;
|
PyObject *self_or_null;
|
||||||
PyObject *callable;
|
PyObject *callable;
|
||||||
|
@ -757,6 +762,7 @@
|
||||||
callable = stack_pointer[-2 - oparg];
|
callable = stack_pointer[-2 - oparg];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -1176,6 +1182,7 @@
|
||||||
INSTRUCTION_STATS(CALL_FUNCTION_EX);
|
INSTRUCTION_STATS(CALL_FUNCTION_EX);
|
||||||
PREDICTED(CALL_FUNCTION_EX);
|
PREDICTED(CALL_FUNCTION_EX);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 1;
|
_Py_CODEUNIT *this_instr = next_instr - 1;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *kwargs = NULL;
|
PyObject *kwargs = NULL;
|
||||||
PyObject *callargs;
|
PyObject *callargs;
|
||||||
PyObject *func;
|
PyObject *func;
|
||||||
|
@ -1336,6 +1343,7 @@
|
||||||
INSTRUCTION_STATS(CALL_KW);
|
INSTRUCTION_STATS(CALL_KW);
|
||||||
PREDICTED(CALL_KW);
|
PREDICTED(CALL_KW);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 1;
|
_Py_CODEUNIT *this_instr = next_instr - 1;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *kwnames;
|
PyObject *kwnames;
|
||||||
PyObject **args;
|
PyObject **args;
|
||||||
PyObject *self_or_null;
|
PyObject *self_or_null;
|
||||||
|
@ -1937,6 +1945,7 @@
|
||||||
|
|
||||||
TARGET(CLEANUP_THROW) {
|
TARGET(CLEANUP_THROW) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(CLEANUP_THROW);
|
INSTRUCTION_STATS(CLEANUP_THROW);
|
||||||
PyObject *exc_value;
|
PyObject *exc_value;
|
||||||
|
@ -1973,6 +1982,7 @@
|
||||||
INSTRUCTION_STATS(COMPARE_OP);
|
INSTRUCTION_STATS(COMPARE_OP);
|
||||||
PREDICTED(COMPARE_OP);
|
PREDICTED(COMPARE_OP);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *right;
|
PyObject *right;
|
||||||
PyObject *left;
|
PyObject *left;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
@ -1981,6 +1991,7 @@
|
||||||
left = stack_pointer[-2];
|
left = stack_pointer[-2];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -2324,6 +2335,7 @@
|
||||||
|
|
||||||
TARGET(END_ASYNC_FOR) {
|
TARGET(END_ASYNC_FOR) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(END_ASYNC_FOR);
|
INSTRUCTION_STATS(END_ASYNC_FOR);
|
||||||
PyObject *exc;
|
PyObject *exc;
|
||||||
|
@ -2460,12 +2472,14 @@
|
||||||
INSTRUCTION_STATS(FOR_ITER);
|
INSTRUCTION_STATS(FOR_ITER);
|
||||||
PREDICTED(FOR_ITER);
|
PREDICTED(FOR_ITER);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *iter;
|
PyObject *iter;
|
||||||
PyObject *next;
|
PyObject *next;
|
||||||
// _SPECIALIZE_FOR_ITER
|
// _SPECIALIZE_FOR_ITER
|
||||||
iter = stack_pointer[-1];
|
iter = stack_pointer[-1];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -2884,6 +2898,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_CALL) {
|
TARGET(INSTRUMENTED_CALL) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 4;
|
next_instr += 4;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_CALL);
|
INSTRUCTION_STATS(INSTRUMENTED_CALL);
|
||||||
/* Skip 3 cache entries */
|
/* Skip 3 cache entries */
|
||||||
|
@ -2909,6 +2924,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_CALL_KW) {
|
TARGET(INSTRUMENTED_CALL_KW) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_CALL_KW);
|
INSTRUCTION_STATS(INSTRUMENTED_CALL_KW);
|
||||||
int is_meth = PEEK(oparg + 2) != NULL;
|
int is_meth = PEEK(oparg + 2) != NULL;
|
||||||
|
@ -2925,6 +2941,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_END_FOR) {
|
TARGET(INSTRUMENTED_END_FOR) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_END_FOR);
|
INSTRUCTION_STATS(INSTRUMENTED_END_FOR);
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
|
@ -2947,6 +2964,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_END_SEND) {
|
TARGET(INSTRUMENTED_END_SEND) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_END_SEND);
|
INSTRUCTION_STATS(INSTRUMENTED_END_SEND);
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
|
@ -2968,6 +2986,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_FOR_ITER) {
|
TARGET(INSTRUMENTED_FOR_ITER) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_FOR_ITER);
|
INSTRUCTION_STATS(INSTRUMENTED_FOR_ITER);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3000,6 +3019,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_INSTRUCTION) {
|
TARGET(INSTRUMENTED_INSTRUCTION) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_INSTRUCTION);
|
INSTRUCTION_STATS(INSTRUMENTED_INSTRUCTION);
|
||||||
int next_opcode = _Py_call_instrumentation_instruction(
|
int next_opcode = _Py_call_instrumentation_instruction(
|
||||||
|
@ -3016,6 +3036,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
|
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_JUMP_BACKWARD);
|
INSTRUCTION_STATS(INSTRUMENTED_JUMP_BACKWARD);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3026,6 +3047,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_JUMP_FORWARD) {
|
TARGET(INSTRUMENTED_JUMP_FORWARD) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_JUMP_FORWARD);
|
INSTRUCTION_STATS(INSTRUMENTED_JUMP_FORWARD);
|
||||||
INSTRUMENTED_JUMP(this_instr, next_instr + oparg, PY_MONITORING_EVENT_JUMP);
|
INSTRUMENTED_JUMP(this_instr, next_instr + oparg, PY_MONITORING_EVENT_JUMP);
|
||||||
|
@ -3034,6 +3056,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) {
|
TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_LOAD_SUPER_ATTR);
|
INSTRUCTION_STATS(INSTRUMENTED_LOAD_SUPER_ATTR);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3045,6 +3068,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
|
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_FALSE);
|
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_FALSE);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3061,6 +3085,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
|
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NONE);
|
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NONE);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3083,6 +3108,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
|
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NOT_NONE);
|
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NOT_NONE);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3105,6 +3131,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
|
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_TRUE);
|
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_TRUE);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3121,6 +3148,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_RESUME) {
|
TARGET(INSTRUMENTED_RESUME) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_RESUME);
|
INSTRUCTION_STATS(INSTRUMENTED_RESUME);
|
||||||
uintptr_t global_version = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & ~_PY_EVAL_EVENTS_MASK;
|
uintptr_t global_version = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & ~_PY_EVAL_EVENTS_MASK;
|
||||||
|
@ -3151,6 +3179,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_RETURN_CONST) {
|
TARGET(INSTRUMENTED_RETURN_CONST) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_RETURN_CONST);
|
INSTRUCTION_STATS(INSTRUMENTED_RETURN_CONST);
|
||||||
PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg);
|
PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg);
|
||||||
|
@ -3174,6 +3203,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_RETURN_VALUE) {
|
TARGET(INSTRUMENTED_RETURN_VALUE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_RETURN_VALUE);
|
INSTRUCTION_STATS(INSTRUMENTED_RETURN_VALUE);
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
|
@ -3198,6 +3228,7 @@
|
||||||
|
|
||||||
TARGET(INSTRUMENTED_YIELD_VALUE) {
|
TARGET(INSTRUMENTED_YIELD_VALUE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(INSTRUMENTED_YIELD_VALUE);
|
INSTRUCTION_STATS(INSTRUMENTED_YIELD_VALUE);
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
|
@ -3261,6 +3292,7 @@
|
||||||
|
|
||||||
TARGET(JUMP_BACKWARD) {
|
TARGET(JUMP_BACKWARD) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(JUMP_BACKWARD);
|
INSTRUCTION_STATS(JUMP_BACKWARD);
|
||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
|
@ -3387,6 +3419,7 @@
|
||||||
INSTRUCTION_STATS(LOAD_ATTR);
|
INSTRUCTION_STATS(LOAD_ATTR);
|
||||||
PREDICTED(LOAD_ATTR);
|
PREDICTED(LOAD_ATTR);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 10;
|
_Py_CODEUNIT *this_instr = next_instr - 10;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *owner;
|
PyObject *owner;
|
||||||
PyObject *attr;
|
PyObject *attr;
|
||||||
PyObject *self_or_null = NULL;
|
PyObject *self_or_null = NULL;
|
||||||
|
@ -3394,6 +3427,7 @@
|
||||||
owner = stack_pointer[-1];
|
owner = stack_pointer[-1];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
||||||
|
@ -4083,11 +4117,13 @@
|
||||||
INSTRUCTION_STATS(LOAD_GLOBAL);
|
INSTRUCTION_STATS(LOAD_GLOBAL);
|
||||||
PREDICTED(LOAD_GLOBAL);
|
PREDICTED(LOAD_GLOBAL);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 5;
|
_Py_CODEUNIT *this_instr = next_instr - 5;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
PyObject *null = NULL;
|
PyObject *null = NULL;
|
||||||
// _SPECIALIZE_LOAD_GLOBAL
|
// _SPECIALIZE_LOAD_GLOBAL
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
||||||
|
@ -4279,6 +4315,7 @@
|
||||||
INSTRUCTION_STATS(LOAD_SUPER_ATTR);
|
INSTRUCTION_STATS(LOAD_SUPER_ATTR);
|
||||||
PREDICTED(LOAD_SUPER_ATTR);
|
PREDICTED(LOAD_SUPER_ATTR);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *class;
|
PyObject *class;
|
||||||
PyObject *global_super;
|
PyObject *global_super;
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
|
@ -4289,6 +4326,7 @@
|
||||||
global_super = stack_pointer[-3];
|
global_super = stack_pointer[-3];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
int load_method = oparg & 1;
|
int load_method = oparg & 1;
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
|
@ -4565,6 +4603,7 @@
|
||||||
|
|
||||||
TARGET(POP_JUMP_IF_FALSE) {
|
TARGET(POP_JUMP_IF_FALSE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(POP_JUMP_IF_FALSE);
|
INSTRUCTION_STATS(POP_JUMP_IF_FALSE);
|
||||||
PyObject *cond;
|
PyObject *cond;
|
||||||
|
@ -4582,6 +4621,7 @@
|
||||||
|
|
||||||
TARGET(POP_JUMP_IF_NONE) {
|
TARGET(POP_JUMP_IF_NONE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(POP_JUMP_IF_NONE);
|
INSTRUCTION_STATS(POP_JUMP_IF_NONE);
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
|
@ -4615,6 +4655,7 @@
|
||||||
|
|
||||||
TARGET(POP_JUMP_IF_NOT_NONE) {
|
TARGET(POP_JUMP_IF_NOT_NONE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(POP_JUMP_IF_NOT_NONE);
|
INSTRUCTION_STATS(POP_JUMP_IF_NOT_NONE);
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
|
@ -4648,6 +4689,7 @@
|
||||||
|
|
||||||
TARGET(POP_JUMP_IF_TRUE) {
|
TARGET(POP_JUMP_IF_TRUE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 2;
|
next_instr += 2;
|
||||||
INSTRUCTION_STATS(POP_JUMP_IF_TRUE);
|
INSTRUCTION_STATS(POP_JUMP_IF_TRUE);
|
||||||
PyObject *cond;
|
PyObject *cond;
|
||||||
|
@ -4709,6 +4751,7 @@
|
||||||
|
|
||||||
TARGET(RAISE_VARARGS) {
|
TARGET(RAISE_VARARGS) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(RAISE_VARARGS);
|
INSTRUCTION_STATS(RAISE_VARARGS);
|
||||||
PyObject **args;
|
PyObject **args;
|
||||||
|
@ -4738,6 +4781,7 @@
|
||||||
|
|
||||||
TARGET(RERAISE) {
|
TARGET(RERAISE) {
|
||||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
|
(void)this_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(RERAISE);
|
INSTRUCTION_STATS(RERAISE);
|
||||||
PyObject *exc;
|
PyObject *exc;
|
||||||
|
@ -4779,6 +4823,7 @@
|
||||||
INSTRUCTION_STATS(RESUME);
|
INSTRUCTION_STATS(RESUME);
|
||||||
PREDICTED(RESUME);
|
PREDICTED(RESUME);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 1;
|
_Py_CODEUNIT *this_instr = next_instr - 1;
|
||||||
|
(void)this_instr;
|
||||||
assert(frame == tstate->current_frame);
|
assert(frame == tstate->current_frame);
|
||||||
if (tstate->tracing == 0) {
|
if (tstate->tracing == 0) {
|
||||||
uintptr_t global_version =
|
uintptr_t global_version =
|
||||||
|
@ -4916,6 +4961,7 @@
|
||||||
INSTRUCTION_STATS(SEND);
|
INSTRUCTION_STATS(SEND);
|
||||||
PREDICTED(SEND);
|
PREDICTED(SEND);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *receiver;
|
PyObject *receiver;
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
|
@ -4923,6 +4969,7 @@
|
||||||
receiver = stack_pointer[-2];
|
receiver = stack_pointer[-2];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -5103,12 +5150,14 @@
|
||||||
INSTRUCTION_STATS(STORE_ATTR);
|
INSTRUCTION_STATS(STORE_ATTR);
|
||||||
PREDICTED(STORE_ATTR);
|
PREDICTED(STORE_ATTR);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 5;
|
_Py_CODEUNIT *this_instr = next_instr - 5;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *owner;
|
PyObject *owner;
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
// _SPECIALIZE_STORE_ATTR
|
// _SPECIALIZE_STORE_ATTR
|
||||||
owner = stack_pointer[-1];
|
owner = stack_pointer[-1];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||||
|
@ -5392,6 +5441,7 @@
|
||||||
INSTRUCTION_STATS(STORE_SUBSCR);
|
INSTRUCTION_STATS(STORE_SUBSCR);
|
||||||
PREDICTED(STORE_SUBSCR);
|
PREDICTED(STORE_SUBSCR);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *sub;
|
PyObject *sub;
|
||||||
PyObject *container;
|
PyObject *container;
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
|
@ -5400,6 +5450,7 @@
|
||||||
container = stack_pointer[-2];
|
container = stack_pointer[-2];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -5495,12 +5546,14 @@
|
||||||
INSTRUCTION_STATS(TO_BOOL);
|
INSTRUCTION_STATS(TO_BOOL);
|
||||||
PREDICTED(TO_BOOL);
|
PREDICTED(TO_BOOL);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 4;
|
_Py_CODEUNIT *this_instr = next_instr - 4;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
// _SPECIALIZE_TO_BOOL
|
// _SPECIALIZE_TO_BOOL
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
@ -5704,11 +5757,13 @@
|
||||||
INSTRUCTION_STATS(UNPACK_SEQUENCE);
|
INSTRUCTION_STATS(UNPACK_SEQUENCE);
|
||||||
PREDICTED(UNPACK_SEQUENCE);
|
PREDICTED(UNPACK_SEQUENCE);
|
||||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||||
|
(void)this_instr;
|
||||||
PyObject *seq;
|
PyObject *seq;
|
||||||
// _SPECIALIZE_UNPACK_SEQUENCE
|
// _SPECIALIZE_UNPACK_SEQUENCE
|
||||||
seq = stack_pointer[-1];
|
seq = stack_pointer[-1];
|
||||||
{
|
{
|
||||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||||
|
(void)counter;
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION
|
||||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
|
|
|
@ -87,6 +87,8 @@ def write_uop(
|
||||||
out.emit(
|
out.emit(
|
||||||
f"{type}{cache.name} = {reader}(&this_instr[{offset}].cache);\n"
|
f"{type}{cache.name} = {reader}(&this_instr[{offset}].cache);\n"
|
||||||
)
|
)
|
||||||
|
if inst.family is None:
|
||||||
|
out.emit(f"(void){cache.name};\n")
|
||||||
offset += cache.size
|
offset += cache.size
|
||||||
emit_tokens(out, uop, stack, inst)
|
emit_tokens(out, uop, stack, inst)
|
||||||
if uop.properties.stores_sp:
|
if uop.properties.stores_sp:
|
||||||
|
@ -131,8 +133,10 @@ def generate_tier1(
|
||||||
needs_this = uses_this(inst)
|
needs_this = uses_this(inst)
|
||||||
out.emit("\n")
|
out.emit("\n")
|
||||||
out.emit(f"TARGET({name}) {{\n")
|
out.emit(f"TARGET({name}) {{\n")
|
||||||
|
unused_guard = "(void)this_instr;\n" if inst.family is None else ""
|
||||||
if needs_this and not inst.is_target:
|
if needs_this and not inst.is_target:
|
||||||
out.emit(f"_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;\n")
|
out.emit(f"_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;\n")
|
||||||
|
out.emit(unused_guard)
|
||||||
else:
|
else:
|
||||||
out.emit(f"frame->instr_ptr = next_instr;\n")
|
out.emit(f"frame->instr_ptr = next_instr;\n")
|
||||||
out.emit(f"next_instr += {inst.size};\n")
|
out.emit(f"next_instr += {inst.size};\n")
|
||||||
|
@ -141,6 +145,7 @@ def generate_tier1(
|
||||||
out.emit(f"PREDICTED({name});\n")
|
out.emit(f"PREDICTED({name});\n")
|
||||||
if needs_this:
|
if needs_this:
|
||||||
out.emit(f"_Py_CODEUNIT *this_instr = next_instr - {inst.size};\n")
|
out.emit(f"_Py_CODEUNIT *this_instr = next_instr - {inst.size};\n")
|
||||||
|
out.emit(unused_guard)
|
||||||
if inst.family is not None:
|
if inst.family is not None:
|
||||||
out.emit(
|
out.emit(
|
||||||
f"static_assert({inst.family.size} == {inst.size-1}"
|
f"static_assert({inst.family.size} == {inst.size-1}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue