JS_SetContextPrivate and friends are being removed

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

JS_SetContextPrivate and friends are being removed

Jason Orendorff-2
In the next release of SpiderMonkey, each thread that wants to use JS must
have a single JSRuntime and a single JSContext. The two concepts are being
unified. Work is ongoing; this week, <
https://bugzilla.mozilla.org/show_bug.cgi?id=1281529>.

As a result, we're removing these API functions:
  JS_GetContextPrivate
  JS_SetContextPrivate
  JS_GetSecondContextPrivate
  JS_SetSecondContextPrivate

Rationale: Once you switch to a single JSRuntime and a single JSContext
per-thread, these functions are useless. You can easily switch to
thread-local or global variables, which are much nicer: they have names and
types, they can be any size, and you can have as many as you like.

See <https://bugzilla.mozilla.org/show_bug.cgi?id=1281582>.

Cheers,
-j
_______________________________________________
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_SetContextPrivate and friends are being removed

Braden McDaniel
On Fri, 2016-06-24 at 11:13 -0500, Jason Orendorff wrote:

> In the next release of SpiderMonkey, each thread that wants to use JS
> must
> have a single JSRuntime and a single JSContext. The two concepts are
> being
> unified. Work is ongoing; this week, <
> https://bugzilla.mozilla.org/show_bug.cgi?id=1281529>;.
>
> As a result, we're removing these API functions:
>   JS_GetContextPrivate
>   JS_SetContextPrivate
>   JS_GetSecondContextPrivate
>   JS_SetSecondContextPrivate
>
> Rationale: Once you switch to a single JSRuntime and a single
> JSContext
> per-thread, these functions are useless. You can easily switch to
> thread-local or global variables, which are much nicer: they have
> names and
> types, they can be any size, and you can have as many as you like.
>
> See <https://bugzilla.mozilla.org/show_bug.cgi?id=1281582>.

Does this mean that if one wants separate scopes (that is, separate
global objects), one *must* use separate threads?

--

Braden McDaniel <[hidden email]>
_______________________________________________
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_SetContextPrivate and friends are being removed

Josh Matthews-4
In reply to this post by Jason Orendorff-2
On 2016-06-25 3:30 PM, Braden McDaniel wrote:

> On Fri, 2016-06-24 at 11:13 -0500, Jason Orendorff wrote:
>> In the next release of SpiderMonkey, each thread that wants to use JS
>> must
>> have a single JSRuntime and a single JSContext. The two concepts are
>> being
>> unified. Work is ongoing; this week, <
>> https://bugzilla.mozilla.org/show_bug.cgi?id=1281529>;.
>>
>> As a result, we're removing these API functions:
>>   JS_GetContextPrivate
>>   JS_SetContextPrivate
>>   JS_GetSecondContextPrivate
>>   JS_SetSecondContextPrivate
>>
>> Rationale: Once you switch to a single JSRuntime and a single
>> JSContext
>> per-thread, these functions are useless. You can easily switch to
>> thread-local or global variables, which are much nicer: they have
>> names and
>> types, they can be any size, and you can have as many as you like.
>>
>> See <https://bugzilla.mozilla.org/show_bug.cgi?id=1281582>.
>
> Does this mean that if one wants separate scopes (that is, separate
> global objects), one *must* use separate threads?
>

It's perfectly fine to create multiple globals for the same runtime on
the same thread.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine