[pypy-svn] pypy jit-lsprofile: (alex, fijal): read_timestamp compiles
alex_gaynor
commits-noreply at bitbucket.org
Sun Mar 13 19:54:08 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: jit-lsprofile
Changeset: r42570:8581da0dcc0a
Date: 2011-03-13 14:53 -0400
http://bitbucket.org/pypy/pypy/changeset/8581da0dcc0a/
Log: (alex, fijal): read_timestamp compiles
diff --git a/pypy/rpython/lltypesystem/lloperation.py b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -440,7 +440,7 @@
'get_write_barrier_failing_case': LLOp(sideeffects=False),
'get_write_barrier_from_array_failing_case': LLOp(sideeffects=False),
'gc_get_type_info_group': LLOp(sideeffects=False),
- 'll_read_timestamp': LLOp(sideeffects=False, canrun=True),
+ 'll_read_timestamp': LLOp(canrun=True),
# __________ GC operations __________
diff --git a/pypy/translator/c/src/timer.h b/pypy/translator/c/src/timer.h
--- a/pypy/translator/c/src/timer.h
+++ b/pypy/translator/c/src/timer.h
@@ -4,12 +4,11 @@
/* XXX Some overlap with the stuff in debug_print
*/
-/* prototypes */
-double pypy_read_timestamp_double(void);
-
#ifndef PYPY_NOT_MAIN_FILE
/* implementations */
+#define OP_LL_READ_TIMESTAMP(v) v = pypy_read_timestamp();
+
#ifdef _WIN32
long long pypy_read_timestamp(void) {
long long timestamp;
diff --git a/pypy/translator/c/src/g_include.h b/pypy/translator/c/src/g_include.h
--- a/pypy/translator/c/src/g_include.h
+++ b/pypy/translator/c/src/g_include.h
@@ -10,6 +10,7 @@
# include "traceback.h"
# include "marshal.h"
# include "eval.h"
+# include "timer.h"
#else
# include <stdlib.h>
# include <assert.h>
diff --git a/pypy/rlib/test/test_rtimer.py b/pypy/rlib/test/test_rtimer.py
--- a/pypy/rlib/test/test_rtimer.py
+++ b/pypy/rlib/test/test_rtimer.py
@@ -2,7 +2,7 @@
from pypy.rlib.rtimer import read_timestamp
from pypy.rpython.test.test_llinterp import interpret
-
+from pypy.translator.c.test.test_genc import compile
def timer():
t1 = read_timestamp()
@@ -20,4 +20,9 @@
def test_annotation():
diff = interpret(timer, [])
+ assert diff > 1000
+
+def test_compile_c():
+ function = compile(timer, [])
+ diff = function()
assert diff > 1000
\ No newline at end of file
More information about the Pypy-commit
mailing list