[pypy-svn] r65157 - pypy/branch/pyjitpl5/pypy/jit/backend/test
benjamin at codespeak.net
benjamin at codespeak.net
Fri May 8 00:46:52 CEST 2009
Author: benjamin
Date: Fri May 8 00:46:50 2009
New Revision: 65157
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py
Log:
add string length operations
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py Fri May 8 00:46:50 2009
@@ -350,6 +350,11 @@
v_target = ConstInt(r.random_integer() % self.max)
builder.do(self.opnum, [v_string, v_index, v_target])
+class AbstractStringLenOperation(AbstractStringOperation):
+ def produce_into(self, builder, r):
+ v_string = self.get_string(builder, r)
+ builder.do(self.opnum, [v_string])
+
class StrGetItemOperation(AbstractGetItemOperation, _StrOperation):
pass
@@ -362,6 +367,12 @@
class UnicodeSetItemOperation(AbstractSetItemOperation, _UnicodeOperation):
pass
+class StrLenOperation(AbstractStringLenOperation, _StrOperation):
+ pass
+
+class UnicodeLenOperation(AbstractStringLenOperation, _UnicodeOperation):
+ pass
+
# there are five options in total:
# 1. non raising call and guard_no_exception
@@ -537,6 +548,8 @@
OPERATIONS.append(UnicodeGetItemOperation(rop.UNICODEGETITEM))
OPERATIONS.append(StrSetItemOperation(rop.STRSETITEM))
OPERATIONS.append(UnicodeSetItemOperation(rop.UNICODESETITEM))
+ OPERATIONS.append(StrLenOperation(rop.STRLEN))
+ OPERATIONS.append(UnicodeLenOperation(rop.UNICODELEN))
for i in range(2):
OPERATIONS.append(GuardClassOperation(rop.GUARD_CLASS))
More information about the Pypy-commit
mailing list