00:08:54  * not-an-aardvarkquit (Quit: Connection closed for inactivity)
01:19:45  * AtumTquit (Remote host closed the connection)
02:03:32  * not-an-aardvarkjoined
03:46:56  * plutoniixquit (Quit: Leaving)
04:32:32  * Garbeequit (Quit: Connection closed for inactivity)
05:12:58  * xaxxonquit (Ping timeout: 264 seconds)
05:18:51  * xaxxonjoined
07:01:49  * xaxxonquit (Quit: xaxxon)
07:45:18  * plutoniixjoined
07:58:54  * not-an-aardvarkquit (Quit: Connection closed for inactivity)
09:57:21  * dobsonquit (Read error: Connection reset by peer)
10:01:40  * dobsonjoined
10:25:12  * mylesborinsquit (Quit: farewell for now)
10:25:41  * mylesborinsjoined
11:37:55  * plutoniixquit (Quit: Leaving)
12:19:35  * cloudshujoined
12:27:00  * Garbeejoined
13:24:46  <gsathya>devsnek: can you explain the problem that you'd trying to solve here? (instead of the solutions themselves)
13:25:10  <devsnek>ok one sec
13:25:59  <devsnek>so basically node has a ModuleWrap and a ScriptWrap
13:26:42  <devsnek>which wrap around Module/Script and help us actually run them
13:26:49  <devsnek>facilitate linking etc
13:27:48  <devsnek>part of this is exposing an api called "vm" to node users
13:28:05  <devsnek>which allows them to create "Scripts" and "Modules"
13:28:16  <devsnek>(see more at https://nodejs.org/api/vm.html)
13:28:39  <devsnek>we need to be able to hook dynamic import requests and initialise import meta requests
13:28:47  <devsnek>and send them to the user somehow
13:29:01  <devsnek>while making sure the user doesn't get to touch the requests going to node's actual esm loader
13:30:25  <devsnek>gsathya: all making sense?
14:30:00  <gsathya>devsnek: i have questions, but go on
14:30:09  <devsnek>that's about it
14:30:40  <devsnek>the last point about directing the requests to different places is where we get stuck
14:33:24  <gsathya>you get the HostImportModuleDynamicallyCallback and that has the HostDefinedOptions that you can use to disambiguate what to call, but HostInitializeImportMetaObjectCallback does not so you don't know what to call. Is this correct? Can you store a Module map from Module -> Primitive? (where the Primitive is that thing that you had originally stored in the HostDefinedOptions)
14:34:24  <devsnek>modules don't have any unique identification though so there's nothing you can put in a primitive to identify one
14:36:10  <devsnek>import meta was easier to implement because it gives the actual module instance
14:39:35  <gsathya>aklein: ^
14:44:57  <aklein>devsnek: the way to get such a primitive for a module is to do the mapping yourself
14:45:15  <aklein>that is, concretely, using something like std::unordered_map in C++
14:45:53  <devsnek>there's nothing to map by for modules
14:45:56  <devsnek>https://github.com/devsnek/node/blob/feature/vm-meta-import-etc/src/module_wrap.cc#L757
14:46:19  <devsnek>the best we can do is GetIdentityHash and that isn't unique
14:46:38  <devsnek>it only works if we have the actual module instance
14:47:05  <devsnek>https://github.com/devsnek/node/blob/feature/vm-meta-import-etc/src/module_wrap.cc#L66-L81
14:47:05  <aklein>devsnek: what are you calling GetIdentityHash() on if all you have is a v8::ScriptOrModule?
14:47:13  <devsnek>nothing
14:47:31  <devsnek>the identity hash is in the host defined options
14:48:09  <aklein>devsnek: so here's d8's mapping of modules: https://cs.chromium.org/chromium/src/v8/src/d8.cc?rcl=79b300af925102cdaaf3b64911687e828c188d2b&l=767
14:48:25  <devsnek>we can't map by url
14:48:39  <devsnek>urls aren't unique
14:48:39  <aklein>devsnek: you could map to some incremented ID on your end
14:48:51  <aklein>and then include that ID in the host defined options
14:49:02  <devsnek>and then when we only have Local<Module>
14:49:05  <devsnek>for the import meta
14:49:11  <devsnek>and not host defined options
14:50:26  <aklein>devsnek: sorry, don't follow, was there more to that last bit?
14:52:42  <devsnek>we can't attach our own incrementing id to the actual module
14:52:50  <devsnek>so it wouldn't work for the import meta callback
14:53:03  <aklein>devsnek: I'm proposing two side tables, analogous to those I'm showing for d8
14:53:24  <aklein>one mapping unique id -> Module
14:53:29  <aklein>and the other mapping Module -> unique id
14:53:41  <devsnek>i guess that would work
14:53:54  <devsnek>can't we just attach these callbacks to the actual scripts and modules
14:54:36  <devsnek>two global maps is a bit excessive
14:54:47  <aklein>devsnek: how would that work? the callbacks are just function pointers
14:55:04  <devsnek>instead of attaching them to the isolate
14:55:07  <devsnek>or context
14:55:10  <devsnek>or wherever
14:56:20  <aklein>devsnek: but you'd need a different callback for each module, right?
14:56:26  <aklein>at that point you couldn't use a function pointer
14:56:34  <devsnek>i would probably use a std::function at that point, yes
14:56:35  <aklein>you'd need some object to encapsulate the callback
14:57:18  <aklein>I'd imagine that in such a system you'd need to store a Global<Module> in the std::function
14:57:43  <devsnek>thats probably what i would do
14:58:01  <aklein>to go up a couple levels of abstraction: the current API assumes embedders might want to associate arbitrary amounts of data with a Module. For that, they'll already need a map of v8::Module to whatever
14:58:20  <devsnek>could also have Module::GetScriptOrigin or something
15:01:01  <aklein>given that assumption, we figured it should be relatively easy to do the inverse mapping as well. obviously some of this is informed (or you could say biased) by Chromium's requirements
15:02:00  <aklein>the reason we didn't expose GetModule() on ScriptOrModule is that we didn't want to constrain that API to actually have a handle to the relevant module
15:03:09  <aklein>and in fact I don't believe the object passed there actually does have access to the module (though I could be wrong, it's been awhile since I looked closely at this code)
15:03:18  <devsnek>i don't understand that last point but knowing that you guys intended people to use inverse maps and stuff at least lets me know theres a method to the madness
15:04:22  <aklein>the last point is that the actual object underlying v8::ScriptOrModule is v8::internal::Script
15:04:24  <aklein>https://cs.chromium.org/chromium/src/v8/src/objects/script.h?rcl=386975ac9a68cd5857557b0a9452f8b1f13e10f7&l=18
15:05:21  <aklein>glad to hear the explanation of the bidirectional mapping is helpful. sorry if the name of GetIdentityHash() was confusing...it really should just be called GetHashCode() or something
15:05:32  <aklein>(I believe it was named for consistency with v8::Object::GetIdentityHash())
15:05:54  <devsnek>well neither of them are unique (which i guess "hash" is supposed to imply?)
15:07:30  <aklein>yeah, the point is that it's only meant as a stable hash code
15:08:12  <aklein>for identity you can just fall back to C++ operator==
15:08:37  <aklein>but there's no notion of stable identity for an object that doesn't require holding a handle to it (either Global or Local)
15:08:40  <aklein>due to the moving GC
15:10:09  <devsnek>ye
15:21:04  <devsnek>aklein: what is this Global construct that d8 is using
15:21:10  <devsnek>its not a actual v8 thing as far as i can tell
15:21:22  <aklein>you might know it as Persistent
15:21:28  <devsnek>oh
15:21:33  <aklein>I believe Persistent is the "old" name :)
15:21:41  <devsnek>its still called a Persistent in v8.h
15:22:42  <aklein>oh, sorry, looks like they're not quite equivalent
15:22:50  <aklein>Global is like Persistent but with move semantics
15:25:39  <devsnek>i dunno what that means :P
15:27:32  <devsnek>oh moving a pointer to another owner
15:55:30  * bengl_joined
16:03:04  * benglquit (*.net *.split)
16:03:07  * bengl_changed nick to bengl
16:18:16  <cloudshu>where are the warmup counts for functions kept?
16:18:27  <cloudshu>(and is that tunable through v8.h?)
16:42:23  <cloudshu>ah ha they're called profiler_ticks
16:47:30  * RT|Chatzillaquit (Quit: ChatZilla [Firefox])
17:01:51  <Wes->devsnek: I don't really know much about node and I'm new to v8 -- but I implemented a fairly substantial platform built on top of CommonJS on SpiderMonkey from roughly 2007 to 2012. I'm confused about one thing in your query: how can URLs not reference unique modules? How do you actually load the module code? Or are these not require()-style modules?
17:35:54  <devsnek>Wes-: these are es modules
17:36:12  <devsnek>and uh we can't use urls as unique because the user can create as many module maps as they want
17:36:26  <devsnek>so any number of module instances may share the same url
18:44:44  * AtumTjoined
19:44:31  * dherman_changed nick to dherman
19:58:49  <Wes->devsnek: *click* - gotcha, all clear.
22:07:23  * AtumTquit (*.net *.split)
22:07:52  * AtumTjoined
22:34:51  * xaxxonjoined
22:51:31  * xaxxonquit (Ping timeout: 256 seconds)
22:53:16  * xaxxonjoined
23:11:16  * RT|Chatzillajoined