Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.3k
bpo-46841: Quicken code in-place#31888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
6ca0d42
a77a124
975b8d1
40ddf39
bfcba6d
0376822
3e77b8d
0a598a7
2fda3b8
42810dd
7df4934
5fa0ca2
1fc2282
b40e300
af27670
629bf8b
59cda59
73c33c1
ecfb193
824b2da
8164f41
932a3f2
c0c5498
f62a395
e7464a3
4f51fdd
75bd375
d6d5128
82145c1
ca176ac
1e06bb5
e70819f
001eb53
6b96204
3087025
6f3bc38
c8054b9
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -170,12 +170,21 @@ top_of_stack(int64_t stack) | ||
static int64_t * | ||
mark_stacks(PyCodeObject *code_obj, int len) | ||
{ | ||
// XXX: this is one big TODO!!! | ||
PyObject *xxx = PyBytes_FromStringAndSize(NULL, _PyCode_GET_SIZE(code_obj)); | ||
if (xxx == NULL) { | ||
return NULL; | ||
} | ||
_Py_CODEUNIT *code = (_Py_CODEUNIT *)PyBytes_AS_STRING(xxx); | ||
for (int i = 0; i < Py_SIZE(code_obj); i++) { | ||
code[i] = _PyCode_GetUnquickened(code_obj, i); | ||
} | ||
int64_t *stacks = PyMem_New(int64_t, len+1); | ||
int i, j, opcode; | ||
if (stacks == NULL) { | ||
PyErr_NoMemory(); | ||
Py_DECREF(xxx); | ||
return NULL; | ||
} | ||
for (int i = 1; i <= len; i++) { | ||
@@ -303,6 +312,7 @@ mark_stacks(PyCodeObject *code_obj, int len) | ||
} | ||
} | ||
} | ||
Py_DECREF(xxx); | ||
return stacks; | ||
} | ||
@@ -837,9 +847,10 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, | ||
static int | ||
_PyFrame_OpAlreadyRan(_PyInterpreterFrame *frame, int opcode, int oparg) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. We might be able to remove this entirely, as there should be no way to trace before the first | ||
{ | ||
// XXX: Does this handle EXTENDED_ARGs? | ||
for (int i = 0; i < frame->f_lasti; i++) { | ||
_Py_CODEUNIT instruction = _PyCode_GetUnquickened(frame->f_code, i); | ||
if (instruction == _Py_MAKECODEUNIT(opcode, oparg)) { | ||
return 1; | ||
} | ||
} | ||