mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Centralize WITH_TSC processing.
This commit is contained in:
parent
dc3883f671
commit
87fa785f0f
1 changed files with 3 additions and 37 deletions
|
@ -16,7 +16,9 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef WITH_TSC
|
#ifndef WITH_TSC
|
||||||
|
#define rdtscll(var)
|
||||||
|
#else /*WITH_TSC defined*/
|
||||||
|
|
||||||
typedef unsigned long long uint64;
|
typedef unsigned long long uint64;
|
||||||
|
|
||||||
|
@ -868,9 +870,7 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Main switch on opcode */
|
/* Main switch on opcode */
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(inst0);
|
rdtscll(inst0);
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
|
|
||||||
|
@ -1629,13 +1629,9 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
v = SECOND();
|
v = SECOND();
|
||||||
u = THIRD();
|
u = THIRD();
|
||||||
STACKADJ(-3);
|
STACKADJ(-3);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr0);
|
rdtscll(intr0);
|
||||||
#endif
|
|
||||||
err = exec_statement(f, u, v, w);
|
err = exec_statement(f, u, v, w);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr1);
|
rdtscll(intr1);
|
||||||
#endif
|
|
||||||
Py_DECREF(u);
|
Py_DECREF(u);
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
Py_DECREF(w);
|
Py_DECREF(w);
|
||||||
|
@ -2011,13 +2007,9 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
x = NULL;
|
x = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr0);
|
rdtscll(intr0);
|
||||||
#endif
|
|
||||||
x = PyEval_CallObject(x, w);
|
x = PyEval_CallObject(x, w);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr1);
|
rdtscll(intr1);
|
||||||
#endif
|
|
||||||
Py_DECREF(w);
|
Py_DECREF(w);
|
||||||
SET_TOP(x);
|
SET_TOP(x);
|
||||||
if (x != NULL) continue;
|
if (x != NULL) continue;
|
||||||
|
@ -2031,13 +2023,9 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
"no locals found during 'import *'");
|
"no locals found during 'import *'");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr0);
|
rdtscll(intr0);
|
||||||
#endif
|
|
||||||
err = import_all_from(x, v);
|
err = import_all_from(x, v);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr1);
|
rdtscll(intr1);
|
||||||
#endif
|
|
||||||
PyFrame_LocalsToFast(f, 0);
|
PyFrame_LocalsToFast(f, 0);
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
if (err == 0) continue;
|
if (err == 0) continue;
|
||||||
|
@ -2046,13 +2034,9 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
case IMPORT_FROM:
|
case IMPORT_FROM:
|
||||||
w = GETITEM(names, oparg);
|
w = GETITEM(names, oparg);
|
||||||
v = TOP();
|
v = TOP();
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr0);
|
rdtscll(intr0);
|
||||||
#endif
|
|
||||||
x = import_from(v, w);
|
x = import_from(v, w);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr1);
|
rdtscll(intr1);
|
||||||
#endif
|
|
||||||
PUSH(x);
|
PUSH(x);
|
||||||
if (x != NULL) continue;
|
if (x != NULL) continue;
|
||||||
break;
|
break;
|
||||||
|
@ -2206,13 +2190,9 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
} else
|
} else
|
||||||
Py_INCREF(func);
|
Py_INCREF(func);
|
||||||
sp = stack_pointer;
|
sp = stack_pointer;
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr0);
|
rdtscll(intr0);
|
||||||
#endif
|
|
||||||
x = ext_do_call(func, &sp, flags, na, nk);
|
x = ext_do_call(func, &sp, flags, na, nk);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(intr1);
|
rdtscll(intr1);
|
||||||
#endif
|
|
||||||
stack_pointer = sp;
|
stack_pointer = sp;
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
|
|
||||||
|
@ -2325,9 +2305,7 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
|
|
||||||
on_error:
|
on_error:
|
||||||
|
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(inst1);
|
rdtscll(inst1);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Quickly continue if no error occurred */
|
/* Quickly continue if no error occurred */
|
||||||
|
|
||||||
|
@ -2340,9 +2318,7 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
"XXX undetected error\n");
|
"XXX undetected error\n");
|
||||||
else {
|
else {
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(loop1);
|
rdtscll(loop1);
|
||||||
#endif
|
|
||||||
continue; /* Normal, fast path */
|
continue; /* Normal, fast path */
|
||||||
#ifdef CHECKEXC
|
#ifdef CHECKEXC
|
||||||
}
|
}
|
||||||
|
@ -2461,9 +2437,7 @@ fast_block_end:
|
||||||
|
|
||||||
if (why != WHY_NOT)
|
if (why != WHY_NOT)
|
||||||
break;
|
break;
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(loop1);
|
rdtscll(loop1);
|
||||||
#endif
|
|
||||||
|
|
||||||
} /* main loop */
|
} /* main loop */
|
||||||
|
|
||||||
|
@ -3560,13 +3534,9 @@ call_function(PyObject ***pp_stack, int oparg
|
||||||
else {
|
else {
|
||||||
PyObject *callargs;
|
PyObject *callargs;
|
||||||
callargs = load_args(pp_stack, na);
|
callargs = load_args(pp_stack, na);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(*pintr0);
|
rdtscll(*pintr0);
|
||||||
#endif
|
|
||||||
C_TRACE(x=PyCFunction_Call(func,callargs,NULL));
|
C_TRACE(x=PyCFunction_Call(func,callargs,NULL));
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(*pintr1);
|
rdtscll(*pintr1);
|
||||||
#endif
|
|
||||||
Py_XDECREF(callargs);
|
Py_XDECREF(callargs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3584,16 +3554,12 @@ call_function(PyObject ***pp_stack, int oparg
|
||||||
n++;
|
n++;
|
||||||
} else
|
} else
|
||||||
Py_INCREF(func);
|
Py_INCREF(func);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(*pintr0);
|
rdtscll(*pintr0);
|
||||||
#endif
|
|
||||||
if (PyFunction_Check(func))
|
if (PyFunction_Check(func))
|
||||||
x = fast_function(func, pp_stack, n, na, nk);
|
x = fast_function(func, pp_stack, n, na, nk);
|
||||||
else
|
else
|
||||||
x = do_call(func, pp_stack, na, nk);
|
x = do_call(func, pp_stack, na, nk);
|
||||||
#ifdef WITH_TSC
|
|
||||||
rdtscll(*pintr1);
|
rdtscll(*pintr1);
|
||||||
#endif
|
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue