Type Inference

Since we are using ArrayBuffer to emulate the heap memory, we need to have the type message of each variable to display them properly to users. (We don't want to show a raw byte array to user!)

Unfortunately, when a C0 source code is compiled into the C0 Bytecode, most type information are lost. All the information are reduced into two types: w32 (value type) and * (pointer).

However, it is possible for us to reconstruct some traces of type information from the comments in .bc0 file and Native Functions. These traces can be collected in a systematically way and allow us to inference the type information during runtime.

This documentation will provide detailed explanation on how this is done, and the situation that we can't resolve the conflict.

Last updated