Ticket #1280 (closed patch: fixed)

Opened 12 years ago

Last modified 12 years ago

[patch]removed unused codes in oo.c

Reported by: jimmy Owned by: jkeenan
Priority: normal Milestone:
Component: core Version: 1.7.0
Severity: medium Keywords:
Cc: Language:
Patch status: applied Platform:

Description

this patch removed some unused codes.

Index: src/oo.c
===================================================================
--- src/oo.c	(版本 42529)
+++ src/oo.c	(工作副本)
@@ -939,16 +939,16 @@
 Parrot_find_method_with_cache(PARROT_INTERP, ARGIN(PMC *_class), ARGIN(STRING *method_name))
 {
     ASSERT_ARGS(Parrot_find_method_with_cache)
-    UINTVAL type, bits;
 
+    UINTVAL type, bits;
     Caches           *mc;
-    Meth_cache_entry *e, *old;
+    Meth_cache_entry *e;
 
     PARROT_ASSERT(method_name != 0);
 
 #if DISABLE_METH_CACHE
     return Parrot_find_method_direct(interp, _class, method_name);
-#endif
+#else
 
     if (! PObj_constant_TEST(method_name))
         return Parrot_find_method_direct(interp, _class, method_name);
@@ -975,10 +975,8 @@
     }
 
     e   = mc->idx[type][bits];
-    old = NULL;
 
     while (e && e->strstart != method_name->strstart) {
-        old = e;
         e   = e->next;
     }
 
@@ -986,10 +984,7 @@
         /* when here no or no correct entry was at [bits] */
         e     = mem_allocate_typed(Meth_cache_entry);
 
-        if (old)
-            old->next = e;
-        else
-            mc->idx[type][bits] = e;
+        mc->idx[type][bits] = e;
 
         e->pmc      = Parrot_find_method_direct(interp, _class, method_name);
         e->next     = NULL;
@@ -997,6 +992,8 @@
     }
 
     return e->pmc;
+
+#endif
 }
 
 

Attachments

cage.patch Download (1.3 KB) - added by jimmy 12 years ago.

Change History

Changed 12 years ago by jimmy

in reply to: ↑ description   Changed 12 years ago by jkeenan

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

Replying to jimmy:

this patch removed some unused codes.

Jimmy,

Could you provide a bit more explanation of what you mean by these codes being "unused"?

When I look at  this test coverage report, I see that the statements involving old are exercised, in some cases more than a million times, in some cases only 12 times. So, in some sense, these statements are being "used".

Can you explain why we can safely delete the lines you indicate?

Thank you very much.

kid51

follow-up: ↓ 3   Changed 12 years ago by jimmy

It's excess tmp var. It's just be used as lvalue.

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

  • owner set to jkeenan
  • status changed from new to assigned
  • patch changed from new to applied

Replying to jimmy:

It's excess tmp var. It's just be used as lvalue.

Passed make and make test. (See  this Smolder report.)

Applied in r42934.

Thank you very much.
kid51

in reply to: ↑ 3   Changed 12 years ago by jkeenan

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

Replying to jkeenan:

No comments or complaints in 3 days. Closing ticket.

Note: See TracTickets for help on using tickets.