develooper Front page | perl.cvs.parrot | Postings from December 2008

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

From:
chromatic
Date:
December 18, 2008 18:40
Subject:
[svn:parrot] r34098 - trunk/src/ops
Message ID:
20081219024007.2BEF0CBA12@x12.develooper.com
Author: chromatic
Date: Thu Dec 18 18:40:06 2008
New Revision: 34098

Modified:
   trunk/src/ops/cmp.ops

Log:
[ops] Made some temporary PMCs used in comparison opcodes *real* temporary PMCs.

Modified: trunk/src/ops/cmp.ops
==============================================================================
--- trunk/src/ops/cmp.ops	(original)
+++ trunk/src/ops/cmp.ops	Thu Dec 18 18:40:06 2008
@@ -92,11 +92,15 @@
 }
 
 op eq(invar PMC, in INT, inconst LABEL) :base_core {
-  PMC *temp = pmc_new(interp, enum_class_Integer);
+  PMC *temp = temporary_pmc_new(interp, enum_class_Integer);
   VTABLE_set_integer_native(interp, temp, $2);
+
   if (VTABLE_is_equal(interp, $1, temp)) {
+    temporary_pmc_free(interp, temp);
     goto OFFSET($3);
   }
+
+  temporary_pmc_free(interp, temp);
 }
 
 op eq(invar PMC, in NUM, inconst LABEL) :base_core {
@@ -195,11 +199,15 @@
 }
 
 op ne(invar PMC, in INT, inconst LABEL) :base_core {
-  PMC *temp = pmc_new(interp, enum_class_Integer);
+  PMC *temp = temporary_pmc_new(interp, enum_class_Integer);
   VTABLE_set_integer_native(interp, temp, $2);
+
   if (!VTABLE_is_equal(interp, $1, temp)) {
+    temporary_pmc_free(interp, temp);
     goto OFFSET($3);
   }
+
+  temporary_pmc_free(interp, temp);
 }
 
 op ne(invar PMC, in NUM, inconst LABEL) :base_core {
@@ -288,12 +296,15 @@
 }
 
 op lt(invar PMC, in INT, inconst LABEL) :base_core {
-  PMC *temp = pmc_new(interp, enum_class_Integer);
-  INTVAL result;
+  PMC *temp         = temporary_pmc_new(interp, enum_class_Integer);
   PMC_int_val(temp) = $2;
+
   if (VTABLE_cmp(interp, $1, temp) < 0) {
+    temporary_pmc_free(interp, temp);
     goto OFFSET($3);
   }
+
+  temporary_pmc_free(interp, temp);
 }
 
 op lt(invar PMC, in NUM, inconst LABEL) :base_core {
@@ -370,11 +381,15 @@
 }
 
 op le(invar PMC, in INT, inconst LABEL) :base_core {
-  PMC *temp = pmc_new(interp, enum_class_Integer);
+  PMC *temp         = temporary_pmc_new(interp, enum_class_Integer);
   PMC_int_val(temp) = $2;
+
   if (VTABLE_cmp(interp, $1, temp) <= 0) {
+    temporary_pmc_free(interp, temp);
     goto OFFSET($3);
   }
+
+  temporary_pmc_free(interp, temp);
 }
 
 op le(invar PMC, in NUM, inconst LABEL) :base_core {
@@ -427,11 +442,15 @@
 }
 
 op gt(invar PMC, in INT, inconst LABEL) :base_core {
-  PMC *temp = pmc_new(interp, enum_class_Integer);
+  PMC *temp         = temporary_pmc_new(interp, enum_class_Integer);
   PMC_int_val(temp) = $2;
+
   if (VTABLE_cmp(interp, $1, temp) > 0) {
+    temporary_pmc_free(interp, temp);
     goto OFFSET($3);
   }
+
+  temporary_pmc_free(interp, temp);
 }
 
 op gt(invar PMC, in NUM, inconst LABEL) :base_core {
@@ -484,11 +503,15 @@
 }
 
 op ge(invar PMC, in INT, inconst LABEL) :base_core {
-  PMC *temp = pmc_new(interp, enum_class_Integer);
+  PMC *temp         = temporary_pmc_new(interp, enum_class_Integer);
   PMC_int_val(temp) = $2;
+
   if (VTABLE_cmp(interp, $1, temp) >= 0) {
+    temporary_pmc_free(interp, temp);
     goto OFFSET($3);
   }
+
+  temporary_pmc_free(interp, temp);
 }
 
 op ge(invar PMC, in NUM, inconst LABEL) :base_core {



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About