[pypy-svn] r69155 - in pypy/trunk/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Wed Nov 11 13:10:16 CET 2009


Author: arigo
Date: Wed Nov 11 13:10:15 2009
New Revision: 69155

Modified:
   pypy/trunk/pypy/jit/metainterp/codewriter.py
   pypy/trunk/pypy/jit/metainterp/pyjitpl.py
   pypy/trunk/pypy/jit/metainterp/test/test_codewriter.py
Log:
Bah.  Revert.


Modified: pypy/trunk/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/codewriter.py	Wed Nov 11 13:10:15 2009
@@ -65,8 +65,6 @@
         self.counter = 0
         self.class_sizes = []
         self._class_sizes_seen = {}
-        self.list_of_addr2name = []
-        self._functions_addr_seen = {}
 
         # set later with .start()
         self.metainterp_sd = None
@@ -174,8 +172,7 @@
         portal_code = self.make_portal_bytecode(portal_graph)
 
         self.metainterp_sd.info_from_codewriter(portal_code, leave_code,
-                                                self.class_sizes,
-                                                self.list_of_addr2name)
+                                                self.class_sizes)
 
     def _start(self, metainterp_sd, portal_runner_ptr):
         self.metainterp_sd = metainterp_sd
@@ -309,8 +306,6 @@
         methdescr.setup(jitcodes)
 
     def getcalldescr(self, v_func, args, result, consider_effects_of=None):
-        if isinstance(v_func, Constant):
-            self.register_known_function(v_func.value)
         non_void_args = [x for x in args if x.concretetype is not lltype.Void]
         NON_VOID_ARGS = [x.concretetype for x in non_void_args]
         RESULT = result.concretetype
@@ -335,8 +330,6 @@
             self._class_sizes_seen[key] = True
             sizedescr = self.cpu.sizeof(STRUCT)
             self.class_sizes.append((vtable, sizedescr))
-            vtable_addr = llmemory.cast_ptr_to_adr(vtable)
-            self.list_of_addr2name.append((vtable_addr, STRUCT.__name__))
 
     def register_known_ooclass(self, cls, CLASS):
         # ootype only
@@ -345,12 +338,6 @@
             typedescr = self.cpu.typedescrof(CLASS)
             self.class_sizes.append((cls, typedescr))
 
-    def register_known_function(self, func):
-        if self.rtyper.type_system.name == 'lltypesystem':
-            if func._obj not in self._functions_addr_seen:
-                self._functions_addr_seen[func._obj] = True
-                func_addr = llmemory.cast_ptr_to_adr(func)
-                self.list_of_addr2name.append((func_addr, func._obj._name))
 
 
 class BytecodeMaker(object):

Modified: pypy/trunk/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/pyjitpl.py	Wed Nov 11 13:10:15 2009
@@ -1022,18 +1022,15 @@
 
         self.portal_code = None
         self.leave_code = None
-        self._class_sizes = None
-        self._list_of_addr2name = None
+        self._class_sizes = None        
 
     def _freeze_(self):
         return True
 
-    def info_from_codewriter(self, portal_code, leave_code, class_sizes,
-                             list_of_addr2name=[]):
+    def info_from_codewriter(self, portal_code, leave_code, class_sizes):
         self.portal_code = portal_code
         self.leave_code = leave_code
         self._class_sizes = class_sizes
-        self._list_of_addr2name = list_of_addr2name
 
     def finish_setup(self, optimizer=None):
         warmrunnerdesc = self.warmrunnerdesc
@@ -1066,10 +1063,6 @@
             class_sizes[vtable] = sizedescr
         self.cpu.set_class_sizes(class_sizes)
 
-    def get_addr2name_dict(self):
-        # for debugging
-        pass #...
-
     def bytecode_for_address(self, fnaddress):
         if we_are_translated():
             d = self.globaldata.indirectcall_dict

Modified: pypy/trunk/pypy/jit/metainterp/test/test_codewriter.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_codewriter.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_codewriter.py	Wed Nov 11 13:10:15 2009
@@ -121,14 +121,12 @@
             supports_floats = False
             def fielddescrof(self, STRUCT, fieldname):
                 return ('fielddescr', STRUCT, fieldname)
-            def calldescrof(self, FUNC, NON_VOID_ARGS, RESULT, stuff=None):
+            def calldescrof(self, FUNC, NON_VOID_ARGS, RESULT):
                 return ('calldescr', FUNC, NON_VOID_ARGS, RESULT)
             def typedescrof(self, CLASS):
                 return ('typedescr', CLASS)
             def methdescrof(self, CLASS, methname):
                 return FakeMethDescr(CLASS, methname)
-            def sizeof(self, STRUCT):
-                return ('sizeof', STRUCT)
 
         if type_system == 'lltype':
             FakeCPU.ts = typesystem.llhelper
@@ -368,24 +366,6 @@
         assert jitcode._source.count('oononnull') == 2
         assert jitcode._source.count('ooisnull') == 2
 
-    def test_list_of_addr2name(self):
-        class A1:
-            def g(self):
-                self.x = 123
-                return 5
-        def f():
-            a = A1()
-            a.y = a.g()
-            return a
-        graphs = self.make_graphs(f, [])
-        cw = CodeWriter(self.rtyper)
-        cw.candidate_graphs = [graphs[0]]
-        cw._start(self.metainterp_sd, None)
-        jitcode = cw.make_one_bytecode((graphs[0], None), False)
-        assert len(cw.list_of_addr2name) == 2
-        assert cw.list_of_addr2name[0][1].endswith('.A1')
-        assert cw.list_of_addr2name[1][1] == 'A1.g'
-
 class ImmutableFieldsTests:
 
     def test_fields(self):



More information about the Pypy-commit mailing list