[pypy-svn] r18351 - pypy/dist/pypy/translator/js
ericvrp at codespeak.net
ericvrp at codespeak.net
Mon Oct 10 22:15:38 CEST 2005
Author: ericvrp
Date: Mon Oct 10 22:15:37 2005
New Revision: 18351
Modified:
pypy/dist/pypy/translator/js/arraynode.py
pypy/dist/pypy/translator/js/opwriter.py
pypy/dist/pypy/translator/js/structnode.py
Log:
Simplifying arraydefinitions. Stripping of the initial length field that
got added by the llvm backend. Javascript can give us this information
in case we even need it.
Modified: pypy/dist/pypy/translator/js/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/js/arraynode.py (original)
+++ pypy/dist/pypy/translator/js/arraynode.py Mon Oct 10 22:15:37 2005
@@ -107,7 +107,8 @@
def get_arrayvalue(self):
items = self.value.items
l = len(items)
- r = "[%s]" % ", ".join([self.db.repr_constant(v)[1] for v in items])
+ #r = "[%s]" % ", ".join([self.db.repr_constant(v)[1] for v in items])
+ r = "[%s]" % ", ".join([str(v) for v in items])
return l, r
def get_typerepr(self):
@@ -140,20 +141,17 @@
def constantvalue(self):
physicallen, arrayrepr = self.get_arrayvalue()
- typeval = self.db.repr_type(self.arraytype)
-
- # first length is logical, second is physical
- value = "[%s, %s]" % (self.get_length(), arrayrepr)
- return value
-
- # first length is logical, second is physical
- value = "int %s, [%s x %s] %s" % (self.get_length(),
- physicallen,
- typeval,
- arrayrepr)
+ return arrayrepr
- s = "%s {%s}" % (self.get_typerepr(), value)
- return s
+ ## first length is logical, second is physical
+ #typeval = self.db.repr_type(self.arraytype)
+ #value = "int %s, [%s x %s] %s" % (self.get_length(),
+ # physicallen,
+ # typeval,
+ # arrayrepr)
+ #
+ #s = "%s {%s}" % (self.get_typerepr(), value)
+ #return s
class StrArrayNode(ArrayNode):
__slots__ = "".split()
Modified: pypy/dist/pypy/translator/js/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/js/opwriter.py (original)
+++ pypy/dist/pypy/translator/js/opwriter.py Mon Oct 10 22:15:37 2005
@@ -462,7 +462,7 @@
#self.codewriter.getelementptr(tmpvar, arraytype, array,
# ("uint", 1), (indextype, index))
#self.codewriter.load(targetvar, targettype, tmpvar)
- self.codewriter.load(targetvar, array, (1, index))
+ self.codewriter.load(targetvar, array, (index,))
else:
self._skipped(op)
@@ -485,7 +485,7 @@
#self.codewriter.getelementptr(tmpvar, arraytype, array,
# ("uint", 1), (indextype, index))
#self.codewriter.store(valuetype, valuevar, tmpvar)
- self.codewriter.store(array, (1, index), valuevar)
+ self.codewriter.store(array, (index,), valuevar)
else:
self._skipped(op)
Modified: pypy/dist/pypy/translator/js/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/js/structnode.py (original)
+++ pypy/dist/pypy/translator/js/structnode.py Mon Oct 10 22:15:37 2005
@@ -44,10 +44,9 @@
super(StructVarsizeTypeNode, self).__init__(db, struct)
prefix = '%new.varsizestruct.'
self.constructor_ref = self.make_ref(prefix, self.name)
- self.constructor_decl = "%s * %s(%s %%len)" % \
+ self.constructor_decl = "%s * %s(int %%len)" % \
(self.ref,
- self.constructor_ref,
- self.db.get_machine_word())
+ self.constructor_ref)
def __str__(self):
return "<StructVarsizeTypeNode %r>" %(self.ref,)
More information about the Pypy-commit
mailing list