Relative pointers

This commit is contained in:
gingerBill
2020-05-15 17:37:00 +01:00
parent 8b066b2456
commit ff92eb9112
14 changed files with 534 additions and 40 deletions
+14 -1
View File
@@ -143,7 +143,15 @@ Type_Info_Simd_Vector :: struct {
elem_size: int,
count: int,
is_x86_mmx: bool,
}
};
Type_Info_Relative_Pointer :: struct {
pointer: ^Type_Info,
base_integer: ^Type_Info,
};
Type_Info_Relative_Slice :: struct {
slice: ^Type_Info,
base_integer: ^Type_Info,
};
Type_Info :: struct {
size: int,
@@ -176,6 +184,8 @@ Type_Info :: struct {
Type_Info_Bit_Set,
Type_Info_Opaque,
Type_Info_Simd_Vector,
Type_Info_Relative_Pointer,
Type_Info_Relative_Slice,
},
}
@@ -205,6 +215,9 @@ Typeid_Kind :: enum u8 {
Bit_Field,
Bit_Set,
Opaque,
Simd_Vector,
Relative_Pointer,
Relative_Slice,
}
#assert(len(Typeid_Kind) < 32);
+12
View File
@@ -442,6 +442,18 @@ print_type :: proc(fd: os.Handle, ti: ^Type_Info) {
os.write_byte(fd, ']');
print_type(fd, info.elem);
}
case Type_Info_Relative_Pointer:
os.write_string(fd, "#relative(");
print_type(fd, info.base_integer);
os.write_string(fd, ") ");
print_type(fd, info.pointer);
case Type_Info_Relative_Slice:
os.write_string(fd, "#relative(");
print_type(fd, info.base_integer);
os.write_string(fd, ") ");
print_type(fd, info.slice);
}
}