Author: Antonio Cuni <[email protected]>
Branch: x86-dump-labels
Changeset: r44072:1f40d0afb5d3
Date: 2011-05-11 13:45 +0200
http://bitbucket.org/pypy/pypy/changeset/1f40d0afb5d3/
Log: move the ownership of labels to the codebuf; labels are still copied
on the looptoken, but only when not translated: this way, we avoid
keeping them alive as long as the loop. Next step will be to dump
the labels to the log
diff --git a/pypy/jit/backend/x86/assembler.py
b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -305,10 +305,6 @@
rawstart = mc.materialize(self.cpu.asmmemmgr, [])
self.stack_check_slowpath = rawstart
- def add_label(self, name):
- pos = self.mc.get_relative_pos()
- self.currently_compiling_loop._x86_labels.append((pos, name))
-
def assemble_loop(self, inputargs, operations, looptoken, log):
'''adds the following attributes to looptoken:
_x86_loop_code (an integer giving an address)
@@ -332,7 +328,6 @@
self.setup(looptoken)
self.currently_compiling_loop = looptoken
- looptoken._x86_labels = []
funcname = self._find_debug_merge_point(operations)
if log:
self._register_counter()
@@ -367,9 +362,10 @@
self.patch_pending_failure_recoveries(rawstart)
#
if not we_are_translated():
- # only for tests
+ # used only by looptoken.dump() -- useful in tests
looptoken._x86_rawstart = rawstart
looptoken._x86_fullsize = fullsize
+ looptoken._x86_labels = self.mc.labels
looptoken._x86_bootstrap_code = rawstart + bootstrappos
looptoken._x86_loop_code = rawstart + self.looppos
diff --git a/pypy/jit/backend/x86/codebuf.py b/pypy/jit/backend/x86/codebuf.py
--- a/pypy/jit/backend/x86/codebuf.py
+++ b/pypy/jit/backend/x86/codebuf.py
@@ -25,10 +25,15 @@
# at [p-4:p] encode an absolute address that will need to be
# made relative.
self.relocations = []
+ self.labels = []
def add_pending_relocation(self):
self.relocations.append(self.get_relative_pos())
+ def mark_label(self, name):
+ pos = self.get_relative_pos()
+ self.labels.append((pos, name))
+
def copy_to_raw_memory(self, addr):
self._copy_to_raw_memory(addr)
for reloc in self.relocations:
diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -406,7 +406,7 @@
#self.operations = operations
while i < len(operations):
op = operations[i]
- self.assembler.add_label(op.repr())
+ self.assembler.mc.mark_label(op.repr())
self.rm.position = i
self.xrm.position = i
if op.has_no_side_effect() and op.result not in self.longevity:
@@ -425,7 +425,7 @@
i += 1
assert not self.rm.reg_bindings
assert not self.xrm.reg_bindings
- self.assembler.add_label('--end of the loop--')
+ self.assembler.mc.mark_label('--end of the loop--')
def _compute_vars_longevity(self, inputargs, operations):
# compute a dictionary that maps variables to index in
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit