Commits

Antonio Cuni committed 9267807

rename "chunks" to "ids", to avoid confusion with the "chunks" used by the parser

  • Participants
  • Parent commits 8da3130

Comments (0)

Files changed (2)

pypy/module/pypyjit/test_pypy_c/model.py

         self.traces = [Trace(rawtrace, chunks) for rawtrace in rawtraces]
 
     @classmethod
-    def find_chunks_range(cls, func):
+    def find_ids_range(cls, func):
         """
-        Parse the given function and return a dictionary mapping "chunk
-        names" to "line ranges".  Chunks are identified by comments with a
-        special syntax::
+        Parse the given function and return a dictionary mapping "ids" to
+        "line ranges".  Ids are identified by comments with a special syntax::
 
-            # the chunk "myid" corresponds to the whole line
+            # "myid" corresponds to the whole line
             print 'foo' # ID: myid
         """
         result = {}
         return result
 
     @classmethod
-    def find_chunks(cls, func):
+    def find_ids(cls, func):
         """
-        Parse the given function and return a dictionary mapping "chunk names"
-        to "opcodes".
+        Parse the given function and return a dictionary mapping "ids" to
+        "opcodes".
         """
-        chunks = {}
+        ids = {}
         code = disassembler.dis(func)
-        ranges = cls.find_chunks_range(func)
+        ranges = cls.find_ids_range(func)
         for name, linerange in ranges.iteritems():
             opcodes = [opcode for opcode in code.opcodes
                        if opcode.lineno in linerange]
-            chunks[name] = opcodes
-        return chunks
+            ids[name] = opcodes
+        return ids
 
 
 class Trace(object):

pypy/module/pypyjit/test_pypy_c/test_model.py

 
 class TestLog(object):
 
-    def test_find_chunks_range(self):
+    def test_find_ids_range(self):
         def f():
             a = 0 # ID: myline
             return a
         #
         start_lineno = f.func_code.co_firstlineno
-        ids = Log.find_chunks_range(f)
+        ids = Log.find_ids_range(f)
         assert len(ids) == 1
         myline_range = ids['myline']
         assert list(myline_range) == range(start_lineno+1, start_lineno+2)
 
-    def test_find_chunks(self):
+    def test_find_ids(self):
         def f():
             i = 0
             x = 0
             z = x + 3 # ID: myline
             return z
         #
-        chunks = Log.find_chunks(f)
-        assert len(chunks) == 1
-        myline = chunks['myline']
+        ids = Log.find_ids(f)
+        assert len(ids) == 1
+        myline = ids['myline']
         opcodes_names = [opcode.__class__.__name__ for opcode in myline]
         assert opcodes_names == ['LOAD_FAST', 'LOAD_CONST', 'BINARY_ADD', 'STORE_FAST']