Ejemplo n.º 1
0
 def setup_after_space_initialization(self):
     """NOT_RPYTHON"""
     if not self.space.config.translating:
         self.extra_interpdef('interp_pdb', 'interp_magic.interp_pdb')
     if self.space.config.objspace.std.withmethodcachecounter:
         self.extra_interpdef('method_cache_counter',
                              'interp_magic.method_cache_counter')
         self.extra_interpdef('reset_method_cache_counter',
                              'interp_magic.reset_method_cache_counter')
         if self.space.config.objspace.std.withmapdict:
             self.extra_interpdef('mapdict_cache_counter',
                                  'interp_magic.mapdict_cache_counter')
     PYC_MAGIC = get_pyc_magic(self.space)
     self.extra_interpdef('PYC_MAGIC', 'space.wrap(%d)' % PYC_MAGIC)
     #
     try:
         from rpython.jit.backend import detect_cpu
         model = detect_cpu.autodetect()
         self.extra_interpdef('cpumodel', 'space.wrap(%r)' % model)
     except Exception:
         if self.space.config.translation.jit:
             raise
         else:
             pass   # ok fine to ignore in this case
     #
     if self.space.config.translation.jit:
         features = detect_cpu.getcpufeatures(model)
         self.extra_interpdef('jit_backend_features',
                                 'space.wrap(%r)' % features)
Ejemplo n.º 2
0
    def setup_after_space_initialization(self):
        """NOT_RPYTHON"""
        if self.space.config.objspace.std.withmethodcachecounter:
            self.extra_interpdef('method_cache_counter',
                                 'interp_magic.method_cache_counter')
            self.extra_interpdef('reset_method_cache_counter',
                                 'interp_magic.reset_method_cache_counter')
            self.extra_interpdef('mapdict_cache_counter',
                                 'interp_magic.mapdict_cache_counter')
        PYC_MAGIC = get_pyc_magic(self.space)
        self.extra_interpdef('PYC_MAGIC', 'space.wrap(%d)' % PYC_MAGIC)
        try:
            from rpython.jit.backend import detect_cpu
            model = detect_cpu.autodetect()
            self.extra_interpdef('cpumodel', 'space.wrap(%r)' % model)
        except Exception:
            if self.space.config.translation.jit:
                raise
            else:
                pass  # ok fine to ignore in this case

        if self.space.config.translation.jit:
            features = detect_cpu.getcpufeatures(model)
            self.extra_interpdef('jit_backend_features',
                                 'space.wrap(%r)' % features)
        if self.space.config.translation.reverse_debugger:
            self.extra_interpdef('revdb_stop', 'interp_magic.revdb_stop')
        else:
            self.extra_interpdef('revdb_stop', 'space.w_None')