[svn:parrot] r49022 - trunk/src/ops

luben at svn.parrot.org luben at svn.parrot.org
Wed Sep 15 17:53:38 UTC 2010


Author: luben
Date: Wed Sep 15 17:53:37 2010
New Revision: 49022
URL: https://trac.parrot.org/parrot/changeset/49022

Log:
fix bug in logical not on PMCs when dest == src

Introduced in logical vtables removal

Modified:
   trunk/src/ops/cmp.ops
   trunk/src/ops/core_ops.c

Modified: trunk/src/ops/cmp.ops
==============================================================================
--- trunk/src/ops/cmp.ops	Wed Sep 15 17:44:16 2010	(r49021)
+++ trunk/src/ops/cmp.ops	Wed Sep 15 17:53:37 2010	(r49022)
@@ -958,8 +958,10 @@
 }
 
 inline op not(out PMC, invar PMC) :base_core {
-    $1 = Parrot_pmc_new(interp, VTABLE_type(interp, $2));
-    VTABLE_set_bool(interp, $1, (!VTABLE_get_bool(interp, $2)));
+    const INTVAL a = ! VTABLE_get_bool(interp, $2);
+    if (PMC_IS_NULL($1))
+        $1 = Parrot_pmc_new(interp, VTABLE_type(interp, $2));
+    VTABLE_set_bool(interp, $1, a);
 }
 
 ########################################

Modified: trunk/src/ops/core_ops.c
==============================================================================
--- trunk/src/ops/core_ops.c	Wed Sep 15 17:44:16 2010	(r49021)
+++ trunk/src/ops/core_ops.c	Wed Sep 15 17:53:37 2010	(r49022)
@@ -18239,8 +18239,10 @@
 opcode_t *
 Parrot_not_p_p(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    PREG(1) = Parrot_pmc_new(interp, VTABLE_type(interp, PREG(2)));
-    VTABLE_set_bool(interp, PREG(1), (!VTABLE_get_bool(interp, PREG(2))));
+    const INTVAL a = ! VTABLE_get_bool(interp, PREG(2));
+    if (PMC_IS_NULL(PREG(1)))
+        PREG(1) = Parrot_pmc_new(interp, VTABLE_type(interp, PREG(2)));
+    VTABLE_set_bool(interp, PREG(1), a);
 
 return (opcode_t *)cur_opcode + 3;}
 


More information about the parrot-commits mailing list