Closed Bug 657135 Opened 13 years ago Closed 6 years ago

ClassClosure::createScriptObjectProc and ScriptObject::create should cooperate to bypass GC::Alloc

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: lhansen, Unassigned)

References

Details

Since createScriptObjectProc is just a function pointer it can be specialized to the size of the object being constructed, which is constant so far as I can tell.  With that specialization it will be possible to avoid calling the generic GC::Alloc (which has to dispatch to a specific allocator based on the size of the request) and instead call the correct sub-allocator directly, in the manner that GC::AllocWhatever variants do for constant-size arguments.  For this to work there probably have to be more ScriptObject::create variants (or maybe a templated version), and there are questions about how to invoke the ScriptObject constructor properly, but I suspect those are minor issues.

The benefit of this change would be reduced allocation costs for ScriptObjects.
(In reply to comment #0)

It's not quite that simple -- consider that all of the "subclasses" of ScriptObject that aren't builtin still get vtable->extraSize, depending on how many fixed slots they have.

That said, yeah: we could have a separate createProc for each size class, and choose the right one at class-initialization time.

(For extra credit, we could do the same for builtin classes, but at *compile* time -- not sure if that's worth the effort.)
I think Lars is saying for any particular Traits extraSize is always the same so all Traits can share a pointer to a fixed-size GC alloc function that returns a chunk of memory of that size.
(In reply to comment #2)
> I think Lars is saying for any particular Traits extraSize is always the
> same so all Traits can share a pointer to a fixed-size GC alloc function
> that returns a chunk of memory of that size.

That is precisely it :-)
Blocks: 531250
Flags: flashplayer-qrb+
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.