[pypy-svn] r54884 - pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk
tverwaes at codespeak.net
tverwaes at codespeak.net
Sun May 18 14:51:28 CEST 2008
Author: tverwaes
Date: Sun May 18 14:51:27 2008
New Revision: 54884
Modified:
pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/interpreter.py
pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py
Log:
(cfbolz, tverwaes) adding tests for processwrapper
Modified: pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/interpreter.py
==============================================================================
--- pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/interpreter.py (original)
+++ pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/interpreter.py Sun May 18 14:51:27 2008
@@ -40,9 +40,9 @@
def store_w_active_context(self, w_context):
# We can only interpret contexts of which we know the type already
- s_ctx = w_context.as_context_get_shadow()
- assert (isinstance(s_ctx, MethodContextShadow) or
- isinstance(s_ctx, BlockContextShadow))
+ #s_ctx = w_context.as_context_get_shadow()
+ #assert (isinstance(s_ctx, MethodContextShadow) or
+ # isinstance(s_ctx, BlockContextShadow))
if self._s_active_context is not None:
self._s_active_context.unnotify(self)
self._s_active_context = None
Modified: pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py
==============================================================================
--- pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py (original)
+++ pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py Sun May 18 14:51:27 2008
@@ -38,9 +38,12 @@
class ProcessWrapper(LinkWrapper):
suspended_context, store_suspended_context = make_getter_setter(1)
- priority = make_getter(2)
my_list, store_my_list = make_getter_setter(3)
+ def priority(self):
+ w_priority = self.read(2)
+ return utility.unwrap_int(w_priority)
+
def put_to_sleep(self):
sched = scheduler()
priority = self.priority()
@@ -52,7 +55,9 @@
sched = scheduler()
w_old_process = sched.active_process()
sched.store_active_process(self.w_self)
- ProcessWrapper(w_old_process).store_suspended_context(interp.w_active_context())
+ old_process = ProcessWrapper(w_old_process)
+ old_process.store_suspended_context(interp.w_active_context())
+ old_process.put_to_sleep()
interp.store_w_active_context(self.suspended_context())
self.store_suspended_context(objtable.w_nil)
@@ -62,10 +67,9 @@
active_priority = active_process.priority()
priority = self.priority()
if priority > active_priority:
- active_process.put_to_sleep()
self.activate(interp)
else:
- self.put_to_sleep(process)
+ self.put_to_sleep()
class LinkedListWrapper(Wrapper):
@@ -109,8 +113,7 @@
priority_list = make_getter(0)
active_process, store_active_process = make_getter_setter(1)
- def get_process_list(self, w_priority):
- priority = utility.unwrap_int(w_priority)
+ def get_process_list(self, priority):
lists = self.priority_list()
return ProcessListWrapper(Wrapper(lists).read(priority))
More information about the Pypy-commit
mailing list