Closed Bug 525562 Opened 15 years ago Closed 14 years ago

Double var assign in QCache.cpp

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: y-a0, Assigned: lhansen)

Details

(Whiteboard: Has patch)

Attachments

(1 file)

User-Agent:       Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.2.15 Version/10.00
Build Identifier: 

patch:

diff --git a/core/QCache.cpp b/core/QCache.cpp
--- a/core/QCache.cpp
+++ b/core/QCache.cpp
@@ -99,7 +99,7 @@
 			}
 			if (evicted_prev)
 			{
-				evicted = evicted_prev->next;
+//				evicted = evicted_prev->next;
 				AvmAssert(evicted != NULL && evicted != gen);
 				WB(m_gc, evicted_prev, &evicted_prev->next, evicted->next);
 			}

Reproducible: Always
Could you explain a bit more? What is the nature of the bug? Inspection doesn't reveal it to me.
In this code one value is twice assigned to a variable "evicted". I have thought that it can influence performance. I am not assured completely, I have not enough experience with C++.
There's a flaw in the code but the offered patch isn't the optimal one.  If you look at the eviction code, 'evicted' is set before the break in the scanning loop.  But then both arms of the 'if' following the loop set 'evicted' first thing, so the assignment in the loop is actually dead and can be removed.

(I expect most compilers will remove the redundant assignment, though, it should be easy enough.)
Ah. Gotcha. Yeah, a minimal inefficiency, but worth correcting next time we touch this code.
Priority: -- → P4
Target Milestone: --- → Future
Priority: P4 → --
Assignee: nobody → lhansen
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch Obvious patchSplinter Review
Attachment #438378 - Flags: review?(stejohns)
Whiteboard: Has patch
Attachment #438378 - Flags: review?(stejohns) → review+
tamarin-redux changeset:   4399:7d02e45ab981
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: