Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r94874:0ee5333ce97e Date: 2018-07-18 10:46 +0200 http://bitbucket.org/pypy/pypy/changeset/0ee5333ce97e/
Log: rvmprof.dummy is not really working, at least for pypy. Try to fix it some more, but give up for now. Instead, robustly detect that vmprof is not supported from pypyoption and disable the '_vmprof' and 'faulthandler' modules. diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -39,14 +39,10 @@ "_csv", "_cppyy", "_pypyjson", "_jitlog" ]) -from rpython.jit.backend import detect_cpu -try: - if detect_cpu.autodetect().startswith('x86'): - if not sys.platform.startswith('openbsd'): - working_modules.add('_vmprof') - working_modules.add('faulthandler') -except detect_cpu.ProcessorAutodetectError: - pass +import rpython.rlib.rvmprof.cintf +if rpython.rlib.rvmprof.cintf.IS_SUPPORTED: + working_modules.add('_vmprof') + working_modules.add('faulthandler') translation_modules = default_modules.copy() translation_modules.update([ @@ -318,3 +314,4 @@ parser = to_optparse(config) #, useoptions=["translation.*"]) option, args = parser.parse_args() print config + print working_modules diff --git a/rpython/rlib/rvmprof/dummy.py b/rpython/rlib/rvmprof/dummy.py --- a/rpython/rlib/rvmprof/dummy.py +++ b/rpython/rlib/rvmprof/dummy.py @@ -1,6 +1,7 @@ from rpython.rlib.objectmodel import specialize class DummyVMProf(object): + is_enabled = False def __init__(self): self._unique_id = 0 diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py --- a/rpython/rlib/rvmprof/rvmprof.py +++ b/rpython/rlib/rvmprof/rvmprof.py @@ -23,6 +23,7 @@ VMPROF_GC_TAG = 5 class VMProfError(Exception): + msg = '' # annotation hack def __init__(self, msg): self.msg = msg def __str__(self): diff --git a/rpython/rlib/rvmprof/traceback.py b/rpython/rlib/rvmprof/traceback.py --- a/rpython/rlib/rvmprof/traceback.py +++ b/rpython/rlib/rvmprof/traceback.py @@ -13,6 +13,8 @@ array_length). The caller must free array_p. Not for signal handlers: for these, call vmprof_get_traceback() from C code. """ + if not cintf.IS_SUPPORTED: + return (None, 0) _cintf = rvmprof._get_vmprof().cintf size = estimate_number_of_entries * 2 + 4 stack = cintf.get_rvmprof_stack() @@ -47,6 +49,8 @@ 'code_obj' may be None if it can't be determined. 'loc' is one of the LOC_xxx constants. """ + if not cintf.IS_SUPPORTED: + return i = 0 while i < array_length - 1: tag = array_p[i] _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit