[pypy-svn] r30710 - in pypy/dist/pypy/translator/js: . jssrc test
fijal at codespeak.net
fijal at codespeak.net
Fri Jul 28 20:20:02 CEST 2006
Author: fijal
Date: Fri Jul 28 20:19:58 2006
New Revision: 30710
Modified:
pypy/dist/pypy/translator/js/jssrc/misc.js
pypy/dist/pypy/translator/js/jts.py
pypy/dist/pypy/translator/js/test/test_genllvm.py
Log:
Added MALLOC_ZERO_STH flag, which makes JS tests pass again. And a test for it as well :)
Modified: pypy/dist/pypy/translator/js/jssrc/misc.js
==============================================================================
--- pypy/dist/pypy/translator/js/jssrc/misc.js (original)
+++ pypy/dist/pypy/translator/js/jssrc/misc.js Fri Jul 28 20:19:58 2006
@@ -1,4 +1,6 @@
// starts hand written code
+MALLOC_ZERO_FILLED = 0
+
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
Modified: pypy/dist/pypy/translator/js/jts.py
==============================================================================
--- pypy/dist/pypy/translator/js/jts.py (original)
+++ pypy/dist/pypy/translator/js/jts.py Fri Jul 28 20:19:58 2006
@@ -9,6 +9,7 @@
from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLong, Primitive
from pypy.rpython.lltypesystem.lltype import Char, UniChar
from pypy.rpython.ootypesystem.ootype import String, _string, List, StaticMethod
+from pypy.rpython.objectmodel import Symbolic
from pypy.translator.js.log import log
@@ -107,7 +108,9 @@
if s != "'\''":
s.replace("'", '"')
val = s
- elif isinstance(_type,Primitive):
+ elif isinstance(v, Symbolic):
+ val = v.expr
+ elif isinstance(_type, Primitive):
#log("Type: %r"%_type)
val = str(v)
else:
Modified: pypy/dist/pypy/translator/js/test/test_genllvm.py
==============================================================================
--- pypy/dist/pypy/translator/js/test/test_genllvm.py (original)
+++ pypy/dist/pypy/translator/js/test/test_genllvm.py Fri Jul 28 20:19:58 2006
@@ -434,3 +434,14 @@
fn = compile_function(some_test, [])
assert fn() == some_test()
+
+def test_symbolic():
+ from pypy.rpython.objectmodel import malloc_zero_filled
+
+ def symbolic1():
+ if malloc_zero_filled:
+ return 3
+ return 2
+
+ fn = compile_function(symbolic1, [])
+ assert fn() == 2
More information about the Pypy-commit
mailing list