summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c24
-rw-r--r--Python/pythonrun.c24
2 files changed, 25 insertions, 23 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index ec279bf..c75caf6 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -617,18 +617,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
COMPARE_OP is often followed by JUMP_IF_FALSE or JUMP_IF_TRUE. And,
those opcodes are often followed by a POP_TOP.
- Verifying the prediction costs a single high-speed test of register
+ Verifying the prediction costs a single high-speed test of a register
variable against a constant. If the pairing was good, then the
- processor has a high likelihood of making its own successful branch
- prediction which results in a nearly zero overhead transition to the
- next opcode.
-
- A successful prediction saves a trip through the eval-loop including
- its two unpredictable branches, the HAS_ARG test and the switch-case.
-
- If collecting opcode statistics, turn off prediction so that
- statistics are accurately maintained (the predictions bypass
- the opcode frequency counter updates).
+ processor's own internal branch predication has a high likelihood of
+ success, resulting in a nearly zero-overhead transition to the
+ next opcode. A successful prediction saves a trip through the eval-loop
+ including its two unpredictable branches, the HAS_ARG test and the
+ switch-case. Combined with the processor's internal branch prediction,
+ a successful PREDICT has the effect of making the two opcodes run as if
+ they were a single new opcode with the bodies combined.
+
+ If collecting opcode statistics, your choices are to either keep the
+ predictions turned-on and interpret the results as if some opcodes
+ had been combined or turn-off predictions so that the opcode frequency
+ counter updates for both opcodes.
*/
#ifdef DYNAMIC_EXECUTION_PROFILE
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index d13563f..3a6cc91 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -229,14 +229,14 @@ Py_InitializeEx(int install_sigs)
if (install_sigs)
initsigs(); /* Signal handling stuff, including initintr() */
- /* Initialize warnings. */
- _PyWarnings_Init();
- if (PySys_HasWarnOptions()) {
- PyObject *warnings_module = PyImport_ImportModule("warnings");
- if (!warnings_module)
- PyErr_Clear();
- Py_XDECREF(warnings_module);
- }
+ /* Initialize warnings. */
+ _PyWarnings_Init();
+ if (PySys_HasWarnOptions()) {
+ PyObject *warnings_module = PyImport_ImportModule("warnings");
+ if (!warnings_module)
+ PyErr_Clear();
+ Py_XDECREF(warnings_module);
+ }
initmain(); /* Module __main__ */
if (!Py_NoSiteFlag)
@@ -1246,7 +1246,7 @@ PyErr_PrintEx(int set_sys_last_vars)
PyException_SetTraceback(v, tb);
if (exception == NULL)
return;
- /* Now we know v != NULL too */
+ /* Now we know v != NULL too */
if (set_sys_last_vars) {
PySys_SetObject("last_type", exception);
PySys_SetObject("last_value", v);
@@ -2096,14 +2096,14 @@ PyRun_AnyFileFlags(FILE *fp, const char *name, PyCompilerFlags *flags)
PyAPI_FUNC(PyObject *)
PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l)
{
- return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL);
+ return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL);
}
#undef PyRun_FileEx
PyAPI_FUNC(PyObject *)
PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c)
{
- return PyRun_FileExFlags(fp, p, s, g, l, c, NULL);
+ return PyRun_FileExFlags(fp, p, s, g, l, c, NULL);
}
#undef PyRun_FileFlags
@@ -2111,7 +2111,7 @@ PyAPI_FUNC(PyObject *)
PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l,
PyCompilerFlags *flags)
{
- return PyRun_FileExFlags(fp, p, s, g, l, 0, flags);
+ return PyRun_FileExFlags(fp, p, s, g, l, 0, flags);
}
#undef PyRun_SimpleFile