[pypy-svn] r67768 - pypy/trunk/pypy/rpython/memory/gctransform
arigo at codespeak.net
arigo at codespeak.net
Fri Sep 18 15:05:47 CEST 2009
Author: arigo
Date: Fri Sep 18 15:05:46 2009
New Revision: 67768
Added:
pypy/trunk/pypy/rpython/memory/gctransform/framework.py.merge.tmp
- copied, changed from r67762, pypy/trunk/pypy/rpython/memory/gctransform/framework.py
Log:
merging of svn+ssh://codespeak.net/svn/pypy/branch/asmgcroot-callback/pypy/rpython/memory/gctransform/framework.py
revisions 67691 to 67762:
------------------------------------------------------------------------
r67709 | arigo | 2009-09-16 11:21:10 +0200 (Wed, 16 Sep 2009) | 2 lines
Small changes that seem to make threads work on top of asmgcc.
------------------------------------------------------------------------
r67692 | arigo | 2009-09-15 15:38:22 +0200 (Tue, 15 Sep 2009) | 3 lines
A branch in which to try to implement callback support
in --gcrootfinder=asmgcc.
------------------------------------------------------------------------
Copied: pypy/trunk/pypy/rpython/memory/gctransform/framework.py.merge.tmp (from r67762, pypy/trunk/pypy/rpython/memory/gctransform/framework.py)
==============================================================================
--- pypy/trunk/pypy/rpython/memory/gctransform/framework.py (original)
+++ pypy/trunk/pypy/rpython/memory/gctransform/framework.py.merge.tmp Fri Sep 18 15:05:46 2009
@@ -151,6 +151,7 @@
gcdata.gc = GCClass(translator.config.translation, **GC_PARAMS)
root_walker = self.build_root_walker()
+ self.root_walker = root_walker
gcdata.set_query_functions(gcdata.gc)
gcdata.gc.set_root_walker(root_walker)
self.num_pushs = 0
@@ -377,17 +378,7 @@
# thread support
if translator.config.translation.thread:
- if not hasattr(root_walker, "need_thread_support"):
- raise Exception("%s does not support threads" % (
- root_walker.__class__.__name__,))
- root_walker.need_thread_support()
- self.thread_prepare_ptr = getfn(root_walker.thread_prepare,
- [], annmodel.s_None)
- self.thread_run_ptr = getfn(root_walker.thread_run,
- [], annmodel.s_None,
- inline=True)
- self.thread_die_ptr = getfn(root_walker.thread_die,
- [], annmodel.s_None)
+ root_walker.need_thread_support(self, getfn)
self.layoutbuilder.encode_type_shapes_now()
@@ -721,15 +712,18 @@
def gct_gc_thread_prepare(self, hop):
assert self.translator.config.translation.thread
- hop.genop("direct_call", [self.thread_prepare_ptr])
+ if hasattr(self.root_walker, 'thread_prepare_ptr'):
+ hop.genop("direct_call", [self.root_walker.thread_prepare_ptr])
def gct_gc_thread_run(self, hop):
assert self.translator.config.translation.thread
- hop.genop("direct_call", [self.thread_run_ptr])
+ if hasattr(self.root_walker, 'thread_run_ptr'):
+ hop.genop("direct_call", [self.root_walker.thread_run_ptr])
def gct_gc_thread_die(self, hop):
assert self.translator.config.translation.thread
- hop.genop("direct_call", [self.thread_die_ptr])
+ if hasattr(self.root_walker, 'thread_die_ptr'):
+ hop.genop("direct_call", [self.root_walker.thread_die_ptr])
def gct_malloc_nonmovable_varsize(self, hop):
TYPE = hop.spaceop.result.concretetype
@@ -918,6 +912,10 @@
if collect_stack_root:
self.walk_stack_roots(collect_stack_root) # abstract
+ def need_thread_support(self, gctransformer, getfn):
+ raise Exception("%s does not support threads" % (
+ self.__class__.__name__,))
+
class ShadowStackRootWalker(BaseRootWalker):
need_root_stack = True
@@ -976,7 +974,7 @@
if self.collect_stacks_from_other_threads is not None:
self.collect_stacks_from_other_threads(collect_stack_root)
- def need_thread_support(self):
+ def need_thread_support(self, gctransformer, getfn):
from pypy.module.thread import ll_thread # xxx fish
from pypy.rpython.memory.support import AddressDict
from pypy.rpython.memory.support import copy_without_null_values
@@ -1087,7 +1085,8 @@
gcdata.thread_stacks.foreach(collect_stack, callback)
self.thread_setup = thread_setup
- self.thread_prepare = thread_prepare
- self.thread_run = thread_run
- self.thread_die = thread_die
+ self.thread_prepare_ptr = getfn(thread_prepare, [], annmodel.s_None)
+ self.thread_run_ptr = getfn(thread_run, [], annmodel.s_None,
+ inline=True)
+ self.thread_die_ptr = getfn(thread_die, [], annmodel.s_None)
self.collect_stacks_from_other_threads = collect_more_stacks
More information about the Pypy-commit
mailing list