Closed Bug 909989 Opened 11 years ago Closed 11 years ago

Implement CodeGenerator::DataPtr

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: efaust, Assigned: efaust)

Details

Attachments

(3 files, 1 obsolete file)

Attached patch DataPtr.patch (obsolete) — Splinter Review
Currently, putting things in CodeGenerator::runtimeData_ is a huge footgun. Every time you append to the vector, it might realloc, causing any pointer to an object stored in the same vector to immediately become stale.

I propose a templated wrapper, DataPtr, which wraps the offset into the vector, and actively does the vector calculations at every access.

Attached in a first draft, previously reviewed.
Attachment #796322 - Flags: review+
Assignee: general → efaustbmo
Status: NEW → ASSIGNED
Attachment #796419 - Flags: review?(nicolas.b.pierron)
Attachment #796420 - Flags: review?(nicolas.b.pierron)
Comment on attachment 796419 [details] [diff] [review]
Part 0: Use runtimeData_ offsets instead of cacheList_ offsets to refer to caches other than during GC

Review of attachment 796419 [details] [diff] [review]:
-----------------------------------------------------------------

I am not sure to understand where this patch should be applied, update the patches which are attached to this bug, either this one, or the one which carry the r+.
Attachment #796419 - Flags: review?(nicolas.b.pierron)
Attachment #796322 - Attachment is obsolete: true
Attachment #796823 - Flags: review+
Comment on attachment 796419 [details] [diff] [review]
Part 0: Use runtimeData_ offsets instead of cacheList_ offsets to refer to caches other than during GC

This should apply to tip. It has no other dependencies.
Attachment #796419 - Flags: review?(nicolas.b.pierron)
Comment on attachment 796823 [details] [diff] [review]
Part 1: Implement DataPtr, and use it in addCache()

Review of attachment 796823 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jit/CodeGenerator.cpp
@@ +118,5 @@
>  
>  bool
>  CodeGenerator::visitOutOfLineCache(OutOfLineUpdateCache *ool)
>  {
> +    DataPtr<IonCache> cache(this, ool->getCacheIndex());

Ok, now that I have seen this change, I can accept the part 0.
(In reply to Nicolas B. Pierron [:nbp] from comment #6)
> Comment on attachment 796823 [details] [diff] [review]
> Part 1: Implement DataPtr, and use it in addCache()
> 
> Review of attachment 796823 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/jit/CodeGenerator.cpp
> @@ +118,5 @@
> >  
> >  bool
> >  CodeGenerator::visitOutOfLineCache(OutOfLineUpdateCache *ool)
> >  {
> > +    DataPtr<IonCache> cache(this, ool->getCacheIndex());
> 
> Ok, now that I have seen this change, I can accept the part 0.

Yeah, sorry. This was not generally well done on my part. I had this mental model of "oh, yeah, and then I'll do the trivial rebase, and it'll be fine. He'll 'just know'", and of course that makes no sense.
Attachment #796419 - Flags: review?(nicolas.b.pierron) → review+
Attachment #796420 - Flags: review?(nicolas.b.pierron) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: