On 5/17/07, via RT Jerry Gay <[EMAIL PROTECTED]> wrote:
# New Ticket Created by Jerry Gay
# Please include the string: [perl #42974]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42974 >
it looks like the register alligator is eating integers in this code:
.const int TESTS = 2
.sub 'main' :main
load_bytecode 'Test/More.pir'
.local pmc exp, test_ns
test_ns = get_namespace ['Test::More']
exp = new 'Exporter'
exp.'source'(test_ns)
exp.'import'('plan ok is diag isa_ok' :named('globals'))
plan(TESTS)
.local pmc attrs
attrs = new 'Hash'
.local pmc red, green, blue
attrs['name'] = 'Red'
red = new 'Role', attrs
attrs['name'] = 'Green'
green = new 'Role', attrs
attrs['name'] = 'Blue'
blue = new 'Role', attrs
green.'add_role'( blue )
.local pmc color
color = new 'Class'
$S0 = 'Red'
$I0 = color.'does'($S0)
is($I0, 0, 'does not Red')
color.'add_role'( red )
$I0 = color.'does'($S0)
is($I0, 1, 'does Red')
.end
which produces:
1..2
ok 1 - does not Red
not ok 2 - does Red
# Received: -888
# Expected: 1
either something's fishy in the PCCRETURN code, or the register
allocator. the -888 is a dead giveaway that an integer register has
been eaten. it's possible it's isolated in code called from the
'add_role' method in the Class PMC... this bug is preventing me from
testing that code.
~jerry
The following patch solves that issue.
--- src/pmc/class.pmc (revision 18568)
+++ src/pmc/class.pmc (working copy)
@@ -1111,8 +1111,9 @@
PMC *role = VTABLE_get_pmc_keyed_int(interp, role_list, i);
(STRING *r_name) = PCCINVOKE(interp, role, "name");
- if (string_compare(interp, role_name, r_name))
+ if (string_compare(interp, role_name, r_name) == 0) {
PCCRETURN(INTVAL 1);
+ }
}
PCCRETURN(INTVAL 0);
--
Mehmet