Skip to content
Spotandjake edited this page Aug 3, 2021 · 7 revisions

Memory


Process

  • Store
    • Malloc
  • Read

Type Id


  • Function: 1
  • Closure: 2
  • Boolean: 3
  • String: 4
  • Number: 5
  • Array: 6
  • Parameters: 7

Layout


Data Header


interface CommonHeader {
  rtSize: i32;
  refs:   i32; //reference count for gc
  rtId:   i32;
  // Payload starts here
}

Types


interface Function {
  CommonHeader: CommonHeader[];
  index: i32[];
  moduleId: i32[];
  closure: i32[];
}
interface Closure {
  CommonHeader: CommonHeader[];
  mem_ptr: [length];
}
interface Boolean {
  CommonHeader: CommonHeader[];
  value: [];
}
interface String {
  CommonHeader: CommonHeader[];
  char: i32[length];
}
interface Number {
  CommonHeader: CommonHeader[];
  boxedType: i32; // i32 = 1, i64 = 2, f32 = 3, f64 = 4
  value: (i32|i64|f32|f64);
}
interface Array {
  CommonHeader: CommonHeader[];
  mem_ptr: [length];
}
interface Parameter {
  CommonHeader: CommonHeader[];
  mem_ptr: [length];
}
Clone this wiki locally