[pypy-svn] r65501 - in pypy/branch/pyjitpl5-experiments/pypy: module/pypyjit objspace/std
cfbolz at codespeak.net
cfbolz at codespeak.net
Fri May 29 20:12:15 CEST 2009
Author: cfbolz
Date: Fri May 29 20:12:14 2009
New Revision: 65501
Modified:
pypy/branch/pyjitpl5-experiments/pypy/module/pypyjit/policy.py
pypy/branch/pyjitpl5-experiments/pypy/objspace/std/dictmultiobject.py
Log:
Remove one dictionary lookup in the residual code for an attribute access when
using shared dicts.
Modified: pypy/branch/pyjitpl5-experiments/pypy/module/pypyjit/policy.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/module/pypyjit/policy.py (original)
+++ pypy/branch/pyjitpl5-experiments/pypy/module/pypyjit/policy.py Fri May 29 20:12:14 2009
@@ -35,7 +35,6 @@
# gc_id operation
if func.__name__ == 'id__ANY':
return False
- return True
# floats
if mod == 'pypy.rlib.rbigint':
#if func.__name__ == '_bigint_true_divide':
Modified: pypy/branch/pyjitpl5-experiments/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/objspace/std/dictmultiobject.py (original)
+++ pypy/branch/pyjitpl5-experiments/pypy/objspace/std/dictmultiobject.py Fri May 29 20:12:14 2009
@@ -711,6 +711,16 @@
self.other_structs[added_key] = new_structure
return new_structure
+ def lookup_position(self, key):
+ # jit helper
+ self = hint(self, promote=True)
+ key = hint(key, promote=True)
+ return _lookup_position_shared(self, key)
+
+ at purefunction
+def _lookup_position_shared(self, key):
+ return self.keys.get(key, -1)
+
class State(object):
def __init__(self, space):
@@ -730,8 +740,8 @@
w_lookup_type = space.type(w_lookup)
if space.is_w(w_lookup_type, space.w_str):
lookup = space.str_w(w_lookup)
- i = self.structure.keys.get(lookup, -1)
- if i < 0:
+ i = self.structure.lookup_position(lookup)
+ if i == -1:
return None
return self.entries[i]
elif _is_sane_hash(space, w_lookup_type):
@@ -748,8 +758,8 @@
def setitem_str(self, w_key, w_value, shadows_type=True):
key = self.space.str_w(w_key)
- i = self.structure.keys.get(key, -1)
- if i >= 0:
+ i = self.structure.lookup_position(key)
+ if i != -1:
self.entries[i] = w_value
return self
if not self.structure.propagating:
More information about the Pypy-commit
mailing list