[pypy-commit] lang-smalltalk default: hoping to get rid of three calls in the interrupt checking code
timfel
noreply at buildbot.pypy.org
Wed Dec 18 17:06:22 CET 2013
Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch:
Changeset: r535:d296a5bfee07
Date: 2013-12-18 13:28 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/d296a5bfee07/
Log: hoping to get rid of three calls in the interrupt checking code
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -5,7 +5,7 @@
from spyvm.tool.bitmanipulation import splitter
from rpython.rlib import jit
-from rpython.rlib import objectmodel, unroll
+from rpython.rlib import objectmodel, unroll, rarithmetic
class MissingBytecode(Exception):
"""Bytecode not implemented yet."""
@@ -182,7 +182,10 @@
# We don't adjust the check counter size
# use the same time value as the primitive MILLISECOND_CLOCK
- now = int(math.fmod(time.time()*1000, constants.TAGGED_MAXINT/2))
+ now = rarithmetic.intmask(
+ int(time.time()*1000) & (constants.TAGGED_MAXINT/2 - 1)
+ )
+ # now = int(math.fmod(time.time()*1000, constants.TAGGED_MAXINT/2))
# XXX the low space semaphore may be signaled here
# Process inputs
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -1017,7 +1017,9 @@
@expose_primitive(MILLISECOND_CLOCK, unwrap_spec=[object])
def func(interp, s_frame, w_arg):
import time, math
- return interp.space.wrap_int(int(math.fmod(time.time()*1000, constants.TAGGED_MAXINT/2)))
+ return interp.space.wrap_int(rarithmetic.intmask(
+ int(time.time()*1000) & (constants.TAGGED_MAXINT/2 - 1)
+ ))
@expose_primitive(SIGNAL_AT_MILLISECONDS, unwrap_spec=[object, object, int])
def func(interp, s_frame, w_delay, w_semaphore, timestamp):
More information about the pypy-commit
mailing list