Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r60400:dad42ccc5996
Date: 2013-01-23 22:55 +0200
http://bitbucket.org/pypy/pypy/changeset/dad42ccc5996/
Log: fixes. Also stupid cpython interpreter exit
diff --git a/rpython/jit/backend/llsupport/asmmemmgr.py
b/rpython/jit/backend/llsupport/asmmemmgr.py
--- a/rpython/jit/backend/llsupport/asmmemmgr.py
+++ b/rpython/jit/backend/llsupport/asmmemmgr.py
@@ -42,7 +42,8 @@
def free(self, start, stop):
"""Free a block (start, stop) returned by a previous malloc()."""
- self.total_mallocs -= r_uint(stop - start)
+ if r_uint is not None:
+ self.total_mallocs -= r_uint(stop - start)
self._add_free_block(start, stop)
def open_malloc(self, minsize):
diff --git a/rpython/jit/backend/model.py b/rpython/jit/backend/model.py
--- a/rpython/jit/backend/model.py
+++ b/rpython/jit/backend/model.py
@@ -297,6 +297,7 @@
self.cpu = cpu
self.number = number
self.bridges_count = 0
+ self.jumping_to = [] # a list of weakrefs who jump here
# This growing list gives the 'descr_number' of all fail descrs
# that belong to this loop or to a bridge attached to it.
# Filled by the frontend calling record_faildescr_index().
diff --git a/rpython/jit/backend/x86/assembler.py
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -1,3 +1,5 @@
+
+import weakref
import sys, os
from rpython.jit.backend.llsupport import symbolic, jitframe
from rpython.jit.backend.llsupport.asmmemmgr import MachineDataBlockWrapper
@@ -536,7 +538,7 @@
looppos = self.mc.get_relative_pos()
looptoken._x86_loop_code = looppos
frame_depth = self._assemble(regalloc, inputargs, operations)
- clt.frame_info.jfi_frame_depth = frame_depth + JITFRAME_FIXED_SIZE
+ self.update_frame_depth(frame_depth + JITFRAME_FIXED_SIZE)
#
size_excluding_failure_stuff = self.mc.get_relative_pos()
self.write_pending_failure_recoveries()
@@ -613,7 +615,7 @@
self._patch_stackadjust(stack_check_patch_ofs + rawstart, frame_depth)
self._patch_stackadjust(ofs2 + rawstart, frame_depth)
self.fixup_target_tokens(rawstart)
- self.current_clt.frame_info.jfi_frame_depth = frame_depth
+ self.update_frame_depth(frame_depth)
self.teardown()
# oprofile support
if self.cpu.profile_agent is not None:
@@ -672,6 +674,17 @@
mc.writeimm32(self.error_trampoline_64 - pos_after_jz)
mc.copy_to_raw_memory(rawstart + pos_after_jz - 4)
+ def update_frame_depth(self, frame_depth):
+ self.current_clt.frame_info.jfi_frame_depth = frame_depth
+ new_jumping_to = []
+ for wref in self.current_clt.jumping_to:
+ clt = wref()
+ if clt:
+ clt.frame_info.jfi_frame_depth = max(frame_depth,
+ clt.frame_info.jfi_frame_depth)
+ new_jumping_to.append(weakref.ref(clt))
+ self.current_clt.jumping_to = new_jumping_to
+
def _check_frame_depth(self, mc, gcmap):
""" check if the frame is of enough depth to follow this bridge.
Otherwise reallocate the frame in a helper.
@@ -2428,6 +2441,8 @@
curpos = self.mc.get_relative_pos() + 5
self.mc.JMP_l(target - curpos)
else:
+ target_token._x86_clt.jumping_to.append(
+ weakref.ref(self.current_clt))
self.mc.JMP(imm(target))
def malloc_cond(self, nursery_free_adr, nursery_top_adr, size, gcmap):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit