JSContext refactoring

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JSContext refactoring

Jan de Mooij-2
Hi all,

After hundreds of Gecko/SpiderMonkey patches (thanks to bholley, bz, and
many others), each JSRuntime in Gecko now has a single JSContext.

We've discussed this a bit the past weeks and the next step will likely be
to make JSContext inherit from JSRuntime [0]. JSContext will then only be
used on the main thread, while background threads can still use (shared)
stuff in JSRuntime via ExclusiveContext, similar to how it works today.
(These names are not set in stone, but for now it's easiest to keep them.)

After that, we can hopefully remove JSRuntime from the public API and
embedders will only have to worry about JSContext.

We can do most of these steps incrementally, but that means there will be
breaking API changes for a while as we remove APIs, add new ones (some of
which will be temporary), etc. Jason and I were talking about that this
week and we still think it will be worth it though.

As this will affect all embedders, a heads up seemed appropriate. Let us
know if you have any ideas or suggestions.

Thanks,
Jan

[0] https://bugzilla.mozilla.org/show_bug.cgi?id=650361
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: [JS-internals] JSContext refactoring

Mike Shaver
On Fri, Jun 17, 2016 at 2:45 AM, Jan de Mooij <[hidden email]> wrote:

> After hundreds of Gecko/SpiderMonkey patches (thanks to bholley, bz, and
> many others), each JSRuntime in Gecko now has a single JSContext.
>

This is amazing!

Mike
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: JSContext refactoring

Kent Williams
In reply to this post by Jan de Mooij-2
Looking at our application -- which is a very straightforward embedding
of Spidermonkey, the only references to JSRuntime is in concert with
creating the JSContext for our interpreter, like thus:
>     JS_Init();
>    JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024);
>     if (!rt)
>         return 1;
>     JSContext *cx = JS_NewContext(rt, 8192);
So in essence, creating and using the Runtime would just go away, as
would the runtime parameter of JS_NewContext. Right?

On 06/17/2016 04:45 AM, Jan de Mooij wrote:

> Hi all,
>
> After hundreds of Gecko/SpiderMonkey patches (thanks to bholley, bz, and
> many others), each JSRuntime in Gecko now has a single JSContext.
>
> We've discussed this a bit the past weeks and the next step will likely be
> to make JSContext inherit from JSRuntime [0]. JSContext will then only be
> used on the main thread, while background threads can still use (shared)
> stuff in JSRuntime via ExclusiveContext, similar to how it works today.
> (These names are not set in stone, but for now it's easiest to keep them.)
>
> After that, we can hopefully remove JSRuntime from the public API and
> embedders will only have to worry about JSContext.
>
> We can do most of these steps incrementally, but that means there will be
> breaking API changes for a while as we remove APIs, add new ones (some of
> which will be temporary), etc. Jason and I were talking about that this
> week and we still think it will be worth it though.
>
> As this will affect all embedders, a heads up seemed appropriate. Let us
> know if you have any ideas or suggestions.
>
> Thanks,
> Jan
>
> [0] https://bugzilla.mozilla.org/show_bug.cgi?id=650361
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: JSContext refactoring

Ms2ger
In reply to this post by Jan de Mooij-2
Hi Kent,

On 17/06/16 22:31, Kent Williams wrote:

> Looking at our application -- which is a very straightforward embedding
> of Spidermonkey, the only references to JSRuntime is in concert with
> creating the JSContext for our interpreter, like thus:
>>     JS_Init();
>>    JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024);
>>     if (!rt)
>>         return 1;
>>     JSContext *cx = JS_NewContext(rt, 8192);
> So in essence, creating and using the Runtime would just go away, as
> would the runtime parameter of JS_NewContext. Right?
>

Yeah, that's basically it.

Ms2ger

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine