[pypy-svn] r40916 - in pypy/dist/pypy/jit/codegen: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Mar 21 14:20:41 CET 2007
Author: arigo
Date: Wed Mar 21 14:20:39 2007
New Revision: 40916
Modified:
pypy/dist/pypy/jit/codegen/model.py
pypy/dist/pypy/jit/codegen/test/rgenop_tests.py
Log:
Tests and documentation about the fact that the backends shouldn't
assume that the lists of live variables contain no duplicates.
Modified: pypy/dist/pypy/jit/codegen/model.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/model.py (original)
+++ pypy/dist/pypy/jit/codegen/model.py Wed Mar 21 14:20:39 2007
@@ -118,7 +118,12 @@
The current builder stays open. To make the backend\'s life
easier it must be closed before the fresh builder is used at
all, and the first thing to call on the latter is
- start_writing().'''
+ start_writing().
+
+ args_for_jump_gv lists the variables that need to be live
+ after the jump is taken. The list can contain duplicates
+ (which the backend should ignore) but no constants.
+ '''
raise NotImplementedError
def jump_if_true(self, gv_condition, args_for_jump_gv):
@@ -151,7 +156,9 @@
few times.
args_gv is the list of live variables. It\'s the list of
- variables that can be used in each switch case.
+ variables that can be used in each switch case. The list can
+ contain duplicates (which the backend should ignore) but no
+ constants.
Returns a tuple:
- an instance of CodeGenSwitch (see below)
@@ -177,7 +184,10 @@
while. This allows the builder to be freed. The pause_writing()
method returns the next builder, on which you will have to call
start_writing() before you continue.
- '''
+
+ args_gv lists the variables that need to stay live. The list can
+ contain duplicates (which the backend should ignore) but no
+ constants.'''
return self
def start_writing(self):
Modified: pypy/dist/pypy/jit/codegen/test/rgenop_tests.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/test/rgenop_tests.py (original)
+++ pypy/dist/pypy/jit/codegen/test/rgenop_tests.py Wed Mar 21 14:20:39 2007
@@ -414,9 +414,10 @@
gv_cond = builder.genop2("int_gt", gv_x, rgenop.genconst(0))
- targetbuilder = builder.jump_if_false(gv_cond, [gv_x])
+ # this also tests duplicates in the lists of live vars
+ targetbuilder = builder.jump_if_false(gv_cond, [gv_x, gv_x])
- builder = builder.pause_writing([gv_x])
+ builder = builder.pause_writing([gv_x, gv_x, gv_x])
targetbuilder.start_writing()
gv_negated = targetbuilder.genop1("int_neg", gv_x)
@@ -1490,7 +1491,8 @@
args_gv = [v3, v4, v5, v8]
label1 = builder1.enter_next_block([signed_kind]*4, args_gv)
[v9, v10, v11, v12] = args_gv
- flexswitch0, builder2 = builder1.flexswitch(v12, [v9, v10, v12])
+ # test duplicates in live vars while we're at it
+ flexswitch0, builder2 = builder1.flexswitch(v12, [v9, v10, v12, v10])
v13 = builder2.genop2("int_add", v9, v10)
v14 = builder2.genop2("int_add", v13, v12)
builder2.finish_and_return(sigtoken, v14)
More information about the Pypy-commit
mailing list