mozilla :: #jsapi

24 Aug 2017
00:01bkellydo we know what caused the speedometer regression on this test?
00:17bkellysmaug: nursery purple buffer landed in that range ^^^
00:18bkellyalso bug 1392530
00:18firebot FIXED, Devirtualize MDefinition::op()
00:19bkellyI guess overall score did not regress
00:20bkellyseems we recovered the time in CompletingAllItems-sync phase of the test
00:20bkellynevermind... sorry for the noise
00:29ptomato-Mis there any way I can make sure a regular JSObject is tenured immediately when it's allocated?
01:00pbonebkelly: No worries, it's good for me to read and be aware of these things.
01:00pboneThe "noise" is information to me ;-)
01:00pboneptomato-M: Probably but I don't know off-hand.
01:00pboneptomato-M: I'll take a look.
01:05pboneThe important bit looks like: group->setShouldPreTenure(cx);
01:05pbonein gc/Nursery.cpp
01:07pboneI guess AutoCompartment locks the compartment, but I don't know.
01:07pbonethis is done during collecting, so the mutator isn't running. I don't know if that changes things for you.
01:10mrgigglesthe mozilla-inbound tree is now open
01:12ptomato-Mpbone: do you know if there's a way to do it through JSAPI? those parts aren't exposed if you are embedding spidermonkey
01:13pboneActually, I don't think this is what you want.
01:13pboneyou want to allocate a specific object (not all objects of that type) straight into the tenured heap at allocation time.
01:13pbonenot request that all future allocations of that object type are tenured.
01:14pboneptomato-M: I don't know offhand again.
01:17pboneIs GCRuntime::tryNewTenuredObject in the public API?
01:21ptomato-Mpbone: it seems not
01:21ptomato-MI'm looking around to find any callers of it that might be
01:22pboneYeah, I'm not finding any callers either.
01:23pboneIt looks like js::Allocate is the entry point, and you pass it a flag saying TenuredHeap or DefaultHeap
01:23pbonebut AIUI "js" is not the public API, JS is.
01:23pboneand I don't see any callers for it.
01:24ptomato-Mit's a bit more complicated than that, it depends on what's exposed in the shared library. headers in js/public are available, plus jsapi.h, jsfriendapi.h and anything included by them
01:24ptomato-Mbut I'm afraid you're right
01:25ptomato-Mhow about moving an individual object to the tenured heap? I suppose that can't be done outside of a GC?
01:27pboneHow do you allocate JSObjects normally via the public API? I don't see anything.
01:27ptomato-MJS_NewObject, JS_NewPlainObject, JS_NewObjectWithGivenProto, etc
01:28pboneMoving is much more tricky, and won't be an optimisation.
01:28pboneif you move it after allocation, you might as well move it during nursery sweeping.
01:30ptomato-Mgot it
01:34pboneI was about to say I found enough code to say that you can't do this with a public API.
01:34pboneLooks like the decision is made here:
01:35pboneso based on what your object/its class needs, you either get default heap or tenured heap.
01:35pboneand default means let the GC decide.
01:38pboneptomato-M: so what did you find?
01:38ptomato-Moh, I meant "got it" = I understood what you were saying
01:38ptomato-MI didn't find anything either
01:39ptomato-MI guess from reading that code you linked, if my class has a finalizer then it is tenured
01:39pboneah, no worries. Well I'm sorry I couldn't help. but it was at least good for me to look at this from the outside perspective.
01:40pboneYeah, but there's the other condition about being allowed to tenure objects with finalisers.
01:41pboneso if it does not have the flag: JSCLASS_SKIP_NURSERY_FINALIZE;
01:41pboneI'm not sure what that flag means.
01:41pboneAnyway, IDK if this is something other people want? I can see that embedders will know about object lifetimes and might like to pretenure things.
01:42ptomato-Mfrom what I can read, it means "okay to allocate in the nursery, even though it has a finalizer" because the finalizer isn't called when swept from the nursery
01:42pboneso if so then maybe it should be in the public API? file a bug maybe?
01:42ptomato-Myeah, I mean, I could use it, but on the other hand it seems like it would be easy to shoot yourself in the foot with it :-)
01:42pboneptomato-M: Yeah, but is the finalliser just delayed (put on a queue for later) or not called at all?
01:43ptomato-Mlooks like not called at all:
01:44pboneah, so something that gets cleaned up each nursery collection anyway.
01:44pboneNot sure why the tenured heap would use that (the situation when the finaliser is called) but I dono..
01:45pboneSo yeah, maybe it should be in the public API. but like all performance things it's definitly the case that you'd have to measure if it had the desired effect.
01:45pboneso shooting yourself in the foot is no worse than any other performance thing IMHO.
01:46pboneSo what timezone are you in? If you want to wait until Europe wakes up then you might get a better answer.
01:47pboneWe now have GC people in Australia (me) the UK and the USA. So we can "follow the sun" but O
01:47pbonebut I'm new to the team, so still learning SpiderMonkey internals.
01:48ptomato-MI'm in UTC-8 (Vancouver)
01:49ptomato-Mbtw, the reason I would want to use it is not so much performance but the ability to use JS::TenuredHeap and store flags in the lower bits of the pointer
01:52pboneHopefully it also copes with moving too. Because the tenured heap can be compacted.
01:57ptomato-Mseems like it does:
02:00pboneokay cool.
02:00pboneI remember that we use pointer tagging for some things, but couldn't remember in which heap. I should have known this.
02:08pboneI have a question. If I am working on SpiderMonkey and I want to make sure I didn't create a performance regression.
02:09pboneI'm aware of the Telos tests I can run with try. Is that what I should be doing? Is there some way I can use AWFY? should I use AWFY? or is that only for testing on each nightly build?
24 Aug 2017
Last message: 6 hours and 37 minutes ago