summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/bytecodes.c8
-rw-r--r--Python/ceval.c6
-rw-r--r--Python/ceval_macros.h7
-rw-r--r--Python/executor_cases.c.h8
-rw-r--r--Python/generated_cases.c.h8
-rw-r--r--Python/jit.c26
6 files changed, 33 insertions, 30 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 565379a..1d51509 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2755,7 +2755,7 @@ dummy_func(
GOTO_ERROR(error);
}
DECREF_INPUTS();
- res = _PyObject_CallNoArgsTstate(tstate, enter);
+ res = PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
@@ -2790,7 +2790,7 @@ dummy_func(
GOTO_ERROR(error);
}
DECREF_INPUTS();
- res = _PyObject_CallNoArgsTstate(tstate, enter);
+ res = PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
@@ -3822,9 +3822,9 @@ dummy_func(
}
inst(CONVERT_VALUE, (value -- result)) {
- convertion_func_ptr conv_fn;
+ conversion_func conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
- conv_fn = CONVERSION_FUNCTIONS[oparg];
+ conv_fn = _PyEval_ConversionFuncs[oparg];
result = conv_fn(value);
Py_DECREF(value);
ERROR_IF(result == NULL, error);
diff --git a/Python/ceval.c b/Python/ceval.c
index 41e9310..34f286e 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -337,6 +337,12 @@ const binaryfunc _PyEval_BinaryOps[] = {
[NB_INPLACE_XOR] = PyNumber_InPlaceXor,
};
+const conversion_func _PyEval_ConversionFuncs[4] = {
+ [FVC_STR] = PyObject_Str,
+ [FVC_REPR] = PyObject_Repr,
+ [FVC_ASCII] = PyObject_ASCII
+};
+
// PEP 634: Structural Pattern Matching
diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h
index 6ad4195..9674a78 100644
--- a/Python/ceval_macros.h
+++ b/Python/ceval_macros.h
@@ -352,13 +352,6 @@ do { \
} \
} while (0);
-typedef PyObject *(*convertion_func_ptr)(PyObject *);
-
-static const convertion_func_ptr CONVERSION_FUNCTIONS[4] = {
- [FVC_STR] = PyObject_Str,
- [FVC_REPR] = PyObject_Repr,
- [FVC_ASCII] = PyObject_ASCII
-};
// GH-89279: Force inlining by using a macro.
#if defined(_MSC_VER) && SIZEOF_INT == 4
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 20fab8f..9ec1be9 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -2548,7 +2548,7 @@
GOTO_ERROR(error);
}
Py_DECREF(mgr);
- res = _PyObject_CallNoArgsTstate(tstate, enter);
+ res = PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
@@ -2591,7 +2591,7 @@
GOTO_ERROR(error);
}
Py_DECREF(mgr);
- res = _PyObject_CallNoArgsTstate(tstate, enter);
+ res = PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
@@ -3570,9 +3570,9 @@
PyObject *result;
oparg = CURRENT_OPARG();
value = stack_pointer[-1];
- convertion_func_ptr conv_fn;
+ conversion_func conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
- conv_fn = CONVERSION_FUNCTIONS[oparg];
+ conv_fn = _PyEval_ConversionFuncs[oparg];
result = conv_fn(value);
Py_DECREF(value);
if (result == NULL) goto pop_1_error_tier_two;
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index bb26dac..3312078 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -40,7 +40,7 @@
GOTO_ERROR(error);
}
Py_DECREF(mgr);
- res = _PyObject_CallNoArgsTstate(tstate, enter);
+ res = PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
@@ -86,7 +86,7 @@
GOTO_ERROR(error);
}
Py_DECREF(mgr);
- res = _PyObject_CallNoArgsTstate(tstate, enter);
+ res = PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
@@ -2140,9 +2140,9 @@
PyObject *value;
PyObject *result;
value = stack_pointer[-1];
- convertion_func_ptr conv_fn;
+ conversion_func conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
- conv_fn = CONVERSION_FUNCTIONS[oparg];
+ conv_fn = _PyEval_ConversionFuncs[oparg];
result = conv_fn(value);
Py_DECREF(value);
if (result == NULL) goto pop_1_error;
diff --git a/Python/jit.c b/Python/jit.c
index ac2c60e..9f9e123 100644
--- a/Python/jit.c
+++ b/Python/jit.c
@@ -203,13 +203,14 @@ patch(unsigned char *base, const Stencil *stencil, uint64_t *patches)
*loc32 = (uint32_t)value;
continue;
case HoleKind_ARM64_RELOC_UNSIGNED:
- case HoleKind_IMAGE_REL_AMD64_ADDR64:
case HoleKind_R_AARCH64_ABS64:
case HoleKind_X86_64_RELOC_UNSIGNED:
case HoleKind_R_X86_64_64:
// 64-bit absolute address.
*loc64 = value;
continue;
+ case HoleKind_IMAGE_REL_AMD64_REL32:
+ case HoleKind_IMAGE_REL_I386_REL32:
case HoleKind_R_X86_64_GOTPCRELX:
case HoleKind_R_X86_64_REX_GOTPCRELX:
case HoleKind_X86_64_RELOC_GOT:
@@ -249,7 +250,7 @@ patch(unsigned char *base, const Stencil *stencil, uint64_t *patches)
// Check that we're not out of range of 32 signed bits:
assert((int64_t)value >= -(1LL << 31));
assert((int64_t)value < (1LL << 31));
- loc32[0] = (uint32_t)value;
+ *loc32 = (uint32_t)value;
continue;
case HoleKind_R_AARCH64_CALL26:
case HoleKind_R_AARCH64_JUMP26:
@@ -307,23 +308,23 @@ patch(unsigned char *base, const Stencil *stencil, uint64_t *patches)
next_hole->addend == hole->addend &&
next_hole->value == hole->value)
{
- unsigned char rd = get_bits(loc32[0], 0, 5);
+ unsigned char reg = get_bits(loc32[0], 0, 5);
assert(IS_AARCH64_LDR_OR_STR(loc32[1]));
- unsigned char rt = get_bits(loc32[1], 0, 5);
- unsigned char rn = get_bits(loc32[1], 5, 5);
- assert(rd == rn && rn == rt);
+ // There should be only one register involved:
+ assert(reg == get_bits(loc32[1], 0, 5)); // ldr's output register.
+ assert(reg == get_bits(loc32[1], 5, 5)); // ldr's input register.
uint64_t relaxed = *(uint64_t *)value;
if (relaxed < (1UL << 16)) {
// adrp reg, AAA; ldr reg, [reg + BBB] -> movz reg, XXX; nop
- loc32[0] = 0xD2800000 | (get_bits(relaxed, 0, 16) << 5) | rd;
+ loc32[0] = 0xD2800000 | (get_bits(relaxed, 0, 16) << 5) | reg;
loc32[1] = 0xD503201F;
i++;
continue;
}
if (relaxed < (1ULL << 32)) {
// adrp reg, AAA; ldr reg, [reg + BBB] -> movz reg, XXX; movk reg, YYY
- loc32[0] = 0xD2800000 | (get_bits(relaxed, 0, 16) << 5) | rd;
- loc32[1] = 0xF2A00000 | (get_bits(relaxed, 16, 16) << 5) | rd;
+ loc32[0] = 0xD2800000 | (get_bits(relaxed, 0, 16) << 5) | reg;
+ loc32[1] = 0xF2A00000 | (get_bits(relaxed, 16, 16) << 5) | reg;
i++;
continue;
}
@@ -332,13 +333,15 @@ patch(unsigned char *base, const Stencil *stencil, uint64_t *patches)
(int64_t)relaxed >= -(1L << 19) &&
(int64_t)relaxed < (1L << 19))
{
- // adrp reg, AAA; ldr reg, [reg + BBB] -> ldr x0, XXX; nop
- loc32[0] = 0x58000000 | (get_bits(relaxed, 2, 19) << 5) | rd;
+ // adrp reg, AAA; ldr reg, [reg + BBB] -> ldr reg, XXX; nop
+ loc32[0] = 0x58000000 | (get_bits(relaxed, 2, 19) << 5) | reg;
loc32[1] = 0xD503201F;
i++;
continue;
}
}
+ // Fall through...
+ case HoleKind_ARM64_RELOC_PAGE21:
// Number of pages between this page and the value's page:
value = (value >> 12) - ((uint64_t)location >> 12);
// Check that we're not out of range of 21 signed bits:
@@ -350,6 +353,7 @@ patch(unsigned char *base, const Stencil *stencil, uint64_t *patches)
set_bits(loc32, 5, value, 2, 19);
continue;
case HoleKind_ARM64_RELOC_GOT_LOAD_PAGEOFF12:
+ case HoleKind_ARM64_RELOC_PAGEOFF12:
case HoleKind_R_AARCH64_LD64_GOT_LO12_NC:
// 12-bit low part of an absolute address. Pairs nicely with
// ARM64_RELOC_GOT_LOAD_PAGE21 (above).