Howdy,<br><br>Can we get a test for this?<br><br>Duke<br><br><br><div class="gmail_quote">On Wed, Sep 15, 2010 at 10:53 AM, <span dir="ltr"><<a href="mailto:luben@parrot.org">luben@parrot.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Author: luben<br>
Date: Wed Sep 15 17:53:37 2010<br>
New Revision: 49022<br>
URL: <a href="https://trac.parrot.org/parrot/changeset/49022" target="_blank">https://trac.parrot.org/parrot/changeset/49022</a><br>
<br>
Log:<br>
fix bug in logical not on PMCs when dest == src<br>
<br>
Introduced in logical vtables removal<br>
<br>
Modified:<br>
trunk/src/ops/cmp.ops<br>
trunk/src/ops/core_ops.c<br>
<br>
Modified: trunk/src/ops/cmp.ops<br>
==============================================================================<br>
--- trunk/src/ops/cmp.ops Wed Sep 15 17:44:16 2010 (r49021)<br>
+++ trunk/src/ops/cmp.ops Wed Sep 15 17:53:37 2010 (r49022)<br>
@@ -958,8 +958,10 @@<br>
}<br>
<br>
inline op not(out PMC, invar PMC) :base_core {<br>
- $1 = Parrot_pmc_new(interp, VTABLE_type(interp, $2));<br>
- VTABLE_set_bool(interp, $1, (!VTABLE_get_bool(interp, $2)));<br>
+ const INTVAL a = ! VTABLE_get_bool(interp, $2);<br>
+ if (PMC_IS_NULL($1))<br>
+ $1 = Parrot_pmc_new(interp, VTABLE_type(interp, $2));<br>
+ VTABLE_set_bool(interp, $1, a);<br>
}<br>
<br>
########################################<br>
<br>
Modified: trunk/src/ops/core_ops.c<br>
==============================================================================<br>
--- trunk/src/ops/core_ops.c Wed Sep 15 17:44:16 2010 (r49021)<br>
+++ trunk/src/ops/core_ops.c Wed Sep 15 17:53:37 2010 (r49022)<br>
@@ -18239,8 +18239,10 @@<br>
opcode_t *<br>
Parrot_not_p_p(opcode_t *cur_opcode, PARROT_INTERP) {<br>
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);<br>
- PREG(1) = Parrot_pmc_new(interp, VTABLE_type(interp, PREG(2)));<br>
- VTABLE_set_bool(interp, PREG(1), (!VTABLE_get_bool(interp, PREG(2))));<br>
+ const INTVAL a = ! VTABLE_get_bool(interp, PREG(2));<br>
+ if (PMC_IS_NULL(PREG(1)))<br>
+ PREG(1) = Parrot_pmc_new(interp, VTABLE_type(interp, PREG(2)));<br>
+ VTABLE_set_bool(interp, PREG(1), a);<br>
<br>
return (opcode_t *)cur_opcode + 3;}<br>
<br>
_______________________________________________<br>
<a href="http://lists.parrot.org/mailman/listinfo/parrot-commits" target="_blank">http://lists.parrot.org/mailman/listinfo/parrot-commits</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Jonathan "Duke" Leto<br><a href="mailto:jonathan@leto.net">jonathan@leto.net</a><br><a href="http://leto.net">http://leto.net</a><br>