Ignore backward jumps in computing serializer size
When defining a new topic, typically the serializer instructions that are usually in constant memory and generated by the IDL compiler are copied into memory managed by the Cyclone implementation. For this it needs to compute the size of the serializer, which the IDL compiler doesn't provide. It does this by effectively dry-running the program. (Note that it doesn't validate the program.) All but the JSR operations move the program counter forward, but the JSR operation can cause it to go backward instead and allows implementing recursive types (the IDL compiler doesn't support them, but one might decide to work around that limitation). When dry-running the program, following a backwards jump can cause a non-terminating loop. The jump could potentially be to an unexplored address and so ignoring all backwards jumps potentially means it skips part of the program. As this is not a validator and the program can always be arranged so that a following a backwards jump is not relevant to computing the size correctly, this is reasonable approximation. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
1b448dee9b
commit
2ef17d0200
1 changed files with 2 additions and 1 deletions
|
@ -364,6 +364,7 @@ static void dds_stream_countops1 (const uint32_t * __restrict ops, const uint32_
|
|||
break;
|
||||
}
|
||||
case DDS_OP_JSR: {
|
||||
if (DDS_OP_JUMP (insn) > 0)
|
||||
dds_stream_countops1 (ops + DDS_OP_JUMP (insn), ops_end);
|
||||
ops++;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue