Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
75eabd29
Kaydet (Commit)
75eabd29
authored
Ock 18, 2005
tarafından
Michael W. Hudson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Change the name of the macro used by --with-tsc builds to the less
inscrutable READ_TIMESTAMP.
üst
46e6d92d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
29 deletions
+32
-29
ceval.c
Python/ceval.c
+32
-29
No files found.
Python/ceval.c
Dosyayı görüntüle @
75eabd29
...
@@ -17,8 +17,10 @@
...
@@ -17,8 +17,10 @@
#include <ctype.h>
#include <ctype.h>
#ifndef WITH_TSC
#ifndef WITH_TSC
#define rdtscll(var)
#else
/*WITH_TSC defined*/
#define READ_TIMESTAMP(var)
#else
typedef
unsigned
long
long
uint64
;
typedef
unsigned
long
long
uint64
;
...
@@ -26,7 +28,7 @@ typedef unsigned long long uint64;
...
@@ -26,7 +28,7 @@ typedef unsigned long long uint64;
section should work for GCC on any PowerPC platform,
section should work for GCC on any PowerPC platform,
irrespective of OS. POWER? Who knows :-) */
irrespective of OS. POWER? Who knows :-) */
#define
rdtscll
(var) ppc_getcounter(&var)
#define
READ_TIMESTAMP
(var) ppc_getcounter(&var)
static
void
static
void
ppc_getcounter
(
uint64
*
v
)
ppc_getcounter
(
uint64
*
v
)
...
@@ -45,9 +47,10 @@ ppc_getcounter(uint64 *v)
...
@@ -45,9 +47,10 @@ ppc_getcounter(uint64 *v)
((
long
*
)(
v
))[
1
]
=
tb
;
((
long
*
)(
v
))[
1
]
=
tb
;
}
}
#else
/* this
section is for linux/x86
*/
#else
/* this
is for linux/x86 (and probably any other GCC/x86 combo)
*/
#include <asm/msr.h>
#define READ_TIMESTAMP(val) \
__asm__ __volatile__("rdtsc" : "=A" (val))
#endif
#endif
...
@@ -575,10 +578,10 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -575,10 +578,10 @@ PyEval_EvalFrame(PyFrameObject *f)
uint64
inst0
,
inst1
,
loop0
,
loop1
,
intr0
=
0
,
intr1
=
0
;
uint64
inst0
,
inst1
,
loop0
,
loop1
,
intr0
=
0
,
intr1
=
0
;
int
ticked
=
0
;
int
ticked
=
0
;
rdtscll
(
inst0
);
READ_TIMESTAMP
(
inst0
);
rdtscll
(
inst1
);
READ_TIMESTAMP
(
inst1
);
rdtscll
(
loop0
);
READ_TIMESTAMP
(
loop0
);
rdtscll
(
loop1
);
READ_TIMESTAMP
(
loop1
);
/* shut up the compiler */
/* shut up the compiler */
opcode
=
0
;
opcode
=
0
;
...
@@ -748,7 +751,7 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -748,7 +751,7 @@ PyEval_EvalFrame(PyFrameObject *f)
or a continue, preventing inst1 from being set
or a continue, preventing inst1 from being set
on the way out of the loop.
on the way out of the loop.
*/
*/
rdtscll
(
inst1
);
READ_TIMESTAMP
(
inst1
);
loop1
=
inst1
;
loop1
=
inst1
;
}
}
dump_tsc
(
opcode
,
ticked
,
inst0
,
inst1
,
loop0
,
loop1
,
dump_tsc
(
opcode
,
ticked
,
inst0
,
inst1
,
loop0
,
loop1
,
...
@@ -757,7 +760,7 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -757,7 +760,7 @@ PyEval_EvalFrame(PyFrameObject *f)
inst1
=
0
;
inst1
=
0
;
intr0
=
0
;
intr0
=
0
;
intr1
=
0
;
intr1
=
0
;
rdtscll
(
loop0
);
READ_TIMESTAMP
(
loop0
);
#endif
#endif
assert
(
stack_pointer
>=
f
->
f_valuestack
);
/* else underflow */
assert
(
stack_pointer
>=
f
->
f_valuestack
);
/* else underflow */
assert
(
STACK_LEVEL
()
<=
f
->
f_stacksize
);
/* else overflow */
assert
(
STACK_LEVEL
()
<=
f
->
f_stacksize
);
/* else overflow */
...
@@ -879,7 +882,7 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -879,7 +882,7 @@ PyEval_EvalFrame(PyFrameObject *f)
#endif
#endif
/* Main switch on opcode */
/* Main switch on opcode */
rdtscll
(
inst0
);
READ_TIMESTAMP
(
inst0
);
switch
(
opcode
)
{
switch
(
opcode
)
{
...
@@ -1638,9 +1641,9 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -1638,9 +1641,9 @@ PyEval_EvalFrame(PyFrameObject *f)
v
=
SECOND
();
v
=
SECOND
();
u
=
THIRD
();
u
=
THIRD
();
STACKADJ
(
-
3
);
STACKADJ
(
-
3
);
rdtscll
(
intr0
);
READ_TIMESTAMP
(
intr0
);
err
=
exec_statement
(
f
,
u
,
v
,
w
);
err
=
exec_statement
(
f
,
u
,
v
,
w
);
rdtscll
(
intr1
);
READ_TIMESTAMP
(
intr1
);
Py_DECREF
(
u
);
Py_DECREF
(
u
);
Py_DECREF
(
v
);
Py_DECREF
(
v
);
Py_DECREF
(
w
);
Py_DECREF
(
w
);
...
@@ -2016,9 +2019,9 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -2016,9 +2019,9 @@ PyEval_EvalFrame(PyFrameObject *f)
x
=
NULL
;
x
=
NULL
;
break
;
break
;
}
}
rdtscll
(
intr0
);
READ_TIMESTAMP
(
intr0
);
x
=
PyEval_CallObject
(
x
,
w
);
x
=
PyEval_CallObject
(
x
,
w
);
rdtscll
(
intr1
);
READ_TIMESTAMP
(
intr1
);
Py_DECREF
(
w
);
Py_DECREF
(
w
);
SET_TOP
(
x
);
SET_TOP
(
x
);
if
(
x
!=
NULL
)
continue
;
if
(
x
!=
NULL
)
continue
;
...
@@ -2032,9 +2035,9 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -2032,9 +2035,9 @@ PyEval_EvalFrame(PyFrameObject *f)
"no locals found during 'import *'"
);
"no locals found during 'import *'"
);
break
;
break
;
}
}
rdtscll
(
intr0
);
READ_TIMESTAMP
(
intr0
);
err
=
import_all_from
(
x
,
v
);
err
=
import_all_from
(
x
,
v
);
rdtscll
(
intr1
);
READ_TIMESTAMP
(
intr1
);
PyFrame_LocalsToFast
(
f
,
0
);
PyFrame_LocalsToFast
(
f
,
0
);
Py_DECREF
(
v
);
Py_DECREF
(
v
);
if
(
err
==
0
)
continue
;
if
(
err
==
0
)
continue
;
...
@@ -2043,9 +2046,9 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -2043,9 +2046,9 @@ PyEval_EvalFrame(PyFrameObject *f)
case
IMPORT_FROM
:
case
IMPORT_FROM
:
w
=
GETITEM
(
names
,
oparg
);
w
=
GETITEM
(
names
,
oparg
);
v
=
TOP
();
v
=
TOP
();
rdtscll
(
intr0
);
READ_TIMESTAMP
(
intr0
);
x
=
import_from
(
v
,
w
);
x
=
import_from
(
v
,
w
);
rdtscll
(
intr1
);
READ_TIMESTAMP
(
intr1
);
PUSH
(
x
);
PUSH
(
x
);
if
(
x
!=
NULL
)
continue
;
if
(
x
!=
NULL
)
continue
;
break
;
break
;
...
@@ -2199,9 +2202,9 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -2199,9 +2202,9 @@ PyEval_EvalFrame(PyFrameObject *f)
}
else
}
else
Py_INCREF
(
func
);
Py_INCREF
(
func
);
sp
=
stack_pointer
;
sp
=
stack_pointer
;
rdtscll
(
intr0
);
READ_TIMESTAMP
(
intr0
);
x
=
ext_do_call
(
func
,
&
sp
,
flags
,
na
,
nk
);
x
=
ext_do_call
(
func
,
&
sp
,
flags
,
na
,
nk
);
rdtscll
(
intr1
);
READ_TIMESTAMP
(
intr1
);
stack_pointer
=
sp
;
stack_pointer
=
sp
;
Py_DECREF
(
func
);
Py_DECREF
(
func
);
...
@@ -2314,7 +2317,7 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -2314,7 +2317,7 @@ PyEval_EvalFrame(PyFrameObject *f)
on_error:
on_error:
rdtscll
(
inst1
);
READ_TIMESTAMP
(
inst1
);
/* Quickly continue if no error occurred */
/* Quickly continue if no error occurred */
...
@@ -2327,7 +2330,7 @@ PyEval_EvalFrame(PyFrameObject *f)
...
@@ -2327,7 +2330,7 @@ PyEval_EvalFrame(PyFrameObject *f)
"XXX undetected error
\n
"
);
"XXX undetected error
\n
"
);
else
{
else
{
#endif
#endif
rdtscll
(
loop1
);
READ_TIMESTAMP
(
loop1
);
continue
;
/* Normal, fast path */
continue
;
/* Normal, fast path */
#ifdef CHECKEXC
#ifdef CHECKEXC
}
}
...
@@ -2446,7 +2449,7 @@ fast_block_end:
...
@@ -2446,7 +2449,7 @@ fast_block_end:
if
(
why
!=
WHY_NOT
)
if
(
why
!=
WHY_NOT
)
break
;
break
;
rdtscll
(
loop1
);
READ_TIMESTAMP
(
loop1
);
}
/* main loop */
}
/* main loop */
...
@@ -3543,9 +3546,9 @@ call_function(PyObject ***pp_stack, int oparg
...
@@ -3543,9 +3546,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
);
rdtscll
(
*
pintr0
);
READ_TIMESTAMP
(
*
pintr0
);
C_TRACE
(
x
=
PyCFunction_Call
(
func
,
callargs
,
NULL
));
C_TRACE
(
x
=
PyCFunction_Call
(
func
,
callargs
,
NULL
));
rdtscll
(
*
pintr1
);
READ_TIMESTAMP
(
*
pintr1
);
Py_XDECREF
(
callargs
);
Py_XDECREF
(
callargs
);
}
}
}
else
{
}
else
{
...
@@ -3563,12 +3566,12 @@ call_function(PyObject ***pp_stack, int oparg
...
@@ -3563,12 +3566,12 @@ call_function(PyObject ***pp_stack, int oparg
n
++
;
n
++
;
}
else
}
else
Py_INCREF
(
func
);
Py_INCREF
(
func
);
rdtscll
(
*
pintr0
);
READ_TIMESTAMP
(
*
pintr0
);
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
);
rdtscll
(
*
pintr1
);
READ_TIMESTAMP
(
*
pintr1
);
Py_DECREF
(
func
);
Py_DECREF
(
func
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment