pass over the make RDI library

- Handle type layout in the library so converts simply
  define type graph and let the library handle DAG layout.
- Changed location baking. For now the library waits for scope, procs,
  global vars, and thread vars steps to serially finish because
  of common dependency on location sections, we need to parallel for each step.
- Changed encoded offset size for RDI_EvalOp_FrameOff to 8 bytes
  (1 byte is not enough to cover all cases)
- Added frame base location to RDI_Procedure (WASM encodes frame base
  as an index into a global array and so we have to resolve the base
  at runtime).
This commit is contained in:
Nikita Smith
2025-03-10 16:49:54 -07:00
parent 5717d6c54c
commit 44249f35fc
10 changed files with 457 additions and 264 deletions
+22
View File
@@ -813,3 +813,25 @@ rdi_cstring_length(char *cstr)
for(;cstr[result] != 0; result += 1){}
return result;
}
RDI_PROC RDI_U64
rdi_size_from_bytecode_stream(U8 *ptr, U8 *opl)
{
RDI_U64 bytecode_size = 0;
RDI_U8 *off_first = ptr + sizeof(RDI_LocationKind);
for(RDI_U8 *off = off_first, *next_off = opl; off < opl; off = next_off)
{
RDI_U8 op = *off;
if(op == 0)
{
break;
}
RDI_U16 ctrlbits = rdi_eval_op_ctrlbits_table[op];
RDI_U32 p_size = RDI_DECODEN_FROM_CTRLBITS(ctrlbits);
bytecode_size += (1 + p_size);
next_off = (off + 1 + p_size);
}
return bytecode_size;
}