<div dir="ltr"><div dir="ltr">I've put up a (WIP) patch for the tool (<a href="https://reviews.llvm.org/D56822">https://reviews.llvm.org/D56822</a>) in case anybody is curious about that. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 15, 2019 at 1:41 PM Jonas Devlieghere <<a href="mailto:jonas@devlieghere.com">jonas@devlieghere.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">I've updated the patch with a new version of the prototype: <a href="https://reviews.llvm.org/D56322" target="_blank">https://reviews.llvm.org/D56322</a></div><div dir="ltr"><br></div><div>It uses Pavel's suggestion to use the function address as a runtime ID. All the deserialization code is generated using templates, with automatic mapping on indices during serialization and deserialization.</div><div><br></div><div>I (again) manually added the macros for the same set of functions I had in the original prototype. Unsurprisingly this is very error-prone. It's easy to forget to add the right macros for the registry, the function, and the return type. Some of these things can be detected at compile time, other only blow up at run-time. I strongly believe that a tool to add the macros is the way forward. It would be more of a developer tool rather than something that hooks up in the build process. </div><div><br></div><div>Note that it's still a prototype, there are outstanding issues like void pointers, callbacks and other types of argument that require some kind of additional information to serialize. I also didn't get around yet to the lifetime issue yet that was discussed on IRC last week. </div><div><br></div><div>Please let me know what you think.</div><div><br></div><div>Thanks, </div><div>Jonas</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 9, 2019 at 8:58 AM Jonas Devlieghere <<a href="mailto:jonas@devlieghere.com" target="_blank">jonas@devlieghere.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 9, 2019 at 8:42 AM Pavel Labath <<a href="mailto:pavel@labath.sk" target="_blank">pavel@labath.sk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On 09/01/2019 17:15, Jonas Devlieghere wrote:<br>
> <br>
> <br>
> On Wed, Jan 9, 2019 at 5:05 AM Pavel Labath <<a href="mailto:pavel@labath.sk" target="_blank">pavel@labath.sk</a> <br>
> <mailto:<a href="mailto:pavel@labath.sk" target="_blank">pavel@labath.sk</a>>> wrote:<br>
> <br>
> On 08/01/2019 21:57, Jonas Devlieghere wrote:<br>
> > Before I got around to coding this up I realized you can't take the<br>
> > address of constructors in C++, so the function address won't<br>
> work as an<br>
> > identifier.<br>
> ><br>
> <br>
> You gave up way too easily. :P<br>
> <br>
> <br>
> I counted on you having something in mind, it sounded too obvious for <br>
> you to have missed. ;-)<br>
> <br>
> I realized that constructors are going to be tricky, but I didn't want<br>
> to dive into those details until I knew if you liked the general idea.<br>
> The most important thing to realize here is that for the identifier<br>
> thingy to work, you don't actually need to use the address of that<br>
> method/constructor as the identifier. It is sufficient to have<br>
> something<br>
> that can be deterministically computed from the function. Then you can<br>
> use the address of *that* as the identifier.<br>
> <br>
> <br>
> I was thinking about that yesterday. I still feel like it would be <br>
> better to have this mapping all done at compile time. I was considering <br>
> some kind of constexpr hashing but that sounded overkill.<br>
> <br>
<br>
Well.. most of this is done through template meta-programming, which <br>
_is_ compile-time. And the fact that I have a use for the new <br>
construct/invoke functions I create this way means that even the space <br>
used by those isn't completely wasted (although I'm sure this could be <br>
made smaller with hard-coded IDs). The biggest impact of this I can <br>
think of is the increased number of dynamic relocations that need to be <br>
performed by the loader, as it introduces a bunch of function pointers <br>
floating around. But even that shouldn't too bad as we have plenty of <br>
other sources of dynamic relocs (currently about 4% of the size of <br>
liblldb and 10% of lldb-server).<br></blockquote><div><br></div><div>Yeah of course, it wasn't my intention to critique your approach. I was talking specifically about the mapping (the std::map) in the prototype, something I asked about earlier in the thread. FWIW I think this would be an excellent trade-off is we don't need a tool to generate code for us. I'm hopeful that we can have the gross of the deserialization code generated this way, most of the "special" cases are still pretty similar and dealing with basic types. Anyway, that should become clear later today as I integrate this into the lldb prototype. </div></div></div>
</blockquote></div></div>
</blockquote></div>