Skip to content

Commit fd4f0d1

Browse files
committed
Add warmup_critical_function to more handlers
1 parent 76f465d commit fd4f0d1

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

pypy/interpreter/baseobjspace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def _cpyext_attach_pyobj(self, space, py_obj):
236236

237237
# -------------------------------------------------------------------
238238

239+
@jit.warmup_critical_function
239240
def is_w(self, space, w_other):
240241
return self is w_other
241242

pypy/interpreter/function.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def getcode(self):
8282
return jit.promote(self.code)
8383
return self.code
8484

85+
@jit.warmup_critical_function
8586
def funccall(self, *args_w): # speed hack
8687
from pypy.interpreter import gateway
8788
from pypy.interpreter.pycode import PyCode
@@ -461,6 +462,7 @@ def fget_func_closure(self, space):
461462
return w_res
462463

463464

465+
@jit.warmup_critical_function
464466
def descr_function_get(space, w_function, w_obj, w_cls=None):
465467
"""functionobject.__get__(obj[, type]) -> method"""
466468
# this is not defined as a method on Function because it's generally

pypy/module/__builtin__/interp_classobj.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def is_subclass_of(self, other):
9090
return False
9191

9292
@jit.unroll_safe
93+
@jit.warmup_critical_function
9394
def lookup(self, space, attr):
9495
# returns w_value or interplevel None
9596
w_result = space.finditem_str(self.w_dict, attr)
@@ -313,6 +314,7 @@ def set_oldstyle_class(self, space, w_class):
313314
raise oefmt(space.w_TypeError, "__class__ must be set to a class")
314315
self.w_class = w_class
315316

317+
@jit.warmup_critical_function
316318
def getattr_from_class(self, space, name):
317319
# Look up w_name in the class dict, and call its __get__.
318320
# This method ignores the instance dict and the __getattr__.
@@ -326,6 +328,7 @@ def getattr_from_class(self, space, name):
326328
return w_value
327329
return space.call_function(w_descr_get, w_value, self, self.w_class)
328330

331+
@jit.warmup_critical_function
329332
def getattr(self, space, name, exc=True):
330333
# Normal getattr rules: look up w_name in the instance dict,
331334
# in the class dict, and then via a call to __getatttr__.
@@ -353,6 +356,7 @@ def getattr(self, space, name, exc=True):
353356
return None
354357

355358
@unwrap_spec(name='text')
359+
@jit.warmup_critical_function
356360
def descr_getattribute(self, space, name):
357361
if len(name) >= 8 and name[0] == '_':
358362
if name == "__dict__":

pypy/objspace/descroperation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def get_and_call_args(space, w_descr, w_obj, args):
160160
w_impl = space.get(w_descr, w_obj)
161161
return space.call_args(w_impl, args)
162162

163+
@jit.warmup_critical_function
163164
def get_and_call_function(space, w_descr, w_obj, *args_w):
164165
typ = type(w_descr)
165166
# a special case for performance and to avoid infinite recursion
@@ -221,7 +222,7 @@ def getattr(space, w_obj, w_name):
221222
w_descr = space.lookup(w_obj, '__getattribute__')
222223
return space._handle_getattribute(w_descr, w_obj, w_name)
223224

224-
#@jit.warmup_critical_function
225+
@jit.warmup_critical_function
225226
def _handle_getattribute(space, w_descr, w_obj, w_name):
226227
try:
227228
if w_descr is None: # obscure case
@@ -235,6 +236,7 @@ def _handle_getattribute(space, w_descr, w_obj, w_name):
235236
raise
236237
return space.get_and_call_function(w_descr, w_obj, w_name)
237238

239+
@jit.warmup_critical_function
238240
def setattr(space, w_obj, w_name, w_val):
239241
# overridden in StdObjSpace
240242
w_descr = space.lookup(w_obj, '__setattr__')

pypy/objspace/std/mapdict.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def read(self, obj, name, attrkind):
6060
else:
6161
return attr._direct_read(obj)
6262

63+
@jit.warmup_critical_function
6364
def write(self, obj, name, attrkind, w_value):
6465
attr = self.find_map_attr(name, attrkind)
6566
if attr is None:
@@ -800,6 +801,7 @@ def _obj_setdict(self, space, w_dict):
800801
assert flag
801802

802803
class MapdictStorageMixin(object):
804+
@jit.warmup_critical_function
803805
def _get_mapdict_map(self):
804806
return jit.promote(self.map)
805807
def _set_mapdict_map(self, map):
@@ -810,6 +812,7 @@ def _mapdict_init_empty(self, map):
810812
self._set_mapdict_map(map)
811813
self.storage = None
812814

815+
@jit.warmup_critical_function
813816
def _mapdict_read_storage(self, storageindex):
814817
assert storageindex >= 0
815818
return self.storage[storageindex]
@@ -872,6 +875,7 @@ def _make_storage_mixin_size_n(n=SUBCLASSES_NUM_FIELDS):
872875
rangenmin1 = unroll.unrolling_iterable(range(nmin1))
873876
valnmin1 = "_value%s" % nmin1
874877
class subcls(object):
878+
@jit.warmup_critical_function
875879
def _get_mapdict_map(self):
876880
return jit.promote(self.map)
877881
def _set_mapdict_map(self, map):
@@ -892,7 +896,7 @@ def _mapdict_get_storage_list(self):
892896
erased = getattr(self, valnmin1)
893897
return unerase_list(erased)
894898

895-
#@jit.warmup_critical_function
899+
@jit.warmup_critical_function
896900
def _mapdict_read_storage(self, storageindex):
897901
assert storageindex >= 0
898902
if storageindex < nmin1:

0 commit comments

Comments
 (0)