[pypy-commit] pypy gc-hooks: add JIT support for rtimer.get_timestamp_unit
antocuni
pypy.commits at gmail.com
Mon Apr 16 05:38:44 EDT 2018
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: gc-hooks
Changeset: r94345:43e5624d7947
Date: 2018-04-16 11:27 +0200
http://bitbucket.org/pypy/pypy/changeset/43e5624d7947/
Log: add JIT support for rtimer.get_timestamp_unit
diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -2164,6 +2164,11 @@
oopspecindex=EffectInfo.OS_MATH_READ_TIMESTAMP,
extraeffect=EffectInfo.EF_CANNOT_RAISE)
+ def rewrite_op_ll_get_timestamp_unit(self, op):
+ op1 = self.prepare_builtin_call(op, "ll_get_timestamp_unit", [])
+ return self.handle_residual_call(op1,
+ extraeffect=EffectInfo.EF_CANNOT_RAISE)
+
def rewrite_op_jit_force_quasi_immutable(self, op):
v_inst, c_fieldname = op.args
descr1 = self.cpu.fielddescrof(v_inst.concretetype.TO,
diff --git a/rpython/jit/codewriter/support.py b/rpython/jit/codewriter/support.py
--- a/rpython/jit/codewriter/support.py
+++ b/rpython/jit/codewriter/support.py
@@ -285,6 +285,9 @@
from rpython.rlib import rtimer
return rtimer.read_timestamp()
+def _ll_0_ll_get_timestamp_unit():
+ from rpython.rlib import rtimer
+ return rtimer.get_timestamp_unit()
# math support
# ------------
diff --git a/rpython/jit/metainterp/test/test_ajit.py b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -2577,6 +2577,14 @@
res = self.interp_operations(f, [])
assert res
+ def test_get_timestamp_unit(self):
+ import time
+ from rpython.rlib import rtimer
+ def f():
+ return rtimer.get_timestamp_unit()
+ unit = self.interp_operations(f, [])
+ assert unit == rtimer.UNIT_NS
+
def test_bug688_multiple_immutable_fields(self):
myjitdriver = JitDriver(greens=[], reds=['counter','context'])
More information about the pypy-commit
mailing list