Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r60198:9fa11e930749
Date: 2013-01-19 13:04 +0200
http://bitbucket.org/pypy/pypy/changeset/9fa11e930749/
Log: slow progress;
diff --git a/pypy/jit/backend/llsupport/asmmemmgr.py
b/pypy/jit/backend/llsupport/asmmemmgr.py
--- a/pypy/jit/backend/llsupport/asmmemmgr.py
+++ b/pypy/jit/backend/llsupport/asmmemmgr.py
@@ -303,7 +303,7 @@
if self.gcroot_markers is not None:
assert gcrootmap is not None
for pos, mark in self.gcroot_markers:
- gcrootmap.put(rawstart + pos, mark)
+ gcrootmap.register_asm_addr(rawstart + pos, mark)
return rawstart
def _become_a_plain_block_builder(self):
diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -70,13 +70,14 @@
return False
def has_write_barrier_class(self):
return None
- def freeing_block(self, start, stop):
- pass
def get_nursery_free_addr(self):
raise NotImplementedError
def get_nursery_top_addr(self):
raise NotImplementedError
+ def freeing_block(self, rawstart, rawstop):
+ pass
+
def gc_malloc(self, sizedescr):
"""Blackhole: do a 'bh_new'. Also used for 'bh_new_with_vtable',
with the vtable pointer set manually afterwards."""
@@ -145,6 +146,7 @@
round_up = False
write_barrier_descr = None
fielddescr_tid = None
+ gcrootmap = None
str_type_id = 0
unicode_type_id = 0
get_malloc_slowpath_addr = None
@@ -224,10 +226,20 @@
arraydescr.itemsize,
arraydescr.lendescr.offset)
-
# ____________________________________________________________
# All code below is for the hybrid or minimark GC
+class GcRootMap_asmgcc(object):
+ is_shadow_stack = False
+
+ def register_asm_addr(self, start, mark):
+ pass
+
+class GcRootMap_shadowstack(object):
+ is_shadow_stack = True
+
+ def register_asm_addr(self, start, mark):
+ pass
class WriteBarrierDescr(AbstractDescr):
def __init__(self, gc_ll_descr):
@@ -300,14 +312,24 @@
assert self.translate_support_code,"required with the framework GC"
self._check_valid_gc()
self._make_layoutbuilder()
- self.gcrootfindername =
self.gcdescr.config.translation.gcrootfinder
- assert self.gcrootfindername in ['asmgcc', 'shadowstack']
+ self._make_gcrootmap()
self._setup_gcclass()
self._setup_tid()
self._setup_write_barrier()
self._setup_str()
self._make_functions(really_not_translated)
+ def _make_gcrootmap(self):
+ # to find roots in the assembler, make a GcRootMap
+ name = self.gcdescr.config.translation.gcrootfinder
+ try:
+ cls = globals()['GcRootMap_' + name]
+ except KeyError:
+ raise NotImplementedError("--gcrootfinder=%s not implemented"
+ " with the JIT" % (name,))
+ gcrootmap = cls(self.gcdescr)
+ self.gcrootmap = gcrootmap
+
def _initialize_for_tests(self):
self.layoutbuilder = None
self.fielddescr_tid = AbstractDescr()
@@ -481,7 +503,7 @@
return rffi.cast(lltype.Signed, nurs_top_addr)
def initialize(self):
- pass
+ self.gcrootmap.initialize()
def init_size_descr(self, S, descr):
if self.layoutbuilder is not None:
@@ -518,9 +540,6 @@
def has_write_barrier_class(self):
return WriteBarrierDescr
- def freeing_block(self, start, stop):
- self.gcrootmap.freeing_block(start, stop)
-
def get_malloc_slowpath_addr(self):
return self.get_malloc_fn_addr('malloc_nursery')
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
@@ -815,7 +815,6 @@
if self.stack_check_slowpath == 0:
pass # no stack check (e.g. not translated)
else:
- xxx
endaddr, lengthaddr, _ = self.cpu.insert_stack_check()
self.mc.MOV(eax, heap(endaddr)) # MOV eax, [start]
self.mc.SUB(eax, esp) # SUB eax, current
diff --git a/pypy/jit/backend/x86/test/test_runner.py
b/pypy/jit/backend/x86/test/test_runner.py
--- a/pypy/jit/backend/x86/test/test_runner.py
+++ b/pypy/jit/backend/x86/test/test_runner.py
@@ -13,10 +13,7 @@
from pypy.jit.metainterp.executor import execute
from pypy.jit.backend.test.runner_test import LLtypeBackendTest
from pypy.jit.tool.oparser import parse
-from pypy.tool.udir import udir
import ctypes
-import sys
-import os
CPU = getcpuclass()
@@ -33,9 +30,9 @@
# for the individual tests see
# ====> ../../test/runner_test.py
- add_loop_instructions = ['mov', 'movabs', 'mov', 'movabs',
+ add_loop_instructions = ['mov', 'mov', 'mov', 'mov',
'mov', 'add', 'test', 'je', 'jmp']
- bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'call',
+ bridge_loop_instructions = ['cmp', 'jge', 'mov', 'call',
'mov', 'jmp']
def setup_method(self, meth):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit