gimli icon indicating copy to clipboard operation
gimli copied to clipboard

Serialize Expressions

Open yurydelendik opened this issue 4 years ago • 4 comments

During migration to 0.20 -> 0.21, I found it impossible to rounds trip Expression. There is Expression::raw() but I could not find "into_raw" or write capabilities.

See requirement at https://github.com/bytecodealliance/wasmtime/blob/7d88384c0fe087cd80a3d8ae1bbc80950b2b7d91/cranelift/codegen/src/isa/unwind/systemv.rs#L25

yurydelendik avatar Jun 04 '20 14:06 yurydelendik

See https://github.com/bytecodealliance/wasmtime/pull/1466#discussion_r416349933. Let me know if the changes I showed there are unsuitable.

philipc avatar Jun 04 '20 21:06 philipc

They are. I just landed the similar patch today. Thanks.

yurydelendik avatar Jun 04 '20 22:06 yurydelendik

They are unsuitable?

write capabilities are already present. This is currently internal, but I don't think there is a need for users to write individual expressions? As I mentioned above the linked comment, references within the expression need to be handled, so they need to be written at the same time as writing the DIE they reference. I don't see a way to make this serializable. Can you be more specific about what you think needs to be done to resolve this issue?

philipc avatar Jun 05 '20 02:06 philipc

Sorry. The changes are suitable.

As I mentioned above the linked comment, references within the expression need to be handled, so they need to be written at the same time as writing the DIE they reference. I don't see a way to make this serializable.

I'm just pointing out that there is Expression::raw but not operation to unwrap that back. It is probably not a big deal now since we are using the approach you described in the proposed patch.

yurydelendik avatar Jun 05 '20 04:06 yurydelendik