Conversation
templates/src/serialize.c.erb
Outdated
| uint32_t owned_mask = 1U << 31; | ||
| // Write the constant contents into the buffer after the constant | ||
| // pool. In place of the source offset, we store a buffer offset | ||
| // with the high bit set to indicate embedded content. |
There was a problem hiding this comment.
Since they would all be embedded we wouldn't need the high bit anymore (once the deserializers are updated of course), right?
|
Some stats: All fields: Only semantic fields: So |
Conceptually it should be strictly better for retained memory, and it should make it possible to lazily deserialize methods. Right now the laziness for methods in TruffleRuby is by lazily translating the Prism AST of a In practice if you're thinking of parse performance in TruffleRuby/JRuby then I think we should adapt deserializers as well already before measuring, e.g. to no longer have to handle the "owned string bit". I checked that the source bytes are only used by |
|
Regarding stopping at DefNode in Loader.java to have lazy deserialization, I'd be happy to look into that, though it seems better done separately from this PR. |
|
I think this looks good. We have plans to do an update on JRuby side this week. Ultimately as @eregon said the big opt for prism will be completely going lazy for methods (leaving serialized sections un-ASTd much less built into IR). Not having to make the AST eagerly for methods we may never call is one step past what we do in legacy parsing. |
|
I also wanted to say for me this PR with the deserializers changes would be fine to merge, for TruffleRuby POV I think there is no need to benchmark before merging. |
|
Worth mentioning that lazy def nodes will also help the wasm implementation narrow the gap with native. |
54468de to
0e7fb6b
Compare
Fixes #1537
@eregon @enebo would you both be able to experiment with this branch and tell me what you think? If it works better for JRuby/TruffleRuby I'm happy to just merge this as the default and remove the branching logic inside the deserializers