[pypy-commit] pypy stm: Hard-code the STM logic here for now.
arigo
noreply at buildbot.pypy.org
Sun Nov 6 08:45:52 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stm
Changeset: r48806:0782958b144f
Date: 2011-11-05 19:41 +0100
http://bitbucket.org/pypy/pypy/changeset/0782958b144f/
Log: Hard-code the STM logic here for now.
diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -306,11 +306,21 @@
AroundFnPtr = lltype.Ptr(lltype.FuncType([], lltype.Void))
class AroundState:
- _alloc_flavor_ = "raw"
+ # XXX for stm with need to comment out this, and use a custom logic
+## def _freeze_(self):
+## self.before = None # or a regular RPython function
+## self.after = None # or a regular RPython function
+## return False
+ @staticmethod
+ def before():
+ from pypy.translator.stm import rstm
+ rstm.commit_transaction()
+ @staticmethod
+ def after():
+ from pypy.translator.stm import rstm
+ rstm.begin_inevitable_transaction()
def _freeze_(self):
- self.before = None # or a regular RPython function
- self.after = None # or a regular RPython function
- return False
+ return True
aroundstate = AroundState()
aroundstate._freeze_()
diff --git a/pypy/translator/stm/test/targetdemo.py b/pypy/translator/stm/test/targetdemo.py
--- a/pypy/translator/stm/test/targetdemo.py
+++ b/pypy/translator/stm/test/targetdemo.py
@@ -53,28 +53,9 @@
glob.done += 1
-
-# __________ temp, move me somewhere else __________
-
-from pypy.rlib.objectmodel import invoke_around_extcall
-
-def before_external_call():
- # this function must not raise, in such a way that the exception
- # transformer knows that it cannot raise!
- rstm.commit_transaction()
-before_external_call._gctransformer_hint_cannot_collect_ = True
-before_external_call._dont_reach_me_in_del_ = True
-
-def after_external_call():
- rstm.begin_inevitable_transaction()
-after_external_call._gctransformer_hint_cannot_collect_ = True
-after_external_call._dont_reach_me_in_del_ = True
-
-
# __________ Entry point __________
def entry_point(argv):
- invoke_around_extcall(before_external_call, after_external_call)
print "hello world"
glob.done = 0
for i in range(NUM_THREADS):
More information about the pypy-commit
mailing list