We had previously commented out the upb portion of simple_nested_test. This is because nonmutable getters have submessages being NULL by default. This means that trying to fetch anything, like a simple scalar from that nested message would segfault. This CL makes the externC return an Option<RawMessage> since we've discovered that upb can return NULL. This way, we can check for `None` and handle the NULL case appropriately. We know that the NULL pathway can only come from terra upb, since cpp automagically constructs submsgs if they don't exist. We've augmented upb.rs to contain a scratch space that allocates a zeroed-out contiguous chunk of memory @64KB. Since a block of zeroed-out memory is a legit message from upb's point of view, we can provide $pbr$::ScratchSpace::zeroed_block() to upb in order to get the default submessage behavior we want from upb. This block is lazily allocated upon first request. This means that a consumer of the cpp kernel will not incur an additional cost. PiperOrigin-RevId: 573840755pull/14416/head
parent
dc4a800a2d
commit
6d4ea615cc
4 changed files with 77 additions and 18 deletions
Loading…
Reference in new issue