Skip to content

Commit bc61b91

Browse files
committed
working on getting the stacklets working with the JIT
1 parent 2b67642 commit bc61b91

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

pixie/vm/stacklet.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def type(self):
2222

2323
box = Box()
2424
box._val = None
25+
fn_box = Box()
26+
arg_box = Box()
2527

2628
class WrappedHandler(BaseCode):
2729
_type = object.Type("Stacklet")
@@ -41,15 +43,18 @@ def _invoke(self, args):
4143

4244

4345
def new_stacklet(f, val):
44-
global box
46+
global box, fn_box, arg_box
4547
box._val = Box()
4648
self_box = box._val
49+
fn_box._val = f
50+
arg_box._val = val
4751
def default_handler(h, o):
48-
global box
52+
global box, fn_box, arg_box
4953
handler = WrappedHandler(h, box._val)
5054
box._val = None
5155
handler._h = th.switch(handler._h)
52-
retval = f.invoke([handler, val])
56+
retval = fn_box._val.invoke([handler, arg_box._val])
57+
5358
return handler._h
5459

5560
h = th.new(default_handler)

pixie/vm/test/test_compile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def test_build_vector():
110110

111111
def test_stacklets():
112112
retval = eval_string("""
113-
(def foo (fn [h v] (h 42)))
114-
((create-stacklet foo) 0)
113+
(do (def foo (fn [h v] (h 42)))
114+
((create-stacklet foo) 0))
115115
""")
116116

117117
assert isinstance(retval, Integer) and retval.int_val() == 42

0 commit comments

Comments
 (0)