Hi,
I get some strange behaviour in the attached code snippet.
The problem is with the lines marked with a '*'. If the global 'r' is
stored into $P0,
and in the second marked line it is called, the output of the print
statements furhter below
is:
Lua_Proto_2_0
2
instead of the expected
1
2
Now, if I change the register from $P0 to, say, $P10 (in both marked
lines), I do get
the expected results. (the code is generated, so somewhat inefficient)
I don't understand really the difference between $P0 and $P10, this
shouldn't make any difference, should it?
I just got a fresh Parrot, shouldn't be the problem here)
thanks,
klaas-jan
.sub _LuaMain :main
LuaProto_1_0()
end
.end
.sub LuaProto_1_0
.lex 'p', $P0
.lex 'q', $P1
$P0 = new .Float
$P0 = 1
$P1 = new .Float
$P1 = 2
$P2 = find_name 'LuaProto_2_0'
$P2 = newclosure $P2
global 'r' = $P2
* $P0 = global 'r'
* ($P10,$P11) = $P0()
global 'b' = $P11
global 'a' = $P10
$P1 = global 'a'
$P2 = global 'b'
print $P1
print "\n"
print $P2
print "\n"
.end
.sub LuaProto_2_0 :outer(LuaProto_1_0) :lex
find_lex $P0, 'p'
find_lex $P1, 'q'
.return($P0,$P1)
.end