Open Bug 1379739 Opened 8 years ago Updated 2 years ago

Consider generating rust bindings for IPDL actors

Categories

(Core :: IPC, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: nika, Unassigned)

References

(Blocks 1 open bug)

Details

It would be nice to allow rust code to directly interact with IPDL actors. We don't necessarily need support for all features, but exporting IPDL structs to rust, and allowing rust code to call and implement IPC methods would be very nice. The scope of what these bindings should look like would probably need to be figured out.
Priority: -- → P3
Depends on bug 1316754?
See Also: → ripdl
(In reply to Jonathan Watt [:jwatt] (needinfo? me) from comment #1) > Depends on bug 1316754? Python could also generate Rust.

Since WebGPU is largely implemented in Rust, we could greatly reduce the boilerplate if we could access the IPDL entry points on GPU process side from Rust directly.

(In reply to Dzmitry Malyshau [:kvark] from comment #4)

Since WebGPU is largely implemented in Rust, we could greatly reduce the boilerplate if we could access the IPDL entry points on GPU process side from Rust directly.

"Me too." This would significantly reduce the amount of code in dom/webgpu that is simply passing Rust values through C++, IPDL, C++, and then Rust again.

exporting IPDL structs to rust

I think the initial comment here assumes that IPDL would serve as an inter-language exchange, with C++ senders driving Rust receivers and vice versa. While it seems essential for an actor written in one language to be able to manage actors written in the other, allowing the parent and child sides of a single protocol to be implemented in different languages seems both difficult and not necessary:

  • "Not necessary": we could restrict IPDL to same-language exchange, and it would still be very useful. I would expect many, if not most, modules to have the parent and child sides written in the same language.

  • "Difficult": the set of types that can be sent over IPDL is open-ended: anything that specializes ParamTraits can be sent, and the encoding is whatever the Read and Write methods say it is. It's also difficult for all the usual reasons that FFI is hard when the type systems don't line up. It helps that IPDL has to serialize everything anyway---we know we're doing a copy, so that gives us a chance to reformat things---but not all problems go away: what is the C++ equivalent of a Rust enum?

If we restricted IPDL to same-language exchange between parent and child, then Rust protocols could use serde for serialization, as the analogue of ParamTraits on the C++ side.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.