GC: exact rooting for JSD

RESOLVED FIXED in mozilla26

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: terrence, Assigned: terrence)

Tracking

Trunk
mozilla26
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [js:t])

Attachments

(1 attachment)

Comment hidden (empty)
We should check in with Honza and robcee before actually doing anything.

(Btw, description is missing. I realize the title is exactly what it says on the tin but a bug like this wants a rationale, and maybe something about the scope or approach if appropriate.)
(Assignee)

Comment 2

5 years ago
Fair enough.

In order to turn on exact rooting in the browser without disabling JSD and thus breaking Firebug, we will need to port JSD to use the new exact rooting APIs.  

This will probably be as simple as replacing all of the JSObject*/Value/jsid/etc with Rooted versions and adding Handles until everything compiles again.  On the other hand, if JSD is doing something strange this could take longer potentially introduce bugs.
JSD maintains shadow copies in its own heap of nearly every type of gcthing there is, and connects them via hashtable lookups on pointer values. Up until now, it has relied on JS_AddNamedRoot and other variants to make this all work. It also keeps weak pointers to at least some of these objects, eg JSScripts, and relies on a debug hook callback to be invoked during finalization to clean them up.

Exact rooting JSD is feasible, but it is not a minor project. I'm not sure how it compares in magnitude to the project of porting Firebug to the new Debugger API, but that needs to be done regardless.

We could also consider having debug mode disable moving GC.
(Assignee)

Comment 4

5 years ago
Hurm.  Well then.  Sadly, we will need this to even turn on exact rooting: it's not like we can just partially disable that.  The JSD situation is rather closer to being a schedule risk for generational GC than I thought.

:Honza, :robcee, what is the status of the Firebug port to JSD2?  Is there anything we can do to make this happen sooner, rather than later?
I started on JSD2 porting to Firebug several weeks ago and I think I am doing good progress. However there is still *a lot* what to do and Firebug needs months to be JSD2 ready (being ready at the end of this year would be rather huge success).

Honza
(Assignee)

Comment 6

5 years ago
(In reply to Jan Honza Odvarko from comment #5)
> I started on JSD2 porting to Firebug several weeks ago and I think I am
> doing good progress.

It's awesome to hear that this work has started!

> However there is still *a lot* what to do and Firebug
> needs months to be JSD2 ready (being ready at the end of this year would be
> rather huge success).

We'd like to be fully transitioned over to exact rooting before then, but not by a huge amount.  It looks like we'll still need some way to deal with JSD in the meantime.  As long as work to get firebug off JSD is going to finish in about the right timeframe, we can use almost arbitrarily ugly hacks to bridge the gap.
Whiteboard: [js:t]
(Assignee)

Updated

5 years ago
Blocks: 831379
(Assignee)

Comment 7

5 years ago
Created attachment 703427 [details] [diff] [review]
wip

While investigating, I put in some rooting for testing purposes. This might be useful as a base when we go forward with rooting this.

Comment 8

5 years ago
I've done most of the rooting work necessary for the JS debugger and all of those patches should be on inbound now.  I did not know how to fix the remaining rooting hazards.
So what remains is:

1)  An on-stack JSPropertyDesc that needs to be rooted.  I think this could most simply be
    done via a RootedJSPropertyDesc that inherits from both JSPropertyDesc and
    CustomAutoRooter.
2)  The glob_proper thing in jsds_SyncFilter.  The biggest problem there is lack of a
    JSContext to root it with....
(Assignee)

Updated

5 years ago
Blocks: 898606
No longer blocks: 831379
(Assignee)

Updated

5 years ago
Depends on: 908483
(Assignee)

Comment 10

4 years ago
We're all done here.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Assignee: general → terrence
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.