[pypy-svn] r20570 - in pypy/dist/pypy/translator/js: . src test
arigo at codespeak.net
arigo at codespeak.net
Fri Dec 2 13:18:41 CET 2005
Author: arigo
Date: Fri Dec 2 13:18:40 2005
New Revision: 20570
Modified:
pypy/dist/pypy/translator/js/js.py
pypy/dist/pypy/translator/js/src/ll_stackless.js
pypy/dist/pypy/translator/js/test/test_stackless.py
Log:
(arigo and ericvrp)
Fix for getting at exception_match function
Fix for yield_frame_to_caller. (return value was overwritten)
All but one test passes now. The last test is fails because structure fields are not defined with a new Object in genjs at the moment.
Modified: pypy/dist/pypy/translator/js/js.py
==============================================================================
--- pypy/dist/pypy/translator/js/js.py (original)
+++ pypy/dist/pypy/translator/js/js.py Fri Dec 2 13:18:40 2005
@@ -41,14 +41,10 @@
self.db.prepare_arg_value(c)
#add exception matching function (XXX should only be done when needed)
- try:
- e = self.db.translator.rtyper.getexceptiondata()
- #matchptr = getfunctionptr(bk.getdesc(e.fn_exception_match).cachedgraph(None))
- matchptr = getfunctionptr(bk.getdesc(e.fn_exception_match._obj).cachedgraph(None))
- matchconst = inputconst(lltype.typeOf(matchptr), matchptr)
- self.db.prepare_arg_value(matchconst)
- except:
- pass #XXX need a fix here
+ e = self.db.translator.rtyper.getexceptiondata()
+ matchptr = e.fn_exception_match
+ matchconst = inputconst(lltype.typeOf(matchptr), matchptr)
+ self.db.prepare_arg_value(matchconst)
# set up all nodes
self.db.setup_all()
Modified: pypy/dist/pypy/translator/js/src/ll_stackless.js
==============================================================================
--- pypy/dist/pypy/translator/js/src/ll_stackless.js (original)
+++ pypy/dist/pypy/translator/js/src/ll_stackless.js Fri Dec 2 13:18:40 2005
@@ -81,7 +81,7 @@
slp_frame_stack_top = slp_frame_stack_bottom = slp_new_frame_simple(ll_stack_unwind);
}
LOG('slp_frame_stack_top='+slp_frame_stack_top + ', slp_frame_stack_bottom='+slp_frame_stack_bottom)
- return null;
+ return slp_return_value;
}
function slp_return_current_frame_to_caller() {
@@ -98,12 +98,13 @@
LOG("slp_end_of_yielding_function");
if (!slp_frame_stack_top) log('slp_end_of_yielding_function !slp_frame_stack_top'); // can only resume from slp_return_current_frame_to_caller()
if (!slp_return_value) log('slp_end_of_yielding_function !slp_return_value');
+ LOG('slp_return_value is going to ' + function_name(slp_return_value.func))
slp_frame_stack_top = slp_return_value;
return null;
}
-function ll_stackless_switch__frame_stack_topPtr(c) {
- LOG("ll_stackless_switch__frame_stack_topPtr");
+function ll_stackless_switch(c) {
+ LOG("ll_stackless_switch");
var f;
var result;
if (slp_frame_stack_top) { //resume
@@ -120,7 +121,7 @@
LOG("slp_frame_stack_top == null");
// first, unwind the current stack
- f = slp_new_frame_simple(ll_stackless_switch__frame_stack_topPtr);
+ f = slp_new_frame_simple(ll_stackless_switch);
f.p0 = c;
slp_frame_stack_top = slp_frame_stack_bottom = f;
}
Modified: pypy/dist/pypy/translator/js/test/test_stackless.py
==============================================================================
--- pypy/dist/pypy/translator/js/test/test_stackless.py (original)
+++ pypy/dist/pypy/translator/js/test/test_stackless.py Fri Dec 2 13:18:40 2005
@@ -130,8 +130,6 @@
assert int(data.strip()) == 697 #10**4==697(6seconds, 10**5==545(45seconds)
def test_yield_frame1():
- py.test.skip("stackless feature not incomplete")
-
def g(lst):
lst.append(2)
frametop_before_5 = yield_current_frame_to_caller()
@@ -148,7 +146,7 @@
lst.append(5)
frametop_after_return = frametop_before_6.switch()
lst.append(7)
- #assert frametop_after_return is None
+ assert frametop_after_return is None
n = 0
for i in lst:
n = n*10 + i
@@ -158,8 +156,6 @@
assert int(data.strip()) == 1234567
def test_yield_frame2():
- py.test.skip("stackless feature incomplete (exception handling?)")
-
S = lltype.GcStruct("base", ('a', lltype.Signed))
s = lltype.malloc(S)
@@ -179,7 +175,7 @@
s.a += 5
frametop_after_return = frametop_before_6.switch()
s.a += 7
- #assert frametop_after_return is None
+ assert frametop_after_return is None
return s.a
data = wrap_stackless_function(f)
More information about the Pypy-commit
mailing list