[pypy-commit] lang-smalltalk emscripten: changes for emscripten compile
timfel
noreply at buildbot.pypy.org
Fri Aug 8 17:54:34 CEST 2014
Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch: emscripten
Changeset: r1031:e0767d248b23
Date: 2014-08-08 11:45 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/e0767d248b23/
Log: changes for emscripten compile
- no references to cursor stuff
- async flag in interpreter
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -61,7 +61,7 @@
class Interpreter(object):
_immutable_fields_ = ["space", "image",
"interrupt_counter_size", "trace_important",
- "startup_time", "evented", "interrupts"]
+ "startup_time", "evented", "interrupts", "is_async"]
jit_driver = jit.JitDriver(
greens=['pc', 'self', 'method'],
@@ -71,10 +71,11 @@
)
def __init__(self, space, image=None, trace_important=False,
- trace=False, evented=True, interrupts=True):
+ trace=False, evented=True, interrupts=True, is_async=False):
# === Initialize immutable variables
self.space = space
self.image = image
+ self.is_async = is_async
if image:
self.startup_time = image.startup_time
else:
@@ -105,6 +106,8 @@
except ContextSwitchException, e:
if self.is_tracing():
e.print_trace()
+ if self.is_async:
+ return e.s_new_context.w_self()
s_context = e.s_new_context
except Return, ret:
target = s_sender if ret.arrived_at_target else ret.s_target_context
diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -987,16 +987,16 @@
def convert_to_c_layout(self):
if self.words is None:
return self.c_words
- else:
- from spyvm.interpreter_proxy import sqIntArrayPtr
- size = self.size()
- old_words = self.words
- c_words = self.c_words = lltype.malloc(sqIntArrayPtr.TO, size, flavor='raw')
- for i in range(size):
- c_words[i] = intmask(old_words[i])
- self.words = None
- return c_words
-
+ # else:
+ # from spyvm.interpreter_proxy import sqIntArrayPtr
+ # size = self.size()
+ # old_words = self.words
+ # c_words = self.c_words = lltype.malloc(sqIntArrayPtr.TO, size, flavor='raw')
+ # for i in range(size):
+ # c_words[i] = intmask(old_words[i])
+ # self.words = None
+ # return c_words
+
def _become(self, w_other):
assert isinstance(w_other, W_WordsObject)
self.words, w_other.words = w_other.words, self.words
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -712,14 +712,15 @@
depth = interp.space.unwrap_int(w_rcvr.fetch(interp.space, 3))
hotpt = wrapper.PointWrapper(interp.space, w_rcvr.fetch(interp.space, 4))
if not interp.image.is_modern:
- display.SDLCursor.set(
- w_bitmap.words,
- width,
- height,
- hotpt.x(),
- hotpt.y(),
- mask_words=mask_words
- )
+ # display.SDLCursor.set(
+ # w_bitmap.words,
+ # width,
+ # height,
+ # hotpt.x(),
+ # hotpt.y(),
+ # mask_words=mask_words
+ # )
+ pass
else:
# TODO: Implement
pass
@@ -890,18 +891,18 @@
if signature[0] == 'BitBltPlugin':
from spyvm.plugins.bitblt import BitBltPlugin
return BitBltPlugin.call(signature[1], interp, s_frame, argcount, w_method)
- elif signature[0] == "SocketPlugin":
- from spyvm.plugins.socket import SocketPlugin
- return SocketPlugin.call(signature[1], interp, s_frame, argcount, w_method)
+ # elif signature[0] == "SocketPlugin":
+ # from spyvm.plugins.socket import SocketPlugin
+ # return SocketPlugin.call(signature[1], interp, s_frame, argcount, w_method)
elif signature[0] == "FilePlugin":
from spyvm.plugins.fileplugin import FilePlugin
return FilePlugin.call(signature[1], interp, s_frame, argcount, w_method)
elif signature[0] == "VMDebugging":
from spyvm.plugins.vmdebugging import DebuggingPlugin
return DebuggingPlugin.call(signature[1], interp, s_frame, argcount, w_method)
- else:
- from spyvm.interpreter_proxy import IProxy
- return IProxy.call(signature, interp, s_frame, argcount, w_method)
+ # else:
+ # from spyvm.interpreter_proxy import IProxy
+ # return IProxy.call(signature, interp, s_frame, argcount, w_method)
raise PrimitiveFailedError
@expose_primitive(COMPILED_METHOD_FLUSH_CACHE, unwrap_spec=[object])
@@ -1497,6 +1498,7 @@
@expose_primitive(IDLE_FOR_MICROSECONDS, unwrap_spec=[object, int], no_result=True, clean_stack=False)
def func(interp, s_frame, w_rcvr, time_mu_s):
import time
+ from spyvm.interpreter import ProcessSwitch
s_frame.pop()
time_s = time_mu_s / 1000000.0
interp.interrupt_check_counter = 0
@@ -1504,6 +1506,8 @@
time.sleep(time_s)
interp.interrupt_check_counter = 0
interp.quick_check_for_interrupt(s_frame, dec=0)
+ if interp.is_async:
+ raise ProcessSwitch(s_frame)
@expose_primitive(FORCE_DISPLAY_UPDATE, unwrap_spec=[object])
def func(interp, s_frame, w_rcvr):
diff --git a/spyvm/wrapper.py b/spyvm/wrapper.py
--- a/spyvm/wrapper.py
+++ b/spyvm/wrapper.py
@@ -298,5 +298,5 @@
extend_y = make_int_getter(2)
depth = make_int_getter(3)
-class CursorWrapper(MaskWrapper):
- offset = make_getter(4)
+# class CursorWrapper(MaskWrapper):
+# offset = make_getter(4)
More information about the pypy-commit
mailing list