Ticket #1346 (closed patch: fixed)

Opened 12 years ago

Last modified 12 years ago

[patch]Removed unused macro in pobj.h, reordered codes in args.c

Reported by: jimmy Owned by:
Priority: normal Milestone:
Component: core Version: 1.8.0
Severity: medium Keywords:
Cc: Language:
Patch status: new Platform:

Description

Removed unused macro in pobj.h. Reordered codes in args.c, because it will return before we need it.

Attachments

cage.2.patch Download (1.9 KB) - added by jimmy 12 years ago.
src.call.args.c.patch Download (1.3 KB) - added by jkeenan 12 years ago.
Reduction of jimmy's cage.2.patch to the one remaining file to be considered

Change History

  Changed 12 years ago by jimmy

Index: include/parrot/pobj.h
===================================================================
--- include/parrot/pobj.h	(版本 42843)
+++ include/parrot/pobj.h	(工作副本)
@@ -100,9 +100,6 @@
 
 #define PMC_data(pmc)                   (pmc)->data
 #define PMC_data_typed(pmc, type) (type)(pmc)->data
-/* do not allow PMC_data2 as lvalue */
-#define PMC_data0(pmc)            (1 ? (pmc)->data : 0)
-#define PMC_data0_typed(pmc)      (type)(1 ? (pmc)->data : 0)
 #define PMC_metadata(pmc)         ((pmc)->_metadata)
 #define PMC_sync(pmc)             ((pmc)->_synchronize)
 
Index: src/call/args.c
===================================================================
--- src/call/args.c	(版本 42843)
+++ src/call/args.c	(工作副本)
@@ -939,7 +939,6 @@
 {
     ASSERT_ARGS(fill_params)
     PMC    *named_used_list = PMCNULL;
-    PMC    *arg_sig;
     INTVAL *raw_params;
     INTVAL  param_count     = VTABLE_elements(interp, raw_sig);
     INTVAL  param_index     = 0;
@@ -963,8 +962,6 @@
         return;
     }
 
-    positional_args = VTABLE_elements(interp, call_object);
-    GETATTR_CallSignature_arg_flags(interp, call_object, arg_sig);
     GETATTR_FixedIntegerArray_int_array(interp, raw_sig, raw_params);
 
     /* EXPERIMENTAL! This block adds provisional :call_sig param support on the
@@ -988,6 +985,7 @@
     /* First iterate over positional args and positional parameters. */
     arg_index = 0;
     param_index = 0;
+    positional_args = VTABLE_elements(interp, call_object);
     while (1) {
         INTVAL param_flags;
 
@@ -1169,6 +1167,10 @@
         }
 
         if (arg_index < positional_args) {
+            const PMC *arg_sig;
+
+            GETATTR_CallSignature_arg_flags(interp, call_object, arg_sig);
+
             /* We've used up all the positional parameters, but have extra
              * positional args left over. */
             if (VTABLE_get_integer_keyed_int(interp, arg_sig, arg_index) & PARROT_ARG_NAME) {

  Changed 12 years ago by jimmy

re-added the patch

Index: include/parrot/pobj.h
===================================================================
--- include/parrot/pobj.h	(版本 42843)
+++ include/parrot/pobj.h	(工作副本)
@@ -100,9 +100,6 @@
 
 #define PMC_data(pmc)                   (pmc)->data
 #define PMC_data_typed(pmc, type) (type)(pmc)->data
-/* do not allow PMC_data2 as lvalue */
-#define PMC_data0(pmc)            (1 ? (pmc)->data : 0)
-#define PMC_data0_typed(pmc)      (type)(1 ? (pmc)->data : 0)
 #define PMC_metadata(pmc)         ((pmc)->_metadata)
 #define PMC_sync(pmc)             ((pmc)->_synchronize)
 
Index: src/call/args.c
===================================================================
--- src/call/args.c	(版本 42843)
+++ src/call/args.c	(工作副本)
@@ -939,7 +939,6 @@
 {
     ASSERT_ARGS(fill_params)
     PMC    *named_used_list = PMCNULL;
-    PMC    *arg_sig;
     INTVAL *raw_params;
     INTVAL  param_count     = VTABLE_elements(interp, raw_sig);
     INTVAL  param_index     = 0;
@@ -963,8 +962,6 @@
         return;
     }
 
-    positional_args = VTABLE_elements(interp, call_object);
-    GETATTR_CallSignature_arg_flags(interp, call_object, arg_sig);
     GETATTR_FixedIntegerArray_int_array(interp, raw_sig, raw_params);
 
     /* EXPERIMENTAL! This block adds provisional :call_sig param support on the
@@ -988,6 +985,7 @@
     /* First iterate over positional args and positional parameters. */
     arg_index = 0;
     param_index = 0;
+    positional_args = VTABLE_elements(interp, call_object);
     while (1) {
         INTVAL param_flags;
 
@@ -1169,6 +1167,10 @@
         }
 
         if (arg_index < positional_args) {
+            PMC *arg_sig;
+
+            GETATTR_CallSignature_arg_flags(interp, call_object, arg_sig);
+
             /* We've used up all the positional parameters, but have extra
              * positional args left over. */
             if (VTABLE_get_integer_keyed_int(interp, arg_sig, arg_index) & PARROT_ARG_NAME) {

Changed 12 years ago by jimmy

  Changed 12 years ago by jimmy

please use the cage2.patch.

in reply to: ↑ description ; follow-up: ↓ 7   Changed 12 years ago by jkeenan

Replying to jimmy:

Removed unused macro in pobj.h. Reordered codes in args.c, because it will return before we need it.

As noted in  this comment on TT #1348, I've been looking at whether your patches work with one another, "work" meaning "does not prevent Parrot from completing make successfully".

This patch works with:

* the Vtable.pm patch submitted in TT #1354

* the arrayiterator.pmc patch submitted in TT #1349

* the bignum.pmc patch submitted in TT #1351

* the bigint.pmc patch submitted in TT #1350

Have not yet run make test.

Thank you very much.

kid51

  Changed 12 years ago by jkeenan

  • component changed from none to core
  • patch set to new

  Changed 12 years ago by jkeenan

Deleted the older patch (cage.patch) per discussion on #parrot with JimmyZ.

in reply to: ↑ 4 ; follow-up: ↓ 8   Changed 12 years ago by jkeenan

Replying to jkeenan:

This patch, applied by itself, completed make and passed make test.

In r42919, I applied the part of the patch addressing include/parrot/pobj.h, as I was able to verify that those macros were unused. I am uploading an attachment that has the remainder of the patch. Can someone help evaluate that?

Thank you very much.

kid51

Changed 12 years ago by jkeenan

Reduction of jimmy's cage.2.patch to the one remaining file to be considered

in reply to: ↑ 7   Changed 12 years ago by jimmy

Replying to jkeenan:

Replying to jkeenan: This patch, applied by itself, completed make and passed make test. In r42919, I applied the part of the patch addressing include/parrot/pobj.h, as I was able to verify that those macros were unused. I am uploading an attachment that has the remainder of the patch. Can someone help evaluate that? Thank you very much. kid51

The src.call.args.c.patch just re-ordered the codes, makes it excute only when it's needed, no function changed. :)

Thank you very much.

JimmyZ

  Changed 12 years ago by cotto

  • status changed from new to closed
  • resolution set to fixed

Thanks for this cleanup. I committed the args.c changes as r42922.

Note: See TracTickets for help on using tickets.