Last Comment Bug 623362 - nanojit: avoid harmless race on nHints[]
: nanojit: avoid harmless race on nHints[]
fixed-in-nanojit, fixed-in-tracemonkey
Product: Core Graveyard
Classification: Graveyard
Component: Nanojit (show other bugs)
: unspecified
: All All
-- normal (vote)
: ---
Assigned To: Nicholas Nethercote [:njn]
Depends on:
  Show dependency treegraph
Reported: 2011-01-05 15:21 PST by Nicholas Nethercote [:njn]
Modified: 2014-03-17 08:00 PDT (History)
7 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---

patch (2.45 KB, patch)
2011-03-06 19:09 PST, Nicholas Nethercote [:njn]
jseward: review+
Details | Diff | Splinter Review

Description User image Nicholas Nethercote [:njn] 2011-01-05 15:21:53 PST
nHints[] is a static variable.  It has a harmless race that Helgrind detected.  It's written by Assembler::nInit() and read by Assembler::hint(), and there's no locking.  It's harmless because the values written by Assembler::nInit() are always the same.  But it's worth fixing just to avoid the warning.

An easy fix would be to make it non-static.  It's one int32 per opcode, so the extra space is minimal, something like 512 bytes.  It would need to be manually zeroed, as well.
Comment 1 User image Nicholas Nethercote [:njn] 2011-03-06 19:09:07 PST
Created attachment 517335 [details] [diff] [review]
Comment 2 User image Julian Seward [:jseward] 2011-03-14 06:46:35 PDT
Comment on attachment 517335 [details] [diff] [review]

Yes, that appears to fix the race -- is no longer detectable.
I only checked on x64-linux, although I know this race also 
exists on arm and probably x86 too.  From the look of it this
patch fixes all targets, yes?
Comment 3 User image Nicholas Nethercote [:njn] 2011-03-15 01:40:03 PDT
(In reply to comment #2)
> From the look of it this patch fixes all targets, yes?

Comment 4 User image Nicholas Nethercote [:njn] 2011-03-17 19:57:00 PDT
Comment 5 User image Nicholas Nethercote [:njn] 2011-03-22 21:18:06 PDT
Comment 6 User image Tamarin Bot 2011-04-27 10:21:34 PDT
changeset: 6225:5b8d188e84a2
user:      Nicholas Nethercote <>
summary:   Bug 623362 - nanojit: avoid harmless race on nHints[].  r=jseward.

Note You need to log in before you can comment on or make changes to this bug.