[pypy-svn] pypy jit-shadowstack: Fixes for test_gc_integration.py.
arigo
commits-noreply at bitbucket.org
Thu Mar 31 17:12:06 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-shadowstack
Changeset: r43056:05cd7ad17f47
Date: 2011-03-31 17:02 +0200
http://bitbucket.org/pypy/pypy/changeset/05cd7ad17f47/
Log: Fixes for test_gc_integration.py.
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
@@ -185,7 +185,7 @@
mc.SUB_rr(edx.value, eax.value) # compute the size we want
addr = self.cpu.gc_ll_descr.get_malloc_fixedsize_slowpath_addr()
#
- if gcrootmap.is_shadow_stack:
+ if gcrootmap is not None and gcrootmap.is_shadow_stack:
# ---- shadowstack ----
for reg, ofs in gpr_reg_mgr_cls.REGLOC_TO_COPY_AREA_OFS.items():
mc.MOV_br(ofs, reg.value)
@@ -2105,12 +2105,13 @@
self._regalloc.reserve_param(1+16)
gcrootmap = self.cpu.gc_ll_descr.gcrootmap
- if not gcrootmap.is_shadow_stack:
+ shadow_stack = (gcrootmap is not None and gcrootmap.is_shadow_stack)
+ if not shadow_stack:
# there are two helpers to call only with asmgcc
slowpath_addr1 = self.malloc_fixedsize_slowpath1
self.mc.CALL(imm(slowpath_addr1))
self.mark_gc_roots(self.write_new_force_index(),
- use_copy_area=gcrootmap.is_shadow_stack)
+ use_copy_area=shadow_stack)
slowpath_addr2 = self.malloc_fixedsize_slowpath2
self.mc.CALL(imm(slowpath_addr2))
diff --git a/pypy/jit/backend/x86/test/test_gc_integration.py b/pypy/jit/backend/x86/test/test_gc_integration.py
--- a/pypy/jit/backend/x86/test/test_gc_integration.py
+++ b/pypy/jit/backend/x86/test/test_gc_integration.py
@@ -26,9 +26,10 @@
CPU = getcpuclass()
class MockGcRootMap(object):
+ is_shadow_stack = False
def get_basic_shape(self, is_64_bit):
return ['shape']
- def add_ebp_offset(self, shape, offset):
+ def add_frame_offset(self, shape, offset):
shape.append(offset)
def add_callee_save_reg(self, shape, reg_index):
index_to_name = { 1: 'ebx', 2: 'esi', 3: 'edi' }
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
@@ -865,7 +865,7 @@
gc_ll_descr = self.assembler.cpu.gc_ll_descr
self.rm.force_allocate_reg(op.result, selected_reg=eax)
- if gc_ll_descr.gcrootmap.is_shadow_stack:
+ if gc_ll_descr.gcrootmap and gc_ll_descr.gcrootmap.is_shadow_stack:
# ---- shadowstack ----
# We need edx as a temporary, but otherwise don't save any more
# register. See comments in _build_malloc_fixedsize_slowpath().
More information about the Pypy-commit
mailing list