blob: 20a6452b2a73edc3b7c857ed13e98a58400a4828 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
from pypy.jit.codewriter.policy import JitPolicy
class PyPyJitPolicy(JitPolicy):
def look_inside_pypy_module(self, modname):
if (modname == '__builtin__.operation' or
modname == '__builtin__.abstractinst' or
modname == '__builtin__.interp_classobj' or
modname == '__builtin__.functional'):
return True
if '.' in modname:
modname, _ = modname.split('.', 1)
if modname in ['pypyjit', 'signal', 'micronumpy', 'math', 'exceptions',
'imp', 'sys', 'array', '_ffi']:
return True
return False
def look_inside_function(self, func):
# this function should never actually return True directly
# but instead call the base implementation
mod = func.__module__ or '?'
if mod.startswith('pypy.objspace.'):
# gc_id operation
if func.__name__ == 'id__ANY':
return False
if mod == 'pypy.rlib.rbigint' or mod == 'pypy.rlib.rlocale':
return False
if '_geninterp_' in func.func_globals: # skip all geninterped stuff
return False
if mod.startswith('pypy.interpreter.astcompiler.'):
return False
if mod.startswith('pypy.interpreter.pyparser.'):
return False
if mod.startswith('pypy.module.'):
modname = mod[len('pypy.module.'):]
if not self.look_inside_pypy_module(modname):
return False
return True
|