diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-02-15 15:47:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-15 15:47:24 +0000 |
| commit | f5697dd7f2e71411957faf9fa620e62363491083 (patch) | |
| tree | 931db0d1c595326524bd7a541b0fb2c6d4a7f186 /core/runtime | |
| parent | 6223f48c3fc096b543a51aa1c993a6f1127f2a0f (diff) | |
| parent | a23ee1edc16dc447b9e342ba56b5871e0424082e (diff) | |
Merge branch 'master' into odin-global-constants-as-enums
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/core.odin | 1 | ||||
| -rw-r--r-- | core/runtime/core_builtin.odin | 4 | ||||
| -rw-r--r-- | core/runtime/internal.odin | 6 | ||||
| -rw-r--r-- | core/runtime/print.odin | 23 |
4 files changed, 25 insertions, 9 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 6c2ab1405..fec51f236 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -95,6 +95,7 @@ Type_Info_Enumerated_Array :: struct { count: int, min_value: Type_Info_Enum_Value, max_value: Type_Info_Enum_Value, + is_sparse: bool, } Type_Info_Dynamic_Array :: struct {elem: ^Type_Info, elem_size: int} Type_Info_Slice :: struct {elem: ^Type_Info, elem_size: int} diff --git a/core/runtime/core_builtin.odin b/core/runtime/core_builtin.odin index 44da894c1..3bafc0b1d 100644 --- a/core/runtime/core_builtin.odin +++ b/core/runtime/core_builtin.odin @@ -614,6 +614,10 @@ raw_data :: proc{raw_array_data, raw_slice_data, raw_dynamic_array_data, raw_str @(disabled=ODIN_DISABLE_ASSERT) assert :: proc(condition: bool, message := "", loc := #caller_location) { if !condition { + // NOTE(bill): This is wrapped in a procedure call + // to improve performance to make the CPU not + // execute speculatively, making it about an order of + // magnitude faster proc(message: string, loc: Source_Code_Location) { p := context.assertion_failure_proc if p == nil { diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin index 0d0e196c4..30798f623 100644 --- a/core/runtime/internal.odin +++ b/core/runtime/internal.odin @@ -37,10 +37,8 @@ bswap_64 :: proc "contextless" (x: u64) -> u64 { bswap_128 :: proc "contextless" (x: u128) -> u128 { z := transmute([4]u32)x - z[0] = bswap_32(z[3]) - z[1] = bswap_32(z[2]) - z[2] = bswap_32(z[1]) - z[3] = bswap_32(z[0]) + z[0], z[3] = bswap_32(z[3]), bswap_32(z[0]) + z[1], z[2] = bswap_32(z[2]), bswap_32(z[1]) return transmute(u128)z } diff --git a/core/runtime/print.odin b/core/runtime/print.odin index 8a14eba08..06740bc75 100644 --- a/core/runtime/print.odin +++ b/core/runtime/print.odin @@ -143,11 +143,21 @@ print_int :: proc "contextless" (x: int) { print_i64(i64(x)) } print_caller_location :: proc "contextless" (using loc: Source_Code_Location) { print_string(file_path) - print_byte('(') - print_u64(u64(line)) - print_byte(':') - print_u64(u64(column)) - print_byte(')') + when ODIN_ERROR_POS_STYLE == .Default { + print_byte('(') + print_u64(u64(line)) + print_byte(':') + print_u64(u64(column)) + print_byte(')') + } else when ODIN_ERROR_POS_STYLE == .Unix { + print_byte(':') + print_u64(u64(line)) + print_byte(':') + print_u64(u64(column)) + print_byte(':') + } else { + #panic("unhandled ODIN_ERROR_POS_STYLE") + } } print_typeid :: proc "contextless" (id: typeid) { if id == nil { @@ -250,6 +260,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) { print_type(info.elem) case Type_Info_Enumerated_Array: + if info.is_sparse { + print_string("#sparse") + } print_byte('[') print_type(info.index) print_byte(']') |