From 0f944bc0a15f75594c3cec65572356868901394a Mon Sep 17 00:00:00 2001 From: flysand7 Date: Sun, 24 Mar 2024 10:22:57 +1100 Subject: [PATCH 01/43] [core/os2]: Reading from unsized files --- core/os/os2/errors.odin | 16 ++++++++++++ core/os/os2/file_util.odin | 46 ++++++++++++++++++++++++++--------- core/os/os2/file_windows.odin | 4 ++- 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/core/os/os2/errors.odin b/core/os/os2/errors.odin index 426375a5a..77c5b1199 100644 --- a/core/os/os2/errors.odin +++ b/core/os/os2/errors.odin @@ -13,6 +13,10 @@ General_Error :: enum u32 { Timeout, + // Indicates that an attempt to retrieve a file's size was made, but the + // file doesn't have a size. + No_Size, + Invalid_File, Invalid_Dir, Invalid_Path, @@ -22,9 +26,15 @@ General_Error :: enum u32 { Platform_Error :: enum i32 {None=0} +Read_Error :: enum u32 { + None, + Broken_Pipe, +} + Error :: union #shared_nil { General_Error, io.Error, + Read_Error, runtime.Allocator_Error, Platform_Error, } @@ -51,6 +61,7 @@ error_string :: proc(ferr: Error) -> string { case .Not_Exist: return "file does not exist" case .Closed: return "file already closed" case .Timeout: return "i/o timeout" + case .No_Size: return "file has no definite size" case .Invalid_File: return "invalid file" case .Invalid_Dir: return "invalid directory" case .Invalid_Path: return "invalid path" @@ -82,6 +93,11 @@ error_string :: proc(ferr: Error) -> string { case .Invalid_Argument: return "invalid allocator argument" case .Mode_Not_Implemented: return "allocator mode not implemented" } + case Read_Error: + switch e { + case .None: return "" + case .Broken_Pipe: return "Broken pipe" + } case Platform_Error: return _error_string(i32(e)) } diff --git a/core/os/os2/file_util.odin b/core/os/os2/file_util.odin index 459544fc0..bb3dfd9eb 100644 --- a/core/os/os2/file_util.odin +++ b/core/os/os2/file_util.odin @@ -87,26 +87,50 @@ read_entire_file_from_path :: proc(name: string, allocator: runtime.Allocator) - read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator) -> (data: []byte, err: Error) { size: int + has_size := true if size64, err := file_size(f); err == nil { if i64(int(size64)) != size64 { size = int(size64) } + } else if err == .No_Size { + has_size = false + } else { + return } size += 1 // for EOF // TODO(bill): Is this correct logic? - total: int - data = make([]byte, size, allocator) or_return - for { - n: int - n, err = read(f, data[total:]) - total += n - if err != nil { - if err == .EOF { - err = nil + if has_size { + total: int + data = make([]byte, size, allocator) or_return + for { + n: int + n, err = read(f, data[total:]) + total += n + if err != nil { + if err == .EOF { + err = nil + } + data = data[:total] + return + } + } + } else { + buffer: [1024]u8 + out_buffer := make([dynamic]u8) + total := 0 + for { + n: int = --- + n, err = read(f, buffer[:]) + total += n + append_elems(&out_buffer, ..buffer[:total]) + if err != nil { + if err == .EOF || err == .Broken_Pipe { + err = nil + } + data = out_buffer[:total] + return } - data = data[:total] - return } } } diff --git a/core/os/os2/file_windows.odin b/core/os/os2/file_windows.odin index 8cb040a0a..fc3cebaea 100644 --- a/core/os/os2/file_windows.odin +++ b/core/os/os2/file_windows.odin @@ -434,6 +434,9 @@ _write_at :: proc(f: ^File, p: []byte, offset: i64) -> (n: i64, err: Error) { _file_size :: proc(f: ^File) -> (n: i64, err: Error) { length: win32.LARGE_INTEGER + if f.impl.kind == .Pipe { + return 0, .No_Size + } handle := _handle(f) if !win32.GetFileSizeEx(handle, &length) { err = _get_platform_error() @@ -766,7 +769,6 @@ _is_dir :: proc(path: string) -> bool { _file_stream_proc :: proc(stream_data: rawptr, mode: io.Stream_Mode, p: []byte, offset: i64, whence: io.Seek_From) -> (n: i64, err: io.Error) { f := (^File)(stream_data) ferr: Error - i: int switch mode { case .Read: n, ferr = _read(f, p) From c843002d07bb7d42b4c1e29801489ee7eb75edf9 Mon Sep 17 00:00:00 2001 From: flysand7 Date: Mon, 25 Mar 2024 23:35:01 +1100 Subject: [PATCH 02/43] [core/os2]: Move .Broken_Pipe to General_Error enum --- core/os/os2/errors.odin | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/core/os/os2/errors.odin b/core/os/os2/errors.odin index 77c5b1199..d76b2d549 100644 --- a/core/os/os2/errors.odin +++ b/core/os/os2/errors.odin @@ -13,6 +13,8 @@ General_Error :: enum u32 { Timeout, + Broken_Pipe, + // Indicates that an attempt to retrieve a file's size was made, but the // file doesn't have a size. No_Size, @@ -26,15 +28,9 @@ General_Error :: enum u32 { Platform_Error :: enum i32 {None=0} -Read_Error :: enum u32 { - None, - Broken_Pipe, -} - Error :: union #shared_nil { General_Error, io.Error, - Read_Error, runtime.Allocator_Error, Platform_Error, } @@ -61,6 +57,7 @@ error_string :: proc(ferr: Error) -> string { case .Not_Exist: return "file does not exist" case .Closed: return "file already closed" case .Timeout: return "i/o timeout" + case .Broken_Pipe: return "Broken pipe" case .No_Size: return "file has no definite size" case .Invalid_File: return "invalid file" case .Invalid_Dir: return "invalid directory" @@ -93,11 +90,6 @@ error_string :: proc(ferr: Error) -> string { case .Invalid_Argument: return "invalid allocator argument" case .Mode_Not_Implemented: return "allocator mode not implemented" } - case Read_Error: - switch e { - case .None: return "" - case .Broken_Pipe: return "Broken pipe" - } case Platform_Error: return _error_string(i32(e)) } From 3975b5e73683dab4ba4fc34058c64c5fa030fd15 Mon Sep 17 00:00:00 2001 From: nicola Date: Sat, 30 Mar 2024 16:48:52 -0400 Subject: [PATCH 03/43] :Updated core:os for darwin to include flush function and match close to api documentation returning errno --- core/os/os_darwin.odin | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin index b22d3250f..def0caa13 100644 --- a/core/os/os_darwin.odin +++ b/core/os/os_darwin.odin @@ -456,6 +456,7 @@ foreign libc { @(link_name="fstat64") _unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> c.int --- @(link_name="readlink") _unix_readlink :: proc(path: cstring, buf: ^byte, bufsiz: c.size_t) -> c.ssize_t --- @(link_name="access") _unix_access :: proc(path: cstring, mask: int) -> int --- + @(link_name="fsync") _unix_fsync :: proc(handle: Handle) -> c.int --- @(link_name="fdopendir$INODE64") _unix_fdopendir_amd64 :: proc(fd: Handle) -> Dir --- @(link_name="readdir_r$INODE64") _unix_readdir_r_amd64 :: proc(dirp: Dir, entry: ^Dirent, result: ^^Dirent) -> c.int --- @@ -565,8 +566,8 @@ fchmod :: proc(fd: Handle, mode: u16) -> Errno { return cast(Errno)_unix_fchmod(fd, mode) } -close :: proc(fd: Handle) -> bool { - return _unix_close(fd) == 0 +close :: proc(fd: Handle) -> Errno { + return cast(Errno)_unix_close(fd) } // If you read or write more than `SSIZE_MAX` bytes, most darwin implementations will return `EINVAL` @@ -894,6 +895,10 @@ access :: proc(path: string, mask: int) -> bool { return _unix_access(cstr, mask) == 0 } +flush :: proc(fd: Handle) -> Errno { + return cast(Errno)_unix_fsync(fd) +} + lookup_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) { runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD(ignore = context.temp_allocator == allocator) path_str := strings.clone_to_cstring(key, context.temp_allocator) From d0674cb70faec3048fece12a8cc72c31494050e9 Mon Sep 17 00:00:00 2001 From: Dragos Popescu Date: Sun, 31 Mar 2024 21:29:49 +0300 Subject: [PATCH 04/43] Fixed windows.COINIT.MULTITHREADED declaration. It's supposed to be 0 rather than 3 --- core/sys/windows/ole32.odin | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/sys/windows/ole32.odin b/core/sys/windows/ole32.odin index 6fa398d46..d344db5f0 100644 --- a/core/sys/windows/ole32.odin +++ b/core/sys/windows/ole32.odin @@ -3,9 +3,24 @@ package sys_windows foreign import "system:Ole32.lib" //objbase.h +// Note(Dragos): https://learn.microsoft.com/en-us/windows/win32/api/objbase/ne-objbase-coinit makes you believe that MULTITHREADED == 3. That is wrong. See definition of objbase.h +/* +typedef enum tagCOINIT +{ + COINIT_APARTMENTTHREADED = 0x2, // Apartment model + +#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM + // These constants are only valid on Windows NT 4.0 + COINIT_MULTITHREADED = COINITBASE_MULTITHREADED, + COINIT_DISABLE_OLE1DDE = 0x4, // Don't use DDE for Ole1 support. + COINIT_SPEED_OVER_MEMORY = 0x8, // Trade memory for speed. +#endif // DCOM +} COINIT; +*/ +// Where COINITBASE_MULTITHREADED == 0x00 COINIT :: enum DWORD { APARTMENTTHREADED = 0x2, - MULTITHREADED, + MULTITHREADED = 0, DISABLE_OLE1DDE = 0x4, SPEED_OVER_MEMORY = 0x8, } From f482cc8374d041795dc106709093f194da5ce5bb Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 1 Apr 2024 12:33:56 +0100 Subject: [PATCH 05/43] Fix error message --- src/check_expr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index c7a1b460a..4142968cc 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -2428,7 +2428,7 @@ gb_internal void check_old_for_or_switch_value_usage(Ast *expr) { if ((e->flags & EntityFlag_ForValue) != 0) { Type *parent_type = type_deref(e->Variable.for_loop_parent_type); - error(expr, "Assuming a for-in defined value is addressable as the iterable is passed by value has been disallowed with '-strict-style'."); + error(expr, "Assuming a for-in defined value is addressable as the iterable is passed by value has been disallowed."); if (is_type_map(parent_type)) { error_line("\tSuggestion: Prefer doing 'for key, &%.*s in ...'\n", LIT(e->token.string)); @@ -2438,7 +2438,7 @@ gb_internal void check_old_for_or_switch_value_usage(Ast *expr) { } else { GB_ASSERT((e->flags & EntityFlag_SwitchValue) != 0); - error(expr, "Assuming a switch-in defined value is addressable as the iterable is passed by value has been disallowed with '-strict-style'."); + error(expr, "Assuming a switch-in defined value is addressable as the iterable is passed by value has been disallowed."); error_line("\tSuggestion: Prefer doing 'switch &%.*s in ...'\n", LIT(e->token.string)); } } From b862691d7524d5dc05d6c43872daa7a488c2411a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 1 Apr 2024 13:08:07 +0100 Subject: [PATCH 06/43] Support `for in` with `bit_set` --- src/check_stmt.cpp | 13 +++++ src/llvm_backend_expr.cpp | 102 +++++++++++++++++++------------------- src/llvm_backend_stmt.cpp | 94 ++++++++++++++++++++++++++++++++--- 3 files changed, 152 insertions(+), 57 deletions(-) diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 1d7e7d4e9..b25df01a6 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1554,6 +1554,19 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) } break; + case Type_BitSet: + array_add(&vals, t->BitSet.elem); + if (rs->vals.count > 1) { + error(rs->vals[1], "Expected 1 name when iterating over a bit_set, got %td", rs->vals.count); + } + if (rs->vals.count == 1 && + rs->vals[0]->kind == Ast_UnaryExpr && + rs->vals[0]->UnaryExpr.op.kind == Token_And) { + error(rs->vals[0], "When iteraing across a bit_set, you cannot modify the value with '&' as that does not make much sense"); + } + add_type_info_type(ctx, operand.type); + break; + case Type_EnumeratedArray: if (is_ptr) use_by_reference_for_value = true; array_add(&vals, t->EnumeratedArray.elem); diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp index 12949f0ab..f6f36e861 100644 --- a/src/llvm_backend_expr.cpp +++ b/src/llvm_backend_expr.cpp @@ -1373,6 +1373,57 @@ gb_internal bool lb_is_empty_string_constant(Ast *expr) { return false; } +gb_internal lbValue lb_build_binary_in(lbProcedure *p, lbValue left, lbValue right, TokenKind op) { + Type *rt = base_type(right.type); + if (is_type_pointer(rt)) { + right = lb_emit_load(p, right); + rt = base_type(type_deref(rt)); + } + + switch (rt->kind) { + case Type_Map: + { + lbValue map_ptr = lb_address_from_load_or_generate_local(p, right); + lbValue key = left; + lbValue ptr = lb_internal_dynamic_map_get_ptr(p, map_ptr, key); + if (op == Token_in) { + return lb_emit_conv(p, lb_emit_comp_against_nil(p, Token_NotEq, ptr), t_bool); + } else { + return lb_emit_conv(p, lb_emit_comp_against_nil(p, Token_CmpEq, ptr), t_bool); + } + } + break; + case Type_BitSet: + { + Type *key_type = rt->BitSet.elem; + GB_ASSERT(are_types_identical(left.type, key_type)); + + Type *it = bit_set_to_int(rt); + left = lb_emit_conv(p, left, it); + if (is_type_different_to_arch_endianness(it)) { + left = lb_emit_byte_swap(p, left, integer_endian_type_to_platform_type(it)); + } + + lbValue lower = lb_const_value(p->module, left.type, exact_value_i64(rt->BitSet.lower)); + lbValue key = lb_emit_arith(p, Token_Sub, left, lower, left.type); + lbValue bit = lb_emit_arith(p, Token_Shl, lb_const_int(p->module, left.type, 1), key, left.type); + bit = lb_emit_conv(p, bit, it); + + lbValue old_value = lb_emit_transmute(p, right, it); + lbValue new_value = lb_emit_arith(p, Token_And, old_value, bit, it); + + if (op == Token_in) { + return lb_emit_conv(p, lb_emit_comp(p, Token_NotEq, new_value, lb_const_int(p->module, new_value.type, 0)), t_bool); + } else { + return lb_emit_conv(p, lb_emit_comp(p, Token_CmpEq, new_value, lb_const_int(p->module, new_value.type, 0)), t_bool); + } + } + break; + } + GB_PANIC("Invalid 'in' type"); + return {}; +} + gb_internal lbValue lb_build_binary_expr(lbProcedure *p, Ast *expr) { ast_node(be, BinaryExpr, expr); @@ -1480,57 +1531,8 @@ gb_internal lbValue lb_build_binary_expr(lbProcedure *p, Ast *expr) { { lbValue left = lb_build_expr(p, be->left); lbValue right = lb_build_expr(p, be->right); - Type *rt = base_type(right.type); - if (is_type_pointer(rt)) { - right = lb_emit_load(p, right); - rt = base_type(type_deref(rt)); - } - - switch (rt->kind) { - case Type_Map: - { - lbValue map_ptr = lb_address_from_load_or_generate_local(p, right); - lbValue key = left; - lbValue ptr = lb_internal_dynamic_map_get_ptr(p, map_ptr, key); - if (be->op.kind == Token_in) { - return lb_emit_conv(p, lb_emit_comp_against_nil(p, Token_NotEq, ptr), t_bool); - } else { - return lb_emit_conv(p, lb_emit_comp_against_nil(p, Token_CmpEq, ptr), t_bool); - } - } - break; - case Type_BitSet: - { - Type *key_type = rt->BitSet.elem; - GB_ASSERT(are_types_identical(left.type, key_type)); - - Type *it = bit_set_to_int(rt); - left = lb_emit_conv(p, left, it); - if (is_type_different_to_arch_endianness(it)) { - left = lb_emit_byte_swap(p, left, integer_endian_type_to_platform_type(it)); - } - - lbValue lower = lb_const_value(p->module, left.type, exact_value_i64(rt->BitSet.lower)); - lbValue key = lb_emit_arith(p, Token_Sub, left, lower, left.type); - lbValue bit = lb_emit_arith(p, Token_Shl, lb_const_int(p->module, left.type, 1), key, left.type); - bit = lb_emit_conv(p, bit, it); - - lbValue old_value = lb_emit_transmute(p, right, it); - lbValue new_value = lb_emit_arith(p, Token_And, old_value, bit, it); - - if (be->op.kind == Token_in) { - return lb_emit_conv(p, lb_emit_comp(p, Token_NotEq, new_value, lb_const_int(p->module, new_value.type, 0)), t_bool); - } else { - return lb_emit_conv(p, lb_emit_comp(p, Token_CmpEq, new_value, lb_const_int(p->module, new_value.type, 0)), t_bool); - } - } - break; - default: - GB_PANIC("Invalid 'in' type"); - } - break; + return lb_build_binary_in(p, left, right, be->op.kind); } - break; default: GB_PANIC("Invalid binary expression"); break; diff --git a/src/llvm_backend_stmt.cpp b/src/llvm_backend_stmt.cpp index 4ecf70ec4..24dd321f6 100644 --- a/src/llvm_backend_stmt.cpp +++ b/src/llvm_backend_stmt.cpp @@ -737,6 +737,22 @@ gb_internal void lb_build_range_interval(lbProcedure *p, AstBinaryExpr *node, lb_start_block(p, done); } +gb_internal lbValue lb_enum_values_slice(lbProcedure *p, Type *enum_type, i64 *enum_count_) { + Type *t = enum_type; + GB_ASSERT(is_type_enum(t)); + t = base_type(t); + GB_ASSERT(t->kind == Type_Enum); + i64 enum_count = t->Enum.fields.count; + + if (enum_count_) *enum_count_ = enum_count; + + lbValue ti = lb_type_info(p, t); + lbValue variant = lb_emit_struct_ep(p, ti, 4); + lbValue eti_ptr = lb_emit_conv(p, variant, t_type_info_enum_ptr); + lbValue values = lb_emit_load(p, lb_emit_struct_ep(p, eti_ptr, 2)); + return values; +} + gb_internal void lb_build_range_enum(lbProcedure *p, Type *enum_type, Type *val_type, lbValue *val_, lbValue *idx_, lbBlock **loop_, lbBlock **done_) { lbModule *m = p->module; @@ -744,15 +760,11 @@ gb_internal void lb_build_range_enum(lbProcedure *p, Type *enum_type, Type *val_ GB_ASSERT(is_type_enum(t)); t = base_type(t); Type *core_elem = core_type(t); - GB_ASSERT(t->kind == Type_Enum); - i64 enum_count = t->Enum.fields.count; - lbValue max_count = lb_const_int(m, t_int, enum_count); + i64 enum_count = 0; - lbValue ti = lb_type_info(p, t); - lbValue variant = lb_emit_struct_ep(p, ti, 4); - lbValue eti_ptr = lb_emit_conv(p, variant, t_type_info_enum_ptr); - lbValue values = lb_emit_load(p, lb_emit_struct_ep(p, eti_ptr, 2)); + lbValue values = lb_enum_values_slice(p, enum_type, &enum_count); lbValue values_data = lb_slice_elem(p, values); + lbValue max_count = lb_const_int(m, t_int, enum_count); lbAddr offset_ = lb_add_local_generated(p, t_int, false); lb_addr_store(p, offset_, lb_const_int(m, t_int, 0)); @@ -1052,6 +1064,74 @@ gb_internal void lb_build_range_stmt(lbProcedure *p, AstRangeStmt *rs, Scope *sc case Type_Tuple: lb_build_range_tuple(p, expr, val0_type, val1_type, &val, &key, &loop, &done); break; + + case Type_BitSet: { + lbModule *m = p->module; + + lbValue the_set = lb_build_expr(p, expr); + if (is_type_pointer(type_deref(the_set.type))) { + the_set = lb_emit_load(p, the_set); + } + + Type *elem = et->BitSet.elem; + if (is_type_enum(elem)) { + i64 enum_count = 0; + lbValue values = lb_enum_values_slice(p, elem, &enum_count); + lbValue values_data = lb_slice_elem(p, values); + lbValue max_count = lb_const_int(m, t_int, enum_count); + + lbAddr offset_ = lb_add_local_generated(p, t_int, false); + lb_addr_store(p, offset_, lb_const_int(m, t_int, 0)); + + loop = lb_create_block(p, "for.bit_set.enum.loop"); + lb_emit_jump(p, loop); + lb_start_block(p, loop); + + lbBlock *body_check = lb_create_block(p, "for.bit_set.enum.body-check"); + lbBlock *body = lb_create_block(p, "for.bit_set.enum.body"); + done = lb_create_block(p, "for.bit_set.enum.done"); + + lbValue offset = lb_addr_load(p, offset_); + lbValue cond = lb_emit_comp(p, Token_Lt, offset, max_count); + lb_emit_if(p, cond, body_check, done); + lb_start_block(p, body_check); + + lbValue val_ptr = lb_emit_ptr_offset(p, values_data, offset); + lb_emit_increment(p, offset_.addr); + val = lb_emit_load(p, val_ptr); + val = lb_emit_conv(p, val, elem); + + lbValue check = lb_build_binary_in(p, val, the_set, Token_in); + lb_emit_if(p, check, body, loop); + lb_start_block(p, body); + } else { + lbAddr offset_ = lb_add_local_generated(p, t_int, false); + lb_addr_store(p, offset_, lb_const_int(m, t_int, et->BitSet.lower)); + + lbValue max_count = lb_const_int(m, t_int, et->BitSet.upper); + + loop = lb_create_block(p, "for.bit_set.range.loop"); + lb_emit_jump(p, loop); + lb_start_block(p, loop); + + lbBlock *body_check = lb_create_block(p, "for.bit_set.range.body-check"); + lbBlock *body = lb_create_block(p, "for.bit_set.range.body"); + done = lb_create_block(p, "for.bit_set.range.done"); + + lbValue offset = lb_addr_load(p, offset_); + lbValue cond = lb_emit_comp(p, Token_LtEq, offset, max_count); + lb_emit_if(p, cond, body_check, done); + lb_start_block(p, body_check); + + val = lb_emit_conv(p, offset, elem); + lb_emit_increment(p, offset_.addr); + + lbValue check = lb_build_binary_in(p, val, the_set, Token_in); + lb_emit_if(p, check, body, loop); + lb_start_block(p, body); + } + break; + } default: GB_PANIC("Cannot range over %s", type_to_string(expr_type)); break; From 3fa02427b318e6e4e226de8b0435a47e01ceb415 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 1 Apr 2024 13:12:09 +0100 Subject: [PATCH 07/43] Unify error message logic for ranges over `bit_set` --- src/check_stmt.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index b25df01a6..1df582e6c 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1479,6 +1479,7 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) auto vals = array_make(temporary_allocator(), 0, 2); auto entities = array_make(temporary_allocator(), 0, 2); bool is_map = false; + bool is_bit_set = false; bool use_by_reference_for_value = false; bool is_soa = false; bool is_reverse = rs->reverse; @@ -1556,14 +1557,9 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) case Type_BitSet: array_add(&vals, t->BitSet.elem); - if (rs->vals.count > 1) { - error(rs->vals[1], "Expected 1 name when iterating over a bit_set, got %td", rs->vals.count); - } - if (rs->vals.count == 1 && - rs->vals[0]->kind == Ast_UnaryExpr && - rs->vals[0]->UnaryExpr.op.kind == Token_And) { - error(rs->vals[0], "When iteraing across a bit_set, you cannot modify the value with '&' as that does not make much sense"); - } + max_val_count = 1; + is_bit_set = true; + is_possibly_addressable = false; add_type_info_type(ctx, operand.type); break; @@ -1722,7 +1718,7 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) if (is_possibly_addressable && i == addressable_index) { entity->flags &= ~EntityFlag_Value; } else { - char const *idx_name = is_map ? "key" : "index"; + char const *idx_name = is_map ? "key" : is_bit_set ? "element" : "index"; error(token, "The %s variable '%.*s' cannot be made addressable", idx_name, LIT(str)); } } else if (i == addressable_index && use_by_reference_for_value) { From 84686c70c56d95e6d42e0d15090f10f49c532695 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 1 Apr 2024 13:16:49 +0100 Subject: [PATCH 08/43] Error message when RTTI is disabled when iterating over an `enum` type or a `bit_set` of `enum` with `for in` --- src/check_stmt.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 1df582e6c..883a6d213 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1525,6 +1525,9 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) array_add(&vals, operand.type); array_add(&vals, t_int); add_type_info_type(ctx, operand.type); + if (build_context.no_rtti) { + error(node, "Iteration over an enum type is not allowed runtime type information (RTTI) has been disallowed"); + } goto skip_expr_range_stmt; } } else if (operand.mode != Addressing_Invalid) { @@ -1561,6 +1564,9 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) is_bit_set = true; is_possibly_addressable = false; add_type_info_type(ctx, operand.type); + if (build_context.no_rtti && is_type_enum(t->BitSet.elem)) { + error(node, "Iteration over a bit_set of an enum is not allowed runtime type information (RTTI) has been disallowed"); + } break; case Type_EnumeratedArray: From 2938def707f2536e3c986f921f7661916633193a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 1 Apr 2024 13:27:51 +0100 Subject: [PATCH 09/43] Remove dead comment --- core/odin/doc-format/doc_format.odin | 1 - 1 file changed, 1 deletion(-) diff --git a/core/odin/doc-format/doc_format.odin b/core/odin/doc-format/doc_format.odin index f8e23d53a..c2d86a0ba 100644 --- a/core/odin/doc-format/doc_format.odin +++ b/core/odin/doc-format/doc_format.odin @@ -249,7 +249,6 @@ Type :: struct { // .Bit_Set - <=2 types: 0=element type, 1=underlying type (Underlying_Type flag will be set) // .Simd_Vector - 1 type: 0=element // .Relative_Pointer - 2 types: 0=pointer type, 1=base integer - // .Relative_Slice - 2 types: 0=slice type, 1=base integer // .Multi_Pointer - 1 type: 0=element // .Matrix - 1 type: 0=element // .Soa_Pointer - 1 type: 0=element From 3ee91845372ec5513812857c9ba069829eba0303 Mon Sep 17 00:00:00 2001 From: flysand7 Date: Mon, 1 Apr 2024 23:32:16 +1100 Subject: [PATCH 10/43] [core/os2]: Fix memory leak on read_entire_file --- core/os/os2/file_util.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/os/os2/file_util.odin b/core/os/os2/file_util.odin index bb3dfd9eb..0708f708e 100644 --- a/core/os/os2/file_util.odin +++ b/core/os/os2/file_util.odin @@ -117,7 +117,7 @@ read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator) -> (d } } else { buffer: [1024]u8 - out_buffer := make([dynamic]u8) + out_buffer := make([dynamic]u8, 0, 0, allocator) total := 0 for { n: int = --- From b47d73c651b02b94389fa205e154f4be905148b3 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 1 Apr 2024 13:34:30 +0100 Subject: [PATCH 11/43] Fix type checking for invalid enum backing type --- src/check_type.cpp | 4 +++- src/types.cpp | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/check_type.cpp b/src/check_type.cpp index 609b73229..81e67f261 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -790,6 +790,9 @@ gb_internal void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *nam ast_node(et, EnumType, node); GB_ASSERT(is_type_enum(enum_type)); + enum_type->Enum.base_type = t_int; + enum_type->Enum.scope = ctx->scope; + Type *base_type = t_int; if (et->base_type != nullptr) { base_type = check_type(ctx, et->base_type); @@ -811,7 +814,6 @@ gb_internal void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *nam // NOTE(bill): Must be up here for the 'check_init_constant' system enum_type->Enum.base_type = base_type; - enum_type->Enum.scope = ctx->scope; auto fields = array_make(permanent_allocator(), 0, et->fields.count); diff --git a/src/types.cpp b/src/types.cpp index 256c654ac..0bf28a28c 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -768,6 +768,7 @@ gb_internal i64 type_offset_of (Type *t, i64 index, Type **field_type_=null gb_internal gbString type_to_string (Type *type, bool shorthand=true); gb_internal gbString type_to_string (Type *type, gbAllocator allocator, bool shorthand=true); gb_internal i64 type_size_of_internal(Type *t, TypePath *path); +gb_internal i64 type_align_of_internal(Type *t, TypePath *path); gb_internal void init_map_internal_types(Type *type); gb_internal Type * bit_set_to_int(Type *t); gb_internal bool are_types_identical(Type *x, Type *y); @@ -780,9 +781,6 @@ gb_internal bool is_type_slice(Type *t); gb_internal bool is_type_integer(Type *t); gb_internal bool type_set_offsets(Type *t); -gb_internal i64 type_size_of_internal(Type *t, TypePath *path); -gb_internal i64 type_align_of_internal(Type *t, TypePath *path); - // IMPORTANT TODO(bill): SHould this TypePath code be removed since type cycle checking is handled much earlier on? @@ -3576,8 +3574,6 @@ gb_internal Slice struct_fields_index_by_increasing_offset(gbAllocator allo -gb_internal i64 type_size_of_internal (Type *t, TypePath *path); -gb_internal i64 type_align_of_internal(Type *t, TypePath *path); gb_internal i64 type_size_of(Type *t); gb_internal i64 type_align_of(Type *t); From bb72ff9c35499078ef5ce22e905ddf919bcc531c Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 1 Apr 2024 14:28:11 +0100 Subject: [PATCH 12/43] Fix nested `ERROR_BLOCK` bug --- src/check_expr.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 4142968cc..c80b08695 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4129,7 +4129,7 @@ gb_internal void update_untyped_expr_value(CheckerContext *c, Ast *e, ExactValue } } -gb_internal void convert_untyped_error(CheckerContext *c, Operand *operand, Type *target_type) { +gb_internal void convert_untyped_error(CheckerContext *c, Operand *operand, Type *target_type, bool ignore_error_block=false) { gbString expr_str = expr_to_string(operand->expr); gbString type_str = type_to_string(target_type); gbString from_type_str = type_to_string(operand->type); @@ -4143,7 +4143,9 @@ gb_internal void convert_untyped_error(CheckerContext *c, Operand *operand, Type } } } - ERROR_BLOCK(); + if (!ignore_error_block) { + begin_error_block(); + } error(operand->expr, "Cannot convert untyped value '%s' to '%s' from '%s'%s", expr_str, type_str, from_type_str, extra_text); if (operand->value.kind == ExactValue_String) { @@ -4158,6 +4160,11 @@ gb_internal void convert_untyped_error(CheckerContext *c, Operand *operand, Type gb_string_free(type_str); gb_string_free(expr_str); operand->mode = Addressing_Invalid; + + if (!ignore_error_block) { + end_error_block(); + } + } gb_internal ExactValue convert_exact_value_for_type(ExactValue v, Type *type) { @@ -4287,7 +4294,7 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar operand->mode = Addressing_Invalid; ERROR_BLOCK(); - convert_untyped_error(c, operand, target_type); + convert_untyped_error(c, operand, target_type, true); error_line("\tNote: Only a square matrix types can be initialized with a scalar value\n"); return; } else { @@ -4350,7 +4357,7 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar GB_ASSERT(first_success_index >= 0); operand->mode = Addressing_Invalid; - convert_untyped_error(c, operand, target_type); + convert_untyped_error(c, operand, target_type, true); error_line("Ambiguous type conversion to '%s', which variant did you mean:\n\t", type_str); i32 j = 0; @@ -4375,9 +4382,10 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar ERROR_BLOCK(); operand->mode = Addressing_Invalid; - convert_untyped_error(c, operand, target_type); + convert_untyped_error(c, operand, target_type, true); if (count > 0) { error_line("'%s' is a union which only excepts the following types:\n", type_str); + error_line("\t"); for (i32 i = 0; i < count; i++) { Type *v = t->Union.variants[i]; From 9647cb74ad7f72b25a1cd513a153871dc00b036d Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Mon, 1 Apr 2024 00:29:57 +0200 Subject: [PATCH 13/43] debug info fixes/refactor This fixes (on my end) #3340, #3117, #2945, #2922, and #2762 A general refactor of debug info generation in order to fix issues and increase stability. What I believe is the root cause of a bunch of issues is that we use the temporary metadata/forward declarations too much (/ hold onto them for too long). It seems to cause problems with the reference counting inside LLVM. This PR reduces the use of these forward declarations to a minimum, it creates it, fills in the fields, and resolves it, instead of waiting until the end of generating code. Some smaller issues I came across have also been solved. --- src/llvm_backend.cpp | 6 - src/llvm_backend.hpp | 2 - src/llvm_backend_debug.cpp | 975 ++++++++++++++++++----------------- src/llvm_backend_general.cpp | 1 - 4 files changed, 495 insertions(+), 489 deletions(-) diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index cc9b3ac5d..645a091b0 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -1975,12 +1975,6 @@ gb_internal void lb_generate_missing_procedures(lbGenerator *gen, bool do_thread } gb_internal void lb_debug_info_complete_types_and_finalize(lbGenerator *gen) { - for (auto const &entry : gen->modules) { - lbModule *m = entry.value; - if (m->debug_builder != nullptr) { - lb_debug_complete_types(m); - } - } for (auto const &entry : gen->modules) { lbModule *m = entry.value; if (m->debug_builder != nullptr) { diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp index 6000be32d..c4bf2691d 100644 --- a/src/llvm_backend.hpp +++ b/src/llvm_backend.hpp @@ -199,8 +199,6 @@ struct lbModule { RecursiveMutex debug_values_mutex; PtrMap debug_values; - Array debug_incomplete_types; - StringMap objc_classes; StringMap objc_selectors; diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index 048f5f933..2bcf6e24b 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -114,6 +114,464 @@ gb_internal LLVMMetadataRef lb_debug_basic_struct(lbModule *m, String const &nam return LLVMDIBuilderCreateStructType(m->debug_builder, scope, cast(char const *)name.text, name.len, file, 1, size_in_bits, align_in_bits, LLVMDIFlagZero, nullptr, elements, element_count, 0, nullptr, "", 0); } +gb_internal LLVMMetadataRef lb_debug_struct(lbModule *m, Type *type, Type *bt, String name, LLVMMetadataRef scope, LLVMMetadataRef file, unsigned line) { + GB_ASSERT(bt->kind == Type_Struct); + + unsigned const int_bits = cast(unsigned)(8*build_context.int_size); + + unsigned tag = DW_TAG_structure_type; + if (is_type_raw_union(bt)) { + tag = DW_TAG_union_type; + } + + u64 size_in_bits = 8*type_size_of(bt); + u32 align_in_bits = 8*cast(u32)type_align_of(bt); + + LLVMMetadataRef temp_forward_decl = LLVMDIBuilderCreateReplaceableCompositeType( + m->debug_builder, tag, + cast(char const *)name.text, cast(size_t)name.len, + scope, file, line, 0, size_in_bits, align_in_bits, LLVMDIFlagZero, "", 0 + ); + + lb_set_llvm_metadata(m, type, temp_forward_decl); + + isize element_offset = 0; + switch (type->Struct.soa_kind) { + case StructSoa_Slice: element_offset = 1; break; + case StructSoa_Dynamic: element_offset = 3; break; + } + + type_set_offsets(bt); + + unsigned element_count = cast(unsigned)(bt->Struct.fields.count + element_offset); + LLVMMetadataRef *elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); + + LLVMMetadataRef member_scope = lb_get_llvm_metadata(m, bt->Struct.scope); + + isize field_size_bits = 8*type_size_of(bt) - element_offset*int_bits; + + switch (bt->Struct.soa_kind) { + case StructSoa_Slice: + elements[0] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "len", 3, + file, line, + 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), + field_size_bits, + LLVMDIFlagZero, lb_debug_type(m, t_int) + ); + break; + case StructSoa_Dynamic: + elements[0] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "len", 3, + file, line, + 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), + field_size_bits + 0*int_bits, + LLVMDIFlagZero, lb_debug_type(m, t_int) + ); + elements[1] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "cap", 3, + file, line, + 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), + field_size_bits + 1*int_bits, + LLVMDIFlagZero, lb_debug_type(m, t_int) + ); + elements[2] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "allocator", 9, + file, line, + 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), + field_size_bits + 2*int_bits, + LLVMDIFlagZero, lb_debug_type(m, t_allocator) + ); + break; + } + + for_array(j, bt->Struct.fields) { + Entity *f = bt->Struct.fields[j]; + String fname = f->token.string; + + unsigned field_line = 0; + LLVMDIFlags field_flags = LLVMDIFlagZero; + GB_ASSERT(bt->Struct.offsets != nullptr); + u64 offset_in_bits = 8*cast(u64)bt->Struct.offsets[j]; + + elements[j] = LLVMDIBuilderCreateMemberType( + m->debug_builder, + member_scope, + cast(char const *)fname.text, cast(size_t)fname.len, + file, field_line, + 8*cast(u64)type_size_of(f->type), 8*cast(u32)type_align_of(f->type), + offset_in_bits, + field_flags, + lb_debug_type(m, f->type) + ); + } + + LLVMMetadataRef final_decl = nullptr; + if (tag == DW_TAG_union_type) { + final_decl = LLVMDIBuilderCreateUnionType( + m->debug_builder, scope, + cast(char const*)name.text, cast(size_t)name.len, + file, line, + size_in_bits, align_in_bits, + LLVMDIFlagZero, + elements, element_count, + 0, + "", 0 + ); + } else { + final_decl = LLVMDIBuilderCreateStructType( + m->debug_builder, scope, + cast(char const *)name.text, cast(size_t)name.len, + file, line, + size_in_bits, align_in_bits, + LLVMDIFlagZero, + nullptr, + elements, element_count, + 0, + nullptr, + "", 0 + ); + } + + LLVMMetadataReplaceAllUsesWith(temp_forward_decl, final_decl); + lb_set_llvm_metadata(m, type, final_decl); + return final_decl; +} + +gb_internal LLVMMetadataRef lb_debug_slice(lbModule *m, Type *type, String name, LLVMMetadataRef scope, LLVMMetadataRef file, unsigned line) { + Type *bt = base_type(type); + GB_ASSERT(bt->kind == Type_Slice); + + unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size); + + u64 size_in_bits = 8*type_size_of(bt); + u32 align_in_bits = 8*cast(u32)type_align_of(bt); + + LLVMMetadataRef temp_forward_decl = LLVMDIBuilderCreateReplaceableCompositeType( + m->debug_builder, DW_TAG_structure_type, + cast(char const *)name.text, cast(size_t)name.len, + scope, file, line, 0, size_in_bits, align_in_bits, LLVMDIFlagZero, "", 0 + ); + + lb_set_llvm_metadata(m, type, temp_forward_decl); + + unsigned element_count = 2; + LLVMMetadataRef elements[2]; + + // LLVMMetadataRef member_scope = lb_get_llvm_metadata(m, bt->Slice.scope); + LLVMMetadataRef member_scope = nullptr; + + Type *elem_type = alloc_type_pointer(bt->Slice.elem); + elements[0] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "data", 4, + file, line, + 8*cast(u64)type_size_of(elem_type), 8*cast(u32)type_align_of(elem_type), + 0, + LLVMDIFlagZero, lb_debug_type(m, elem_type) + ); + + elements[1] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "len", 3, + file, line, + 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), + ptr_bits, + LLVMDIFlagZero, lb_debug_type(m, t_int) + ); + + LLVMMetadataRef final_decl = LLVMDIBuilderCreateStructType( + m->debug_builder, scope, + cast(char const *)name.text, cast(size_t)name.len, + file, line, + size_in_bits, align_in_bits, + LLVMDIFlagZero, + nullptr, + elements, element_count, + 0, + nullptr, + "", 0 + ); + + LLVMMetadataReplaceAllUsesWith(temp_forward_decl, final_decl); + lb_set_llvm_metadata(m, type, final_decl); + return final_decl; +} + +gb_internal LLVMMetadataRef lb_debug_dynamic_array(lbModule *m, Type *type, String name, LLVMMetadataRef scope, LLVMMetadataRef file, unsigned line) { + Type *bt = base_type(type); + GB_ASSERT(bt->kind == Type_DynamicArray); + + unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size); + unsigned const int_bits = cast(unsigned)(8*build_context.int_size); + + u64 size_in_bits = 8*type_size_of(bt); + u32 align_in_bits = 8*cast(u32)type_align_of(bt); + + LLVMMetadataRef temp_forward_decl = LLVMDIBuilderCreateReplaceableCompositeType( + m->debug_builder, DW_TAG_structure_type, + cast(char const *)name.text, cast(size_t)name.len, + scope, file, line, 0, size_in_bits, align_in_bits, LLVMDIFlagZero, "", 0 + ); + + lb_set_llvm_metadata(m, type, temp_forward_decl); + + unsigned element_count = 4; + LLVMMetadataRef elements[4]; + + // LLVMMetadataRef member_scope = lb_get_llvm_metadata(m, bt->DynamicArray.scope); + LLVMMetadataRef member_scope = nullptr; + + Type *elem_type = alloc_type_pointer(bt->DynamicArray.elem); + elements[0] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "data", 4, + file, line, + 8*cast(u64)type_size_of(elem_type), 8*cast(u32)type_align_of(elem_type), + 0, + LLVMDIFlagZero, lb_debug_type(m, elem_type) + ); + + elements[1] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "len", 3, + file, line, + 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), + ptr_bits, + LLVMDIFlagZero, lb_debug_type(m, t_int) + ); + + elements[2] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "cap", 3, + file, line, + 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), + ptr_bits+int_bits, + LLVMDIFlagZero, lb_debug_type(m, t_int) + ); + + elements[3] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "allocator", 9, + file, line, + 8*cast(u64)type_size_of(t_allocator), 8*cast(u32)type_align_of(t_allocator), + ptr_bits+int_bits+int_bits, + LLVMDIFlagZero, lb_debug_type(m, t_allocator) + ); + + LLVMMetadataRef final_decl = LLVMDIBuilderCreateStructType( + m->debug_builder, scope, + cast(char const *)name.text, cast(size_t)name.len, + file, line, + size_in_bits, align_in_bits, + LLVMDIFlagZero, + nullptr, + elements, element_count, + 0, + nullptr, + "", 0 + ); + + LLVMMetadataReplaceAllUsesWith(temp_forward_decl, final_decl); + lb_set_llvm_metadata(m, type, final_decl); + return final_decl; +} + +gb_internal LLVMMetadataRef lb_debug_union(lbModule *m, Type *type, String name, LLVMMetadataRef scope, LLVMMetadataRef file, unsigned line) { + Type *bt = base_type(type); + GB_ASSERT(bt->kind == Type_Union); + + u64 size_in_bits = 8*type_size_of(bt); + u32 align_in_bits = 8*cast(u32)type_align_of(bt); + + LLVMMetadataRef temp_forward_decl = LLVMDIBuilderCreateReplaceableCompositeType( + m->debug_builder, DW_TAG_union_type, + cast(char const *)name.text, cast(size_t)name.len, + scope, file, line, 0, size_in_bits, align_in_bits, LLVMDIFlagZero, "", 0 + ); + + lb_set_llvm_metadata(m, type, temp_forward_decl); + + isize index_offset = 1; + if (is_type_union_maybe_pointer(bt)) { + index_offset = 0; + } + + LLVMMetadataRef member_scope = lb_get_llvm_metadata(m, bt->Union.scope); + unsigned element_count = cast(unsigned)bt->Union.variants.count; + if (index_offset > 0) { + element_count += 1; + } + + LLVMMetadataRef *elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); + + if (index_offset > 0) { + Type *tag_type = union_tag_type(bt); + u64 offset_in_bits = 8*cast(u64)bt->Union.variant_block_size; + + elements[0] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + "tag", 3, + file, line, + 8*cast(u64)type_size_of(tag_type), 8*cast(u32)type_align_of(tag_type), + offset_in_bits, + LLVMDIFlagZero, lb_debug_type(m, tag_type) + ); + } + + for_array(j, bt->Union.variants) { + Type *variant = bt->Union.variants[j]; + + unsigned field_index = cast(unsigned)(index_offset+j); + + char name[16] = {}; + gb_snprintf(name, gb_size_of(name), "v%u", field_index); + isize name_len = gb_strlen(name); + + elements[field_index] = LLVMDIBuilderCreateMemberType( + m->debug_builder, member_scope, + name, name_len, + file, line, + 8*cast(u64)type_size_of(variant), 8*cast(u32)type_align_of(variant), + 0, + LLVMDIFlagZero, lb_debug_type(m, variant) + ); + } + + LLVMMetadataRef final_decl = LLVMDIBuilderCreateUnionType( + m->debug_builder, + scope, + cast(char const *)name.text, cast(size_t)name.len, + file, line, + size_in_bits, align_in_bits, + LLVMDIFlagZero, + elements, + element_count, + 0, + "", 0 + ); + + LLVMMetadataReplaceAllUsesWith(temp_forward_decl, final_decl); + lb_set_llvm_metadata(m, type, final_decl); + return final_decl; +} + +gb_internal LLVMMetadataRef lb_debug_bitset(lbModule *m, Type *type, String name, LLVMMetadataRef scope, LLVMMetadataRef file, unsigned line) { + Type *bt = base_type(type); + GB_ASSERT(bt->kind == Type_BitSet); + + u64 size_in_bits = 8*type_size_of(bt); + u32 align_in_bits = 8*cast(u32)type_align_of(bt); + + LLVMMetadataRef bit_set_field_type = lb_debug_type(m, t_bool); + + unsigned element_count = 0; + LLVMMetadataRef *elements = nullptr; + + Type *elem = base_type(bt->BitSet.elem); + if (elem->kind == Type_Enum) { + element_count = cast(unsigned)elem->Enum.fields.count; + elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); + + for_array(i, elem->Enum.fields) { + Entity *f = elem->Enum.fields[i]; + GB_ASSERT(f->kind == Entity_Constant); + i64 val = exact_value_to_i64(f->Constant.value); + String field_name = f->token.string; + u64 offset_in_bits = cast(u64)(val - bt->BitSet.lower); + elements[i] = LLVMDIBuilderCreateBitFieldMemberType( + m->debug_builder, + scope, + cast(char const *)field_name.text, field_name.len, + file, line, + 1, + offset_in_bits, + 0, + LLVMDIFlagZero, + bit_set_field_type + ); + } + } else { + char name[32] = {}; + + GB_ASSERT(is_type_integer(elem)); + i64 count = bt->BitSet.upper - bt->BitSet.lower + 1; + GB_ASSERT(0 <= count); + + element_count = cast(unsigned)count; + elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); + + for (unsigned i = 0; i < element_count; i++) { + u64 offset_in_bits = i; + i64 val = bt->BitSet.lower + cast(i64)i; + gb_snprintf(name, gb_count_of(name), "%lld", cast(long long)val); + elements[i] = LLVMDIBuilderCreateBitFieldMemberType( + m->debug_builder, + scope, + name, gb_strlen(name), + file, line, + 1, + offset_in_bits, + 0, + LLVMDIFlagZero, + bit_set_field_type + ); + } + } + + LLVMMetadataRef final_decl = LLVMDIBuilderCreateUnionType( + m->debug_builder, + scope, + cast(char const *)name.text, cast(size_t)name.len, + file, line, + size_in_bits, align_in_bits, + LLVMDIFlagZero, + elements, + element_count, + 0, + "", 0 + ); + lb_set_llvm_metadata(m, type, final_decl); + return final_decl; +} + +gb_internal LLVMMetadataRef lb_debug_enum(lbModule *m, Type *type, String name, LLVMMetadataRef scope, LLVMMetadataRef file, unsigned line) { + Type *bt = base_type(type); + GB_ASSERT(bt->kind == Type_Enum); + + u64 size_in_bits = 8*type_size_of(bt); + u32 align_in_bits = 8*cast(u32)type_align_of(bt); + + unsigned element_count = cast(unsigned)bt->Enum.fields.count; + LLVMMetadataRef *elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); + + Type *bt_enum = base_enum_type(bt); + LLVMBool is_unsigned = is_type_unsigned(bt_enum); + for (unsigned i = 0; i < element_count; i++) { + Entity *f = bt->Enum.fields[i]; + GB_ASSERT(f->kind == Entity_Constant); + String enum_name = f->token.string; + i64 value = exact_value_to_i64(f->Constant.value); + elements[i] = LLVMDIBuilderCreateEnumerator(m->debug_builder, cast(char const *)enum_name.text, cast(size_t)enum_name.len, value, is_unsigned); + } + + LLVMMetadataRef class_type = lb_debug_type(m, bt_enum); + LLVMMetadataRef final_decl = LLVMDIBuilderCreateEnumerationType( + m->debug_builder, + scope, + cast(char const *)name.text, cast(size_t)name.len, + file, line, + size_in_bits, align_in_bits, + elements, element_count, + class_type + ); + lb_set_llvm_metadata(m, type, final_decl); + return final_decl; +} gb_internal LLVMMetadataRef lb_debug_type_basic_type(lbModule *m, String const &name, u64 size_in_bits, LLVMDWARFTypeEncoding encoding, LLVMDIFlags flags = LLVMDIFlagZero) { LLVMMetadataRef basic_type = LLVMDIBuilderCreateBasicType(m->debug_builder, cast(char const *)name.text, name.len, size_in_bits, encoding, flags); @@ -329,53 +787,19 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) { return LLVMDIBuilderCreateTypedef(m->debug_builder, array_type, name, gb_string_length(name), nullptr, 0, nullptr, cast(u32)(8*type_align_of(type))); } + case Type_Map: { + Type *bt = base_type(type->Map.debug_metadata_type); + GB_ASSERT(bt->kind == Type_Struct); - case Type_Struct: - case Type_Union: - case Type_Slice: - case Type_DynamicArray: - case Type_Map: - case Type_BitSet: - { - unsigned tag = DW_TAG_structure_type; - if (is_type_raw_union(type) || is_type_union(type)) { - tag = DW_TAG_union_type; - } - u64 size_in_bits = cast(u64)(8*type_size_of(type)); - u32 align_in_bits = cast(u32)(8*type_size_of(type)); - LLVMDIFlags flags = LLVMDIFlagZero; + return lb_debug_struct(m, type, bt, make_string_c(type_to_string(type, temporary_allocator())), nullptr, nullptr, 0); + } - LLVMMetadataRef temp_forward_decl = LLVMDIBuilderCreateReplaceableCompositeType( - m->debug_builder, tag, "", 0, nullptr, nullptr, 0, 0, size_in_bits, align_in_bits, flags, "", 0 - ); - lbIncompleteDebugType idt = {}; - idt.type = type; - idt.metadata = temp_forward_decl; - - array_add(&m->debug_incomplete_types, idt); - lb_set_llvm_metadata(m, type, temp_forward_decl); - return temp_forward_decl; - } - - case Type_Enum: - { - LLVMMetadataRef scope = nullptr; - LLVMMetadataRef file = nullptr; - unsigned line = 0; - unsigned element_count = cast(unsigned)type->Enum.fields.count; - LLVMMetadataRef *elements = gb_alloc_array(permanent_allocator(), LLVMMetadataRef, element_count); - Type *bt = base_enum_type(type); - LLVMBool is_unsigned = is_type_unsigned(bt); - for (unsigned i = 0; i < element_count; i++) { - Entity *f = type->Enum.fields[i]; - GB_ASSERT(f->kind == Entity_Constant); - String name = f->token.string; - i64 value = exact_value_to_i64(f->Constant.value); - elements[i] = LLVMDIBuilderCreateEnumerator(m->debug_builder, cast(char const *)name.text, cast(size_t)name.len, value, is_unsigned); - } - LLVMMetadataRef class_type = lb_debug_type(m, bt); - return LLVMDIBuilderCreateEnumerationType(m->debug_builder, scope, "", 0, file, line, 8*type_size_of(type), 8*cast(unsigned)type_align_of(type), elements, element_count, class_type); - } + case Type_Struct: return lb_debug_struct( m, type, type, make_string_c(type_to_string(type, temporary_allocator())), nullptr, nullptr, 0); + case Type_Slice: return lb_debug_slice( m, type, make_string_c(type_to_string(type, temporary_allocator())), nullptr, nullptr, 0); + case Type_DynamicArray: return lb_debug_dynamic_array(m, type, make_string_c(type_to_string(type, temporary_allocator())), nullptr, nullptr, 0); + case Type_Union: return lb_debug_union( m, type, make_string_c(type_to_string(type, temporary_allocator())), nullptr, nullptr, 0); + case Type_BitSet: return lb_debug_bitset( m, type, make_string_c(type_to_string(type, temporary_allocator())), nullptr, nullptr, 0); + case Type_Enum: return lb_debug_enum( m, type, make_string_c(type_to_string(type, temporary_allocator())), nullptr, nullptr, 0); case Type_Tuple: if (type->Tuple.variables.count == 1) { @@ -539,7 +963,6 @@ gb_internal LLVMMetadataRef lb_debug_type(lbModule *m, Type *type) { unsigned line = 0; LLVMMetadataRef scope = nullptr; - if (type->Named.type_name != nullptr) { Entity *e = type->Named.type_name; scope = lb_get_base_scope_metadata(m, e->scope); @@ -548,456 +971,48 @@ gb_internal LLVMMetadataRef lb_debug_type(lbModule *m, Type *type) { } line = cast(unsigned)e->token.pos.line; } - // TODO(bill): location data for Type_Named - u64 size_in_bits = 8*type_size_of(type); - u32 align_in_bits = 8*cast(u32)type_align_of(type); String name = type->Named.name; - char const *name_text = cast(char const *)name.text; - size_t name_len = cast(size_t)name.len; - unsigned tag = DW_TAG_structure_type; - if (is_type_raw_union(type) || is_type_union(type)) { - tag = DW_TAG_union_type; + if (type->Named.type_name && type->Named.type_name->pkg && type->Named.type_name->pkg->name.len != 0) { + name = concatenate3_strings(permanent_allocator(), type->Named.type_name->pkg->name, str_lit("."), type->Named.name); } - LLVMDIFlags flags = LLVMDIFlagZero; Type *bt = base_type(type->Named.base); - lbIncompleteDebugType idt = {}; - idt.type = type; - switch (bt->kind) { - case Type_Enum: - { - unsigned line = 0; - unsigned element_count = cast(unsigned)bt->Enum.fields.count; - LLVMMetadataRef *elements = gb_alloc_array(permanent_allocator(), LLVMMetadataRef, element_count); - Type *ct = base_enum_type(type); - LLVMBool is_unsigned = is_type_unsigned(ct); - for (unsigned i = 0; i < element_count; i++) { - Entity *f = bt->Enum.fields[i]; - GB_ASSERT(f->kind == Entity_Constant); - String name = f->token.string; - i64 value = exact_value_to_i64(f->Constant.value); - elements[i] = LLVMDIBuilderCreateEnumerator(m->debug_builder, cast(char const *)name.text, cast(size_t)name.len, value, is_unsigned); - } - LLVMMetadataRef class_type = lb_debug_type(m, ct); - return LLVMDIBuilderCreateEnumerationType(m->debug_builder, scope, name_text, name_len, file, line, 8*type_size_of(type), 8*cast(unsigned)type_align_of(type), elements, element_count, class_type); - } + default: { + u32 align_in_bits = 8*cast(u32)type_align_of(type); + LLVMMetadataRef debug_bt = lb_debug_type(m, bt); + LLVMMetadataRef final_decl = LLVMDIBuilderCreateTypedef( + m->debug_builder, + debug_bt, + cast(char const *)name.text, cast(size_t)name.len, + file, line, scope, align_in_bits + ); + lb_set_llvm_metadata(m, type, final_decl); + return final_decl; + } + case Type_Map: { + bt = base_type(type->Map.debug_metadata_type); + GB_ASSERT(bt->kind == Type_Struct); + return lb_debug_struct(m, type, bt, name, scope, file, line); + } - default: - { - LLVMMetadataRef debug_bt = lb_debug_type(m, bt); - LLVMMetadataRef final_decl = LLVMDIBuilderCreateTypedef(m->debug_builder, debug_bt, name_text, name_len, file, line, scope, align_in_bits); - lb_set_llvm_metadata(m, type, final_decl); - return final_decl; - } - - case Type_Slice: - case Type_DynamicArray: - case Type_Map: - case Type_Struct: - case Type_Union: - case Type_BitSet: - { - LLVMMetadataRef temp_forward_decl = LLVMDIBuilderCreateReplaceableCompositeType( - m->debug_builder, tag, name_text, name_len, nullptr, nullptr, 0, 0, size_in_bits, align_in_bits, flags, "", 0 - ); - idt.metadata = temp_forward_decl; - - array_add(&m->debug_incomplete_types, idt); - lb_set_llvm_metadata(m, type, temp_forward_decl); - - LLVMMetadataRef dummy = nullptr; - switch (bt->kind) { - case Type_Slice: - dummy = lb_debug_type(m, bt->Slice.elem); - dummy = lb_debug_type(m, alloc_type_pointer(bt->Slice.elem)); - dummy = lb_debug_type(m, t_int); - break; - case Type_DynamicArray: - dummy = lb_debug_type(m, bt->DynamicArray.elem); - dummy = lb_debug_type(m, alloc_type_pointer(bt->DynamicArray.elem)); - dummy = lb_debug_type(m, t_int); - dummy = lb_debug_type(m, t_allocator); - break; - case Type_Map: - dummy = lb_debug_type(m, bt->Map.key); - dummy = lb_debug_type(m, bt->Map.value); - dummy = lb_debug_type(m, t_int); - dummy = lb_debug_type(m, t_allocator); - dummy = lb_debug_type(m, t_uintptr); - break; - case Type_BitSet: - if (bt->BitSet.elem) dummy = lb_debug_type(m, bt->BitSet.elem); - if (bt->BitSet.underlying) dummy = lb_debug_type(m, bt->BitSet.underlying); - break; - } - - return temp_forward_decl; - } + case Type_Struct: return lb_debug_struct(m, type, base_type(type), name, scope, file, line); + case Type_Slice: return lb_debug_slice(m, type, name, scope, file, line); + case Type_DynamicArray: return lb_debug_dynamic_array(m, type, name, scope, file, line); + case Type_Union: return lb_debug_union(m, type, name, scope, file, line); + case Type_BitSet: return lb_debug_bitset(m, type, name, scope, file, line); + case Type_Enum: return lb_debug_enum(m, type, name, scope, file, line); } } - LLVMMetadataRef dt = lb_debug_type_internal(m, type); lb_set_llvm_metadata(m, type, dt); return dt; } -gb_internal void lb_debug_complete_types(lbModule *m) { - unsigned const int_bits = cast(unsigned)(8*build_context.int_size); - - for_array(debug_incomplete_type_index, m->debug_incomplete_types) { - TEMPORARY_ALLOCATOR_GUARD(); - - // NOTE(laytan): don't make this a pointer, the array could resize while in this iteration - // and cause a use-after-free at the end. - auto const idt = m->debug_incomplete_types[debug_incomplete_type_index]; - GB_ASSERT(idt.type != nullptr); - GB_ASSERT(idt.metadata != nullptr); - - Type *t = idt.type; - Type *bt = base_type(t); - - LLVMMetadataRef parent_scope = nullptr; - LLVMMetadataRef file = nullptr; - unsigned line_number = 0; - u64 size_in_bits = 8*type_size_of(t); - u32 align_in_bits = cast(u32)(8*type_align_of(t)); - LLVMDIFlags flags = LLVMDIFlagZero; - - LLVMMetadataRef derived_from = nullptr; - - LLVMMetadataRef *elements = nullptr; - unsigned element_count = 0; - - - unsigned runtime_lang = 0; // Objective-C runtime version - char const *unique_id = ""; - LLVMMetadataRef vtable_holder = nullptr; - size_t unique_id_len = 0; - - - LLVMMetadataRef record_scope = nullptr; - - switch (bt->kind) { - case Type_Slice: - case Type_DynamicArray: - case Type_Map: - case Type_Struct: - case Type_Union: - case Type_BitSet: { - bool is_union = is_type_raw_union(bt) || is_type_union(bt); - - String name = str_lit(""); - if (t->kind == Type_Named) { - name = t->Named.name; - if (t->Named.type_name && t->Named.type_name->pkg && t->Named.type_name->pkg->name.len != 0) { - name = concatenate3_strings(temporary_allocator(), t->Named.type_name->pkg->name, str_lit("."), t->Named.name); - } - - LLVMMetadataRef file = nullptr; - unsigned line = 0; - LLVMMetadataRef file_scope = nullptr; - - if (t->Named.type_name != nullptr) { - Entity *e = t->Named.type_name; - file_scope = lb_get_llvm_metadata(m, e->scope); - if (file_scope != nullptr) { - file = LLVMDIScopeGetFile(file_scope); - } - line = cast(unsigned)e->token.pos.line; - } - // TODO(bill): location data for Type_Named - - } else { - name = make_string_c(type_to_string(t, temporary_allocator())); - } - - - - switch (bt->kind) { - case Type_Slice: - element_count = 2; - elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); - #if defined(GB_SYSTEM_WINDOWS) - elements[0] = lb_debug_struct_field(m, str_lit("data"), alloc_type_pointer(bt->Slice.elem), 0*int_bits); - #else - // FIX HACK TODO(bill): For some reason this causes a crash in *nix systems due to the reference counting - // of the debug type information - elements[0] = lb_debug_struct_field(m, str_lit("data"), t_rawptr, 0*int_bits); - #endif - elements[1] = lb_debug_struct_field(m, str_lit("len"), t_int, 1*int_bits); - break; - case Type_DynamicArray: - element_count = 4; - elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); - #if defined(GB_SYSTEM_WINDOWS) - elements[0] = lb_debug_struct_field(m, str_lit("data"), alloc_type_pointer(bt->DynamicArray.elem), 0*int_bits); - #else - // FIX HACK TODO(bill): For some reason this causes a crash in *nix systems due to the reference counting - // of the debug type information - elements[0] = lb_debug_struct_field(m, str_lit("data"), t_rawptr, 0*int_bits); - #endif - elements[1] = lb_debug_struct_field(m, str_lit("len"), t_int, 1*int_bits); - elements[2] = lb_debug_struct_field(m, str_lit("cap"), t_int, 2*int_bits); - elements[3] = lb_debug_struct_field(m, str_lit("allocator"), t_allocator, 3*int_bits); - break; - - case Type_Map: - GB_ASSERT(t_raw_map != nullptr); - bt = base_type(bt->Map.debug_metadata_type); - // bt = base_type(t_raw_map); - GB_ASSERT(bt->kind == Type_Struct); - /*fallthrough*/ - case Type_Struct: - if (file == nullptr) { - if (bt->Struct.node) { - file = lb_get_llvm_metadata(m, bt->Struct.node->file()); - line_number = cast(unsigned)ast_token(bt->Struct.node).pos.line; - } - } - - type_set_offsets(bt); - { - isize element_offset = 0; - record_scope = lb_get_llvm_metadata(m, bt->Struct.scope); - switch (bt->Struct.soa_kind) { - case StructSoa_Slice: element_offset = 1; break; - case StructSoa_Dynamic: element_offset = 3; break; - } - element_count = cast(unsigned)(bt->Struct.fields.count + element_offset); - elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); - - isize field_size_bits = 8*type_size_of(bt) - element_offset*int_bits; - - switch (bt->Struct.soa_kind) { - case StructSoa_Slice: - elements[0] = LLVMDIBuilderCreateMemberType( - m->debug_builder, record_scope, - ".len", 4, - file, 0, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits, - LLVMDIFlagZero, lb_debug_type(m, t_int) - ); - break; - case StructSoa_Dynamic: - elements[0] = LLVMDIBuilderCreateMemberType( - m->debug_builder, record_scope, - ".len", 4, - file, 0, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits + 0*int_bits, - LLVMDIFlagZero, lb_debug_type(m, t_int) - ); - elements[1] = LLVMDIBuilderCreateMemberType( - m->debug_builder, record_scope, - ".cap", 4, - file, 0, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits + 1*int_bits, - LLVMDIFlagZero, lb_debug_type(m, t_int) - ); - elements[2] = LLVMDIBuilderCreateMemberType( - m->debug_builder, record_scope, - ".allocator", 10, - file, 0, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits + 2*int_bits, - LLVMDIFlagZero, lb_debug_type(m, t_allocator) - ); - break; - } - - for_array(j, bt->Struct.fields) { - Entity *f = bt->Struct.fields[j]; - String fname = f->token.string; - - unsigned field_line = 0; - LLVMDIFlags field_flags = LLVMDIFlagZero; - GB_ASSERT(bt->Struct.offsets != nullptr); - u64 offset_in_bits = 8*cast(u64)bt->Struct.offsets[j]; - - elements[element_offset+j] = LLVMDIBuilderCreateMemberType( - m->debug_builder, record_scope, - cast(char const *)fname.text, cast(size_t)fname.len, - file, field_line, - 8*cast(u64)type_size_of(f->type), 8*cast(u32)type_align_of(f->type), - offset_in_bits, - field_flags, lb_debug_type(m, f->type) - ); - } - } - break; - case Type_Union: - { - if (file == nullptr) { - GB_ASSERT(bt->Union.node != nullptr); - file = lb_get_llvm_metadata(m, bt->Union.node->file()); - line_number = cast(unsigned)ast_token(bt->Union.node).pos.line; - } - - isize index_offset = 1; - if (is_type_union_maybe_pointer(bt)) { - index_offset = 0; - } - record_scope = lb_get_llvm_metadata(m, bt->Union.scope); - element_count = cast(unsigned)bt->Union.variants.count; - if (index_offset > 0) { - element_count += 1; - } - - elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); - if (index_offset > 0) { - Type *tag_type = union_tag_type(bt); - unsigned field_line = 0; - u64 offset_in_bits = 8*cast(u64)bt->Union.variant_block_size; - LLVMDIFlags field_flags = LLVMDIFlagZero; - - elements[0] = LLVMDIBuilderCreateMemberType( - m->debug_builder, record_scope, - "tag", 3, - file, field_line, - 8*cast(u64)type_size_of(tag_type), 8*cast(u32)type_align_of(tag_type), - offset_in_bits, - field_flags, lb_debug_type(m, tag_type) - ); - } - - for_array(j, bt->Union.variants) { - Type *variant = bt->Union.variants[j]; - - unsigned field_index = cast(unsigned)(index_offset+j); - - char name[16] = {}; - gb_snprintf(name, gb_size_of(name), "v%u", field_index); - isize name_len = gb_strlen(name); - - unsigned field_line = 0; - LLVMDIFlags field_flags = LLVMDIFlagZero; - u64 offset_in_bits = 0; - - elements[field_index] = LLVMDIBuilderCreateMemberType( - m->debug_builder, record_scope, - name, name_len, - file, field_line, - 8*cast(u64)type_size_of(variant), 8*cast(u32)type_align_of(variant), - offset_in_bits, - field_flags, lb_debug_type(m, variant) - ); - } - } - break; - - case Type_BitSet: - { - if (file == nullptr) { - GB_ASSERT(bt->BitSet.node != nullptr); - file = lb_get_llvm_metadata(m, bt->BitSet.node->file()); - line_number = cast(unsigned)ast_token(bt->BitSet.node).pos.line; - } - - LLVMMetadataRef bit_set_field_type = lb_debug_type(m, t_bool); - LLVMMetadataRef scope = file; - - Type *elem = base_type(bt->BitSet.elem); - if (elem->kind == Type_Enum) { - element_count = cast(unsigned)elem->Enum.fields.count; - elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); - for_array(i, elem->Enum.fields) { - Entity *f = elem->Enum.fields[i]; - GB_ASSERT(f->kind == Entity_Constant); - i64 val = exact_value_to_i64(f->Constant.value); - String name = f->token.string; - u64 offset_in_bits = cast(u64)(val - bt->BitSet.lower); - elements[i] = LLVMDIBuilderCreateBitFieldMemberType( - m->debug_builder, - scope, - cast(char const *)name.text, name.len, - file, line_number, - 1, - offset_in_bits, - 0, - LLVMDIFlagZero, - bit_set_field_type - ); - } - } else { - - char name[32] = {}; - - GB_ASSERT(is_type_integer(elem)); - i64 count = bt->BitSet.upper - bt->BitSet.lower + 1; - GB_ASSERT(0 <= count); - - element_count = cast(unsigned)count; - elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); - for (unsigned i = 0; i < element_count; i++) { - u64 offset_in_bits = i; - i64 val = bt->BitSet.lower + cast(i64)i; - gb_snprintf(name, gb_count_of(name), "%lld", cast(long long)val); - elements[i] = LLVMDIBuilderCreateBitFieldMemberType( - m->debug_builder, - scope, - name, gb_strlen(name), - file, line_number, - 1, - offset_in_bits, - 0, - LLVMDIFlagZero, - bit_set_field_type - ); - } - } - } - } - - - LLVMMetadataRef final_metadata = nullptr; - if (is_union) { - final_metadata = LLVMDIBuilderCreateUnionType( - m->debug_builder, - parent_scope, - cast(char const *)name.text, cast(size_t)name.len, - file, line_number, - size_in_bits, align_in_bits, - flags, - elements, element_count, - runtime_lang, - unique_id, unique_id_len - ); - } else { - final_metadata = LLVMDIBuilderCreateStructType( - m->debug_builder, - parent_scope, - cast(char const *)name.text, cast(size_t)name.len, - file, line_number, - size_in_bits, align_in_bits, - flags, - derived_from, - elements, element_count, - runtime_lang, - vtable_holder, - unique_id, unique_id_len - ); - } - - LLVMMetadataReplaceAllUsesWith(idt.metadata, final_metadata); - lb_set_llvm_metadata(m, idt.type, final_metadata); - } break; - default: - GB_PANIC("invalid incomplete debug type"); - break; - } - } - array_clear(&m->debug_incomplete_types); -} - - - gb_internal void lb_add_debug_local_variable(lbProcedure *p, LLVMValueRef ptr, Type *type, Token const &token) { if (p->debug_info == nullptr) { return; @@ -1267,4 +1282,4 @@ gb_internal void add_debug_info_for_global_constant_from_entity(lbGenerator *gen add_debug_info_for_global_constant_internal_i64(m, e, dtype, v); } } -} \ No newline at end of file +} diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp index a77e2ad15..889cb8822 100644 --- a/src/llvm_backend_general.cpp +++ b/src/llvm_backend_general.cpp @@ -81,7 +81,6 @@ gb_internal void lb_init_module(lbModule *m, Checker *c) { array_init(&m->global_procedures_and_types_to_create, a, 0, 1024); array_init(&m->missing_procedures_to_check, a, 0, 16); map_init(&m->debug_values); - array_init(&m->debug_incomplete_types, a, 0, 1024); string_map_init(&m->objc_classes); string_map_init(&m->objc_selectors); From 7c2352ea083132bbe28e41bd958eb6608c4c1986 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Mon, 1 Apr 2024 16:48:47 +0200 Subject: [PATCH 14/43] remove soa handling in debug info, fields are already added in checker --- src/llvm_backend_debug.cpp | 51 +------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index 2bcf6e24b..1b8e02a36 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -117,8 +117,6 @@ gb_internal LLVMMetadataRef lb_debug_basic_struct(lbModule *m, String const &nam gb_internal LLVMMetadataRef lb_debug_struct(lbModule *m, Type *type, Type *bt, String name, LLVMMetadataRef scope, LLVMMetadataRef file, unsigned line) { GB_ASSERT(bt->kind == Type_Struct); - unsigned const int_bits = cast(unsigned)(8*build_context.int_size); - unsigned tag = DW_TAG_structure_type; if (is_type_raw_union(bt)) { tag = DW_TAG_union_type; @@ -135,60 +133,13 @@ gb_internal LLVMMetadataRef lb_debug_struct(lbModule *m, Type *type, Type *bt, S lb_set_llvm_metadata(m, type, temp_forward_decl); - isize element_offset = 0; - switch (type->Struct.soa_kind) { - case StructSoa_Slice: element_offset = 1; break; - case StructSoa_Dynamic: element_offset = 3; break; - } - type_set_offsets(bt); - unsigned element_count = cast(unsigned)(bt->Struct.fields.count + element_offset); + unsigned element_count = cast(unsigned)(bt->Struct.fields.count); LLVMMetadataRef *elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); LLVMMetadataRef member_scope = lb_get_llvm_metadata(m, bt->Struct.scope); - isize field_size_bits = 8*type_size_of(bt) - element_offset*int_bits; - - switch (bt->Struct.soa_kind) { - case StructSoa_Slice: - elements[0] = LLVMDIBuilderCreateMemberType( - m->debug_builder, member_scope, - "len", 3, - file, line, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits, - LLVMDIFlagZero, lb_debug_type(m, t_int) - ); - break; - case StructSoa_Dynamic: - elements[0] = LLVMDIBuilderCreateMemberType( - m->debug_builder, member_scope, - "len", 3, - file, line, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits + 0*int_bits, - LLVMDIFlagZero, lb_debug_type(m, t_int) - ); - elements[1] = LLVMDIBuilderCreateMemberType( - m->debug_builder, member_scope, - "cap", 3, - file, line, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits + 1*int_bits, - LLVMDIFlagZero, lb_debug_type(m, t_int) - ); - elements[2] = LLVMDIBuilderCreateMemberType( - m->debug_builder, member_scope, - "allocator", 9, - file, line, - 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), - field_size_bits + 2*int_bits, - LLVMDIFlagZero, lb_debug_type(m, t_allocator) - ); - break; - } - for_array(j, bt->Struct.fields) { Entity *f = bt->Struct.fields[j]; String fname = f->token.string; From b2f432c223ed1ef34c8601b1ca999d324956fc9d Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Mon, 1 Apr 2024 17:18:31 +0200 Subject: [PATCH 15/43] Add SHA3-512 digests verification to test assets. --- tests/core/download_assets.py | 243 ++++++++++++++++++++++++++++------ 1 file changed, 202 insertions(+), 41 deletions(-) diff --git a/tests/core/download_assets.py b/tests/core/download_assets.py index 50137f563..dd2e03fbe 100644 --- a/tests/core/download_assets.py +++ b/tests/core/download_assets.py @@ -4,49 +4,199 @@ import shutil import sys import os import zipfile +import hashlib TEST_SUITES = ['PNG', 'XML'] DOWNLOAD_BASE_PATH = "assets/{}" ASSETS_BASE_URL = "https://raw.githubusercontent.com/odin-lang/test-assets/master/{}/{}" -PNG_IMAGES = [ - "basi0g01.png", "basi0g02.png", "basi0g04.png", "basi0g08.png", "basi0g16.png", "basi2c08.png", - "basi2c16.png", "basi3p01.png", "basi3p02.png", "basi3p04.png", "basi3p08.png", "basi4a08.png", - "basi4a16.png", "basi6a08.png", "basi6a16.png", "basn0g01.png", "basn0g02.png", "basn0g04.png", - "basn0g08.png", "basn0g16.png", "basn2c08.png", "basn2c16.png", "basn3p01.png", "basn3p02.png", - "basn3p04.png", "basn3p08.png", "basn4a08.png", "basn4a16.png", "basn6a08.png", "basn6a16.png", - "bgai4a08.png", "bgai4a16.png", "bgan6a08.png", "bgan6a16.png", "bgbn4a08.png", "bggn4a16.png", - "bgwn6a08.png", "bgyn6a16.png", "ccwn2c08.png", "ccwn3p08.png", "cdfn2c08.png", "cdhn2c08.png", - "cdsn2c08.png", "cdun2c08.png", "ch1n3p04.png", "ch2n3p08.png", "cm0n0g04.png", "cm7n0g04.png", - "cm9n0g04.png", "cs3n2c16.png", "cs3n3p08.png", "cs5n2c08.png", "cs5n3p08.png", "cs8n2c08.png", - "cs8n3p08.png", "ct0n0g04.png", "ct1n0g04.png", "cten0g04.png", "ctfn0g04.png", "ctgn0g04.png", - "cthn0g04.png", "ctjn0g04.png", "ctzn0g04.png", "exif2c08.png", "f00n0g08.png", "f00n2c08.png", - "f01n0g08.png", "f01n2c08.png", "f02n0g08.png", "f02n2c08.png", "f03n0g08.png", "f03n2c08.png", - "f04n0g08.png", "f04n2c08.png", "f99n0g04.png", "g03n0g16.png", "g03n2c08.png", "g03n3p04.png", - "g04n0g16.png", "g04n2c08.png", "g04n3p04.png", "g05n0g16.png", "g05n2c08.png", "g05n3p04.png", - "g07n0g16.png", "g07n2c08.png", "g07n3p04.png", "g10n0g16.png", "g10n2c08.png", "g10n3p04.png", - "g25n0g16.png", "g25n2c08.png", "g25n3p04.png", "oi1n0g16.png", "oi1n2c16.png", "oi2n0g16.png", - "oi2n2c16.png", "oi4n0g16.png", "oi4n2c16.png", "oi9n0g16.png", "oi9n2c16.png", "pp0n2c16.png", - "pp0n6a08.png", "ps1n0g08.png", "ps1n2c16.png", "ps2n0g08.png", "ps2n2c16.png", "s01i3p01.png", - "s01n3p01.png", "s02i3p01.png", "s02n3p01.png", "s03i3p01.png", "s03n3p01.png", "s04i3p01.png", - "s04n3p01.png", "s05i3p02.png", "s05n3p02.png", "s06i3p02.png", "s06n3p02.png", "s07i3p02.png", - "s07n3p02.png", "s08i3p02.png", "s08n3p02.png", "s09i3p02.png", "s09n3p02.png", "s32i3p04.png", - "s32n3p04.png", "s33i3p04.png", "s33n3p04.png", "s34i3p04.png", "s34n3p04.png", "s35i3p04.png", - "s35n3p04.png", "s36i3p04.png", "s36n3p04.png", "s37i3p04.png", "s37n3p04.png", "s38i3p04.png", - "s38n3p04.png", "s39i3p04.png", "s39n3p04.png", "s40i3p04.png", "s40n3p04.png", "tbbn0g04.png", - "tbbn2c16.png", "tbbn3p08.png", "tbgn2c16.png", "tbgn3p08.png", "tbrn2c08.png", "tbwn0g16.png", - "tbwn3p08.png", "tbyn3p08.png", "tm3n3p02.png", "tp0n0g08.png", "tp0n2c08.png", "tp0n3p08.png", - "tp1n3p08.png", "xc1n0g08.png", "xc9n2c08.png", "xcrn0g04.png", "xcsn0g01.png", "xd0n2c08.png", - "xd3n2c08.png", "xd9n2c08.png", "xdtn0g01.png", "xhdn0g08.png", "xlfn0g04.png", "xs1n0g01.png", - "xs2n0g01.png", "xs4n0g01.png", "xs7n0g01.png", "z00n2c08.png", "z03n2c08.png", "z06n2c08.png", - "z09n2c08.png", - "PngSuite.png", "logo-slim.png", "emblem-1024.png" -] + +DIGESTS = { + 'basi0g01.png': "b5008fe99ddbdda3fa01d74af76c174f206478cc58618872da5231907a026ee3e5a2506ad3575edd9a395bda4632b6927d028a42121a5675a329b2470b9bd8fc", + 'basi0g02.png': "d10ac5a9eda33b2b0061c6b15ff5a95c300a2eb7a600db1e2b03b60b9fd36caadf2bd6e32ae42acc5e69ac63abc32d297af0716f654db77897e7b9a2ee4e2b48", + 'basi0g04.png': "7319490d96ee805acc86ad86d2ef5e5219320519cc29c6051adb886b242e1a29dce8329ddf7483a24364acd03cf6b51c74f0783b363bc1358a1b9acf080b2664", + 'basi0g08.png': "1d91e7b475e0b5a9427101fbc7369bc024b2748095ba526ca3ccf47bb22478d15e5df61ae0449ee85f4e2a8ef5707493ec60281ea691bfef2391e21557318e44", + 'basi0g16.png': "47e5694a42bbcab0b2a0079d17fed0b7a296f418e818be24f7ec77299469b43f63145869a150fca5682dc5de1315b514cd775022f306cabe9f1a7c6a50eaef92", + 'basi2c08.png': "a29fd3e5d8ac542b907a2b40800a8159e62f12bd14125f4d103407f012f0cfcaadcf0c2afdcacf928201e06362b887b729b4f96b5b17e23fe9e6df381b2494f4", + 'basi2c16.png': "c6a65d2b5b07c9339e799564443865767d8530634b590f11caef74a2e8764516d63a4cab96de0ab6941bb877c16eb913f78e0d9135fbbbd831719d079f0087bc", + 'basi3p01.png': "661d31721f82c533e0412f327d67cc0590a82501ccf2addeee73d42f91307b738d5bae612f4a7227779a08df4817502616dd92c7d54706bae150df6c1d1213db", + 'basi3p02.png': "abf601db3a5cdb94688da772e051756dcc4d14b744812893be8d68b8ad82921c24a55e8da528b5653192de74217a6ec886a44d162ef35abfa2f056ae989ed02a", + 'basi3p04.png': "cbd9ac744036bd94ecf453616fd2ca599c9725c8b1600bab2453f9936979ead1dc3aa0194383811cc87ded45bbad5a02af48e8d060f7945ad1fd68cce7bc3e31", + 'basi3p08.png': "17d7b42a7a5eda85305a566a05b30f1873c0f76ed26b7211ebb03e4d806f7c7cc1adc00048e090b9bb4246769b9732f4ab84604d4568456f492d5dd048e75db8", + 'basi4a08.png': "1b697908e8cbdc55c501c2bca48a5314540d3b74ac395556846ceeb63a5511e4552f9f3e1227ba36516bbe6ee157f60c2fc4120f51dfa1307c0e9312bbb24b14", + 'basi4a16.png': "24685550d46b2a420b906ef5af1f9efac058b6a8fee1aef35f10b9a68475f4df6cee1cbf7c15169a333012bcf5d76755fc795dda8799e9e58966d3e9ff4c83d4", + 'basi6a08.png': "bdf48010b049bbc08e35050b0bff0f2c91a115b095dc8d4ccd53f89942046aec2c9a81c3ae0ff8eb7b3a2a3b0cf6bf88cde6b02262efd5c0810f9ff5b1e3d431", + 'basi6a16.png': "64f6a1bdce69f6b9f0946fc37125be638681a134de895c7fb7a107e8fe6222e158d94fc80c99756f4703be5c4b413f9fb4c7a30dcf7ad6ce91a45b18bced7237", + 'basn0g01.png': "7bd2c8a317e41d497e899958bc023a11fd7a5d77f5655762d92b504fff63a57d3e743eeae224106a672dda921f4947c044051344b06757dd0c26c2eb82d1bca7", + 'basn0g02.png': "a1b04ae6a6c7476f223d2423f3851efdc237d4f86f94c008a4caefe23f3c927d44e4934ee798947a0ee0b3fd95fd98f1c5070a2bcb82765bb3015fb12055253c", + 'basn0g04.png': "b011cb0f75a0fb72da15794b67e8520a964cf5b15010e3b831fb19640b4253f034bb693ecbe5d71c8352adc6fbd749847b7df582f2bfd9d7a03f3973398d8ab9", + 'basn0g08.png': "814c2036b0c13bd043da94fbf3c98d9220f410387c0d295e1b0087f782e9f0c2c21d43b5e15db0c652069a0fb79f4d83e7178ec9b65b96eb0baed8949890239d", + 'basn0g16.png': "7daf56e398e9801bd0be5904b6e22ef87c574c326037af180dcf60800a3ffc0ae47463ddbb268396e3121bba8958df2d208df2d442e24c363ec802d2275f6337", + 'basn2c08.png': "3ebf04d33f8a07d01565830db5d5026370f803fa2f2bbb72708c9af5b29a5269880d25f0784e183d68527a74e3ad63c2dd02c7615888cb0674cb08d7b729d933", + 'basn2c16.png': "ed7cd6ae047bcc58844d69cfb918a40bfb999bdcef6353e2dfc33dd041378adc08b48c9baca202f39d83456f1752727db82f4746aa9a6f7fd243afbc5eabed7e", + 'basn3p01.png': "52418cc42834d521446dc8863f61c3af0e409e41ab7b372204af477d1df856bd4fb65f060f6358efe1b011fb7e26f72b573721e57fef637d015c56fff8484d42", + 'basn3p02.png': "37afc5d1ecb43635e93a699dd4a22089fb096715deb327864f182cece0ac2df1b561a82c758a2a8e5baa9d296b90af90fe34b4de596b2eb113af0be2934ad2ba", + 'basn3p04.png': "0e9373728af095033e577cc63c5638d0cb34fcda44d2cac34789fc854a3b75a89fd5c54a62118d9e5bb30f57e834635350d1b7a7b4894481b2cdd87f6216380b", + 'basn3p08.png': "1adebd9dcc092df2ddce0568e66751d31cf4c30a2b580e4dcd5e4202471a69d78e7c89c4ecb4fc610baae68df9120708e512e900c075660ae45317305317ac68", + 'basn4a08.png': "1557ad77873b34bf5ec3e5508749b2046cdfa8f95c01073e354b2fa3fe89432459daff7da8888512050b71e79e0a2f97bab1d80f2d3a387f5e2587b8c0334455", + 'basn4a16.png': "35e69781cb2c278e594b098f75c659ad01d1b5d93e96268a49a1e27fd811cde499c21b696e9de43f5a7d451b3313c8db7e63935ee1caec9d45ba113f4cb423bd", + 'basn6a08.png': "ae0e18af14740ee1fb0e5e4036f00e8b323f1b86078c577fda80fbe44ead15fc6beeb2069a787e8e8e9a36dbc5018fa6412e99889c85b8a3679addb173547649", + 'basn6a16.png': "3b72b89fef39df23e9ed606d744a4356f3b5aad7c62c723a393882985ee849ab5a687fb4423120ba6f1efc62d916e8f781ebb54f7aa99753569bdae59fe758d5", + 'bgai4a08.png': "1b697908e8cbdc55c501c2bca48a5314540d3b74ac395556846ceeb63a5511e4552f9f3e1227ba36516bbe6ee157f60c2fc4120f51dfa1307c0e9312bbb24b14", + 'bgai4a16.png': "24685550d46b2a420b906ef5af1f9efac058b6a8fee1aef35f10b9a68475f4df6cee1cbf7c15169a333012bcf5d76755fc795dda8799e9e58966d3e9ff4c83d4", + 'bgan6a08.png': "ae0e18af14740ee1fb0e5e4036f00e8b323f1b86078c577fda80fbe44ead15fc6beeb2069a787e8e8e9a36dbc5018fa6412e99889c85b8a3679addb173547649", + 'bgan6a16.png': "3b72b89fef39df23e9ed606d744a4356f3b5aad7c62c723a393882985ee849ab5a687fb4423120ba6f1efc62d916e8f781ebb54f7aa99753569bdae59fe758d5", + 'bgbn4a08.png': "4d9514b3855a026155fe68878280c4eaaaa76eebb1cb9009536557e9163202961b96ea55a52de1c3d03aec85fefbf8d77b8ab63342ef2077e6714a3bc41e4e48", + 'bggn4a16.png': "8f93257eccfb9457f6e83e0ecb67afbb5b0d5a222c412cf2ec0c7c8024b78f56935a283d66dd8330b60c9f9cbf13e06cd38cfc8805851356e5d4bcd0e16d89b2", + 'bgwn6a08.png': "0ff6d2251271a9c0aca98fe9aa6ce9395c65572af64a2280769def7a2ae58a1db6e3c087549d8109494faca0d3ae0cc613c804a9f2be5255f09c12fdc18a5a76", + 'bgyn6a16.png': "b93d2f2aa94f3db768b0c30fc426541424f8df205461165f70bb5e7cbec53eeea4af627d3b96df5dbfaa9a2c21ccaf51431958a0b970355ca6ff41271d078873", + 'ccwn2c08.png': "caec91fd136b873387ef1e236f7e9791c1ca5aaf3c055b833a34821db1e9a7a0b2b83ed4b5c3ba4d208f5ca2cf9c83c7a876eab3fa1cf29c8046239c09e55803", + 'ccwn3p08.png': "b912871bc3e53ae4c0f905a778de329e813d7965a8706bc7487cdbe036bec0d9cdb3d890600645f0b7fe95e6d86bedbb804ec49868643085378c5f1db1c1b6f8", + 'cdfn2c08.png': "92a9dabf65d9f233d4d2dfd857328ac55c0bd8ade18fd9e624146f891643865ab7b030d85e124f4242164e27ad6fbbd85ae6a882594c57795bd06dfb168b817c", + 'cdhn2c08.png': "58beb4d5e967810d3ee90b7d1414cc6cab8afdc7e2cdd2e34bfe54b47df772fdf34851bce8ab7aa65d47aa16046bf441c905e20081b6964c1942e500667fb467", + 'cdsn2c08.png': "0657d6d4e7b937b9043e99712c31dcf93de675d30d6535b6259936cb8efa388d1cfda1dbbd22853778aa80887895bf37f77dd3ffe019d2eb8158b1b44ee16a1d", + 'cdun2c08.png': "2cb39c65bbe59eae788cb049e1dec2b36fe6c4ade18eec6045430fd5580c94742302d6adecdc07d0ea8bbbc6d35cd3077425cc2daea51253dd049ea284d76cfc", + 'ch1n3p04.png': "e4bec9006f5d3802dfbf78293b00bda6ad948d835c867d884a365933508a214dc50ac9a39c497c5a2c7d65acc8b8882bd121b6496e0963be5ddd8a4607cffa16", + 'ch2n3p08.png': "c05154d4739123b9cd826ccadf3f3fd47c3ca22d5277629e66aedf1dbde1ea277e3c9706dd28e925d4ec918834db427fa5558dffbb26c96289c0515fcf31c671", + 'cm0n0g04.png': "02ffc2cc1d47c0f021fc96b9ad2e33cc2e9c6ba3ab3d00a2ca6af5ef848bb4b591992fea7f5d86adee2cbcfb2a7d4dc8fa6cacbca71c407c617b33b01580489f", + 'cm7n0g04.png': "acb49a0f404ce72b6cc9da02e7ca9cb6468c1b22ea62e634f382c4c57eb9add446e6fe5901a9b5939c7cbe5dfc748dfee415a35f1567cab4bb86c3ab85cdcf01", + 'cm9n0g04.png': "6d57e85db5660d696169a232e26f010d19dc523348cdd59c4668e87ae828a302dbeddab170fbea079bfc14071eed7e90a9d994f52ab04125bd7448b16aa646bf", + 'cs3n2c16.png': "f61644100be9f49dd0e6aee29c587f2fe942abce2ae0c9c9807f092b2783d4c3f6318a941cd74c918bb465ca4fdebd5ef6fa86db5734c717959afa3a0993437b", + 'cs3n3p08.png': "df0966d891ab1cee03e2a4130d4bd32acf7996bc7e568fd646221ab1bd0664d0c6b3faaa1ec77240f4496cbc07e89afbdf8aa5ff944be0b686a9a4987e2b1081", + 'cs5n2c08.png': "cc99786013c1281b0738473c221b5eb5d6c84c467360fe9e5650df648b8efffe5f533bdccdea4e563aac70feda9ab9362a81143fc2dfffd5dee35a78ec57c74e", + 'cs5n3p08.png': "80021bea80c627a9e35d3770fbcee0b05ff791b595dcab8e1a7ccec5003ff5c4abc44a026d6ac4693388c64503b64e6cb2b882662d78e8d62120923810e4bf74", + 'cs8n2c08.png': "42bcfc93d407a35d3209e46ffc4c438c08a0ca2db15fc112fae93c4a9ff82a1e889ebcb8bb44370dc855aab768bad450dbb575a5807467a04cb26772e24bc873", + 'cs8n3p08.png': "a29a7a569a9fc94cdda8938e0acb09f9781f52d326ae57318b25a82c0652e30307964c900e8033dccd3035eeae0df3e8c6bdb88562882986fbde3c3a173c7f39", + 'ct0n0g04.png': "24405bcaed6cabc6be73061e80f4839a2952ce69d843f6a1c47cb286eca76f82cec6d65466eccc4a0577cb6a4923ef43d3c01ce5a63bdaf3731b8118a686d1d0", + 'ct1n0g04.png': "fbd0b417257b38dff4a5cee2c004b9c79bf9fa72ee16b0452468d802f46d768c6c694ac270b00fb0cb2b25b82ee6a53a87f3f961263948474a47409fb94d2b21", + 'cten0g04.png': "8c814e8f51b6aa37adb66138505cfb6b878fff482f096575b43d4a1d68fe64ee733faf4b8c4d761daf902403c88ec2b561a518d762f30b40dfe980b9d7491b61", + 'ctfn0g04.png': "d2d98415cea47d25b23abdbde300533c501a8c4bf3ff76d6e126a0306b9c80026059a07130ea398b7bda825ae1d338106dcb855e3a55e25d38d4a7ac76c3c390", + 'ctgn0g04.png': "d7cae7fb860d12c068753af903a3d045712dad6d98653d6e9ca7527b26f3087af627b0921be08a299c38f6b76e268197b2b0f5c01510c69cb97ec7e0e08cacc3", + 'cthn0g04.png': "8587da6d046cb8d2fd706a3ef656532c7a5837729b574353895b7d662052bf6eec2873cd38e7299756b12aa0b7660a8d9afdcb0f0459433dc86a21b564b7a8fe", + 'ctjn0g04.png': "2624ba67fb5e52156575238be129649fcf9468a836e4c53bf1fcf99963f82c9a98b611376e0e85188564489ec135933e58e8f01b1b7967a15cf84e401ad504d2", + 'ctzn0g04.png': "cad58005a079a80679649eeb36f97f9dee9f4ff596e84fbbbe3d66dc9d8184c89b8fc88c99c04f1493f55a82c2f73ec33bc73b4f356b08b47e24ced6b6dd30cd", + 'emblem-1024.png': "9b7820be0cc034bda7a13960eb5e41b61139e5b80b74e612e5711f6bd59ed46d5a7e59b7186ef7aa76da5a47314426d6578490a3b99aa31f2515353c8e49f750", + 'exif2c08.png': "3bae00c46ec275fe50b94d2cbd53dae2fec1d7e056f046d16a0cc0080a40f82daabbc0e1ecb362e4deb222738cca2d3781bd5eb12de3a08cdeeb564bebb26f6f", + 'f00n0g08.png': "2d8bbd48ab09f120680d1a11958035e6a8c8890cf044ccd223e05b7d1c90b0e7f3273164bdefafb02934cc0991604a6d02acdc911ea5bf5f8898b7352fc47b0e", + 'f00n2c08.png': "cf3167907d5726f0b7918b2b78191565c90b5ab23668c0f64f37aef39487729e311f96f745e8bce3b73e98ba959ac0116d0cd7d2b41a573d09ab0da1249f802a", + 'f01n0g08.png': "315d66a14a5fde7c6618029dbe8c74c5704429e25b96603169e70eb6facda4d637e56eef58c6c6a9fed22cd7309eead82d63b9011286fc183c909d97f2b1ae8b", + 'f01n2c08.png': "fa16a0cde456f6a0a7fc592bebcee7d97f2e9947c7de409354774b1600f4f1643427edfd9c9288cb4f65089064458639d3eb9a433be9a453fc1ad7c702fcdc0e", + 'f02n0g08.png': "d105deb31d8076b1ba35f28310e30e9db0e87f5be8ee496a03422cf312482e1dc1d48d13d088155b9883e30103ac94f403943e72b96015ef96465e70614d139c", + 'f02n2c08.png': "ae38403bae423da5f60606528f1055e399f49e54190c6cfcb549a38bcbae753aa1c3d79d98cddfff798eef9a920dc586c02c2aa803238213798524fe57e8271b", + 'f03n0g08.png': "57f8020fde86a5c10c7242a3f1dcd735c8e070b18819bd714013862e7704382e2dea0b3d8da294b56a470a196cc1b7a5a842b0fe5343e3ac8f148854bea74d19", + 'f03n2c08.png': "272eea58b186b9d67be75d6c39b8f3130a5682ad36ba0daf12d2d2e0f4a7e089ca3aa00715ef8e9ef5cbc29417080e0ad111e06896a1249321338da067fc0def", + 'f04n0g08.png': "4489805b60dc9e752b33fa1e3b88b601a729e0c37408eb1da98f8daf30c1f2f3fb70f6d1048d8904dda553f33dd6b2ee687fe8cdf5545bccfcbec68df27586ea", + 'f04n2c08.png': "1123338a338bed5f044eb92bb6f3f146e34a2754835ae833ea6a6a0750efd866b1bf5168265632a4097b1cec4ddea2542a79c634db7ebd7f13c1529ec46c1117", + 'f99n0g04.png': "28ba7bfd82d5c1694c054562fca785a920eeae18242f2207a356be4e7c30618d7d5a4aa7b99f67d0081ce102ec1229540658e0c9e29d7d7ea3a83349f1592e74", + 'g03n0g16.png': "d17984e55061bbfa21c66bd40f6b9a4d2353fcb1787814908a5f552bee2752e0dd670071bf5840f813cda668acd007b965c6cac18aefba5ccff3bea2368c801a", + 'g03n2c08.png': "225efe0c9735a4bc61bae5e96e7df84d72d55969317cdb02a19825b1f0aa9e17e3e07fa9078370a05ded3b53d80151841f4e780dcae226eac687783e50e6767d", + 'g03n3p04.png': "494ae0118a73ce8dcabe22f7c9c40dd7ddf21fb676389284111afaefdd700a311516bac48f3d5afdbb28c084c6bceef09e62e879039b69e4ebdb099692a04539", + 'g04n0g16.png': "c4d58651fec06f8a8045474190541e917f7c5ec01169e49bd897e1965ec5e09b1e142a47e5747b01f5535678cad4a7acfab45aaa3432fa304fe36430536e35ce", + 'g04n2c08.png': "963334bdc0ea83ba639b70d864b187a6ee13399874e96fb07ff3b0dec8708983676c52c82617ef610d001de00b70b6596283dce682486ca3a1dbfb3c91ed7258", + 'g04n3p04.png': "cfe390d16f07fc3ecc4c3fdf9b53b5b9de6980b99097d202dd2d2f43fb0b4612e2237688c656a77b52519e02f71ec284045c7930940004e60aed043819775394", + 'g05n0g16.png': "1ed9fec03f57682c81fb1813cee1f48f80da4db5223b57f8f5d675c14c4d85cca9481d555020837d95c0817930ee75a06e897eebd246e9cc0de065dbf687d4a3", + 'g05n2c08.png': "b5447e45eaff246a4ef7001276619ce38a0876fde1bb26411f67f97c5ef4e3e0ab3b82169667dc4fd44bbfad87116e0e2223f878f530127c6c87e043d006588d", + 'g05n3p04.png': "1fd897a387b01b879dd9effcca2078333b9d5730a63faa0c1b3941794a895894aa403feb4836690311c1a1b7bb50d61e22599e4b81ddf42bd137d2639bdbd0ee", + 'g07n0g16.png': "db7190d3cfac8407c07b83bc02ff1a6c15a393e6ef88fadece1c08c2d2bcbed8146f63e549d1d343bef83105fe8700a52e9ded2d96c03ff33f4b4aed787ad219", + 'g07n2c08.png': "c8483d32c431e5f8a9a666ee97fe0932f2adb01fe0112dff636484b22a5142d92218906e8e8ef98eea846ca6015e7ce39f367fde9aac9ef7112cfd1865f9935c", + 'g07n3p04.png': "a1096b453af956f580642d9e9de864b9cea69503e10a6fc4c250a238118add3a8a7a34f7da24c121af59fd14ff259b0fa73d305f6bf886eaa2dde058e8ee72cd", + 'g10n0g16.png': "1df304c87cba2a285e0610ed8655ada912e4d58fdfe47802863ec83a1dea17cf59a34fdbdf570f2a11800aa6023aaca6b48dc23f2e8699a73f168f21e73c8ea0", + 'g10n2c08.png': "8ca900ba7ba1f3d17a5bb3945753ae472aad77ec7b3722f0d83ecbf77981ab612e1a9a3bd63213e651e798ce0dfbc9e3ef52f09273194531a78519d461333bf6", + 'g10n3p04.png': "95a52464557e1b5c52dcbea5e009ed004d05763c1e2e475ce96736713aca06a01c42f74ecbc9d9feb5a4fb7f777b31f35a0dbdd7b5a6a9bd5591142b60be170d", + 'g25n0g16.png': "23d7a7302e8a42819848475a2ca73b4895038a7d9b1f822e6ae9218348d6018313cb7ad2ec9fa301663cef75bcf4fb5bb9da7dcc9e17349768c2ecc2d65883b4", + 'g25n2c08.png': "400b394b8e5b751dbf64227b35a7e72945b3542b7be7015f8615ace7898ee20a2f6b2391422521173f7a2c165834c94ab396bf6b29ac5f45b66d97a5c2ab51fe", + 'g25n3p04.png': "4f4e254be3802aa63596dce708383840518ec47bbc09b6aaa92b6106860939eb152f6ead983bd187105f492e4936ccb6343c5ad4ab548bdc834f9e33cb225b9a", + 'logo-slim.png': "072dfec9c28ad388f61e9323deda00d04c293e53044fc4e02d5fcd5adc8fb74240cd61d267eea6f6afa70eb9023a20084c9c2f7ba1b5d5e56495b71356a0b36f", + 'oi1n0g16.png': "7daf56e398e9801bd0be5904b6e22ef87c574c326037af180dcf60800a3ffc0ae47463ddbb268396e3121bba8958df2d208df2d442e24c363ec802d2275f6337", + 'oi1n2c16.png': "ed7cd6ae047bcc58844d69cfb918a40bfb999bdcef6353e2dfc33dd041378adc08b48c9baca202f39d83456f1752727db82f4746aa9a6f7fd243afbc5eabed7e", + 'oi2n0g16.png': "a57f1ea4054278a66c4369712fa499c2bf69b6dcbd35f74f1714dca2ebf17f068a80ef88482a296559be20a99e8506850e4d54dd8752d6146d2f35d1f6690a6c", + 'oi2n2c16.png': "21bcd689bd28342acd1f006d82a3c904b882a1f5a5a639e26d248d87687284a22aa45b4f02fc92370cd77440899afede340ca29f7e384be6a373a6d43cd19703", + 'oi4n0g16.png': "0f01f28517f57b510aac6e1d2b3dcc5e94279054b9ba358804319f689451490b6d023e178f14e719f81acaf10b6192705fd1998f8a4fa33c918b9de07c47ff5b", + 'oi4n2c16.png': "72cc16bcb694944810e347438927f0799c6d864f453a5d1142ed6213723d214c739248b42a119defb9cfdc8c59d86962e344bd57fbdfb1ef375578f1e940a9f5", + 'oi9n0g16.png': "d3f6831bc64e80b32b3f87e228de1c2d311e530b2ad62da262722cbecf535c04c8f83572d854ad22ce1ffb9d88996db11ab02b17ca669ad73e44100f5a78377f", + 'oi9n2c16.png': "bd9eb600404f02ee3de562fa3f2fe4593348ae9efcaedff900e51e3ab01120fc615ec5ef73daee7a1b3788e31c917f86dffbd88c1d955f3572658f6409104e13", + 'PngSuite.png': "022070b160a8843573fbfd22f1d54e95227da2cf025a0ea5d017f59d0023da0921db1a76122e7b309ee9036a0df8780965256e97d53d017583bc2e22c929b2e8", + 'pp0n2c16.png': "efbeb27ecfa7bd50c70061fbd8ff538726eefc070ebcfd5bbaa90a64dba41e51d55c7ffbd1853098dad13586b3d80cf5f91cce1f776afc2630758fbe05191ffe", + 'pp0n6a08.png': "49c7f141b85782eda585eda8fb7c99b92b8f60e20438c5efd28393a4a956d1341459ec31d6ebd35c8a63343b653bb453a4eece252fd08eb9d4d31a86b040c92d", + 'ps1n0g08.png': "a23aa40328fcffa15004f33127e822ba0ae8db27898efe0735234bf5a6a137ae3869deec4b5947c75c24fc0748d1def746f3c9939a2d3f5821e8052777c79511", + 'ps1n2c16.png': "8a4bd1209067cbcc96e7ccc6f9f537e01d5fbdc035650df6136042b12fac903ab420215278109fb29594b7ddd59fe5d01715daa7d59f937c91b39285a73d87e9", + 'ps2n0g08.png': "8b13dae52a78512869af3e930d986278e9f8cd0476c37efd7238161576bcf72a261d859d1392d5edc7031a986d882c4a4610c2596a73d40e664081136899b059", + 'ps2n2c16.png': "fe4a1120c5458ccf12c77477aa3f60898db1a9ed30b56e481f3fc9cf475798b869f6761734b5e254cd03e047e4f3d9ca3d4f73d0c6754e582f1711a5dcf7a163", + 's01i3p01.png': "0bdbf666db0a5ada5eef96a330d633fd1742bf455dc67b554aa2b99920f8091471976ee27982c549269ee5c21302fa3acd9bb9c29f7d9fb7fae020564d508eb4", + 's01n3p01.png': "50bf7256c271afca66d9891b571827bd5fb7a1b3b6fbcb7ef077b4ff98c73322106b557bcaeb6d5f9c4854a488439b4a7fffb550d2d9b51150ca9de958f1ba6c", + 's02i3p01.png': "3a389a879ac464739555067bdf0e6df0cb2abe187569d5dfd28b4569ee88dcb41c51a66c8666af17d8554db00cf83ee2dd782d0ddd472a755224a09dfd0e20a8", + 's02n3p01.png': "eac6f1f8b9d0f5d4fb24c711cf771b4d7faf16da4df9ac67b51dbda21fb00993a1c10fc601e5a3664bef4512c2da344b1de384bd8e7455adac00274c49b32b8c", + 's03i3p01.png': "0b5b95c919c7abaf1347c2fc802c505388af3bd3df6c8d062b2327b0ff7d8ca7ae12768bef7659c0214e57071b62af88bed36d0848105f4f96ecc1d06eddb2f9", + 's03n3p01.png': "599252f2b5cfe56e96725e92cbaf25857678b315934ab52a6af3000a2c5e06db49d289557bfc123ccbc7baec31954d33dd51b5a976f8d0733d296a29a1ccfe9c", + 's04i3p01.png': "2fca110ec03d7fcf5ae57f13612d00096822d8ec97f7c8f46088f131fd9b53d15f88eb811191e306180f32e00d9e9bb5691b45e3cfae32837ec417cac8ed3045", + 's04n3p01.png': "795598f09c722133956d80c63805178977436a5412d397247544de64706f29c865ffaa8c9ff2c85b74503c98e9f749b1bb2a7031607e8d565f3b5e6da7d12f13", + 's05i3p02.png': "545ef14d73ce35066a4c98da61950d1f0356cda7041c1bb4ff69a8e67ac13ad9eb8503c15824cd93b82ae03814c84c0cd61e3a07328a8b71a79634530ede4c37", + 's05n3p02.png': "b5d5ec774da44af91903798ff1bfd36aa4fde0c83580fa19970cafd12e74d739e2f5198147cdbc845062b977127b8daf875a629f41ca84f4a1c29182e8845753", + 's06i3p02.png': "7b6ccd5f7ff168c00f7ee7c9f59b56157c96f556493a9865539296137801030b6aa523a52ee661b8d15bef55d06916f150eeacd90fd9e9cf881d6b0cc5d4a30a", + 's06n3p02.png': "0eb30c9c9b0f03ba767bf07fa1e1e5eee6c71a0edcf664ee601d6f3e95d57eb62404488a3fccd18afe5fee18e951d3ceb0418d98de9bd34bd2fb213ce20f0e68", + 's07i3p02.png': "cadf56926834f278d6d6e6ee89eb47fd05535c04f87cf16623ba1bf7c52c6678c6b507a19e8fbcc8a7db1aae3b8f861898e270d59e35d4a72c1cb0d6b2f952fd", + 's07n3p02.png': "796ee93dbe71893c190feebe06d906018fb0fcdcabb30f3cf666399937aa07fe9d7cf444e53895e4bf168f50559d98d6d2eb9d30792675f217917f4215cea46b", + 's08i3p02.png': "d9f6be2a8623ecad39a6b9805c0d08a3e58b02dd74a1b0ce02902e82633a947c5a30921da6b7c99dfe284b310bb578e357937891216a24d3ae90ca32fe67d3ec", + 's08n3p02.png': "a945e144d5c53f9205b2d7ca2e57dcfac23c2a923d3326aeabe775324c73b59db9bd5b8871524928e604d376762c4178924bd230918bea30f18b6169a83ab3ad", + 's09i3p02.png': "2db824ec6807ef1c2ed9cf8a897b513a41d70305e4bb5b5918447bd059dc17f2d7d1caf868a95ff84a4b904e377faaa088691e1e0f700b7bad1c4e79b849c1be", + 's09n3p02.png': "a3b5464dba07f474da30c50bb9baebff7314535e7310e36f51bbbd0d89877850fd898f1ef991f5352853baa410b737754634fbd5957fdfb3becf8ad5e4776b9a", + 's32i3p04.png': "a64eec719844aaee1c93c81244cbea5f986b8319657b5ccaddf047e3ff314b64c73a224e6db9eebdec50ed72928ddebf2795a79fb665de353de0d52d310ad52f", + 's32n3p04.png': "b31ef24705ad3d09b25709ab7f2815df250f0261a9ba31d16fd55f21a733ba23efb8a0122700900943a08e1acb7af2e682111b0b47f57a2a4bf579b198cb4212", + 's33i3p04.png': "47e09222309c5f059107097cb74fcb14046a50197fca88a18d1c42781167c766fe8e5d5909265afd460a09bc130f7b4c54f8908a633237701fc032c1c4529d01", + 's33n3p04.png': "b81d9dbaa19280b84078dcdd8dfc87ec94ab9045dba6a5556bda2f4aeb034972672d811ade46b5c157501451ea9f89a791f26bf6e74fdbbfd7f40f5a6ef80892", + 's34i3p04.png': "c43834c3389c4a6b62ff9815b31e485b4a3989ced74dbf6da0f43abcddd0e7c8dadb06299d94f06f1b8650ea1557657cde3526918689c52084b87dc0c1a99f30", + 's34n3p04.png': "66f211232c8726adffb606274d848f8717a0ed202d437b85449e0f720a9172c6977c5c8e56f92edbb3759fae3ffe70c38cfe737a838c61c4b3d2a13913904c90", + 's35i3p04.png': "ef79c73d61333e895f7b6907bac6ce6cf14cf4d0e293dd93062b27c55b25539abde428d25cbb81cc6f4e9916a1dfaed6d4d8c7a9c0f047e496ba02325ba94d0b", + 's35n3p04.png': "921e7f6afab61a2016f5e1f83572ad5932cd1d702a978dfc8da04824efe03500da16425b22c79df7c3f9f867fb54cc6d444e362f4aa38b2a36b7f361f74d93b3", + 's36i3p04.png': "e98f7f87b7d38d3d5ef3f6d4b191ee62176ffa8e6ab611f7d94d5172e593257f5fbb5b8a2aad479a380cb6c6fc8a08cf6cd008576d7ad02eb1fa78c6bc138bd9", + 's36n3p04.png': "0122083643ec591176d17664a246da96e5f3599efaf546a0a6009ba5cb9d6f5064bf987cad54822a92d80fe9cb0189323947ab74f61346ead8b93f5f84288842", + 's37i3p04.png': "c1534a07947e5e13a754b9cb8b698bbad4edd9f6301405ecc0538eafa8c558bf9ee8aec9398308f891cb5114407be6e8979f8d294378b1d5a585a129f32fc45e", + 's37n3p04.png': "1cfecf9a90c677f18876b3480a847504a559ee61fa185f1b64c7802a259b21d583fb555ed01e3c218e87252ba73a1c983f222db576509b6ba131642f37a79e20", + 's38i3p04.png': "71881b215645dc62a080f4433527afc64a8c1a24dd56e88bbe2969b5d33c5808ca107d6525c04018b483d8f5218eeff65d1082538d75c23157b6b09df0a78624", + 's38n3p04.png': "217817f08610e139053719016e0d6345945bd85069011174ee2495ad702002622bbb5a27e4663bef92f456b592a4e38eac79d47b4eb023d819e2980075759544", + 's39i3p04.png': "f9d77bc09e7d277091b52cd94d84452974ecbb8fc7a0f3fb52e4c109e71da0c393c942c568aa76214d06b99e082fa37eba3894ace89b6d8f98a2ad14daced769", + 's39n3p04.png': "4f76f71c7a139393b27295cd4377deb31ef4be5b4c552557fd6b4581d2c254d141cec9368008b283ec33c2eac49671833f0af288e0a054eea6f5562f8ef3e766", + 's40i3p04.png': "9a2e9b85ca3966053e743d1f56ea895f4ac536568d5b19e9d3bf2f4a483ec33610287c9e79cf0469c651ff8c76a117b5849f275a51ed428d01a77cb63e7c78d7", + 's40n3p04.png': "a5bfd8e42d9c30d2963e197aafc0414417a8d82cce7731bd2026019704c7e08f3f2bd9b5045bb6bf3b1600ef0f8093422bc887159832fa49071bc31f73a74322", + 'tbbn0g04.png': "4855b45c0e55a2b371aa7b864f2e04e2d08cc935b317f88f175268528e1016584005032c1f9efcb6b8ffbcf0c034945e68453c471c7563f3f69a37a3761eb00b", + 'tbbn2c16.png': "7ccd34a23627324c7d2014ae94ebe4c88d8cddf35b13098ee8c55f31ef7e5a865b34ca78053e4b3c617b83b5dcc08c84f10b6974a81a50925f0976d7b8477811", + 'tbbn3p08.png': "efd458c974e0b2dfef57463e19261d022bd2699efa9bd7e1f222eb46d09e6932c3db5991921b96c6999cbf1cb5180b29af66450a7084d15188ef2ac2d8e0aaea", + 'tbgn2c16.png': "75e1acc0734b3a80c73a8b7ea9d4cb635c42f70e33f50f5b749e9d86a8ee2b91938798be5706534c4b2b1505fc706ccab4262bfb9fd69cbcb184bc6728331595", + 'tbgn3p08.png': "fee9776510ea1f848ccfec8d664dcdac4705ad870cc29699d198aa3be15bbb059a924587f53da314ef3b365f7f21f81d8eb3a3f218f80776d5234aa9abb138fc", + 'tbrn2c08.png': "f0edb3e74dddafbb26a999c95b0530a0731cddd58189e095cf4d6d95167b1b6bcfe4cc7eb75dd03f1478ec37462924eae8c73d11652e0edb6834f1485ea2b14d", + 'tbwn0g16.png': "24629715e35a72df1be36eb80ab3a5b14a8789bd20898f738e547fb6e96149c295d849892a2bae16be6d230dc33ca91dbc11b024cef1857e5861f73817ffe2ab", + 'tbwn3p08.png': "6b109509998d89130b1120859c1b146f42876eb193b273af3035ad6ff24f51ae46767a5a31730d5eca6df3b981e3912d0ddaa04024e3a3fd688ac8f269d10dc4", + 'tbyn3p08.png': "720468cb7d4eb60fba8bada976c9afbc645179ce84ba27f2d70942ed9d11d31471ca7f78a00ad8aaecf83498023c2fa78e2417c69506d9dc1d645f6f3854a177", + 'tm3n3p02.png': "f08f9981c2724b3d4bd7881128046125d881e1578202482b34c6ffba743bdfd12cbd3400590ef7df117cabd63424faff2ebb5b37a29cd4df287c41cb15b7311d", + 'tp0n0g08.png': "1f7e0f28db7e8e1188eadc037b625caf5fd781f3905d74d2be8abaf2c86bdbe8de69881f14032eb56555057b1bbf49f73ee70e83f87f14f287ef19d68c734738", + 'tp0n2c08.png': "c1a790ab942368875ec269e38806a81ae7c66a5d2cba3e96539cef2ebc9e54c8af9dd4c4beaf408afc284195a089829bb631b9731a75ae61b0f5668b20ee2e23", + 'tp0n3p08.png': "cdeef81826868b9df1070952538be83dba801d260062714d02e7478d0ab1a984aaf6758396e7cde8fff3e59fcbf5fa6960d85f0817c53de48b398c9a05b31f91", + 'tp1n3p08.png': "177554a69f64a9c39face95f316ffca7b15649ecf72de43d413d347e0c2b1b2bb1f2213e71310eb4d648822b71f086c825030b0c9020a807957d3100e460e1aa", + 'xc1n0g08.png': "de870aca8da595b7a7cfdd70465ff206a43e286265c06d5554df9cc96d4c8532debf140dd3afc67adfa9a23fabe808b1b08a20b3bbe265a7e3a4bba2c34da3b2", + 'xc9n2c08.png': "f31a707359fb788934ee1809a3abd7e663f9843caaaefec8804f4d00bc9f02bdd73bd686ec0d763fc73461faa3864666a99ea85ace1f921a8145ac506d40df31", + 'xcrn0g04.png': "433b40a2f9e73c88d50a04b0e9a2c98e08e947d418b66f8f9e3c1aab681a994af046afa0ff1508d34c1f1f9316ad14d764811c906f452516d7b7a100ddb24764", + 'xcsn0g01.png': "5d06d0c6bff9a1b06c75299c019bc8fdc49122bce43112312103ea02da841d4e9641b39129bb8618463e503d525a3f181bd959b278f3eba062b06e85f2d67825", + 'xd0n2c08.png': "5c7b87bd799a648703b5660a56d125103456d87209770bba2a0a7349230d93f376f09374487241c7cc41fadda221c159f5cfba293c8dbedf7c4a8ff402b16c3f", + 'xd3n2c08.png': "f51ca8607d30492c857348c218f3970890a84d75f5b6933dad6bd6a5feab42eafee4e3dffcf36c53f1d40c92c5853a5ceef889c19fc61875a74ac1fb189e1b35", + 'xd9n2c08.png': "dbf060b66b6bb47582659fc741ec8a49c1d1f1f4b5824014139277cc9951f39c2b7b2b60b3d262cc876f0d210f5d580c293cc161f21861ef4de32d2d9289f1b4", + 'xdtn0g01.png': "29b95b7961f4898efa63148d7b6cd03e537a878b1529c3f7490fbf5e0dffbfadac45a0bf1f8ea9bbb4ada2ce3f361a27124c6c602af750ba78a7695e42ee2d99", + 'xhdn0g08.png': "5e750c095cfce4c55c62a6486e5608474f8b3b4124012d8b5efafa421ec675a04018d1008bdde1e1d4b4fad7c17eb5a155ffd14e64d7005fd6483c518d29c844", + 'xlfn0g04.png': "26c5f68e1cac1d37daa3c4d26d5b262b06ebfe204a77fa35fcdd2dbd247bebcfb070cca790f4df7fa443c7dc62f95fd1a1ea674c111049f96abd55be3654bd89", + 'xs1n0g01.png': "da6735534724fbe50ccbc2e5e78692752060410b734b3fc3007b7ea9ac85cb13fd40f5ce4bf2a37448437523484aea2d979c4dac3ea17d11f160ea4c388ec296", + 'xs2n0g01.png': "b68167c21e365fd5eeabac9cb78e2aa02ae0261a9fb25a34f9a47adb29ba3a0504a2c5e5f3945991edcf9d2d89f148735570468acd829d4112a74e1abf0ca54a", + 'xs4n0g01.png': "5fcefe356bfb967ceca8bbc6f991ad1645bf3ac5fad9b5e8c5c624a99aba30cffc36ae8a08542816e7907b0035ee948eba29c45c1422c5802a22ca9918c651fa", + 'xs7n0g01.png': "97f9e89223e53c450a8cd8709ec550a0155b97a8a34cafd8032d4590dd3c05edab9099ea19386b341ad0985cdf388b23478ba0de57b96055ee7f07c74a67326c", + 'z00n2c08.png': "2cb69802a02bb4ed0e8d3a1436ba952049733beea8efc4d4b3fe2bfbaf6c90b6eeaec221e3bf349f20054f17b23c65ed285f97a413ced448ffc2d1b7484328dd", + 'z03n2c08.png': "b8bbe4a48e924a5b8a2f22b5f6877335810321461f9702b9a8d273d8defe4056ddf75d1096bf254ea03ef9aa386319c113fcef8cc0146377b5290c4a4e930aec", + 'z06n2c08.png': "5bb4d290d70737009ef77059016078c665f6407e9fcf4ba04603e776f68087e1a33d72b54419925c2474669dd2426584342872120b2923c559ff71033739a801", + 'z09n2c08.png': "ebeadaebdb570ad5782765381cb4ff2ad833cfcdb7754663b752472f575ba6e2c2b33eb56d3082c31a589df9347dfa502aa138bcb03c359b552f87b55afdf0a9", + + 'unicode.xml': "56609b607cc1ba43a6b4ff327ab70ac18ede6d0c68ed61e953bfd225134ca8ce25c2460fb094ab7dbd98bf4c37dc69cebc7242140d015173b612d850650d57b8", +} def try_download_file(url, out_file): try: with urllib.request.urlopen(url) as response, open(out_file, 'wb') as of: shutil.copyfileobj(response, of) - print("... ", out_file) except urllib.error.HTTPError: print("Could not download", url) return 1 @@ -55,7 +205,7 @@ def try_download_and_unpack_zip(suite): url = ASSETS_BASE_URL.format(suite, "{}.zip".format(suite)) out_file = DOWNLOAD_BASE_PATH.format(suite) + "/{}.zip".format(suite) - print("\tDownloading {} to {}.".format(url, out_file)) + print("\tDownloading {} to {}".format(url, out_file)) if try_download_file(url, out_file) is not None: print("Could not download ZIP file") @@ -64,12 +214,25 @@ def try_download_and_unpack_zip(suite): # Try opening the ZIP file and extracting the test images try: with zipfile.ZipFile(out_file) as z: + print("\tUnpacking and verifying using SHA3-512:\n") for file in z.filelist: - filename = file.filename - extract_path = DOWNLOAD_BASE_PATH.format(suite) + if file.filename not in DIGESTS: + print("Missing digest for {}".format(file.filename)) + return 3 - print("\t\tExtracting: {}".format(filename)) + extract_path = DOWNLOAD_BASE_PATH.format(suite) z.extract(file, extract_path) + + file_path = "{}/{}".format(extract_path, file.filename) + + with open(file_path, "rb") as f: + file_data = f.read() + digest = hashlib.sha3_512(file_data).hexdigest() + print("{} *{}".format(digest, file.filename)) + if DIGESTS[file.filename] != digest: + print("FAIL! Expected: {}".format(DIGESTS[file.filename])) + return 4 + except: print("Could not extract ZIP file") return 2 @@ -91,9 +254,7 @@ def main(): return r # We could fall back on downloading the PNG files individually, but it's slow - print("Done downloading {} assets.".format(suite)) - - + print("\nDone downloading {} assets.".format(suite)) return 0 From b3580fa63a78b39ec52280b9c1e740d05d40182e Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Mon, 1 Apr 2024 18:20:14 +0200 Subject: [PATCH 16/43] Make it a HMAC. --- tests/core/download_assets.py | 406 +++++++++++++++++----------------- 1 file changed, 205 insertions(+), 201 deletions(-) diff --git a/tests/core/download_assets.py b/tests/core/download_assets.py index dd2e03fbe..7874b7e91 100644 --- a/tests/core/download_assets.py +++ b/tests/core/download_assets.py @@ -5,192 +5,194 @@ import sys import os import zipfile import hashlib +import hmac TEST_SUITES = ['PNG', 'XML'] DOWNLOAD_BASE_PATH = "assets/{}" ASSETS_BASE_URL = "https://raw.githubusercontent.com/odin-lang/test-assets/master/{}/{}" +HMAC_KEY = "https://odin-lang.org" +HMAC_HASH = hashlib.sha3_512 +HMAC_DIGESTS = { + 'basi0g01.png': "eb26159a783a4dcf27878754e34db6960e992072fc565b12360c894746bc6369101df579e3b9a5c478167f0435e89efb2ab5484056f66c7104f07267f043c82d", + 'basi0g02.png': "f0f74d33ee4b3d3c9f1f4aacf8b0620a33cf1d5c6e9f409e11b4a6e95f2ab1c9159c1bd0bcf6f9553397bf670f4c92712b703d496665d4c6e88fdaf6a0c98620", + 'basi0g04.png': "7b81665f353ff6347304b761d26b4f1baa6118daefc4790f4b0e690150a4e6306514f2aef87e2c39e83e56a0b704df987b10a5366244da58697cda4d5d2745c1", + 'basi0g08.png': "6c809574674494d10eb04c58191c4e0b35813c45962ecafe36a9fe5ba44e5d74ba098e0a524a30c1508eb2dad601f04d5230dceb61a307ef1120f07a8bcbc92f", + 'basi0g16.png': "dd439069fb704b8deff3de822314c012e91a0bd84984d2e79888c6394b78557a0ae6197a7b0a4d64eb4e16fc758946c4f1f13d0d06e512ed9743c4a355b02488", + 'basi2c08.png': "e851fb030f88ead2541a01591882dde5fd9f5dea6bb2b11b374394ed86abc7289e72c4c90808b261aceac13111d3c05b39033168b42ffd1c7ea367314b3a8dc5", + 'basi2c16.png': "e0f81dd459860f7eaf04a2c54932547f41cdc9903a1295a26cc4a2087fd79c98a2e5d5e74f22345dba08b1eb12f3f53c9b904c88b756cbae0c19f9d680e2f1e8", + 'basi3p01.png': "aa21cbcd5d64e6e88056af907509f3b98b00d105198ea2a669fcb25b6966f06d5e4e3afc160b2382935e8ab8e7ccf61733424dfb39b9e864306b82f8355bbb58", + 'basi3p02.png': "d6182370236630d42fd75eed7dc54079ddb7fa9bd601eba22a8dc3331dce31b9a9465027145c29bd56cf778ab0ac029df6aa6481ef65c9464a1ce1d89423faa5", + 'basi3p04.png': "2b35fb98884da370f25833d25f0ab4b188cc26440321e95519131c675818c128b2029d38b3477ef94d88052ec6e9f8b1f7410c5576ce0b47b2fb7a5ba771ce48", + 'basi3p08.png': "7415890831958ca34c73de3e33a9c88980e788d10c983c3a00967886f05053d359499bf0bad386af8ee1bfdb73f666e1d541b0ab682c6092ebdbad3d93e145b1", + 'basi4a08.png': "22ab23a3070d9f1316e8c65b333745e4abf6dcbe63d9d0ada7f6881604b498a92e5b49eb8c1e32f453f4319d94d3d0f48441bac2e79ea528fd7ace0dbbacea9f", + 'basi4a16.png': "2b1436a619f91cf4045e18acf03201b5e9c7774fc77e4c3f38d668984d98543fe64978e80854f30adfecd89b71632945250508bea9eb1ce8e9145e3e55bdeece", + 'basi6a08.png': "aea929866edc5e607d7dc90fcd871f4b6d548abb379b9427fce75a773705e0d8c3ed03bb64e530482b72973eb09844638db5db93666ca1605ff6bbaf194f70e8", + 'basi6a16.png': "29b6ce7c2469e24587b87559f85551334c51bd9d7867f4066c0f7dcb01d710e11e87ee8654c91dc986454cd70f8bd6021e2086ea40e48a28d68a9bdf2283573f", + 'basn0g01.png': "52da610af6f97b03fd8e9f8e52276227f57a97e2bc7e47ae9484b2a37472330f8f5ecef2d6de7fde8f7eb8f144f233bdcf8a3d716c5d193e44d9590af2709cea", + 'basn0g02.png': "676c727faf143af658ed6c6333b15e50387c566c1846a4dda636ed4a2dbb1c0d6d32f0db635479f6851047a32c6d9c52898cfda004ea986853f3ee13750ed90a", + 'basn0g04.png': "123a6652b56f5b858373836509f6b7433221e6ff4eb9ce8a68d0d12bfb27cad0c1bb0cb159523ef1ae5997cb07f994bfbfeabcf0a813aa83495f8269a7a6c4e5", + 'basn0g08.png': "ad5ff30613a462a9b61242d42bb7c854b8247d80a1d03a3919dfdfe8a91c8a962ff51932b2411f714f1be7b803cbd4605c1d4441882cad7e8f44dd8d927198a4", + 'basn0g16.png': "40a96ed10ad5cc58180701e0bb6d6f36c1752c8b8329a80be2960535ad9e168469efbd8f3dc825b57bf65e78a3b61835f19697f2a22511f79c06ce2c6a0034c0", + 'basn2c08.png': "fd92ba13d2038c632fd8bdd3e33971cc69f561bee1eb04ff7920625c6771e0cf7fdda29e48b8a6ca71702c0624ebbca232793f28bb2073b0247d30ce0c549ad5", + 'basn2c16.png': "f6b3cfbc70ae502edbeabde828823dc079dc4e9a586a7fc326c70caec3033124121e3ee2e6481e6ce966efcdef9376cb3ec3edb8e677e91563f510bd6f6e83e6", + 'basn3p01.png': "d262c97549cd1d43e36f5990dac051ead80f1456693c8b1e19a8a48796195831a6ddd5c4a0ac44d22fee51ce4d9392c1c40a0be05571b1b2a961691636d69cd3", + 'basn3p02.png': "a00e375e1fbcc23de38b3b11a0fda4d0204f55473f74e37e0bb5c5f391b37c019293ccddbb99196b9457cd0b7fe5b9e34a55dc6b8167b6909b38813e37a95e46", + 'basn3p04.png': "1a6ab4c567e75b20ee6cdb400dd1f7764a05679c35010e6144fede5a55767dd1861df8e6240e1e59d4166e25d972ff05a41cdfd527818b6ec960a0f9d57d0939", + 'basn3p08.png': "b8f99f6410cc1ac0ceb366e93fc1008f45fb2499e39c489fafa143e8e881f334735e118eec93dde687bf4ea524b4548741c520d770ba6d7071e8fdce576644de", + 'basn4a08.png': "4b7758d4fce3bba95ef3d09cff0ab28c21b8bf568156730fd4e3bcea1c1c2d3ff77f53fe3551f617bd01c8c96e929eb20bf04f5c1a84f37c3cd6bacd4730e6eb", + 'basn4a16.png': "aa0c411f8bb15fc801b072f1048de2fd08761fe245ad267e8503eef8ffe1c39be845e99c04245771afe9b102328129f6375869a4e6cec60eeca641b3e5df3a8b", + 'basn6a08.png': "78d7c811c5463ce53a50874baed840ba70c811513e0ff98fda15a08f01ac6a7c7139a9979cb3688451af6b7e2981699be3c27a386d77af5e60d1acc9e23cb103", + 'basn6a16.png': "e1ad0ed2bf5774b2733d23f2ea9570c6edc933298572933010144ef07bfe6a7878f7367a76f2affbf9845d5b69ea3c84b885f9415e18e752fb1bf21d0dd9d9a2", + 'bgai4a08.png': "22ab23a3070d9f1316e8c65b333745e4abf6dcbe63d9d0ada7f6881604b498a92e5b49eb8c1e32f453f4319d94d3d0f48441bac2e79ea528fd7ace0dbbacea9f", + 'bgai4a16.png': "2b1436a619f91cf4045e18acf03201b5e9c7774fc77e4c3f38d668984d98543fe64978e80854f30adfecd89b71632945250508bea9eb1ce8e9145e3e55bdeece", + 'bgan6a08.png': "78d7c811c5463ce53a50874baed840ba70c811513e0ff98fda15a08f01ac6a7c7139a9979cb3688451af6b7e2981699be3c27a386d77af5e60d1acc9e23cb103", + 'bgan6a16.png': "e1ad0ed2bf5774b2733d23f2ea9570c6edc933298572933010144ef07bfe6a7878f7367a76f2affbf9845d5b69ea3c84b885f9415e18e752fb1bf21d0dd9d9a2", + 'bgbn4a08.png': "4fb9b1023c8c7accb93cf42bd345846c787735df01f7db0df4233737f144e2d5348afaededcdd8c2bcf2e53ce00e2ff095c91de14d7818b4b41c396ab85c9137", + 'bggn4a16.png': "302d7c02ddb0be62aeffeeda46957102c13a2701b841a757486cb3eec7b5456cfabc6ee1954f334ad525badc7c607621a72559b01ce338a0f39e2426d0a03fce", + 'bgwn6a08.png': "d380c477775d102288b43c387dbd7b931f85520f2f6151e3ccc5a25764169312d98fcebf69fb86d3d12520edc3de9bfced559ddf73366f0679e52defb9116424", + 'bgyn6a16.png': "b688d395552eb2a8506fa539ee9159b40a57d02c81860bcf76176213504eb10bdd89de7ce9da452e43f2a46c15290755cdc4816738620b27aed45b3ea7f7ee84", + 'ccwn2c08.png': "c4d58269ef360e42870cce5fb0b1134bfe5706f172c5ff916a338978798fc541a463ab4fdb7c91c424fa385f0ac5d6f576967f178b858d7503f609b2daeacb64", + 'ccwn3p08.png': "d89becf7d24dc57c931a8af1b9dc03ae10302785cc67028cec7255e1aa0ffb0d508d894023a98c10a24cf145aa60b93f977acb8231c8fee9d3f0934484757c30", + 'cdfn2c08.png': "a5faf9cfd284d3750ce2c2f8e15d0ff1bca09da4a9d46b8797c7a1a9f2ebe79d7a7a552bad3c3c049d6186460e81e1e7f9b94e7bb98a3c79d2516f6fb7ac6aa6", + 'cdhn2c08.png': "396eec14e76c00d22ee153171243ac531dcf7adad830948dfd5d6f0a84155734b90407e74f8c1ab8cfb0af5084c03f511530739751f8da070379c826545d0237", + 'cdsn2c08.png': "051b0defa4363ceb3fbc44f460f99a10cdd7c15797ea6d8aa62513b8b6fc5000fe542899db464db30eac56d0c9cd2a5d3778c6962f3aaa85a20881951a7f963a", + 'cdun2c08.png': "946074446fb99f0b790146df0f6e362c68e79b46ec7cbc4ce3d3dc9f75f66e58715caac4b3d7aa8fe8360c32abd2702e7228f9c03b4ba2a0d7f2f970a7ba8f32", + 'ch1n3p04.png': "6680e895195295989850129bcf9d0d0c47efca1c3bc363e4ea822c688707955cdcd07ae92e6e213ee388a62e14b51e036f9a9e075ad7b0f736b0cbc5cc4a108d", + 'ch2n3p08.png': "778ba389d9d0bcbe188e2501c7c1d047f1287179b3760b43da0053f0853e77a0575c7179a02f2442b83efa6cc0951b32d09bd7ea3b6848f261f10b8127e4b0e0", + 'cm0n0g04.png': "9e7e94d201a1222383294bd60e2627207b7b99c0bd80aecd677a1b7d8b372de4981b781fb794811d29a4b2c4db4f5a40c953039c31084f8f3de9aff13fbd1dc9", + 'cm7n0g04.png': "33bb0ffdfe54d655683e4e1bd6d963b9a35a6500129b5dd574245e78971de8d19f27b86a76d42056716b90c2bfc950241bfdc6c4b52ee0e125571de36ba61904", + 'cm9n0g04.png': "fd59386d15a1a324c5ff32f574484c1209afe4ad99f7dc12dce45b2a9bfefd33311ec93211fea3a8e61d1ad2f98220b0c15d151be304bdaa7f88126d54299f68", + 'cs3n2c16.png': "93ca3eeba9aef67de15f943fb2383d208ad1a68518ab78c9fa5ea306ad077b789e873f9e453f0354535167aa4e3d3fec715df05e827bf510948bf0e6fa0dacad", + 'cs3n3p08.png': "e8ddabbf0b17db03bcd7ff0c61d08cc971b3b88e3b3ecd2d4a296da8cf7d7708fa5b42ff3d5813d936ab7f5b4bafbf5842fa4c0fcf0cff15258548d2d26882f3", + 'cs5n2c08.png': "4e3eae53e8c27d4c58d8ad8cdff2c06b00a61d1528a41f5566694f10ef33c4a66f40d3d9fc247731c3ba6dfb734c9f2f90ef031c64486fbdf8a825e354fd67b9", + 'cs5n3p08.png': "31ee0f7f789c1203a9b0e81da34960a47017f3fce37bf2b711738ebd535bb3003ef60c2b0b1fca16587a59955c1ae24b9d186d7ead1d3ece6ada2bbfbc5aee85", + 'cs8n2c08.png': "11bbc80c3168f632deb4453f9199c7994255a0f4f2d7d2d2b06a00931fda4c56985b5a2ca8e969893ff2d65bf330c3d3148b80cbf72aacfe0054b612e6ae05e6", + 'cs8n3p08.png': "49ae3a9050487f6cae826407d421f32a8c67977dd057a6e36f1b2e1ec6abdf5cd46c8929ef4d7b565921ed6c9ae0dde89e243714fdf1510503c7d7b8af6d66e3", + 'ct0n0g04.png': "b6a66fda9ad82cb3287a1ef54702926204bbd4186969cdc2e0741a28dae1869ed76939199f44fd7dd78332753cb8b20a53c4bf740e353f2cc4247870cf576848", + 'ct1n0g04.png': "7cdbaebb6be5d9165972b5fa24f2b64ab437f5337f0548f3d212be8aa95e5dee6ff9abd76ec232faafedc4a41ab8825221b6ced2ecab81c1b3ab20042ceb81a3", + 'cten0g04.png': "648769788c3eb4acd06784dc428bab9e7868328aa3cfe3718ee6656e13e40c4502ca5ac1fe6d4baccb666d4a4f6b3a5d3c97d489f9919ae0d26c2dcdc62e526c", + 'ctfn0g04.png': "c40768807f13dee8dd80ab012bf82b7e8551cb20bde3c7b5c4c45ed19c764cb981945ef036292bd9a2838d34b1b52284295133fea326aea9fc391708bf1d1fbe", + 'ctgn0g04.png': "e0cb7a2d983f1c1c38054b02aabeec657e3f85dba3a52b4878798664c8c6db77cef84d01f042368de6e77cd07b7c2cc6e324aa70bd44c2c8a3642f0cc8fc6a65", + 'cthn0g04.png': "b8614c14bc8c32bb3b29d3b0ac9f3d04c0fcaa40818ab86866e2a8ba1e0c6a87a989f499f208a776d47bff8ab09bfa09352d52089b3cd5bf599faf27627a630b", + 'ctjn0g04.png': "02e2e0a5fa8054e7c7e1c583945da06fb31eff9a3fdd1a7c9f76ba3333f20ce60aec8fafe07f608e9d65a6543e97bab0ff8ae66f3995e8035c05a7c53168ca9a", + 'ctzn0g04.png': "ac35974bd1182e339327245ffa1c0afde634b3a67ee9d6e4e22deee983d6d31054e7843cf1720087b88f6510ed70276e9b0bf43deaf861bd16ceb166140352f9", + 'emblem-1024.png': "5b2e174847274069fc8f4e30c32870ddc7c0e3616a3f04fd41583543aa99ac6d9b7d5a63ed1da672c551b4d193568bb58ddac5e87a101b73367c7c3b01e36fa9", + 'exif2c08.png': "e81b85aa36c9aab55754dd8b73d42497c38eddf9ff3c2981529eb62993d8c0ab33d1b5146a350dd8a1c528d42a967733b2f86248ac615e0254fed53d66d0d895", + 'f00n0g08.png': "fa362f0262ce522297ce52bd7d18b1dc28a2eee3e099b4104c2fb6bdc3fbce0b70303e6df31b709b4033b41e8acec29c81d456c67cde741243c9a54f1ba17f17", + 'f00n2c08.png': "040e95e05152c4bb30608556c828f453c46253c7e0ab18984076cde29b5b6afea7b6658cb019a2723af02a5aabadb1af3b1190655256f3477cd54b9ebdd4df91", + 'f01n0g08.png': "5c60761dc803de1509ef33b4e0ee350d15488d73f4b4e2f93311beb19667626f42d91af39873cd078617c5a2e7c46cceb831d53299c3ff2e7486b43a02ce4967", + 'f01n2c08.png': "a2762a0c4905d05469178176966e86ed4f14c3fcf5c88336209cb923d76e73acc94c619947be87b9183afc20bcd002ab2cc84d81897ec8fc0a4bdeb02a2b7863", + 'f02n0g08.png': "adf640a6f60662ad1b47b5666d2ce86489c685284e50d47344af7cda37f4a42697b5e249f5140413bb3c3e563cca09b2693dcea8bd9ad9adad1adf654ce00bb1", + 'f02n2c08.png': "5f70f19d318ff1d9de4c2f728d83952b12b59bfebac213766ef835dd19f8214f56fa92318041eff25e720503542d067bc9fdf91d86016713c68eb1c52870bad4", + 'f03n0g08.png': "742efed3d25ada0449ed60e4fe1dc94abbe494870536946810cc0eef5c3bfbebefd9bb6d1a482cd5e2c2ee0f34a74b2ea796772254d05accb6739c1ab4d19cdd", + 'f03n2c08.png': "adfac7d6dcc7354467cb3f65742e30ecd44a09b5913ffb656664c9c4730e9cfab9c5e0df2ff8995d412b1ea9cd30ec061eead939546bf795e50a2d49cd10bf92", + 'f04n0g08.png': "9f229c609e87e6c3b83fa82f4f59d7b6494b70c7f85cc807b3611a12d5c59953f11c163228f2bb8b2e7ce77ad204e0da099ab06f8fc480d3ab0ca99fef83c23d", + 'f04n2c08.png': "2dd8b926d1f370b3d3ebaa982491fbe446f3c22b89e635c76eeab60c9ccd3ee7cf39773108d2cec647e480d40de88c4173369b4a12a3fccfba9e4040752cfb4b", + 'f99n0g04.png': "b41996ddf1b770d01900c309cfd2f96d6e60df8313cfda3585a731f32166aa447bcf66ef4af907d6417528024961408d06ca0894fbd6a63fd47ee5a9ed541b51", + 'g03n0g16.png': "02a49b9735063a4d1888b550ed961251b150794422b00ca3800ebba09cd55bdcba15cc8dfe0c41e5a99b2f4d3976b32b1cd08aba92f3dfc3960c71e28ec6cb51", + 'g03n2c08.png': "70b3d643218e033959c51279439d80982f338016b4355aff12be51e7bc59a79f5a5d519c0fa5f13db072cc667fb9635654766af2a11ea25c1b6673f554ceb1f4", + 'g03n3p04.png': "7bfab2aef6f2c04063c438a8f5cda38f3221892ec22a83ab3d3441a900b97c0a7184336ffc2e0c6748e4d931fc80855eed5d6b208ba6ac0709ef02bfbab3e8f2", + 'g04n0g16.png': "9a1d60c89bd63e1f2c81adf1ce7025b7f465e00f0c5142d8a67b5a92e2b042d41a352704969f237883e376bf50c911db196d46f8c28c30ef5763e1e717710c8a", + 'g04n2c08.png': "8e482c99cbc90e6e4aa678e5dbdc39f5b432d740ff260ab1ec04ffa199d97ed2e06491cf88eb0bbbda2f4133f174cf3741474305d9645e0268916aaaab43299d", + 'g04n3p04.png': "d95a52bdc83db74dd19aaa56b40bcbcea268492498c7b2348882a4a5ea70c2b258462c3d5cef85e5372188f21001f719afeb2fac635006486c8fc84b96cc4622", + 'g05n0g16.png': "75954c2e19aa2ba43f7011adecded403035ecb21595a5d116896d2bfc1b71eac42c9b6f008a748cd21b70004921832b3e0dafa1fc0fda4c51ad44cd2b4d782c9", + 'g05n2c08.png': "272baa8dc73cbd63f4fb9545288cfdfcee544e266c9074b73b401895188a123960a6000959f9c034f7b5abe2bfa5e6185253447bac82e9fbfa9634d7e9981d95", + 'g05n3p04.png': "81105d25df2bbbdce60e90cb9a7d0784326bc3c2857fdca4f1f3ef7ab301627685057b97b8d0c0c725d92bc0b48aa1b156dadf5e302ca35917f0b407689ba054", + 'g07n0g16.png': "cb6babe4e25f4cc7e0c3602d9f0e9e538f46a4c4e40420c29521799c528da31afd07b614ae64fbc0e9d0904c9f3e7395b31452abdc69c6a03bf1b5817035b669", + 'g07n2c08.png': "c61e8f936afda939d6497687597d3381485b7cc00716101fc4d6f3abf44df63659b762c77ee252a8735f8e0be0809961db17abbd42c5deab5bad10d0b6b28a55", + 'g07n3p04.png': "8151fa9e9ccd1991a05ea129a7363e23de80688c65d0554c7f3142ed7099d01d82d8ef122986693718f221202657ff965b1b6387a237b36ae741e3d4ea693280", + 'g10n0g16.png': "28ad93f3bebed928c3b0bb4beecaa1b1b55e480c7922d2a36c8f92fc0de012adab523c42f22871b82c6683a7ae74864ed1c35a76cfad92dc6692be0b78c22f50", + 'g10n2c08.png': "4b922386b48c0dd51aee3852da4e52c5c4f3eabe3fcb000e4cfdf0c0e8b27d6a6f77fed944932726fe884f468ac24d89c5c46d65db99be1ae797bc4bbee4cd01", + 'g10n3p04.png': "9b106a0db8ea7e4bc3876beed0f13d83b6f3d6d7d7211441379dd8d18db080f5dc81c6d15312cc3c8ae569b991852ad48f167229dec033f1a974d2a95c83cb3c", + 'g25n0g16.png': "0910ee601a4c4cb546c3bf2b5e8a799d199e34e1434c58c75ddad17f2b295920cf3dde9fe05eee19689705f76b11474b4edc73f4ff346b6ab2d02ec40a13d3cb", + 'g25n2c08.png': "080ed57fd4185c00c6c70e48c27612621393a6ef3987aefd1481611f74d0aebc58d1a90386e4e7bb0321eca961e97cd403a7e727f7324196c5a3cf0e07bffce3", + 'g25n3p04.png': "1deb4281d9792af858e715c39ef7e6756f3004845d87f52054efc9f02c679b2b1b6c2a548a5e6a3f31604b115469ba4bb81510470a47ff9a22b133427375a8db", + 'logo-slim.png': "0104624a95b1b8a97bb5013927cb8fbe330a8c9e7197814147702702cd1d44cdde956404786bb0e69927c6b03ed8031bab566599b1291b995ce747f7cb2135eb", + 'oi1n0g16.png': "40a96ed10ad5cc58180701e0bb6d6f36c1752c8b8329a80be2960535ad9e168469efbd8f3dc825b57bf65e78a3b61835f19697f2a22511f79c06ce2c6a0034c0", + 'oi1n2c16.png': "f6b3cfbc70ae502edbeabde828823dc079dc4e9a586a7fc326c70caec3033124121e3ee2e6481e6ce966efcdef9376cb3ec3edb8e677e91563f510bd6f6e83e6", + 'oi2n0g16.png': "aab1bbfc7b711ba66260985bd8bda6ffaa1e09a0a546b2fe8869b508d823a9e5a412ba6337355a81d87f010e9db8c95eee5f5084b21ddd5cca5d7db7725603b0", + 'oi2n2c16.png': "8d1dd257f3b1bf44ef0bf38338a1e3f2ff78670ac779959751a56231109ca1ed82414f50a221aa45333263073e1e1a950ac8df8e5318e2ed695422d49400c540", + 'oi4n0g16.png': "7675dfa4cff547c3029b21cc892b90a8647199dc9290add932535b04b4eaadaedbc338704f98a075f4690b87815eec8cc0f90a3dbaa2a7809aa03f238ebc5815", + 'oi4n2c16.png': "66313c9d4731e2a9fa006ee9e43c6ac4a3034ce2826c6213f67bfa349bb8bb3cfd8acd2c4553fd1fcd4b2f43993a54539ec8b7fb7f07b3a406adfe919f17b065", + 'oi9n0g16.png': "5615cd4c277be96b21031827d08c8fb2971fda090a0031fd34594f77f7cc558bc68917542597a32bc39c0cd29f7759f0f0429203aa285c163bba8c8f78894e72", + 'oi9n2c16.png': "e2184c00b952a3aa53078a5f995715fa683718a9cbe42705fae3a7c77b236ee6ad706f6dbf2c243aeea17e2c53e84724907724634545e065dd16ff400f5677ab", + 'PngSuite.png': "af1d473e986b3f5cb1006340f8f99156e980e2f8c9f804f0e27c57a51d0dec332a81d99c6e50162f63792d89da44857a6072f8431aa735f1e8f86c06520eff4e", + 'pp0n2c16.png': "82ee5674861b5f9bdab6cf41910d980fc33b5188e191b8892b051dc3b3bbceb4c6d421cbed7bc9b71a9a14db43991c0458ed2cbe5166939f1cbb1e20e445e8b1", + 'pp0n6a08.png': "71c0d4c87b6b2644a4529cd240c8d583c25d45e79fd8bb71ca850dada37e46571052b2da28b926a8194169b82da505c9a3e3a701816d91ac968ad6ff41132b70", + 'ps1n0g08.png': "b273e94c2f826640b10b27b50c605be06541b397ea1289be6f4ea821dff6c7b4b209ec8817a315db442de04c975b7cfecba07b51c6cec965ab9062c05ba04edd", + 'ps1n2c16.png': "833993b81801432eb3a9dbca81f4fdd8ab720c76f8d99a2d298fa1dc4ebd19759c158dd10a68f690f999ea643f62fb7e779e916df86aeb05c43bc4db62aa520b", + 'ps2n0g08.png': "4abea03946d751f03e1438e5987ae691607e528c577db52e893051b54a5d147969dd965e44aaf5540fea75baad873327d76aa71a07c81de31f04f3b781d01e3c", + 'ps2n2c16.png': "bfea51d7be49c04293de034c7649472d34becb663169608490916795fe988df7b812ff8950a3f8d896ee27756effcf9fb525d8d455226cf3965595ee85188581", + 's01i3p01.png': "18b405c902977d2553aab1738a3c00e602e40d11c121a7007c9b7b4cc499aba1fab12fc12aecbdbd5b5cd2638ec5ca5157b5d8fce5dad3cdc3bea02b0904c9cf", + 's01n3p01.png': "8e3e1c9754ebde8c687355b80eee4bf0e0ee8e37b39b784f1997cd2eb60ece7f077b40c8027b0d7f4b7e8f242c22173a244f4e599db33985187439bd918d4486", + 's02i3p01.png': "3e26a8cf35e3df1650adc1656f2d3e7c9b5e1c7932826cf792cbe2cc538c1283ff145f66e4682d459bb0b4f2a2f9ce7209f1997e336e06ca49a83f75270ccad1", + 's02n3p01.png': "d34685ade19ee550ba52e81657627832cb9ba3655f6fe336ebb5fdc4d35c380e819efc1556e1bd1ca2b4e456727dbc5312eb513e7254dfd057a25963e57f0ff4", + 's03i3p01.png': "818a2c91d6c0f96b13806d945d1fc1b4c64f17a9b6a2ede2658c84e20269cd80289312a163761165f0d99e1824f283844f1b4696af314c05714fd349acf7609e", + 's03n3p01.png': "fe847a62eb64bf9db4d9751600b19333f057b626f2f2eb80ee78a3374ae562944c2ebc9c2712f3bbf862798ef9205f38297cad44e8df5dcd96c158ca2e9d9233", + 's04i3p01.png': "1c63332a0d2f31b3a6457038ec2b8c5b4bd3192320fb1c44873947375dcaa028ea07151853e53c6f3fff6878cf90adedea35ae819e5a1b2dbf92399b29464d56", + 's04n3p01.png': "1312d9f3e5bb07b6cbf0c6798c3ae9b0a6cebae465ae6d4ba115ef585616b3b1f7723c6481fcfaa00626d6c62e4fbff7023faf1e92eedeb5354b9805542d43b6", + 's05i3p02.png': "13225a16a79579c4040cdc03f11c71d8589ab322a4f3926e32d9499fe4ca8503a43870e532b2da2597a6c3dd89c3904428cf89c25a8637d40bb3a353017cad5e", + 's05n3p02.png': "d07f2ef30c06a29b9c5c6a52ce1485a3bb9dacb5f119c2829c4cfd69c8fa272d6065eab21a5acd016bdb4f4c724214e8a737c2b76e0f0151e6afcbe5586a37ad", + 's06i3p02.png': "b386f0387e8496849b6d325e710440f7937a403b123886a52af8327e69e411fd632db19daaecfe2e712d49279630515d7217533112acde73cb429e2cfa465b63", + 's06n3p02.png': "df0968c77975f350a86fc09c047d9e3a0a2b71890a0ae67bdfedb23e7f0ce303ff883a463668e10df1dcf2e57cea8cf1fc7c836f5d13a73c1ecd8d66284fc0c5", + 's07i3p02.png': "0f67816f188ce11f15d0f345d2695f1920a322d84be3f332d542c5d20d10a9cef2cebf1e8ae778b25677beeda229c06221eb3450b851ea0e8cd102e5cad14e66", + 's07n3p02.png': "0af60c935e2da2a8a3173edf614085ad0df095c882a140437bdf93ecd5494cfeb5c068dc7ea4d49e181c67d26dd9cf8c969bb2d95f2fbce212ddf5817dd7f642", + 's08i3p02.png': "3204dd0879b6b1284f197a0437e674c4280adad180d4a1d37dff1555be1924d6234dad5d02266aa575d782c53fa52fd4580d452482ba939c732c09709075306f", + 's08n3p02.png': "135039621ce2079465ef49c1b7e5a5aeab299993d2bac864d822ff0669843df1e733a729ca5226ec05c94ddfebdcb2f4b78699fb3adb741db993d9757b4ca71c", + 's09i3p02.png': "dc4d8ed06a81fcd604f949f43e7d5f482c3ad9efd113d220b709de38ca0ca1a340f4cce7e929ca6323390b4ea7c4399cf2f1f2e34c1ef1b38c8296b51d7e8f4b", + 's09n3p02.png': "96b8204f7008899993d8d277ff42c8eb7c85e7cd522cae2e9cf28b8e10e3904c7ec2e3227372f397f6c5a381875dd747a42409471a29ad5049240417ec1441f3", + 's32i3p04.png': "a4de495c70f54eeccd115492a0dfe1cbbcf7f308343eacf6a57515d7a248b356a2639f5e88246d630c8713724cfd7ab1d5d388c677f026a1c5c9b4270a837c67", + 's32n3p04.png': "757009a2fdf19d1187d85930eeb4e75c6831387348fd8e618d1ef971c27d2682b2464b4160a743a6c6d712553fd7fe1f0e5d78226e348f270093495297ec83bf", + 's33i3p04.png': "19259eaf76a42fec949a21c4c55715247a027c2b59ba4bd0f45fdea1f3406cb475c33213b662fd64089b697a6cd25700364f76923dc2531fa0b39546242b3356", + 's33n3p04.png': "3f42b5f3896c1a47fe5dff9921d56234b4326dcffb70a7c6b1f0e7193a6f8f898438635f3b1cfef92c59d7ab827e2a3f40671d97c8547c8e7063a0076c97fba9", + 's34i3p04.png': "db0f7fe138fd732eae4a5c1b8d013167eb3be4afa86141b3e6ad096eabec67644e3108189311b3ce2c78f891d1ea7f5dfa1c30be59509edf123696064eecd00c", + 's34n3p04.png': "e35d9338637ae4c7a1c74a0e73a5c4ba405c2b0d36efd92512b7572d418c25e7d06361be2a8d16323c2708ff3921da24b76be5a41bd3cccf09c27ad472078261", + 's35i3p04.png': "9f0602e1160b81c2e88fc30daf295ff29c4f6faa5a3391c69d895621e7ab76e2071ced6f5a798e294f69621bb32272070ff4ceeeb1436b1cf03640417961a9d1", + 's35n3p04.png': "f12e6a7364073b7a010db0cf952989f5f5da20c592b0256efabb5e82e96d928dce7695c2a0af0749ddfa2739e3ca985463eb0f4a7fb6b8ab0638d65079fc6265", + 's36i3p04.png': "a2d0374bba6fb665deda98b1bd0ef767243b7a974b9f00c78d54bdbfed2c00decf6faef95816ef711efdc359247142be08ce2b86f7860b7384948ba394b4dd21", + 's36n3p04.png': "e200a6869dba1fc9e2eeeff6e686e02313c366a990bfb5582f66dba486251392a465db03806092543008e1130624f1d16cde61613d0ae2a9589941f69a1608db", + 's37i3p04.png': "555f1f7ec2d8ddb58ced7162a4dec315780be13b7cb9ed6d8978046c7fbcb91b4ecf6fcc5c99bd5b8b8d348e4cd202d882a31dec1ecd25156af8968c4a06fbff", + 's37n3p04.png': "d28b3f442b481214774d543924ab07b75fee5916262e6404992962184ea0059ca34fb32d14076642ecd83a3063966ea80676e3165759632782ffd844702cb74e", + 's38i3p04.png': "d4fe0179effbf28f7d28c0192de614512870367cec14ca04d86eb9fff9d6864b1074a68144023244e46cb69ad601e81632c36eb2ed307a32a3c37b7683f882d5", + 's38n3p04.png': "19d23ca8b9b44d26bc9173a69d1d8332e4e7b2ce6e6422195e71dfd0701158023253b130a831a035b2fce0a1556004e8de74e893caeea3d12410909e6e649831", + 's39i3p04.png': "f0c783232707d288b086398565918079e510677742bb5dab09b4520687a06809ae328d24508ebd8f5c26cf85105300ba98e55c29e3773579929839ed9ddbf7fa", + 's39n3p04.png': "39763c31a17edf2751442cf45ae3cc315623ed5b04141bbced2ee8d233485b2d1a2cc0678d60a1c84e3d89a7513634bfd9c82b58754cdfe95885f7a54ff18e2c", + 's40i3p04.png': "d33b29e6669accf1325e8212c555a6cb1d8413c445140aecb62eb6b40912743ef7c6298ad4bc2e232bc448ddaba37f79fa4d25e0cc8e3d53a5ebc93f8f984555", + 's40n3p04.png': "463eb60a2f0884fc368ea0650c5b7b6469c1429e5f006a6537e4aac721094bbd57baa6bcfe4025939089e27b344d7077ff09618e9ce3a5bd40ee3fe5a0e33ce0", + 'tbbn0g04.png': "24fb55d9fed351946869552edb15bf20a2e7a050094ca4b51ebd135958f8b77401e0e9b18618de0cbd18f835e16df24dc57ef094d3b456f0eb9f73c31748ce2a", + 'tbbn2c16.png': "ee98ae3a1cb4a851830ee3e8f4112d08bd74c2a05b778ce51102780ba9d7170c5200c9cc4e1a5c0833618ebe137595eb8fc0591b8798bb6e4e94c234f8cbba3b", + 'tbbn3p08.png': "ed325815b8525d3a5fa37c968b7c85946add7c08abd1c66d86e0264951cfa5a377078b910a78cc664ec2c43d352093c2609b8d01c9572f4ba922d98264e55c04", + 'tbgn2c16.png': "e6da4190d4cea04b0002d598d68c0536448899dd8fca4931b44bc8ea6d47e6946c55ebc5d2049936db2f7f52caef124648d25a360e838571f5f7cb2795eb3657", + 'tbgn3p08.png': "865358d285a8d8682a16b050d9c1b7492042e1a217b0b5753ad28ae1a698dd77150f8cd6510f345157e1efa1411b4e4d5938a81024c150c9d5e76e423105d9c8", + 'tbrn2c08.png': "cc3cd3b8b6cc9920914e0184bdedcf9e59975db3f99c39b93ea1202cf6e11689eb966fc40ae2caca8ef224a8aac03723142b58b701ca2a02fd73a62e379f7a6b", + 'tbwn0g16.png': "fa8359bf8cdac3ab9ac54cd4f1e96b1469ff3e3494102be179b5c7394a4e37953ef54f5e1ccffe771b4f028225ec164b410b0d08f82224ed93a654433feb14fe", + 'tbwn3p08.png': "a0e10707fe9df085596a724561ba6c80662f87095ba479b2345c985f4beb2933f7767fe3d07b30002591259dc14012f4b26fa9b503cc75fd644def7c27c9f2e6", + 'tbyn3p08.png': "9920b40b016c4a05a094c28a989d06e108e2ebd5d72c2a6ddca359b68ad95238b0b6dca0f60b78c56b551a2e44f924d5a443071bda6f6e31669b0a78c09b18af", + 'tm3n3p02.png': "e9910a8ccb78a10980c55c6ca7115757b48075e42c14a83aece92a7f85eee538d5e1d9301efc443a867628993ceff1c13aebcc574641ad85eec48ae05df9997c", + 'tp0n0g08.png': "57fbf8a07060565c23918420952d1feb506ce5b1bdb25f22d41ee1de4ce9655c6dde04b9643d2491b59efba229b7e0cacd6799010a89005802c28a300a4e578e", + 'tp0n2c08.png': "eed3f6c18bd81d96870a47c737574746293c71c517b6a5ba88afdad5ef89fa30d975717f8a8f84ec16cb98390353934cbdd6e4b099e86f0ca3fe8d50fa07bb11", + 'tp0n3p08.png': "9650347d0f4a1a6596828f48766949947148952c93c4899541324a48289ea558c5d7bd1a076ac0e32f71d197e478ffc418e424c52b3fcacd2f94eaae98a566c3", + 'tp1n3p08.png': "fbd0f987d98d96f85679ec237c05925032e8d7783551b3f3cffb1b7db6ebdb3afb61214460386b2a3a011826bbda8340757ba22727325eea9fe518c136969f24", + 'xc1n0g08.png': "6aa3e16f11e82378fa7d3767a785840960f2c152338374e3f64f94eb0799e1f29637a1a66435b6dcdbffb9208efbff65a70e17e80f1e05b3038a837dcf79312c", + 'xc9n2c08.png': "7e0d4285bc67345e092656f04b235b4fc273c7892e26dea339dc2bb8df6348d8477f7e6573fe4f40ede1c94b49a60d46ef47ff4f7327fb12cd6de3737e8b5e4c", + 'xcrn0g04.png': "f971b781eb229ada882bb333bbcce956740f9761581d68ba95b49d998b89499bdd4598c4155e72240d6a5b74c04d7081fe284f78fd3f85f2550a3d2171f6efbb", + 'xcsn0g01.png': "9e1d234c3775920546ab9f9eeabdb75457bd823d48ed677fdfe61a95c02c65730182ba7e84209bfbf59de5d1bea533ca57c90ff6a49ea6d5749636f949bdc16a", + 'xd0n2c08.png': "6458d4b8f10a01ff86207496fbf38b25c35857cc537e9e11085fd5fa7befe956e707e6c1c61bdd76a393a816fdc916e2003fcecf5b33dfeb53c4bb071110eaf0", + 'xd3n2c08.png': "fdf261941945d1231ff3b8e91db063ac5a52e8e56f1fc80c5c51149ed255a4eebb4351194d76ae156bdff1eaf5180184c2aa2dd27e4129498279360e00d7db4e", + 'xd9n2c08.png': "b7a3a47c0863bde4ae8aa5ef5fe5d43f8e29abb413dc002553b63d6a4c1fb79eaee66011f1f45887c218aef3fcd63fda847a1b1bc1975252c3b4fcad553c7b70", + 'xdtn0g01.png': "788ed6f9e7ed64e5f4dfa8b62dd88f6f37f7abd1c8e3abf4db2d1c46f0344e7ba638f6721e69ebffa19cf6536f7685f485e9eb548a3cae55131963da05950acd", + 'xhdn0g08.png': "1f06044e4607902e7bd8ba291bf2b9bbb855a881b4a7dde6a21e9f5f9b74f0f43f55a8aa31fa6d1c225d0dc891744943c1544aa17836b3ecf900f041b1cca23c", + 'xlfn0g04.png': "bf3467f8aa9d35f7ae17cd59c3b2d5f6bf110b71afdb3a501ee88306647d669e8419e78b93b995651193a9ff99c849f82530a0bd410cec445feffe36c8df8dd1", + 'xs1n0g01.png': "d1bae1e471886f1661354f23b3564a34c9e1b076bd158ba129388aeb1f287d39ba647269b955bf3cc81f2b962ac6a3eb1a887a8c85243574e84778e48096cf88", + 'xs2n0g01.png': "abd509aa6253d8367980e4f6f4d96bb4b3732287601a7bd3dfb0fa4c70dc3908937c16e6459961421409c74f9952b4693ed1d352dc002bd120a57ba5407cac1f", + 'xs4n0g01.png': "015a1bdc1f878435c3de87feed442e467b3c96f3db3134d1e23653b6759a3a3d68f05325d15992ecce18ec5c00cab7e430c1965ccf36b434d8c9f9a4e8194bfe", + 'xs7n0g01.png': "03dab5037599a58f25dcbd1be556ff60dba08ed3e0e92e5791c53e98041b0ef174a9ebdf75fd997696521ca96a19ca1bb9a5eff929f1a7c0dc1a7d3598d07d04", + 'z00n2c08.png': "9a65f94ebb3614b65e093534a7763f55687144fc9a82e2680e7cad9863d72947a0de3dfe57468e11b578234b8460485e8ee895c681c391d140d84b15c7a40f41", + 'z03n2c08.png': "847fd249d190ccd8ec54afc910afaecf007db7ea5753c18eec8de654b159f4cdf99b70bdd55ec276ce5340fd2ede5290468fe4c6029b5e4c0825ca881a75bde3", + 'z06n2c08.png': "94268c1998de1f4304d24219e31175def7375cc26e2bbfc7d1ac20465a42fae49bcc8ff7626873138b537588e8bce21b6d5e1373efaade1f83cae455334074aa", + 'z09n2c08.png': "3cbb1bb58d78ecc9dd5568a8e9093ba020b63449ef3ab102f98fac4220fc9619feaa873336a25f3c1ad99cfb3e5d32bcfe52d966bc8640d1d5ba4e061741743e", -DIGESTS = { - 'basi0g01.png': "b5008fe99ddbdda3fa01d74af76c174f206478cc58618872da5231907a026ee3e5a2506ad3575edd9a395bda4632b6927d028a42121a5675a329b2470b9bd8fc", - 'basi0g02.png': "d10ac5a9eda33b2b0061c6b15ff5a95c300a2eb7a600db1e2b03b60b9fd36caadf2bd6e32ae42acc5e69ac63abc32d297af0716f654db77897e7b9a2ee4e2b48", - 'basi0g04.png': "7319490d96ee805acc86ad86d2ef5e5219320519cc29c6051adb886b242e1a29dce8329ddf7483a24364acd03cf6b51c74f0783b363bc1358a1b9acf080b2664", - 'basi0g08.png': "1d91e7b475e0b5a9427101fbc7369bc024b2748095ba526ca3ccf47bb22478d15e5df61ae0449ee85f4e2a8ef5707493ec60281ea691bfef2391e21557318e44", - 'basi0g16.png': "47e5694a42bbcab0b2a0079d17fed0b7a296f418e818be24f7ec77299469b43f63145869a150fca5682dc5de1315b514cd775022f306cabe9f1a7c6a50eaef92", - 'basi2c08.png': "a29fd3e5d8ac542b907a2b40800a8159e62f12bd14125f4d103407f012f0cfcaadcf0c2afdcacf928201e06362b887b729b4f96b5b17e23fe9e6df381b2494f4", - 'basi2c16.png': "c6a65d2b5b07c9339e799564443865767d8530634b590f11caef74a2e8764516d63a4cab96de0ab6941bb877c16eb913f78e0d9135fbbbd831719d079f0087bc", - 'basi3p01.png': "661d31721f82c533e0412f327d67cc0590a82501ccf2addeee73d42f91307b738d5bae612f4a7227779a08df4817502616dd92c7d54706bae150df6c1d1213db", - 'basi3p02.png': "abf601db3a5cdb94688da772e051756dcc4d14b744812893be8d68b8ad82921c24a55e8da528b5653192de74217a6ec886a44d162ef35abfa2f056ae989ed02a", - 'basi3p04.png': "cbd9ac744036bd94ecf453616fd2ca599c9725c8b1600bab2453f9936979ead1dc3aa0194383811cc87ded45bbad5a02af48e8d060f7945ad1fd68cce7bc3e31", - 'basi3p08.png': "17d7b42a7a5eda85305a566a05b30f1873c0f76ed26b7211ebb03e4d806f7c7cc1adc00048e090b9bb4246769b9732f4ab84604d4568456f492d5dd048e75db8", - 'basi4a08.png': "1b697908e8cbdc55c501c2bca48a5314540d3b74ac395556846ceeb63a5511e4552f9f3e1227ba36516bbe6ee157f60c2fc4120f51dfa1307c0e9312bbb24b14", - 'basi4a16.png': "24685550d46b2a420b906ef5af1f9efac058b6a8fee1aef35f10b9a68475f4df6cee1cbf7c15169a333012bcf5d76755fc795dda8799e9e58966d3e9ff4c83d4", - 'basi6a08.png': "bdf48010b049bbc08e35050b0bff0f2c91a115b095dc8d4ccd53f89942046aec2c9a81c3ae0ff8eb7b3a2a3b0cf6bf88cde6b02262efd5c0810f9ff5b1e3d431", - 'basi6a16.png': "64f6a1bdce69f6b9f0946fc37125be638681a134de895c7fb7a107e8fe6222e158d94fc80c99756f4703be5c4b413f9fb4c7a30dcf7ad6ce91a45b18bced7237", - 'basn0g01.png': "7bd2c8a317e41d497e899958bc023a11fd7a5d77f5655762d92b504fff63a57d3e743eeae224106a672dda921f4947c044051344b06757dd0c26c2eb82d1bca7", - 'basn0g02.png': "a1b04ae6a6c7476f223d2423f3851efdc237d4f86f94c008a4caefe23f3c927d44e4934ee798947a0ee0b3fd95fd98f1c5070a2bcb82765bb3015fb12055253c", - 'basn0g04.png': "b011cb0f75a0fb72da15794b67e8520a964cf5b15010e3b831fb19640b4253f034bb693ecbe5d71c8352adc6fbd749847b7df582f2bfd9d7a03f3973398d8ab9", - 'basn0g08.png': "814c2036b0c13bd043da94fbf3c98d9220f410387c0d295e1b0087f782e9f0c2c21d43b5e15db0c652069a0fb79f4d83e7178ec9b65b96eb0baed8949890239d", - 'basn0g16.png': "7daf56e398e9801bd0be5904b6e22ef87c574c326037af180dcf60800a3ffc0ae47463ddbb268396e3121bba8958df2d208df2d442e24c363ec802d2275f6337", - 'basn2c08.png': "3ebf04d33f8a07d01565830db5d5026370f803fa2f2bbb72708c9af5b29a5269880d25f0784e183d68527a74e3ad63c2dd02c7615888cb0674cb08d7b729d933", - 'basn2c16.png': "ed7cd6ae047bcc58844d69cfb918a40bfb999bdcef6353e2dfc33dd041378adc08b48c9baca202f39d83456f1752727db82f4746aa9a6f7fd243afbc5eabed7e", - 'basn3p01.png': "52418cc42834d521446dc8863f61c3af0e409e41ab7b372204af477d1df856bd4fb65f060f6358efe1b011fb7e26f72b573721e57fef637d015c56fff8484d42", - 'basn3p02.png': "37afc5d1ecb43635e93a699dd4a22089fb096715deb327864f182cece0ac2df1b561a82c758a2a8e5baa9d296b90af90fe34b4de596b2eb113af0be2934ad2ba", - 'basn3p04.png': "0e9373728af095033e577cc63c5638d0cb34fcda44d2cac34789fc854a3b75a89fd5c54a62118d9e5bb30f57e834635350d1b7a7b4894481b2cdd87f6216380b", - 'basn3p08.png': "1adebd9dcc092df2ddce0568e66751d31cf4c30a2b580e4dcd5e4202471a69d78e7c89c4ecb4fc610baae68df9120708e512e900c075660ae45317305317ac68", - 'basn4a08.png': "1557ad77873b34bf5ec3e5508749b2046cdfa8f95c01073e354b2fa3fe89432459daff7da8888512050b71e79e0a2f97bab1d80f2d3a387f5e2587b8c0334455", - 'basn4a16.png': "35e69781cb2c278e594b098f75c659ad01d1b5d93e96268a49a1e27fd811cde499c21b696e9de43f5a7d451b3313c8db7e63935ee1caec9d45ba113f4cb423bd", - 'basn6a08.png': "ae0e18af14740ee1fb0e5e4036f00e8b323f1b86078c577fda80fbe44ead15fc6beeb2069a787e8e8e9a36dbc5018fa6412e99889c85b8a3679addb173547649", - 'basn6a16.png': "3b72b89fef39df23e9ed606d744a4356f3b5aad7c62c723a393882985ee849ab5a687fb4423120ba6f1efc62d916e8f781ebb54f7aa99753569bdae59fe758d5", - 'bgai4a08.png': "1b697908e8cbdc55c501c2bca48a5314540d3b74ac395556846ceeb63a5511e4552f9f3e1227ba36516bbe6ee157f60c2fc4120f51dfa1307c0e9312bbb24b14", - 'bgai4a16.png': "24685550d46b2a420b906ef5af1f9efac058b6a8fee1aef35f10b9a68475f4df6cee1cbf7c15169a333012bcf5d76755fc795dda8799e9e58966d3e9ff4c83d4", - 'bgan6a08.png': "ae0e18af14740ee1fb0e5e4036f00e8b323f1b86078c577fda80fbe44ead15fc6beeb2069a787e8e8e9a36dbc5018fa6412e99889c85b8a3679addb173547649", - 'bgan6a16.png': "3b72b89fef39df23e9ed606d744a4356f3b5aad7c62c723a393882985ee849ab5a687fb4423120ba6f1efc62d916e8f781ebb54f7aa99753569bdae59fe758d5", - 'bgbn4a08.png': "4d9514b3855a026155fe68878280c4eaaaa76eebb1cb9009536557e9163202961b96ea55a52de1c3d03aec85fefbf8d77b8ab63342ef2077e6714a3bc41e4e48", - 'bggn4a16.png': "8f93257eccfb9457f6e83e0ecb67afbb5b0d5a222c412cf2ec0c7c8024b78f56935a283d66dd8330b60c9f9cbf13e06cd38cfc8805851356e5d4bcd0e16d89b2", - 'bgwn6a08.png': "0ff6d2251271a9c0aca98fe9aa6ce9395c65572af64a2280769def7a2ae58a1db6e3c087549d8109494faca0d3ae0cc613c804a9f2be5255f09c12fdc18a5a76", - 'bgyn6a16.png': "b93d2f2aa94f3db768b0c30fc426541424f8df205461165f70bb5e7cbec53eeea4af627d3b96df5dbfaa9a2c21ccaf51431958a0b970355ca6ff41271d078873", - 'ccwn2c08.png': "caec91fd136b873387ef1e236f7e9791c1ca5aaf3c055b833a34821db1e9a7a0b2b83ed4b5c3ba4d208f5ca2cf9c83c7a876eab3fa1cf29c8046239c09e55803", - 'ccwn3p08.png': "b912871bc3e53ae4c0f905a778de329e813d7965a8706bc7487cdbe036bec0d9cdb3d890600645f0b7fe95e6d86bedbb804ec49868643085378c5f1db1c1b6f8", - 'cdfn2c08.png': "92a9dabf65d9f233d4d2dfd857328ac55c0bd8ade18fd9e624146f891643865ab7b030d85e124f4242164e27ad6fbbd85ae6a882594c57795bd06dfb168b817c", - 'cdhn2c08.png': "58beb4d5e967810d3ee90b7d1414cc6cab8afdc7e2cdd2e34bfe54b47df772fdf34851bce8ab7aa65d47aa16046bf441c905e20081b6964c1942e500667fb467", - 'cdsn2c08.png': "0657d6d4e7b937b9043e99712c31dcf93de675d30d6535b6259936cb8efa388d1cfda1dbbd22853778aa80887895bf37f77dd3ffe019d2eb8158b1b44ee16a1d", - 'cdun2c08.png': "2cb39c65bbe59eae788cb049e1dec2b36fe6c4ade18eec6045430fd5580c94742302d6adecdc07d0ea8bbbc6d35cd3077425cc2daea51253dd049ea284d76cfc", - 'ch1n3p04.png': "e4bec9006f5d3802dfbf78293b00bda6ad948d835c867d884a365933508a214dc50ac9a39c497c5a2c7d65acc8b8882bd121b6496e0963be5ddd8a4607cffa16", - 'ch2n3p08.png': "c05154d4739123b9cd826ccadf3f3fd47c3ca22d5277629e66aedf1dbde1ea277e3c9706dd28e925d4ec918834db427fa5558dffbb26c96289c0515fcf31c671", - 'cm0n0g04.png': "02ffc2cc1d47c0f021fc96b9ad2e33cc2e9c6ba3ab3d00a2ca6af5ef848bb4b591992fea7f5d86adee2cbcfb2a7d4dc8fa6cacbca71c407c617b33b01580489f", - 'cm7n0g04.png': "acb49a0f404ce72b6cc9da02e7ca9cb6468c1b22ea62e634f382c4c57eb9add446e6fe5901a9b5939c7cbe5dfc748dfee415a35f1567cab4bb86c3ab85cdcf01", - 'cm9n0g04.png': "6d57e85db5660d696169a232e26f010d19dc523348cdd59c4668e87ae828a302dbeddab170fbea079bfc14071eed7e90a9d994f52ab04125bd7448b16aa646bf", - 'cs3n2c16.png': "f61644100be9f49dd0e6aee29c587f2fe942abce2ae0c9c9807f092b2783d4c3f6318a941cd74c918bb465ca4fdebd5ef6fa86db5734c717959afa3a0993437b", - 'cs3n3p08.png': "df0966d891ab1cee03e2a4130d4bd32acf7996bc7e568fd646221ab1bd0664d0c6b3faaa1ec77240f4496cbc07e89afbdf8aa5ff944be0b686a9a4987e2b1081", - 'cs5n2c08.png': "cc99786013c1281b0738473c221b5eb5d6c84c467360fe9e5650df648b8efffe5f533bdccdea4e563aac70feda9ab9362a81143fc2dfffd5dee35a78ec57c74e", - 'cs5n3p08.png': "80021bea80c627a9e35d3770fbcee0b05ff791b595dcab8e1a7ccec5003ff5c4abc44a026d6ac4693388c64503b64e6cb2b882662d78e8d62120923810e4bf74", - 'cs8n2c08.png': "42bcfc93d407a35d3209e46ffc4c438c08a0ca2db15fc112fae93c4a9ff82a1e889ebcb8bb44370dc855aab768bad450dbb575a5807467a04cb26772e24bc873", - 'cs8n3p08.png': "a29a7a569a9fc94cdda8938e0acb09f9781f52d326ae57318b25a82c0652e30307964c900e8033dccd3035eeae0df3e8c6bdb88562882986fbde3c3a173c7f39", - 'ct0n0g04.png': "24405bcaed6cabc6be73061e80f4839a2952ce69d843f6a1c47cb286eca76f82cec6d65466eccc4a0577cb6a4923ef43d3c01ce5a63bdaf3731b8118a686d1d0", - 'ct1n0g04.png': "fbd0b417257b38dff4a5cee2c004b9c79bf9fa72ee16b0452468d802f46d768c6c694ac270b00fb0cb2b25b82ee6a53a87f3f961263948474a47409fb94d2b21", - 'cten0g04.png': "8c814e8f51b6aa37adb66138505cfb6b878fff482f096575b43d4a1d68fe64ee733faf4b8c4d761daf902403c88ec2b561a518d762f30b40dfe980b9d7491b61", - 'ctfn0g04.png': "d2d98415cea47d25b23abdbde300533c501a8c4bf3ff76d6e126a0306b9c80026059a07130ea398b7bda825ae1d338106dcb855e3a55e25d38d4a7ac76c3c390", - 'ctgn0g04.png': "d7cae7fb860d12c068753af903a3d045712dad6d98653d6e9ca7527b26f3087af627b0921be08a299c38f6b76e268197b2b0f5c01510c69cb97ec7e0e08cacc3", - 'cthn0g04.png': "8587da6d046cb8d2fd706a3ef656532c7a5837729b574353895b7d662052bf6eec2873cd38e7299756b12aa0b7660a8d9afdcb0f0459433dc86a21b564b7a8fe", - 'ctjn0g04.png': "2624ba67fb5e52156575238be129649fcf9468a836e4c53bf1fcf99963f82c9a98b611376e0e85188564489ec135933e58e8f01b1b7967a15cf84e401ad504d2", - 'ctzn0g04.png': "cad58005a079a80679649eeb36f97f9dee9f4ff596e84fbbbe3d66dc9d8184c89b8fc88c99c04f1493f55a82c2f73ec33bc73b4f356b08b47e24ced6b6dd30cd", - 'emblem-1024.png': "9b7820be0cc034bda7a13960eb5e41b61139e5b80b74e612e5711f6bd59ed46d5a7e59b7186ef7aa76da5a47314426d6578490a3b99aa31f2515353c8e49f750", - 'exif2c08.png': "3bae00c46ec275fe50b94d2cbd53dae2fec1d7e056f046d16a0cc0080a40f82daabbc0e1ecb362e4deb222738cca2d3781bd5eb12de3a08cdeeb564bebb26f6f", - 'f00n0g08.png': "2d8bbd48ab09f120680d1a11958035e6a8c8890cf044ccd223e05b7d1c90b0e7f3273164bdefafb02934cc0991604a6d02acdc911ea5bf5f8898b7352fc47b0e", - 'f00n2c08.png': "cf3167907d5726f0b7918b2b78191565c90b5ab23668c0f64f37aef39487729e311f96f745e8bce3b73e98ba959ac0116d0cd7d2b41a573d09ab0da1249f802a", - 'f01n0g08.png': "315d66a14a5fde7c6618029dbe8c74c5704429e25b96603169e70eb6facda4d637e56eef58c6c6a9fed22cd7309eead82d63b9011286fc183c909d97f2b1ae8b", - 'f01n2c08.png': "fa16a0cde456f6a0a7fc592bebcee7d97f2e9947c7de409354774b1600f4f1643427edfd9c9288cb4f65089064458639d3eb9a433be9a453fc1ad7c702fcdc0e", - 'f02n0g08.png': "d105deb31d8076b1ba35f28310e30e9db0e87f5be8ee496a03422cf312482e1dc1d48d13d088155b9883e30103ac94f403943e72b96015ef96465e70614d139c", - 'f02n2c08.png': "ae38403bae423da5f60606528f1055e399f49e54190c6cfcb549a38bcbae753aa1c3d79d98cddfff798eef9a920dc586c02c2aa803238213798524fe57e8271b", - 'f03n0g08.png': "57f8020fde86a5c10c7242a3f1dcd735c8e070b18819bd714013862e7704382e2dea0b3d8da294b56a470a196cc1b7a5a842b0fe5343e3ac8f148854bea74d19", - 'f03n2c08.png': "272eea58b186b9d67be75d6c39b8f3130a5682ad36ba0daf12d2d2e0f4a7e089ca3aa00715ef8e9ef5cbc29417080e0ad111e06896a1249321338da067fc0def", - 'f04n0g08.png': "4489805b60dc9e752b33fa1e3b88b601a729e0c37408eb1da98f8daf30c1f2f3fb70f6d1048d8904dda553f33dd6b2ee687fe8cdf5545bccfcbec68df27586ea", - 'f04n2c08.png': "1123338a338bed5f044eb92bb6f3f146e34a2754835ae833ea6a6a0750efd866b1bf5168265632a4097b1cec4ddea2542a79c634db7ebd7f13c1529ec46c1117", - 'f99n0g04.png': "28ba7bfd82d5c1694c054562fca785a920eeae18242f2207a356be4e7c30618d7d5a4aa7b99f67d0081ce102ec1229540658e0c9e29d7d7ea3a83349f1592e74", - 'g03n0g16.png': "d17984e55061bbfa21c66bd40f6b9a4d2353fcb1787814908a5f552bee2752e0dd670071bf5840f813cda668acd007b965c6cac18aefba5ccff3bea2368c801a", - 'g03n2c08.png': "225efe0c9735a4bc61bae5e96e7df84d72d55969317cdb02a19825b1f0aa9e17e3e07fa9078370a05ded3b53d80151841f4e780dcae226eac687783e50e6767d", - 'g03n3p04.png': "494ae0118a73ce8dcabe22f7c9c40dd7ddf21fb676389284111afaefdd700a311516bac48f3d5afdbb28c084c6bceef09e62e879039b69e4ebdb099692a04539", - 'g04n0g16.png': "c4d58651fec06f8a8045474190541e917f7c5ec01169e49bd897e1965ec5e09b1e142a47e5747b01f5535678cad4a7acfab45aaa3432fa304fe36430536e35ce", - 'g04n2c08.png': "963334bdc0ea83ba639b70d864b187a6ee13399874e96fb07ff3b0dec8708983676c52c82617ef610d001de00b70b6596283dce682486ca3a1dbfb3c91ed7258", - 'g04n3p04.png': "cfe390d16f07fc3ecc4c3fdf9b53b5b9de6980b99097d202dd2d2f43fb0b4612e2237688c656a77b52519e02f71ec284045c7930940004e60aed043819775394", - 'g05n0g16.png': "1ed9fec03f57682c81fb1813cee1f48f80da4db5223b57f8f5d675c14c4d85cca9481d555020837d95c0817930ee75a06e897eebd246e9cc0de065dbf687d4a3", - 'g05n2c08.png': "b5447e45eaff246a4ef7001276619ce38a0876fde1bb26411f67f97c5ef4e3e0ab3b82169667dc4fd44bbfad87116e0e2223f878f530127c6c87e043d006588d", - 'g05n3p04.png': "1fd897a387b01b879dd9effcca2078333b9d5730a63faa0c1b3941794a895894aa403feb4836690311c1a1b7bb50d61e22599e4b81ddf42bd137d2639bdbd0ee", - 'g07n0g16.png': "db7190d3cfac8407c07b83bc02ff1a6c15a393e6ef88fadece1c08c2d2bcbed8146f63e549d1d343bef83105fe8700a52e9ded2d96c03ff33f4b4aed787ad219", - 'g07n2c08.png': "c8483d32c431e5f8a9a666ee97fe0932f2adb01fe0112dff636484b22a5142d92218906e8e8ef98eea846ca6015e7ce39f367fde9aac9ef7112cfd1865f9935c", - 'g07n3p04.png': "a1096b453af956f580642d9e9de864b9cea69503e10a6fc4c250a238118add3a8a7a34f7da24c121af59fd14ff259b0fa73d305f6bf886eaa2dde058e8ee72cd", - 'g10n0g16.png': "1df304c87cba2a285e0610ed8655ada912e4d58fdfe47802863ec83a1dea17cf59a34fdbdf570f2a11800aa6023aaca6b48dc23f2e8699a73f168f21e73c8ea0", - 'g10n2c08.png': "8ca900ba7ba1f3d17a5bb3945753ae472aad77ec7b3722f0d83ecbf77981ab612e1a9a3bd63213e651e798ce0dfbc9e3ef52f09273194531a78519d461333bf6", - 'g10n3p04.png': "95a52464557e1b5c52dcbea5e009ed004d05763c1e2e475ce96736713aca06a01c42f74ecbc9d9feb5a4fb7f777b31f35a0dbdd7b5a6a9bd5591142b60be170d", - 'g25n0g16.png': "23d7a7302e8a42819848475a2ca73b4895038a7d9b1f822e6ae9218348d6018313cb7ad2ec9fa301663cef75bcf4fb5bb9da7dcc9e17349768c2ecc2d65883b4", - 'g25n2c08.png': "400b394b8e5b751dbf64227b35a7e72945b3542b7be7015f8615ace7898ee20a2f6b2391422521173f7a2c165834c94ab396bf6b29ac5f45b66d97a5c2ab51fe", - 'g25n3p04.png': "4f4e254be3802aa63596dce708383840518ec47bbc09b6aaa92b6106860939eb152f6ead983bd187105f492e4936ccb6343c5ad4ab548bdc834f9e33cb225b9a", - 'logo-slim.png': "072dfec9c28ad388f61e9323deda00d04c293e53044fc4e02d5fcd5adc8fb74240cd61d267eea6f6afa70eb9023a20084c9c2f7ba1b5d5e56495b71356a0b36f", - 'oi1n0g16.png': "7daf56e398e9801bd0be5904b6e22ef87c574c326037af180dcf60800a3ffc0ae47463ddbb268396e3121bba8958df2d208df2d442e24c363ec802d2275f6337", - 'oi1n2c16.png': "ed7cd6ae047bcc58844d69cfb918a40bfb999bdcef6353e2dfc33dd041378adc08b48c9baca202f39d83456f1752727db82f4746aa9a6f7fd243afbc5eabed7e", - 'oi2n0g16.png': "a57f1ea4054278a66c4369712fa499c2bf69b6dcbd35f74f1714dca2ebf17f068a80ef88482a296559be20a99e8506850e4d54dd8752d6146d2f35d1f6690a6c", - 'oi2n2c16.png': "21bcd689bd28342acd1f006d82a3c904b882a1f5a5a639e26d248d87687284a22aa45b4f02fc92370cd77440899afede340ca29f7e384be6a373a6d43cd19703", - 'oi4n0g16.png': "0f01f28517f57b510aac6e1d2b3dcc5e94279054b9ba358804319f689451490b6d023e178f14e719f81acaf10b6192705fd1998f8a4fa33c918b9de07c47ff5b", - 'oi4n2c16.png': "72cc16bcb694944810e347438927f0799c6d864f453a5d1142ed6213723d214c739248b42a119defb9cfdc8c59d86962e344bd57fbdfb1ef375578f1e940a9f5", - 'oi9n0g16.png': "d3f6831bc64e80b32b3f87e228de1c2d311e530b2ad62da262722cbecf535c04c8f83572d854ad22ce1ffb9d88996db11ab02b17ca669ad73e44100f5a78377f", - 'oi9n2c16.png': "bd9eb600404f02ee3de562fa3f2fe4593348ae9efcaedff900e51e3ab01120fc615ec5ef73daee7a1b3788e31c917f86dffbd88c1d955f3572658f6409104e13", - 'PngSuite.png': "022070b160a8843573fbfd22f1d54e95227da2cf025a0ea5d017f59d0023da0921db1a76122e7b309ee9036a0df8780965256e97d53d017583bc2e22c929b2e8", - 'pp0n2c16.png': "efbeb27ecfa7bd50c70061fbd8ff538726eefc070ebcfd5bbaa90a64dba41e51d55c7ffbd1853098dad13586b3d80cf5f91cce1f776afc2630758fbe05191ffe", - 'pp0n6a08.png': "49c7f141b85782eda585eda8fb7c99b92b8f60e20438c5efd28393a4a956d1341459ec31d6ebd35c8a63343b653bb453a4eece252fd08eb9d4d31a86b040c92d", - 'ps1n0g08.png': "a23aa40328fcffa15004f33127e822ba0ae8db27898efe0735234bf5a6a137ae3869deec4b5947c75c24fc0748d1def746f3c9939a2d3f5821e8052777c79511", - 'ps1n2c16.png': "8a4bd1209067cbcc96e7ccc6f9f537e01d5fbdc035650df6136042b12fac903ab420215278109fb29594b7ddd59fe5d01715daa7d59f937c91b39285a73d87e9", - 'ps2n0g08.png': "8b13dae52a78512869af3e930d986278e9f8cd0476c37efd7238161576bcf72a261d859d1392d5edc7031a986d882c4a4610c2596a73d40e664081136899b059", - 'ps2n2c16.png': "fe4a1120c5458ccf12c77477aa3f60898db1a9ed30b56e481f3fc9cf475798b869f6761734b5e254cd03e047e4f3d9ca3d4f73d0c6754e582f1711a5dcf7a163", - 's01i3p01.png': "0bdbf666db0a5ada5eef96a330d633fd1742bf455dc67b554aa2b99920f8091471976ee27982c549269ee5c21302fa3acd9bb9c29f7d9fb7fae020564d508eb4", - 's01n3p01.png': "50bf7256c271afca66d9891b571827bd5fb7a1b3b6fbcb7ef077b4ff98c73322106b557bcaeb6d5f9c4854a488439b4a7fffb550d2d9b51150ca9de958f1ba6c", - 's02i3p01.png': "3a389a879ac464739555067bdf0e6df0cb2abe187569d5dfd28b4569ee88dcb41c51a66c8666af17d8554db00cf83ee2dd782d0ddd472a755224a09dfd0e20a8", - 's02n3p01.png': "eac6f1f8b9d0f5d4fb24c711cf771b4d7faf16da4df9ac67b51dbda21fb00993a1c10fc601e5a3664bef4512c2da344b1de384bd8e7455adac00274c49b32b8c", - 's03i3p01.png': "0b5b95c919c7abaf1347c2fc802c505388af3bd3df6c8d062b2327b0ff7d8ca7ae12768bef7659c0214e57071b62af88bed36d0848105f4f96ecc1d06eddb2f9", - 's03n3p01.png': "599252f2b5cfe56e96725e92cbaf25857678b315934ab52a6af3000a2c5e06db49d289557bfc123ccbc7baec31954d33dd51b5a976f8d0733d296a29a1ccfe9c", - 's04i3p01.png': "2fca110ec03d7fcf5ae57f13612d00096822d8ec97f7c8f46088f131fd9b53d15f88eb811191e306180f32e00d9e9bb5691b45e3cfae32837ec417cac8ed3045", - 's04n3p01.png': "795598f09c722133956d80c63805178977436a5412d397247544de64706f29c865ffaa8c9ff2c85b74503c98e9f749b1bb2a7031607e8d565f3b5e6da7d12f13", - 's05i3p02.png': "545ef14d73ce35066a4c98da61950d1f0356cda7041c1bb4ff69a8e67ac13ad9eb8503c15824cd93b82ae03814c84c0cd61e3a07328a8b71a79634530ede4c37", - 's05n3p02.png': "b5d5ec774da44af91903798ff1bfd36aa4fde0c83580fa19970cafd12e74d739e2f5198147cdbc845062b977127b8daf875a629f41ca84f4a1c29182e8845753", - 's06i3p02.png': "7b6ccd5f7ff168c00f7ee7c9f59b56157c96f556493a9865539296137801030b6aa523a52ee661b8d15bef55d06916f150eeacd90fd9e9cf881d6b0cc5d4a30a", - 's06n3p02.png': "0eb30c9c9b0f03ba767bf07fa1e1e5eee6c71a0edcf664ee601d6f3e95d57eb62404488a3fccd18afe5fee18e951d3ceb0418d98de9bd34bd2fb213ce20f0e68", - 's07i3p02.png': "cadf56926834f278d6d6e6ee89eb47fd05535c04f87cf16623ba1bf7c52c6678c6b507a19e8fbcc8a7db1aae3b8f861898e270d59e35d4a72c1cb0d6b2f952fd", - 's07n3p02.png': "796ee93dbe71893c190feebe06d906018fb0fcdcabb30f3cf666399937aa07fe9d7cf444e53895e4bf168f50559d98d6d2eb9d30792675f217917f4215cea46b", - 's08i3p02.png': "d9f6be2a8623ecad39a6b9805c0d08a3e58b02dd74a1b0ce02902e82633a947c5a30921da6b7c99dfe284b310bb578e357937891216a24d3ae90ca32fe67d3ec", - 's08n3p02.png': "a945e144d5c53f9205b2d7ca2e57dcfac23c2a923d3326aeabe775324c73b59db9bd5b8871524928e604d376762c4178924bd230918bea30f18b6169a83ab3ad", - 's09i3p02.png': "2db824ec6807ef1c2ed9cf8a897b513a41d70305e4bb5b5918447bd059dc17f2d7d1caf868a95ff84a4b904e377faaa088691e1e0f700b7bad1c4e79b849c1be", - 's09n3p02.png': "a3b5464dba07f474da30c50bb9baebff7314535e7310e36f51bbbd0d89877850fd898f1ef991f5352853baa410b737754634fbd5957fdfb3becf8ad5e4776b9a", - 's32i3p04.png': "a64eec719844aaee1c93c81244cbea5f986b8319657b5ccaddf047e3ff314b64c73a224e6db9eebdec50ed72928ddebf2795a79fb665de353de0d52d310ad52f", - 's32n3p04.png': "b31ef24705ad3d09b25709ab7f2815df250f0261a9ba31d16fd55f21a733ba23efb8a0122700900943a08e1acb7af2e682111b0b47f57a2a4bf579b198cb4212", - 's33i3p04.png': "47e09222309c5f059107097cb74fcb14046a50197fca88a18d1c42781167c766fe8e5d5909265afd460a09bc130f7b4c54f8908a633237701fc032c1c4529d01", - 's33n3p04.png': "b81d9dbaa19280b84078dcdd8dfc87ec94ab9045dba6a5556bda2f4aeb034972672d811ade46b5c157501451ea9f89a791f26bf6e74fdbbfd7f40f5a6ef80892", - 's34i3p04.png': "c43834c3389c4a6b62ff9815b31e485b4a3989ced74dbf6da0f43abcddd0e7c8dadb06299d94f06f1b8650ea1557657cde3526918689c52084b87dc0c1a99f30", - 's34n3p04.png': "66f211232c8726adffb606274d848f8717a0ed202d437b85449e0f720a9172c6977c5c8e56f92edbb3759fae3ffe70c38cfe737a838c61c4b3d2a13913904c90", - 's35i3p04.png': "ef79c73d61333e895f7b6907bac6ce6cf14cf4d0e293dd93062b27c55b25539abde428d25cbb81cc6f4e9916a1dfaed6d4d8c7a9c0f047e496ba02325ba94d0b", - 's35n3p04.png': "921e7f6afab61a2016f5e1f83572ad5932cd1d702a978dfc8da04824efe03500da16425b22c79df7c3f9f867fb54cc6d444e362f4aa38b2a36b7f361f74d93b3", - 's36i3p04.png': "e98f7f87b7d38d3d5ef3f6d4b191ee62176ffa8e6ab611f7d94d5172e593257f5fbb5b8a2aad479a380cb6c6fc8a08cf6cd008576d7ad02eb1fa78c6bc138bd9", - 's36n3p04.png': "0122083643ec591176d17664a246da96e5f3599efaf546a0a6009ba5cb9d6f5064bf987cad54822a92d80fe9cb0189323947ab74f61346ead8b93f5f84288842", - 's37i3p04.png': "c1534a07947e5e13a754b9cb8b698bbad4edd9f6301405ecc0538eafa8c558bf9ee8aec9398308f891cb5114407be6e8979f8d294378b1d5a585a129f32fc45e", - 's37n3p04.png': "1cfecf9a90c677f18876b3480a847504a559ee61fa185f1b64c7802a259b21d583fb555ed01e3c218e87252ba73a1c983f222db576509b6ba131642f37a79e20", - 's38i3p04.png': "71881b215645dc62a080f4433527afc64a8c1a24dd56e88bbe2969b5d33c5808ca107d6525c04018b483d8f5218eeff65d1082538d75c23157b6b09df0a78624", - 's38n3p04.png': "217817f08610e139053719016e0d6345945bd85069011174ee2495ad702002622bbb5a27e4663bef92f456b592a4e38eac79d47b4eb023d819e2980075759544", - 's39i3p04.png': "f9d77bc09e7d277091b52cd94d84452974ecbb8fc7a0f3fb52e4c109e71da0c393c942c568aa76214d06b99e082fa37eba3894ace89b6d8f98a2ad14daced769", - 's39n3p04.png': "4f76f71c7a139393b27295cd4377deb31ef4be5b4c552557fd6b4581d2c254d141cec9368008b283ec33c2eac49671833f0af288e0a054eea6f5562f8ef3e766", - 's40i3p04.png': "9a2e9b85ca3966053e743d1f56ea895f4ac536568d5b19e9d3bf2f4a483ec33610287c9e79cf0469c651ff8c76a117b5849f275a51ed428d01a77cb63e7c78d7", - 's40n3p04.png': "a5bfd8e42d9c30d2963e197aafc0414417a8d82cce7731bd2026019704c7e08f3f2bd9b5045bb6bf3b1600ef0f8093422bc887159832fa49071bc31f73a74322", - 'tbbn0g04.png': "4855b45c0e55a2b371aa7b864f2e04e2d08cc935b317f88f175268528e1016584005032c1f9efcb6b8ffbcf0c034945e68453c471c7563f3f69a37a3761eb00b", - 'tbbn2c16.png': "7ccd34a23627324c7d2014ae94ebe4c88d8cddf35b13098ee8c55f31ef7e5a865b34ca78053e4b3c617b83b5dcc08c84f10b6974a81a50925f0976d7b8477811", - 'tbbn3p08.png': "efd458c974e0b2dfef57463e19261d022bd2699efa9bd7e1f222eb46d09e6932c3db5991921b96c6999cbf1cb5180b29af66450a7084d15188ef2ac2d8e0aaea", - 'tbgn2c16.png': "75e1acc0734b3a80c73a8b7ea9d4cb635c42f70e33f50f5b749e9d86a8ee2b91938798be5706534c4b2b1505fc706ccab4262bfb9fd69cbcb184bc6728331595", - 'tbgn3p08.png': "fee9776510ea1f848ccfec8d664dcdac4705ad870cc29699d198aa3be15bbb059a924587f53da314ef3b365f7f21f81d8eb3a3f218f80776d5234aa9abb138fc", - 'tbrn2c08.png': "f0edb3e74dddafbb26a999c95b0530a0731cddd58189e095cf4d6d95167b1b6bcfe4cc7eb75dd03f1478ec37462924eae8c73d11652e0edb6834f1485ea2b14d", - 'tbwn0g16.png': "24629715e35a72df1be36eb80ab3a5b14a8789bd20898f738e547fb6e96149c295d849892a2bae16be6d230dc33ca91dbc11b024cef1857e5861f73817ffe2ab", - 'tbwn3p08.png': "6b109509998d89130b1120859c1b146f42876eb193b273af3035ad6ff24f51ae46767a5a31730d5eca6df3b981e3912d0ddaa04024e3a3fd688ac8f269d10dc4", - 'tbyn3p08.png': "720468cb7d4eb60fba8bada976c9afbc645179ce84ba27f2d70942ed9d11d31471ca7f78a00ad8aaecf83498023c2fa78e2417c69506d9dc1d645f6f3854a177", - 'tm3n3p02.png': "f08f9981c2724b3d4bd7881128046125d881e1578202482b34c6ffba743bdfd12cbd3400590ef7df117cabd63424faff2ebb5b37a29cd4df287c41cb15b7311d", - 'tp0n0g08.png': "1f7e0f28db7e8e1188eadc037b625caf5fd781f3905d74d2be8abaf2c86bdbe8de69881f14032eb56555057b1bbf49f73ee70e83f87f14f287ef19d68c734738", - 'tp0n2c08.png': "c1a790ab942368875ec269e38806a81ae7c66a5d2cba3e96539cef2ebc9e54c8af9dd4c4beaf408afc284195a089829bb631b9731a75ae61b0f5668b20ee2e23", - 'tp0n3p08.png': "cdeef81826868b9df1070952538be83dba801d260062714d02e7478d0ab1a984aaf6758396e7cde8fff3e59fcbf5fa6960d85f0817c53de48b398c9a05b31f91", - 'tp1n3p08.png': "177554a69f64a9c39face95f316ffca7b15649ecf72de43d413d347e0c2b1b2bb1f2213e71310eb4d648822b71f086c825030b0c9020a807957d3100e460e1aa", - 'xc1n0g08.png': "de870aca8da595b7a7cfdd70465ff206a43e286265c06d5554df9cc96d4c8532debf140dd3afc67adfa9a23fabe808b1b08a20b3bbe265a7e3a4bba2c34da3b2", - 'xc9n2c08.png': "f31a707359fb788934ee1809a3abd7e663f9843caaaefec8804f4d00bc9f02bdd73bd686ec0d763fc73461faa3864666a99ea85ace1f921a8145ac506d40df31", - 'xcrn0g04.png': "433b40a2f9e73c88d50a04b0e9a2c98e08e947d418b66f8f9e3c1aab681a994af046afa0ff1508d34c1f1f9316ad14d764811c906f452516d7b7a100ddb24764", - 'xcsn0g01.png': "5d06d0c6bff9a1b06c75299c019bc8fdc49122bce43112312103ea02da841d4e9641b39129bb8618463e503d525a3f181bd959b278f3eba062b06e85f2d67825", - 'xd0n2c08.png': "5c7b87bd799a648703b5660a56d125103456d87209770bba2a0a7349230d93f376f09374487241c7cc41fadda221c159f5cfba293c8dbedf7c4a8ff402b16c3f", - 'xd3n2c08.png': "f51ca8607d30492c857348c218f3970890a84d75f5b6933dad6bd6a5feab42eafee4e3dffcf36c53f1d40c92c5853a5ceef889c19fc61875a74ac1fb189e1b35", - 'xd9n2c08.png': "dbf060b66b6bb47582659fc741ec8a49c1d1f1f4b5824014139277cc9951f39c2b7b2b60b3d262cc876f0d210f5d580c293cc161f21861ef4de32d2d9289f1b4", - 'xdtn0g01.png': "29b95b7961f4898efa63148d7b6cd03e537a878b1529c3f7490fbf5e0dffbfadac45a0bf1f8ea9bbb4ada2ce3f361a27124c6c602af750ba78a7695e42ee2d99", - 'xhdn0g08.png': "5e750c095cfce4c55c62a6486e5608474f8b3b4124012d8b5efafa421ec675a04018d1008bdde1e1d4b4fad7c17eb5a155ffd14e64d7005fd6483c518d29c844", - 'xlfn0g04.png': "26c5f68e1cac1d37daa3c4d26d5b262b06ebfe204a77fa35fcdd2dbd247bebcfb070cca790f4df7fa443c7dc62f95fd1a1ea674c111049f96abd55be3654bd89", - 'xs1n0g01.png': "da6735534724fbe50ccbc2e5e78692752060410b734b3fc3007b7ea9ac85cb13fd40f5ce4bf2a37448437523484aea2d979c4dac3ea17d11f160ea4c388ec296", - 'xs2n0g01.png': "b68167c21e365fd5eeabac9cb78e2aa02ae0261a9fb25a34f9a47adb29ba3a0504a2c5e5f3945991edcf9d2d89f148735570468acd829d4112a74e1abf0ca54a", - 'xs4n0g01.png': "5fcefe356bfb967ceca8bbc6f991ad1645bf3ac5fad9b5e8c5c624a99aba30cffc36ae8a08542816e7907b0035ee948eba29c45c1422c5802a22ca9918c651fa", - 'xs7n0g01.png': "97f9e89223e53c450a8cd8709ec550a0155b97a8a34cafd8032d4590dd3c05edab9099ea19386b341ad0985cdf388b23478ba0de57b96055ee7f07c74a67326c", - 'z00n2c08.png': "2cb69802a02bb4ed0e8d3a1436ba952049733beea8efc4d4b3fe2bfbaf6c90b6eeaec221e3bf349f20054f17b23c65ed285f97a413ced448ffc2d1b7484328dd", - 'z03n2c08.png': "b8bbe4a48e924a5b8a2f22b5f6877335810321461f9702b9a8d273d8defe4056ddf75d1096bf254ea03ef9aa386319c113fcef8cc0146377b5290c4a4e930aec", - 'z06n2c08.png': "5bb4d290d70737009ef77059016078c665f6407e9fcf4ba04603e776f68087e1a33d72b54419925c2474669dd2426584342872120b2923c559ff71033739a801", - 'z09n2c08.png': "ebeadaebdb570ad5782765381cb4ff2ad833cfcdb7754663b752472f575ba6e2c2b33eb56d3082c31a589df9347dfa502aa138bcb03c359b552f87b55afdf0a9", - - 'unicode.xml': "56609b607cc1ba43a6b4ff327ab70ac18ede6d0c68ed61e953bfd225134ca8ce25c2460fb094ab7dbd98bf4c37dc69cebc7242140d015173b612d850650d57b8", + 'unicode.xml': "e0cdc94f07fdbb15eea811ed2ae6dcf494a83d197dafe6580c740270feb0d8f5f7146d4a7d4c2d2ea25f8bd9678bc986123484b39399819a6b7262687959d1ae", } def try_download_file(url, out_file): @@ -212,30 +214,32 @@ def try_download_and_unpack_zip(suite): return 1 # Try opening the ZIP file and extracting the test images - try: - with zipfile.ZipFile(out_file) as z: - print("\tUnpacking and verifying using SHA3-512:\n") - for file in z.filelist: - if file.filename not in DIGESTS: - print("Missing digest for {}".format(file.filename)) - return 3 + #try: + with zipfile.ZipFile(out_file) as z: + print("\tUnpacking and verifying using HMAC(\"{}\", data, {}):\n".format(HMAC_KEY, HMAC_HASH.__name__)) + for file in z.filelist: + if file.filename not in HMAC_DIGESTS: + print("Missing digest for {}".format(file.filename)) + return 3 - extract_path = DOWNLOAD_BASE_PATH.format(suite) - z.extract(file, extract_path) + extract_path = DOWNLOAD_BASE_PATH.format(suite) + z.extract(file, extract_path) - file_path = "{}/{}".format(extract_path, file.filename) + file_path = "{}/{}".format(extract_path, file.filename) - with open(file_path, "rb") as f: - file_data = f.read() - digest = hashlib.sha3_512(file_data).hexdigest() - print("{} *{}".format(digest, file.filename)) - if DIGESTS[file.filename] != digest: - print("FAIL! Expected: {}".format(DIGESTS[file.filename])) - return 4 + with open(file_path, "rb") as f: + file_data = f.read() + digest = hashlib.sha3_512(file_data).hexdigest() - except: - print("Could not extract ZIP file") - return 2 + hmac_digest = hmac.new(HMAC_KEY.encode(), file_data, HMAC_HASH).hexdigest() + print("{} *{}".format(hmac_digest, file.filename)) + if not hmac.compare_digest(hmac_digest, HMAC_DIGESTS[file.filename]): + print("FAIL! Expected: {}".format(HMAC_DIGESTS[file.filename])) + return 4 + + #except: + # print("Could not extract ZIP file") + # return 2 def main(): for suite in TEST_SUITES: From cfc85fd737a5e51e68cf5d87ba4cd8a9846df61d Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Mon, 1 Apr 2024 18:42:10 +0200 Subject: [PATCH 17/43] fix wrong type in map debug info --- src/llvm_backend_debug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index 1b8e02a36..faefb569e 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -945,7 +945,7 @@ gb_internal LLVMMetadataRef lb_debug_type(lbModule *m, Type *type) { } case Type_Map: { - bt = base_type(type->Map.debug_metadata_type); + bt = base_type(bt->Map.debug_metadata_type); GB_ASSERT(bt->kind == Type_Struct); return lb_debug_struct(m, type, bt, name, scope, file, line); } From 4fc96e1ca52c8e70cbd6b0f5582b3c469c8a17d2 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Mon, 1 Apr 2024 19:05:49 +0200 Subject: [PATCH 18/43] change unneeded permanent allocation to temporary --- src/llvm_backend_debug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index faefb569e..511ff0475 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -925,7 +925,7 @@ gb_internal LLVMMetadataRef lb_debug_type(lbModule *m, Type *type) { String name = type->Named.name; if (type->Named.type_name && type->Named.type_name->pkg && type->Named.type_name->pkg->name.len != 0) { - name = concatenate3_strings(permanent_allocator(), type->Named.type_name->pkg->name, str_lit("."), type->Named.name); + name = concatenate3_strings(temporary_allocator(), type->Named.type_name->pkg->name, str_lit("."), type->Named.name); } Type *bt = base_type(type->Named.base); From fdd4ef3c59cf7555f1cc397bb3b7ff4a5fa76b48 Mon Sep 17 00:00:00 2001 From: Vitalii Kravchenko Date: Tue, 2 Apr 2024 00:26:43 +0100 Subject: [PATCH 19/43] Add NSApplication.active to Foundation bindings. --- vendor/darwin/Foundation/NSApplication.odin | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vendor/darwin/Foundation/NSApplication.odin b/vendor/darwin/Foundation/NSApplication.odin index c87a3d44c..d332345f9 100644 --- a/vendor/darwin/Foundation/NSApplication.odin +++ b/vendor/darwin/Foundation/NSApplication.odin @@ -79,11 +79,22 @@ Application_setActivationPolicy :: proc "c" (self: ^Application, activationPolic return msgSend(BOOL, self, "setActivationPolicy:", activationPolicy) } +@(deprecated="Use NSApplication method activate instead.") @(objc_type=Application, objc_name="activateIgnoringOtherApps") Application_activateIgnoringOtherApps :: proc "c" (self: ^Application, ignoreOtherApps: BOOL) { msgSend(nil, self, "activateIgnoringOtherApps:", ignoreOtherApps) } +@(objc_type=Application, objc_name="activate") +Application_activate :: proc "c" (self: ^Application) { + msgSend(nil, self, "activate") +} + +@(objc_type=Application, objc_name="setTitle") +Application_setTitle :: proc "c" (self: ^Application, title: ^String) { + msgSend(nil, self, "setTitle", title) +} + @(objc_type=Application, objc_name="setMainMenu") Application_setMainMenu :: proc "c" (self: ^Application, menu: ^Menu) { msgSend(nil, self, "setMainMenu:", menu) From a8d8696e2fcaccfc34504ec897a6551ff7bfe4b1 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Tue, 2 Apr 2024 17:20:44 +0200 Subject: [PATCH 20/43] fix named arguments with #c_vararg Previously `args=1`, `args={}`, `args={1, 2, 3}` would all crash the compiler. Now it passes them correctly, and if given a compound literal, the values are expanded into the call so you can use a named arg while passing multiple values. Fixes #3168 --- src/llvm_backend_proc.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index fba7eb381..7338281dc 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -3423,6 +3423,27 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) { if (e->kind == Entity_TypeName) { lbValue value = lb_const_nil(p->module, e->type); args[param_index] = value; + } else if (is_c_vararg && pt->variadic && pt->variadic_index == param_index) { + GB_ASSERT(param_index == pt->param_count-1); + Type *slice_type = e->type; + GB_ASSERT(slice_type->kind == Type_Slice); + Type *elem_type = slice_type->Slice.elem; + + if (fv->value->kind == Ast_CompoundLit) { + ast_node(literal, CompoundLit, fv->value); + for (Ast *var_arg : literal->elems) { + lbValue arg = lb_build_expr(p, var_arg); + if (is_type_any(elem_type)) { + array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(default_type(arg.type)))); + } else { + array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(elem_type))); + } + } + } else { + lbValue value = lb_build_expr(p, fv->value); + GB_ASSERT(!is_type_tuple(value.type)); + array_add(&args, lb_emit_conv(p, value, c_vararg_promote_type(value.type))); + } } else { lbValue value = lb_build_expr(p, fv->value); GB_ASSERT(!is_type_tuple(value.type)); From fc30bde0f6d91cdcfc518b9ca729ff5014a006ef Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Tue, 2 Apr 2024 18:49:35 +0200 Subject: [PATCH 21/43] fix untyped nil into c varargs Fixes #2842 --- src/llvm_backend_proc.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index 7338281dc..2c79499f4 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -3359,6 +3359,9 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) { for (Ast *var_arg : variadic) { lbValue arg = lb_build_expr(p, var_arg); if (is_type_any(elem_type)) { + if (is_type_untyped_nil(arg.type)) { + arg = lb_const_nil(p->module, t_rawptr); + } array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(default_type(arg.type)))); } else { array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(elem_type))); @@ -3434,6 +3437,9 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) { for (Ast *var_arg : literal->elems) { lbValue arg = lb_build_expr(p, var_arg); if (is_type_any(elem_type)) { + if (is_type_untyped_nil(arg.type)) { + arg = lb_const_nil(p->module, t_rawptr); + } array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(default_type(arg.type)))); } else { array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(elem_type))); From 21fcf7c8744260c904e7040bdb1d550a0931aa3e Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Tue, 2 Apr 2024 23:59:38 +0200 Subject: [PATCH 22/43] fix vet scope bug skipping some scopes Fixes #3146 --- src/checker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/checker.cpp b/src/checker.cpp index 100b53315..7e653ffe6 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -224,7 +224,7 @@ gb_internal Scope *create_scope(CheckerInfo *info, Scope *parent) { if (parent != nullptr && parent != builtin_pkg->scope) { Scope *prev_head_child = parent->head_child.exchange(s, std::memory_order_acq_rel); if (prev_head_child) { - prev_head_child->next.store(s, std::memory_order_release); + s->next.store(prev_head_child, std::memory_order_release); } } From 692a47f080f3de24ed05eeed90994112a4d9e0e8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 2 Apr 2024 23:36:36 +0100 Subject: [PATCH 23/43] Fix printing of warnings --- src/error.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/error.cpp b/src/error.cpp index b18df79b7..5b12a7ab8 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -12,7 +12,7 @@ struct ErrorValue { struct ErrorCollector { TokenPos prev; - std::atomic count; + std::atomic count; // error+warning_count std::atomic warning_count; std::atomic in_block; @@ -384,6 +384,7 @@ gb_internal void warning_va(TokenPos const &pos, TokenPos end, char const *fmt, error_va(pos, end, fmt, va); return; } + global_error_collector.count.fetch_add(1); global_error_collector.warning_count.fetch_add(1); mutex_lock(&global_error_collector.mutex); From a9bfb3ac2e3a0f1e4c98596685e983aaf1e1f651 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 2 Apr 2024 23:39:14 +0100 Subject: [PATCH 24/43] Clarity warning and error printing --- src/error.cpp | 13 +++++++------ src/main.cpp | 7 +++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/error.cpp b/src/error.cpp index 5b12a7ab8..c92392dce 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -12,7 +12,7 @@ struct ErrorValue { struct ErrorCollector { TokenPos prev; - std::atomic count; // error+warning_count + std::atomic count; std::atomic warning_count; std::atomic in_block; @@ -62,7 +62,9 @@ gb_internal ErrorValue *get_error_value(void) { gb_internal bool any_errors(void) { return global_error_collector.count.load() != 0; } - +gb_internal bool any_warnings(void) { + return global_error_collector.warning_count.load() != 0; +} gb_internal void init_global_error_collector(void) { @@ -384,7 +386,6 @@ gb_internal void warning_va(TokenPos const &pos, TokenPos end, char const *fmt, error_va(pos, end, fmt, va); return; } - global_error_collector.count.fetch_add(1); global_error_collector.warning_count.fetch_add(1); mutex_lock(&global_error_collector.mutex); @@ -601,7 +602,7 @@ gb_internal void syntax_error_with_verbose(TokenPos pos, TokenPos end, char cons gb_internal void compiler_error(char const *fmt, ...) { - if (any_errors()) { + if (any_errors() || any_warnings()) { print_all_errors(); } @@ -617,7 +618,7 @@ gb_internal void compiler_error(char const *fmt, ...) { gb_internal void exit_with_errors(void) { - if (any_errors()) { + if (any_errors() || any_warnings()) { print_all_errors(); } gb_exit(1); @@ -651,7 +652,7 @@ gb_internal void print_all_errors(void) { } }; - GB_ASSERT(any_errors()); + GB_ASSERT(any_errors() || any_warnings()); gbFile *f = gb_file_get_standard(gbFileStandard_Error); array_sort(global_error_collector.error_values, error_value_cmp); diff --git a/src/main.cpp b/src/main.cpp index 79c3a1670..b8c21fd3b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2694,6 +2694,9 @@ int main(int arg_count, char const **arg_ptr) { print_all_errors(); return 1; } + if (any_warnings()) { + print_all_errors(); + } MAIN_TIME_SECTION("type check"); @@ -2706,6 +2709,10 @@ int main(int arg_count, char const **arg_ptr) { print_all_errors(); return 1; } + if (any_warnings()) { + print_all_errors(); + } + if (build_context.command_kind == Command_strip_semicolon) { return strip_semicolons(parser); From 3a0df800664105f5944ad9e0230debe3a3207969 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Wed, 3 Apr 2024 00:05:31 +0200 Subject: [PATCH 25/43] correct newly found vets --- core/encoding/hxa/read.odin | 2 +- core/encoding/json/marshal.odin | 21 ++++++++++----------- core/encoding/json/unmarshal.odin | 4 ++-- core/image/netpbm/netpbm.odin | 12 ++++++------ core/net/addr.odin | 4 ++-- core/net/dns.odin | 1 - core/net/dns_windows.odin | 7 ++----- core/net/socket.odin | 7 +++---- core/odin/printer/printer.odin | 6 +++--- core/odin/printer/visit.odin | 4 ++-- core/strconv/strconv.odin | 2 +- core/strings/strings.odin | 2 +- core/sys/info/platform_linux.odin | 4 ++-- core/text/i18n/qt_linguist.odin | 2 +- tests/core/image/test_core_image.odin | 4 ++-- tests/internal/test_map.odin | 12 ++++++------ vendor/microui/microui.odin | 18 +++++++++--------- vendor/nanovg/nanovg.odin | 6 +++--- 18 files changed, 56 insertions(+), 62 deletions(-) diff --git a/core/encoding/hxa/read.odin b/core/encoding/hxa/read.odin index 8a8636f19..f37dc3193 100644 --- a/core/encoding/hxa/read.odin +++ b/core/encoding/hxa/read.odin @@ -177,7 +177,7 @@ read :: proc(data: []byte, filename := "", print_error := false, allocato } defer file.nodes = file.nodes[:node_count] - for node_idx in 0.. max(Node_Type) { diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin index 985de6880..68d087a6e 100644 --- a/core/encoding/json/marshal.odin +++ b/core/encoding/json/marshal.odin @@ -246,7 +246,6 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err: opt_write_end(w, opt, ']') or_return case runtime.Type_Info_Enumerated_Array: - index := runtime.type_info_base(info.index).variant.(runtime.Type_Info_Enum) opt_write_start(w, opt, '[') or_return for i in 0.. (err: // check for string type { - v := any{key, info.key.id} - ti := runtime.type_info_base(type_info_of(v.id)) - a := any{v.data, ti.id} + kv := any{key, info.key.id} + kti := runtime.type_info_base(type_info_of(kv.id)) + ka := any{kv.data, kti.id} name: string - #partial switch info in ti.variant { + #partial switch info in kti.variant { case runtime.Type_Info_String: - switch s in a { + switch s in ka { case string: name = s case cstring: name = string(s) } @@ -336,13 +335,13 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err: // check for string type { - v := any{key, info.key.id} - ti := runtime.type_info_base(type_info_of(v.id)) - a := any{v.data, ti.id} + kv := any{key, info.key.id} + kti := runtime.type_info_base(type_info_of(kv.id)) + ka := any{kv.data, kti.id} - #partial switch info in ti.variant { + #partial switch info in kti.variant { case runtime.Type_Info_String: - switch s in a { + switch s in ka { case string: name = s case cstring: name = string(s) } diff --git a/core/encoding/json/unmarshal.odin b/core/encoding/json/unmarshal.odin index 8c21098fb..edc4903a1 100644 --- a/core/encoding/json/unmarshal.odin +++ b/core/encoding/json/unmarshal.odin @@ -483,9 +483,9 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm mem.zero_slice(elem_backing) - if err := unmarshal_value(p, map_backing_value); err != nil { + if uerr := unmarshal_value(p, map_backing_value); uerr != nil { delete(key, p.allocator) - return err + return uerr } key_ptr := rawptr(&key) diff --git a/core/image/netpbm/netpbm.odin b/core/image/netpbm/netpbm.odin index 079c5b4be..ab3945ad7 100644 --- a/core/image/netpbm/netpbm.odin +++ b/core/image/netpbm/netpbm.odin @@ -199,8 +199,8 @@ save_to_buffer :: proc(img: ^Image, custom_info: Info = {}, allocator := context for x in 0 ..< img.width { i := y * img.width + x for c in 0 ..< img.channels { - i := i * img.channels + c - fmt.sbprintf(&data, "%i ", pixels[i]) + j := i * img.channels + c + fmt.sbprintf(&data, "%i ", pixels[j]) } fmt.sbprint(&data, "\n") } @@ -213,8 +213,8 @@ save_to_buffer :: proc(img: ^Image, custom_info: Info = {}, allocator := context for x in 0 ..< img.width { i := y * img.width + x for c in 0 ..< img.channels { - i := i * img.channels + c - fmt.sbprintf(&data, "%i ", pixels[i]) + j := i * img.channels + c + fmt.sbprintf(&data, "%i ", pixels[j]) } fmt.sbprint(&data, "\n") } @@ -283,7 +283,7 @@ _parse_header_pnm :: proc(data: []byte) -> (header: Header, length: int, err: Er current_field := 0 current_value := header_fields[0] - parse_loop: for d, i in data[SIG_LENGTH:] { + parse_loop: for d in data[SIG_LENGTH:] { length += 1 // handle comments @@ -728,4 +728,4 @@ _register :: proc() { _ = destroy(img) } image.register(.NetPBM, loader, destroyer) -} \ No newline at end of file +} diff --git a/core/net/addr.odin b/core/net/addr.odin index 508399bf4..c01724d99 100644 --- a/core/net/addr.odin +++ b/core/net/addr.odin @@ -119,9 +119,9 @@ aton :: proc(address_and_maybe_port: string, family: Address_Family, allow_decim } a: [4]u8 = --- - for v, i in buf { + for v, j in buf { if v > 255 { return {}, false } - a[i] = u8(v) + a[j] = u8(v) } return IP4_Address(a), true diff --git a/core/net/dns.odin b/core/net/dns.odin index c556450c6..48cd8bf29 100644 --- a/core/net/dns.odin +++ b/core/net/dns.odin @@ -816,7 +816,6 @@ parse_response :: proc(response: []u8, filter: DNS_Record_Type = nil, allocator dq_sz :: 4 hn_sz := skip_hostname(response, cur_idx) or_return - dns_query := mem.slice_data_cast([]u16be, response[cur_idx+hn_sz:cur_idx+hn_sz+dq_sz]) cur_idx += hn_sz + dq_sz } diff --git a/core/net/dns_windows.odin b/core/net/dns_windows.odin index e54b067b6..ccec7ea4b 100644 --- a/core/net/dns_windows.odin +++ b/core/net/dns_windows.odin @@ -85,11 +85,9 @@ _get_dns_records_os :: proc(hostname: string, type: DNS_Record_Type, allocator : append(&recs, record) case .CNAME: - - hostname := strings.clone(string(r.Data.CNAME)) record := DNS_Record_CNAME{ base = base_record, - host_name = hostname, + host_name = strings.clone(string(r.Data.CNAME)), } append(&recs, record) @@ -107,10 +105,9 @@ _get_dns_records_os :: proc(hostname: string, type: DNS_Record_Type, allocator : } case .NS: - hostname := strings.clone(string(r.Data.NS)) record := DNS_Record_NS{ base = base_record, - host_name = hostname, + host_name = strings.clone(string(r.Data.NS)), } append(&recs, record) diff --git a/core/net/socket.odin b/core/net/socket.odin index 1bfa52257..5f137401e 100644 --- a/core/net/socket.odin +++ b/core/net/socket.odin @@ -161,11 +161,10 @@ recv_any :: proc(socket: Any_Socket, buf: []byte) -> ( ) { switch socktype in socket { case TCP_Socket: - bytes_read, err := recv_tcp(socktype, buf) - return bytes_read, nil, err + bytes_read, err = recv_tcp(socktype, buf) + return case UDP_Socket: - bytes_read, endpoint, err := recv_udp(socktype, buf) - return bytes_read, endpoint, err + return recv_udp(socktype, buf) case: panic("Not supported") } } diff --git a/core/odin/printer/printer.odin b/core/odin/printer/printer.odin index 63a3b543d..ce75352bd 100644 --- a/core/odin/printer/printer.odin +++ b/core/odin/printer/printer.odin @@ -643,7 +643,7 @@ align_switch_stmt :: proc(p: ^Printer, index: int) { format_tokens := make([dynamic]TokenAndLength, 0, brace_token.parameter_count, context.temp_allocator) //find all the switch cases that are one lined - for line, line_index in p.lines[brace_line + 1:] { + for line in p.lines[brace_line + 1:] { case_found := false colon_found := false @@ -716,7 +716,7 @@ align_enum :: proc(p: ^Printer, index: int) { format_tokens := make([dynamic]TokenAndLength, 0, brace_token.parameter_count, context.temp_allocator) - for line, line_index in p.lines[brace_line + 1:] { + for line in p.lines[brace_line + 1:] { length := 0 for format_token, i in line.format_tokens { @@ -880,7 +880,7 @@ align_comments :: proc(p: ^Printer) { length := 0 - for format_token, i in line.format_tokens { + for format_token in line.format_tokens { if format_token.kind == .Comment { current_info.length = max(current_info.length, length) current_info.end = line_index diff --git a/core/odin/printer/visit.odin b/core/odin/printer/visit.odin index 1aefcf967..7dd208a49 100644 --- a/core/odin/printer/visit.odin +++ b/core/odin/printer/visit.odin @@ -1462,9 +1462,9 @@ visit_binary_expr :: proc(p: ^Printer, binary: ^ast.Binary_Expr) { } either_implicit_selector := false - if _, ok := binary.left.derived.(^ast.Implicit_Selector_Expr); ok { + if _, lok := binary.left.derived.(^ast.Implicit_Selector_Expr); lok { either_implicit_selector = true - } else if _, ok := binary.right.derived.(^ast.Implicit_Selector_Expr); ok { + } else if _, rok := binary.right.derived.(^ast.Implicit_Selector_Expr); rok { either_implicit_selector = true } diff --git a/core/strconv/strconv.odin b/core/strconv/strconv.odin index eae9f9504..f23e619dc 100644 --- a/core/strconv/strconv.odin +++ b/core/strconv/strconv.odin @@ -878,7 +878,7 @@ parse_f64_prefix :: proc(str: string) -> (value: f64, nr: int, ok: bool) { s = s[1:] fallthrough case 'i', 'I': - n := common_prefix_len_ignore_case(s, "infinity") + n = common_prefix_len_ignore_case(s, "infinity") if 3 < n && n < 8 { // "inf" or "infinity" n = 3 } diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 5cee25a66..13c53f48e 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -809,7 +809,7 @@ _split :: proc(s_, sep: string, sep_save, n_: int, allocator := context.allocato n = l } - res := make([]string, n, allocator, loc) or_return + res = make([]string, n, allocator, loc) or_return for i := 0; i < n-1; i += 1 { _, w := utf8.decode_rune_in_string(s) res[i] = s[:w] diff --git a/core/sys/info/platform_linux.odin b/core/sys/info/platform_linux.odin index 93770a460..89b1204a7 100644 --- a/core/sys/info/platform_linux.odin +++ b/core/sys/info/platform_linux.odin @@ -18,8 +18,8 @@ init_os_version :: proc () { fd, errno := linux.open("/etc/os-release", {.RDONLY}, {}) assert(errno == .NONE, "Failed to read /etc/os-release") defer { - errno := linux.close(fd) - assert(errno == .NONE, "Failed to close the file descriptor") + cerrno := linux.close(fd) + assert(cerrno == .NONE, "Failed to close the file descriptor") } os_release_buf: [2048]u8 n, read_errno := linux.read(fd, os_release_buf[:]) diff --git a/core/text/i18n/qt_linguist.odin b/core/text/i18n/qt_linguist.odin index fa05a6dc1..0e75df873 100644 --- a/core/text/i18n/qt_linguist.odin +++ b/core/text/i18n/qt_linguist.odin @@ -128,7 +128,7 @@ parse_qt_linguist_from_bytes :: proc(data: []byte, options := DEFAULT_PARSE_OPTI num_plurals: int for { - numerus_id := xml.find_child_by_ident(ts, translation_id, "numerusform", num_plurals) or_break + xml.find_child_by_ident(ts, translation_id, "numerusform", num_plurals) or_break num_plurals += 1 } diff --git a/tests/core/image/test_core_image.odin b/tests/core/image/test_core_image.odin index 54b3608b7..ae92ca617 100644 --- a/tests/core/image/test_core_image.odin +++ b/tests/core/image/test_core_image.odin @@ -1580,7 +1580,7 @@ run_png_suite :: proc(t: ^testing.T, suite: []PNG_Test) -> (subtotal: int) { { // Roundtrip through PBM to test the PBM encoders and decoders - prefer ASCII - pbm_info, pbm_format_selected := pbm.autoselect_pbm_format_from_image(img, false) + pbm_info, _ := pbm.autoselect_pbm_format_from_image(img, false) // We already tested the binary formats above. if pbm_info.header.format in pbm.ASCII { @@ -1912,4 +1912,4 @@ run_png_suite :: proc(t: ^testing.T, suite: []PNG_Test) -> (subtotal: int) { } return -} \ No newline at end of file +} diff --git a/tests/internal/test_map.odin b/tests/internal/test_map.odin index 2c808d85e..7d1dbf470 100644 --- a/tests/internal/test_map.odin +++ b/tests/internal/test_map.odin @@ -32,7 +32,7 @@ map_insert_random_key_value :: proc(t: ^testing.T) { } key_count := 0 - for k in m { + for _ in m { key_count += 1 } @@ -82,7 +82,7 @@ map_update_random_key_value :: proc(t: ^testing.T) { } key_count := 0 - for k in m { + for _ in m { key_count += 1 } @@ -144,7 +144,7 @@ map_delete_random_key_value :: proc(t: ^testing.T) { } key_count := 0 - for k in m { + for _ in m { key_count += 1 } @@ -220,7 +220,7 @@ set_insert_random_key_value :: proc(t: ^testing.T) { } key_count := 0 - for k in m { + for _ in m { key_count += 1 } @@ -268,7 +268,7 @@ set_delete_random_key_value :: proc(t: ^testing.T) { } key_count := 0 - for k in m { + for _ in m { key_count += 1 } @@ -379,4 +379,4 @@ when ODIN_TEST { fmt.printf("[%v] ", loc) fmt.printf("log: %v\n", v) } -} \ No newline at end of file +} diff --git a/vendor/microui/microui.odin b/vendor/microui/microui.odin index 1ddad2121..495289ede 100644 --- a/vendor/microui/microui.odin +++ b/vendor/microui/microui.odin @@ -1316,10 +1316,10 @@ begin_window :: proc(ctx: ^Context, title: string, rect: Rect, opt := Options{}) /* do title text */ if .NO_TITLE not_in opt { - id := get_id(ctx, "!title") - update_control(ctx, id, tr, opt) + tid := get_id(ctx, "!title") + update_control(ctx, tid, tr, opt) draw_control_text(ctx, title, tr, .TITLE_TEXT, opt) - if id == ctx.focus_id && ctx.mouse_down_bits == {.LEFT} { + if tid == ctx.focus_id && ctx.mouse_down_bits == {.LEFT} { cnt.rect.x += ctx.mouse_delta.x cnt.rect.y += ctx.mouse_delta.y } @@ -1329,12 +1329,12 @@ begin_window :: proc(ctx: ^Context, title: string, rect: Rect, opt := Options{}) /* do `close` button */ if .NO_CLOSE not_in opt { - id := get_id(ctx, "!close") + cid := get_id(ctx, "!close") r := Rect{tr.x + tr.w - tr.h, tr.y, tr.h, tr.h} tr.w -= r.w draw_icon(ctx, .CLOSE, r, ctx.style.colors[.TITLE_TEXT]) - update_control(ctx, id, r, opt) - if .LEFT in ctx.mouse_released_bits && id == ctx.hover_id { + update_control(ctx, cid, r, opt) + if .LEFT in ctx.mouse_released_bits && cid == ctx.hover_id { cnt.open = false } } @@ -1343,11 +1343,11 @@ begin_window :: proc(ctx: ^Context, title: string, rect: Rect, opt := Options{}) /* do `resize` handle */ if .NO_RESIZE not_in opt { sz := ctx.style.footer_height - id := get_id(ctx, "!resize") + rid := get_id(ctx, "!resize") r := Rect{rect.x + rect.w - sz, rect.y + rect.h - sz, sz, sz} draw_icon(ctx, .RESIZE, r, ctx.style.colors[.TEXT]) - update_control(ctx, id, r, opt) - if id == ctx.focus_id && .LEFT in ctx.mouse_down_bits { + update_control(ctx, rid, r, opt) + if rid == ctx.focus_id && .LEFT in ctx.mouse_down_bits { cnt.rect.w = max(96, cnt.rect.w + ctx.mouse_delta.x) cnt.rect.h = max(64, cnt.rect.h + ctx.mouse_delta.y) } diff --git a/vendor/nanovg/nanovg.odin b/vendor/nanovg/nanovg.odin index 74fc70692..15611cfef 100644 --- a/vendor/nanovg/nanovg.odin +++ b/vendor/nanovg/nanovg.odin @@ -2009,7 +2009,7 @@ __expandStroke :: proc( } } - for j in start.. Date: Wed, 3 Apr 2024 01:05:54 +0200 Subject: [PATCH 26/43] fix -vet warning for stack overflows not showing up Due to the placement of this code, the warning would only ever be added if the variable was also either unused or shadowed. --- src/checker.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/checker.cpp b/src/checker.cpp index 100b53315..82f0a09be 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -703,6 +703,15 @@ gb_internal void check_scope_usage(Checker *c, Scope *scope, u64 vet_flags) { array_add(&vetted_entities, ve_unused); } else if (is_shadowed) { array_add(&vetted_entities, ve_shadowed); + } else if (e->kind == Entity_Variable && (e->flags & (EntityFlag_Param|EntityFlag_Using)) == 0) { + i64 sz = type_size_of(e->type); + // TODO(bill): When is a good size warn? + // Is 128 KiB good enough? + if (sz >= 1ll<<17) { + gbString type_str = type_to_string(e->type); + warning(e->token, "Declaration of '%.*s' may cause a stack overflow due to its type '%s' having a size of %lld bytes", LIT(e->token.string), type_str, cast(long long)sz); + gb_string_free(type_str); + } } } rw_mutex_shared_unlock(&scope->mutex); @@ -734,17 +743,6 @@ gb_internal void check_scope_usage(Checker *c, Scope *scope, u64 vet_flags) { break; } } - - if (e->kind == Entity_Variable && (e->flags & (EntityFlag_Param|EntityFlag_Using)) == 0) { - i64 sz = type_size_of(e->type); - // TODO(bill): When is a good size warn? - // Is 128 KiB good enough? - if (sz >= 1ll<<17) { - gbString type_str = type_to_string(e->type); - warning(e->token, "Declaration of '%.*s' may cause a stack overflow due to its type '%s' having a size of %lld bytes", LIT(name), type_str, cast(long long)sz); - gb_string_free(type_str); - } - } } array_free(&vetted_entities); From 5fe0788cffcbcfd153ea23954b5a11a853ef50b4 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 3 Apr 2024 11:47:39 +0100 Subject: [PATCH 27/43] Minimize code duplication in `core:mem` by using the `base:runtime` calls --- core/mem/alloc.odin | 65 +++++++++++---------------------------------- core/mem/mem.odin | 2 ++ 2 files changed, 17 insertions(+), 50 deletions(-) diff --git a/core/mem/alloc.odin b/core/mem/alloc.odin index e25fc2bc1..acd77241f 100644 --- a/core/mem/alloc.odin +++ b/core/mem/alloc.odin @@ -83,11 +83,7 @@ free :: proc(ptr: rawptr, allocator := context.allocator, loc := #caller_locatio } free_with_size :: proc(ptr: rawptr, byte_count: int, allocator := context.allocator, loc := #caller_location) -> Allocator_Error { - if ptr == nil || allocator.procedure == nil { - return nil - } - _, err := allocator.procedure(allocator.data, .Free, 0, 0, ptr, byte_count, loc) - return err + return runtime.mem_free_with_size(ptr, byte_count, allocator, loc) } free_bytes :: proc(bytes: []byte, allocator := context.allocator, loc := #caller_location) -> Allocator_Error { @@ -130,19 +126,19 @@ query_info :: proc(pointer: rawptr, allocator: Allocator, loc := #caller_locatio delete_string :: proc(str: string, allocator := context.allocator, loc := #caller_location) -> Allocator_Error { - return free_with_size(raw_data(str), len(str), allocator, loc) + return runtime.delete_string(str, allocator, loc) } delete_cstring :: proc(str: cstring, allocator := context.allocator, loc := #caller_location) -> Allocator_Error { - return free((^byte)(str), allocator, loc) + return runtime.delete_cstring(str, allocator, loc) } delete_dynamic_array :: proc(array: $T/[dynamic]$E, loc := #caller_location) -> Allocator_Error { - return free_with_size(raw_data(array), cap(array)*size_of(E), array.allocator, loc) + return runtime.delete_dynamic_array(array, loc) } delete_slice :: proc(array: $T/[]$E, allocator := context.allocator, loc := #caller_location) -> Allocator_Error { - return free_with_size(raw_data(array), len(array)*size_of(E), allocator, loc) + return runtime.delete_slice(array, allocator, loc) } delete_map :: proc(m: $T/map[$K]$V, loc := #caller_location) -> Allocator_Error { - return runtime.map_free_dynamic(transmute(Raw_Map)m, runtime.map_info(T), loc) + return runtime.delete_map(m, loc) } @@ -161,71 +157,40 @@ new :: proc($T: typeid, allocator := context.allocator, loc := #caller_location) } @(require_results) new_aligned :: proc($T: typeid, alignment: int, allocator := context.allocator, loc := #caller_location) -> (t: ^T, err: Allocator_Error) { - data := alloc_bytes(size_of(T), alignment, allocator, loc) or_return - t = (^T)(raw_data(data)) - return + return runtime.new_aligned(T, alignment, allocator, loc) } @(require_results) new_clone :: proc(data: $T, allocator := context.allocator, loc := #caller_location) -> (t: ^T, err: Allocator_Error) { - backing := alloc_bytes(size_of(T), align_of(T), allocator, loc) or_return - t = (^T)(raw_data(backing)) - if t != nil { - t^ = data - return t, nil - } - return nil, .Out_Of_Memory + return runtime.new_clone(data, allocator, loc) } @(require_results) make_aligned :: proc($T: typeid/[]$E, #any_int len: int, alignment: int, allocator := context.allocator, loc := #caller_location) -> (slice: T, err: Allocator_Error) { - runtime.make_slice_error_loc(loc, len) - data := alloc_bytes(size_of(E)*len, alignment, allocator, loc) or_return - if data == nil && size_of(E) != 0 { - return - } - slice = transmute(T)Raw_Slice{raw_data(data), len} - return + return runtime.make_aligned(T, len, alignment, allocator, loc) } @(require_results) make_slice :: proc($T: typeid/[]$E, #any_int len: int, allocator := context.allocator, loc := #caller_location) -> (T, Allocator_Error) { - return make_aligned(T, len, align_of(E), allocator, loc) + return runtime.make_slice(T, len, allocator, loc) } @(require_results) make_dynamic_array :: proc($T: typeid/[dynamic]$E, allocator := context.allocator, loc := #caller_location) -> (T, Allocator_Error) { - return make_dynamic_array_len_cap(T, 0, 16, allocator, loc) + return runtime.make_dynamic_array(T, allocator, loc) } @(require_results) make_dynamic_array_len :: proc($T: typeid/[dynamic]$E, #any_int len: int, allocator := context.allocator, loc := #caller_location) -> (T, Allocator_Error) { - return make_dynamic_array_len_cap(T, len, len, allocator, loc) + return runtime.make_dynamic_array(T, len, allocator, loc) } @(require_results) make_dynamic_array_len_cap :: proc($T: typeid/[dynamic]$E, #any_int len: int, #any_int cap: int, allocator := context.allocator, loc := #caller_location) -> (array: T, err: Allocator_Error) { - runtime.make_dynamic_array_error_loc(loc, len, cap) - data := alloc_bytes(size_of(E)*cap, align_of(E), allocator, loc) or_return - s := Raw_Dynamic_Array{raw_data(data), len, cap, allocator} - if data == nil && size_of(E) != 0 { - s.len, s.cap = 0, 0 - } - array = transmute(T)s - return + return runtime.make_dynamic_array(T, len, cap, allocator, loc) } @(require_results) make_map :: proc($T: typeid/map[$K]$E, #any_int cap: int = 1< (m: T, err: Allocator_Error) { - runtime.make_map_expr_error_loc(loc, cap) - context.allocator = allocator - - err = reserve_map(&m, cap, loc) - return + return runtime.make_map(T, cap, allocator, loc) } @(require_results) make_multi_pointer :: proc($T: typeid/[^]$E, #any_int len: int, allocator := context.allocator, loc := #caller_location) -> (mp: T, err: Allocator_Error) { - runtime.make_slice_error_loc(loc, len) - data := alloc_bytes(size_of(E)*len, align_of(E), allocator, loc) or_return - if data == nil && size_of(E) != 0 { - return - } - mp = cast(T)raw_data(data) - return + return runtime.make_multi_pointer(T, len, allocator, loc) } make :: proc{ diff --git a/core/mem/mem.odin b/core/mem/mem.odin index 0ea9d5b79..d423cc1eb 100644 --- a/core/mem/mem.odin +++ b/core/mem/mem.odin @@ -45,6 +45,8 @@ copy_non_overlapping :: proc "contextless" (dst, src: rawptr, len: int) -> rawpt intrinsics.mem_copy_non_overlapping(dst, src, len) return dst } + +@(require_results) compare :: proc "contextless" (a, b: []byte) -> int { res := compare_byte_ptrs(raw_data(a), raw_data(b), min(len(a), len(b))) if res == 0 && len(a) != len(b) { From 5339e1e1b6824b67fbbe195e18d1122bda3dd6f7 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Wed, 3 Apr 2024 21:21:46 +0200 Subject: [PATCH 28/43] fix objc proc group edge case Fixes #2648 --- src/llvm_backend_expr.cpp | 6 ++++-- src/types.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp index f6f36e861..0649150ca 100644 --- a/src/llvm_backend_expr.cpp +++ b/src/llvm_backend_expr.cpp @@ -4677,8 +4677,10 @@ gb_internal lbAddr lb_build_addr_internal(lbProcedure *p, Ast *expr) { if (tav.mode == Addressing_Type) { // Addressing_Type Selection sel = lookup_field(tav.type, selector, true); if (sel.pseudo_field) { - GB_ASSERT(sel.entity->kind == Entity_Procedure); - return lb_addr(lb_find_value_from_entity(p->module, sel.entity)); + GB_ASSERT(sel.entity->kind == Entity_Procedure || sel.entity->kind == Entity_ProcGroup); + Entity *e = entity_of_node(sel_node); + GB_ASSERT(e->kind == Entity_Procedure); + return lb_addr(lb_find_value_from_entity(p->module, e)); } GB_PANIC("Unreachable %.*s", LIT(selector)); } diff --git a/src/types.cpp b/src/types.cpp index 0bf28a28c..97512d29b 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -3158,7 +3158,7 @@ gb_internal Selection lookup_field_with_selection(Type *type_, String field_name mutex_lock(md->mutex); defer (mutex_unlock(md->mutex)); for (TypeNameObjCMetadataEntry const &entry : md->type_entries) { - GB_ASSERT(entry.entity->kind == Entity_Procedure); + GB_ASSERT(entry.entity->kind == Entity_Procedure || entry.entity->kind == Entity_ProcGroup); if (entry.name == field_name) { sel.entity = entry.entity; sel.pseudo_field = true; From 62cebe1bc9976f009a2ac3eac9bc25e84142164c Mon Sep 17 00:00:00 2001 From: gerigk Date: Thu, 4 Apr 2024 16:00:01 +0200 Subject: [PATCH 29/43] Add windows.SetEvent --- core/sys/windows/kernel32.odin | 1 + 1 file changed, 1 insertion(+) diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin index 952d5bb31..76bf7ca9d 100644 --- a/core/sys/windows/kernel32.odin +++ b/core/sys/windows/kernel32.odin @@ -324,6 +324,7 @@ foreign kernel32 { lpName: LPCWSTR, ) -> HANDLE --- ResetEvent :: proc(hEvent: HANDLE) -> BOOL --- + SetEvent :: proc(hEvent: HANDLE) -> BOOL --- WaitForMultipleObjects :: proc( nCount: DWORD, lpHandles: ^HANDLE, From a7056f2b4f8ac7c5fe78b00cbae686da4867e206 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Thu, 4 Apr 2024 16:58:22 +0200 Subject: [PATCH 30/43] fix lbArg_Ignore logic Fixes #2698 --- src/llvm_abi.cpp | 2 +- src/llvm_backend_proc.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 724e4e35a..49b5224ec 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -192,7 +192,7 @@ gb_internal void lb_add_function_type_attributes(LLVMValueRef fn, lbFunctionType // } LLVMSetFunctionCallConv(fn, cc_kind); if (calling_convention == ProcCC_Odin) { - unsigned context_index = offset+arg_count; + unsigned context_index = arg_index; LLVMAddAttributeAtIndex(fn, context_index, noalias_attr); LLVMAddAttributeAtIndex(fn, context_index, nonnull_attr); LLVMAddAttributeAtIndex(fn, context_index, nocapture_attr); diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index 2c79499f4..8ce116715 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -578,7 +578,10 @@ gb_internal void lb_begin_procedure_body(lbProcedure *p) { defer (param_index += 1); if (arg_type->kind == lbArg_Ignore) { - continue; + // Even though it is an ignored argument, it might still be referenced in the + // body. + lbValue dummy = lb_add_local_generated(p, e->type, false).addr; + lb_add_entity(p->module, e, dummy); } else if (arg_type->kind == lbArg_Direct) { if (e->token.string.len != 0 && !is_blank_ident(e->token.string)) { LLVMTypeRef param_type = lb_type(p->module, e->type); @@ -1051,6 +1054,7 @@ gb_internal lbValue lb_emit_call(lbProcedure *p, lbValue value, Array c Type *original_type = e->type; lbArgType *arg = &ft->args[param_index]; if (arg->kind == lbArg_Ignore) { + param_index += 1; continue; } From d248cddf903714cb5b3f3dee300837d1e9fac032 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 4 Apr 2024 16:07:55 +0100 Subject: [PATCH 31/43] Remove dead newline --- core/sys/linux/constants.odin | 1 - 1 file changed, 1 deletion(-) diff --git a/core/sys/linux/constants.odin b/core/sys/linux/constants.odin index 6294602e9..51f7db68f 100644 --- a/core/sys/linux/constants.odin +++ b/core/sys/linux/constants.odin @@ -1,4 +1,3 @@ - package linux /* From 1af84e082c12b620a77396211cdbfc30adaecd25 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Thu, 4 Apr 2024 17:00:29 +0200 Subject: [PATCH 32/43] add some wsa based additions to `core:sys/windows` --- core/sys/windows/kernel32.odin | 4 +++ core/sys/windows/ws2_32.odin | 57 +++++++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin index 952d5bb31..cc5f2b188 100644 --- a/core/sys/windows/kernel32.odin +++ b/core/sys/windows/kernel32.odin @@ -545,6 +545,10 @@ FILE_MAP_RESERVE :: DWORD(0x80000000) FILE_MAP_TARGETS_INVALID :: DWORD(0x40000000) FILE_MAP_LARGE_PAGES :: DWORD(0x20000000) +// Flags for `SetFileCompletionNotificationModes`. +FILE_SKIP_COMPLETION_PORT_ON_SUCCESS :: 0x1 +FILE_SKIP_SET_EVENT_ON_HANDLE :: 0x2 + PAGE_NOACCESS :: 0x01 PAGE_READONLY :: 0x02 PAGE_READWRITE :: 0x04 diff --git a/core/sys/windows/ws2_32.odin b/core/sys/windows/ws2_32.odin index c60a21a36..e9bf8abc9 100644 --- a/core/sys/windows/ws2_32.odin +++ b/core/sys/windows/ws2_32.odin @@ -2,12 +2,12 @@ package sys_windows // Define flags to be used with the WSAAsyncSelect() call. -FD_READ :: 0x01 -FD_WRITE :: 0x02 -FD_OOB :: 0x04 -FD_ACCEPT :: 0x08 -FD_CONNECT :: 0x10 -FD_CLOSE :: 0x20 +FD_READ :: 0x01 +FD_WRITE :: 0x02 +FD_OOB :: 0x04 +FD_ACCEPT :: 0x08 +FD_CONNECT :: 0x10 +FD_CLOSE :: 0x20 FD_MAX_EVENTS :: 10 INADDR_LOOPBACK :: 0x7f000001 @@ -24,10 +24,10 @@ POLLERR :: 0x0001 POLLHUP :: 0x0002 POLLNVAL :: 0x0004 -WSA_POLLFD::struct{ - fd:SOCKET, - events:c_short, - revents:c_short, +WSA_POLLFD :: struct{ + fd: SOCKET, + events: c_short, + revents: c_short, } WSANETWORKEVENTS :: struct { @@ -37,16 +37,43 @@ WSANETWORKEVENTS :: struct { WSAEVENT :: HANDLE -WSAID_ACCEPTEX :: GUID{0xb5367df1, 0xcbac, 0x11cf, {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} +WSAID_ACCEPTEX :: GUID{0xb5367df1, 0xcbac, 0x11cf, {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} WSAID_GETACCEPTEXSOCKADDRS :: GUID{0xb5367df2, 0xcbac, 0x11cf, {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} +WSAID_CONNECTX :: GUID{0x25a207b9, 0xddf3, 0x4660, {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}} + SIO_GET_EXTENSION_FUNCTION_POINTER :: IOC_INOUT | IOC_WS2 | 6 -IOC_OUT :: 0x40000000 -IOC_IN :: 0x80000000 + +IOC_OUT :: 0x40000000 +IOC_IN :: 0x80000000 IOC_INOUT :: (IOC_IN | IOC_OUT) -IOC_WS2 :: 0x08000000 +IOC_WS2 :: 0x08000000 + +SO_UPDATE_ACCEPT_CONTEXT :: 28683 + +LPFN_CONNECTEX :: #type proc "system" ( + s: SOCKET, + sockaddr: ^SOCKADDR_STORAGE_LH, + namelen: c_int, + lpSendBuffer: PVOID, + dwSendDataLength: DWORD, + lpdwBytesSent: LPDWORD, + lpOverlapped: LPOVERLAPPED, +) -> BOOL + +LPFN_ACCEPTEX :: #type proc "system" ( + sListenSocket: SOCKET, + sAcceptSocket: SOCKET, + lpOutputBuffer: PVOID, + dwReceiveDataLength: DWORD, + dwLocalAddressLength: DWORD, + dwRemoteAddressLength: DWORD, + lpdwBytesReceived: LPDWORD, + lpOverlapped: LPOVERLAPPED, +) -> BOOL + /* Example Load: - load_accept_ex :: proc(listener: SOCKET, fn_acceptex: rawptr) { + load_accept_ex :: proc(listener: SOCKET, fn_acceptex: ^LPFN_ACCEPTEX) { bytes: u32 guid_accept_ex := WSAID_ACCEPTEX rc := WSAIoctl(listener, SIO_GET_EXTENSION_FUNCTION_POINTER, &guid_accept_ex, size_of(guid_accept_ex), From 0e5a482c42f28c58da18213b2b3257304f357476 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 4 Apr 2024 16:11:26 +0100 Subject: [PATCH 33/43] Default to "smart" linker behaviour; Add `-min-link-libs` to use minimize link libs if wanted --- src/build_settings.cpp | 4 ++- src/linker.cpp | 60 +++++++++++++++++++----------------------- src/main.cpp | 13 +++++++++ 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 1ac9e451f..3b5d33ae3 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -412,7 +412,9 @@ struct BuildContext { bool dynamic_map_calls; - bool obfuscate_source_code_locations; + bool obfuscate_source_code_locations; + + bool min_link_libs; RelocMode reloc_mode; bool disable_red_zone; diff --git a/src/linker.cpp b/src/linker.cpp index 0e3169b22..2ff7ad0f4 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -139,9 +139,9 @@ gb_internal i32 linker_stage(LinkerData *gen) { } - StringSet libs = {}; - string_set_init(&libs, 64); - defer (string_set_destroy(&libs)); + StringSet min_libs_set = {}; + string_set_init(&min_libs_set, 64); + defer (string_set_destroy(&min_libs_set)); StringSet asm_files = {}; string_set_init(&asm_files, 64); @@ -149,6 +149,11 @@ gb_internal i32 linker_stage(LinkerData *gen) { for (Entity *e : gen->foreign_libraries) { GB_ASSERT(e->kind == Entity_LibraryName); + // NOTE(bill): Add these before the linking values + String extra_linker_flags = string_trim_whitespace(e->LibraryName.extra_linker_flags); + if (extra_linker_flags.len != 0) { + lib_str = gb_string_append_fmt(lib_str, " %.*s", LIT(extra_linker_flags)); + } for_array(i, e->LibraryName.paths) { String lib = string_trim_whitespace(e->LibraryName.paths[i]); // IMPORTANT NOTE(bill): calling `string_to_lower` here is not an issue because @@ -162,12 +167,11 @@ gb_internal i32 linker_stage(LinkerData *gen) { if (!string_set_update(&asm_files, lib)) { String asm_file = asm_files.entries[i].value; String obj_file = concatenate_strings(permanent_allocator(), asm_file, str_lit(".obj")); - String obj_format; -#if defined(GB_ARCH_64_BIT) - obj_format = str_lit("win64"); -#elif defined(GB_ARCH_32_BIT) + String obj_format = str_lit("win64"); + #if defined(GB_ARCH_32_BIT) obj_format = str_lit("win32"); -#endif // GB_ARCH_*_BIT + #endif + result = system_exec_command_line_app("nasm", "\"%.*s\\bin\\nasm\\windows\\nasm.exe\" \"%.*s\" " "-f \"%.*s\" " @@ -185,21 +189,13 @@ gb_internal i32 linker_stage(LinkerData *gen) { } array_add(&gen->output_object_paths, obj_file); } - } else { - if (!string_set_update(&libs, lib)) { - lib_str = gb_string_append_fmt(lib_str, " \"%.*s\"", LIT(lib)); - } + } else if (!string_set_update(&min_libs_set, lib) || + !build_context.min_link_libs) { + lib_str = gb_string_append_fmt(lib_str, " \"%.*s\"", LIT(lib)); } } } - for (Entity *e : gen->foreign_libraries) { - GB_ASSERT(e->kind == Entity_LibraryName); - if (e->LibraryName.extra_linker_flags.len != 0) { - lib_str = gb_string_append_fmt(lib_str, " %.*s", LIT(e->LibraryName.extra_linker_flags)); - } - } - if (build_context.build_mode == BuildMode_DynamicLibrary) { link_settings = gb_string_append_fmt(link_settings, " /DLL"); } else { @@ -318,12 +314,17 @@ gb_internal i32 linker_stage(LinkerData *gen) { string_set_init(&asm_files, 64); defer (string_set_destroy(&asm_files)); - StringSet libs = {}; - string_set_init(&libs, 64); - defer (string_set_destroy(&libs)); + StringSet min_libs_set = {}; + string_set_init(&min_libs_set, 64); + defer (string_set_destroy(&min_libs_set)); for (Entity *e : gen->foreign_libraries) { GB_ASSERT(e->kind == Entity_LibraryName); + // NOTE(bill): Add these before the linking values + String extra_linker_flags = string_trim_whitespace(e->LibraryName.extra_linker_flags); + if (extra_linker_flags.len != 0) { + lib_str = gb_string_append_fmt(lib_str, " %.*s", LIT(extra_linker_flags)); + } for (String lib : e->LibraryName.paths) { lib = string_trim_whitespace(lib); if (lib.len == 0) { @@ -336,19 +337,19 @@ gb_internal i32 linker_stage(LinkerData *gen) { String asm_file = lib; String obj_file = concatenate_strings(permanent_allocator(), asm_file, str_lit(".o")); String obj_format; -#if defined(GB_ARCH_64_BIT) + #if defined(GB_ARCH_64_BIT) if (is_osx) { obj_format = str_lit("macho64"); } else { obj_format = str_lit("elf64"); } -#elif defined(GB_ARCH_32_BIT) + #elif defined(GB_ARCH_32_BIT) if (is_osx) { obj_format = str_lit("macho32"); } else { obj_format = str_lit("elf32"); } -#endif // GB_ARCH_*_BIT + #endif // GB_ARCH_*_BIT if (is_osx) { // `as` comes with MacOS. @@ -383,7 +384,7 @@ gb_internal i32 linker_stage(LinkerData *gen) { } array_add(&gen->output_object_paths, obj_file); } else { - if (string_set_update(&libs, lib)) { + if (string_set_update(&min_libs_set, lib) && build_context.min_link_libs) { continue; } @@ -433,13 +434,6 @@ gb_internal i32 linker_stage(LinkerData *gen) { } } - for (Entity *e : gen->foreign_libraries) { - GB_ASSERT(e->kind == Entity_LibraryName); - if (e->LibraryName.extra_linker_flags.len != 0) { - lib_str = gb_string_append_fmt(lib_str, " %.*s", LIT(e->LibraryName.extra_linker_flags)); - } - } - gbString object_files = gb_string_make(heap_allocator(), ""); defer (gb_string_free(object_files)); for (String object_path : gen->output_object_paths) { diff --git a/src/main.cpp b/src/main.cpp index b8c21fd3b..2dbb72ca2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -296,6 +296,8 @@ enum BuildFlagKind { BuildFlag_ErrorPosStyle, BuildFlag_MaxErrorCount, + BuildFlag_MinLinkLibs, + // internal use only BuildFlag_InternalIgnoreLazy, BuildFlag_InternalIgnoreLLVMBuild, @@ -485,6 +487,8 @@ gb_internal bool parse_build_flags(Array args) { add_flag(&build_flags, BuildFlag_ErrorPosStyle, str_lit("error-pos-style"), BuildFlagParam_String, Command_all); add_flag(&build_flags, BuildFlag_MaxErrorCount, str_lit("max-error-count"), BuildFlagParam_Integer, Command_all); + add_flag(&build_flags, BuildFlag_MinLinkLibs, str_lit("min-link-libs"), BuildFlagParam_None, Command__does_build); + add_flag(&build_flags, BuildFlag_InternalIgnoreLazy, str_lit("internal-ignore-lazy"), BuildFlagParam_None, Command_all); add_flag(&build_flags, BuildFlag_InternalIgnoreLLVMBuild, str_lit("internal-ignore-llvm-build"),BuildFlagParam_None, Command_all); @@ -1215,6 +1219,10 @@ gb_internal bool parse_build_flags(Array args) { break; } + case BuildFlag_MinLinkLibs: + build_context.min_link_libs = true; + break; + case BuildFlag_InternalIgnoreLazy: build_context.ignore_lazy = true; break; @@ -2008,6 +2016,11 @@ gb_internal void print_show_help(String const arg0, String const &command) { print_usage_line(2, "If not set, the default max error count is %d.", DEFAULT_MAX_ERROR_COLLECTOR_COUNT); print_usage_line(0, ""); + print_usage_line(1, "-min-link-libs"); + print_usage_line(2, "If set, the number of linked libraries will be minimized to prevent duplications."); + print_usage_line(2, "This is useful for so called \"dumb\" linkers compared to \"smart\" linkers."); + print_usage_line(0, ""); + print_usage_line(1, "-foreign-error-procedures"); print_usage_line(2, "States that the error procedures used in the runtime are defined in a separate translation unit."); print_usage_line(0, ""); From b979fd4c439f8b9eb30d800dec92a0a669617981 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 4 Apr 2024 16:14:05 +0100 Subject: [PATCH 34/43] Remove consecutive linking libraries --- src/linker.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/linker.cpp b/src/linker.cpp index 2ff7ad0f4..aa36b3278 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -143,6 +143,8 @@ gb_internal i32 linker_stage(LinkerData *gen) { string_set_init(&min_libs_set, 64); defer (string_set_destroy(&min_libs_set)); + String prev_lib = {}; + StringSet asm_files = {}; string_set_init(&asm_files, 64); defer (string_set_destroy(&asm_files)); @@ -191,7 +193,10 @@ gb_internal i32 linker_stage(LinkerData *gen) { } } else if (!string_set_update(&min_libs_set, lib) || !build_context.min_link_libs) { - lib_str = gb_string_append_fmt(lib_str, " \"%.*s\"", LIT(lib)); + if (prev_lib != lib) { + lib_str = gb_string_append_fmt(lib_str, " \"%.*s\"", LIT(lib)); + } + prev_lib = lib; } } } @@ -317,6 +322,8 @@ gb_internal i32 linker_stage(LinkerData *gen) { StringSet min_libs_set = {}; string_set_init(&min_libs_set, 64); defer (string_set_destroy(&min_libs_set)); + + String prev_lib = {}; for (Entity *e : gen->foreign_libraries) { GB_ASSERT(e->kind == Entity_LibraryName); @@ -388,6 +395,11 @@ gb_internal i32 linker_stage(LinkerData *gen) { continue; } + if (prev_lib == lib) { + continue; + } + prev_lib = lib; + // Do not add libc again, this is added later already, and omitted with // the `-no-crt` flag, not skipping here would cause duplicate library // warnings when linking on darwin and might link libc silently even with `-no-crt`. From 2375ac22a7535981b5177c09ca16f36f42fc2cda Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 4 Apr 2024 16:57:08 +0100 Subject: [PATCH 35/43] Improve error messages for `A variable declaration must be an identifier` --- src/check_stmt.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 883a6d213..a543ed9b0 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -740,6 +740,25 @@ gb_internal bool check_using_stmt_entity(CheckerContext *ctx, AstUsingStmt *us, return true; } +gb_internal void error_var_decl_identifier(Ast *name) { + GB_ASSERT(name != nullptr); + GB_ASSERT(name->kind != Ast_Ident); + + ERROR_BLOCK(); + gbString s = expr_to_string(name); + defer (gb_string_free(s)); + + error(name, "A variable declaration must be an identifier, got '%s'", s); + if (name->kind == Ast_Implicit) { + String imp = name->Implicit.string; + if (imp == "context") { + error_line("\tSuggestion: '%.*s' is a reserved keyword, would 'ctx' suffice?\n", LIT(imp)); + } else { + error_line("\tNote: '%.*s' is a reserved keyword\n", LIT(imp)); + } + } +} + gb_internal void check_inline_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) { ast_node(irs, UnrollRangeStmt, node); check_open_scope(ctx, node); @@ -851,7 +870,7 @@ gb_internal void check_inline_range_stmt(CheckerContext *ctx, Ast *node, u32 mod entity = found; } } else { - error(name, "A variable declaration must be an identifier"); + error_var_decl_identifier(name); } if (entity == nullptr) { @@ -1747,9 +1766,7 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) entity = found; } } else { - gbString s = expr_to_string(lhs[i]); - error(name, "A variable declaration must be an identifier, got %s", s); - gb_string_free(s); + error_var_decl_identifier(name); } if (entity == nullptr) { @@ -1801,7 +1818,7 @@ gb_internal void check_value_decl_stmt(CheckerContext *ctx, Ast *node, u32 mod_f for (Ast *name : vd->names) { Entity *entity = nullptr; if (name->kind != Ast_Ident) { - error(name, "A variable declaration must be an identifier"); + error_var_decl_identifier(name); } else { Token token = name->Ident.token; String str = token.string; From 83e2f5ff74a6f2224983ac4c5631b8f65024a239 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 4 Apr 2024 17:01:31 +0100 Subject: [PATCH 36/43] Add better error messages with suggestions for using `context` as an identifier --- src/parser.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/parser.cpp b/src/parser.cpp index 13225f622..bf16f5c9f 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1482,7 +1482,16 @@ gb_internal Token expect_token(AstFile *f, TokenKind kind) { if (prev.kind != kind) { String c = token_strings[kind]; String p = token_to_string(prev); + begin_error_block(); syntax_error(f->curr_token, "Expected '%.*s', got '%.*s'", LIT(c), LIT(p)); + if (kind == Token_Ident) switch (prev.kind) { + case Token_context: + error_line("\tSuggestion: 'context' is a reserved keyword, would 'ctx' suffice?\n"); + break; + } + + end_error_block(); + if (prev.kind == Token_EOF) { exit_with_errors(); } @@ -4055,7 +4064,12 @@ gb_internal Array convert_to_ident_list(AstFile *f, Array li case Ast_BadExpr: break; case Ast_Implicit: + begin_error_block(); syntax_error(ident, "Expected an identifier, '%.*s' which is a keyword", LIT(ident->Implicit.string)); + if (ident->Implicit.kind == Token_context) { + error_line("\tSuggestion: Would 'ctx' suffice as an alternative name?\n"); + } + end_error_block(); ident = ast_ident(f, blank_token); break; From 31407d9b1b8d0d35ba53a0245d86ed37007a28e2 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Thu, 4 Apr 2024 18:39:41 +0200 Subject: [PATCH 37/43] fix 128 bit int alignment on arm64 Fixes #2403 --- src/build_settings.cpp | 2 +- src/llvm_abi.cpp | 2 +- tests/internal/Makefile | 7 +++-- tests/internal/build.bat | 4 ++- tests/internal/test_128.odin | 59 ++++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 tests/internal/test_128.odin diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 1ac9e451f..a96c4491b 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -519,7 +519,7 @@ gb_global TargetMetrics target_darwin_amd64 = { gb_global TargetMetrics target_darwin_arm64 = { TargetOs_darwin, TargetArch_arm64, - 8, 8, 8, 16, + 8, 8, 16, 16, str_lit("arm64-apple-macosx"), // NOTE: Changes during initialization based on build flags. str_lit("e-m:o-i64:64-i128:128-n32:64-S128"), }; diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 724e4e35a..507881f99 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -275,7 +275,7 @@ gb_internal i64 lb_alignof(LLVMTypeRef type) { case LLVMIntegerTypeKind: { unsigned w = LLVMGetIntTypeWidth(type); - return gb_clamp((w + 7)/8, 1, build_context.ptr_size); + return gb_clamp((w + 7)/8, 1, build_context.max_align); } case LLVMHalfTypeKind: return 2; diff --git a/tests/internal/Makefile b/tests/internal/Makefile index 00e46197b..daefd5959 100644 --- a/tests/internal/Makefile +++ b/tests/internal/Makefile @@ -1,6 +1,6 @@ ODIN=../../odin -all: rtti_test map_test pow_test +all: rtti_test map_test pow_test 128_test rtti_test: $(ODIN) run test_rtti.odin -file -vet -strict-style -o:minimal @@ -9,4 +9,7 @@ map_test: $(ODIN) run test_map.odin -file -vet -strict-style -o:minimal pow_test: - $(ODIN) run test_pow.odin -file -vet -strict-style -o:minimal \ No newline at end of file + $(ODIN) run test_pow.odin -file -vet -strict-style -o:minimal + +128_test: + $(ODIN) run test_128.odin -file -vet -strict-style -o:minimal diff --git a/tests/internal/build.bat b/tests/internal/build.bat index f289d17fa..da4fe890d 100644 --- a/tests/internal/build.bat +++ b/tests/internal/build.bat @@ -3,4 +3,6 @@ set PATH_TO_ODIN==..\..\odin rem %PATH_TO_ODIN% run test_rtti.odin -file -vet -strict-style -o:minimal || exit /b %PATH_TO_ODIN% run test_map.odin -file -vet -strict-style -o:minimal || exit /b rem -define:SEED=42 -%PATH_TO_ODIN% run test_pow.odin -file -vet -strict-style -o:minimal || exit /b \ No newline at end of file +%PATH_TO_ODIN% run test_pow.odin -file -vet -strict-style -o:minimal || exit /b + +%PATH_TO_ODIN% run test_128.odin -file -vet -strict-style -o:minimal || exit /b diff --git a/tests/internal/test_128.odin b/tests/internal/test_128.odin new file mode 100644 index 000000000..11ef068ed --- /dev/null +++ b/tests/internal/test_128.odin @@ -0,0 +1,59 @@ +package test_128 + +import "core:fmt" +import "core:os" +import "core:testing" + +TEST_count := 0 +TEST_fail := 0 + +when ODIN_TEST { + expect :: testing.expect + log :: testing.log +} else { + expect :: proc(t: ^testing.T, condition: bool, message: string, loc := #caller_location) { + TEST_count += 1 + if !condition { + TEST_fail += 1 + fmt.printf("[%v] %v\n", loc, message) + return + } + } + log :: proc(t: ^testing.T, v: any, loc := #caller_location) { + fmt.printf("[%v] ", loc) + fmt.printf("log: %v\n", v) + } +} + +main :: proc() { + t := testing.T{} + + test_128_align(&t) + + fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count) + if TEST_fail > 0 { + os.exit(1) + } +} + +@test +test_128_align :: proc(t: ^testing.T) { + Danger_Struct :: struct { + x: u128, + y: u64, + } + + list := [?]Danger_Struct{{0, 0}, {1, 0}, {2, 0}, {3, 0}} + + expect(t, list[0].x == 0, fmt.tprintf("[0].x (%v) != 0", list[0].x)) + expect(t, list[0].y == 0, fmt.tprintf("[0].y (%v) != 0", list[0].y)) + + expect(t, list[1].x == 1, fmt.tprintf("[1].x (%v) != 1", list[1].x)) + expect(t, list[1].y == 0, fmt.tprintf("[1].y (%v) != 0", list[1].y)) + + expect(t, list[2].x == 2, fmt.tprintf("[2].x (%v) != 2", list[2].x)) + expect(t, list[2].y == 0, fmt.tprintf("[2].y (%v) != 0", list[2].y)) + + expect(t, list[3].x == 3, fmt.tprintf("[3].x (%v) != 3", list[3].x)) + expect(t, list[3].y == 0, fmt.tprintf("[3].y (%v) != 0", list[3].y)) +} From 133b45d843657215bbb4121d0d361134b2731255 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Thu, 4 Apr 2024 23:30:06 +0200 Subject: [PATCH 38/43] fix amd64 sysv abi to pass asan everywhere I verified the PR by running the entire test suite of Odin itself with `-sanitize:address` and also the ols test suite (which caused unique problems before). A test has also been added with some problematic code, Windows seems to have problems with asan in CI or in general so it is not ran there. The LB_ABI_COMPUTE_RETURN_TYPES block has been removed entirely because it was unused, I got pretty confused why it didn't effect anything at first. Fixes #3211 --- src/llvm_abi.cpp | 47 +++++++++----------------- tests/internal/Makefile | 5 ++- tests/internal/test_asan.odin | 62 +++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 33 deletions(-) create mode 100644 tests/internal/test_asan.odin diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 4cee0e443..88bb58c55 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -558,7 +558,6 @@ namespace lbAbiAmd64SysV { Amd64TypeAttribute_StructRect, }; - gb_internal LB_ABI_COMPUTE_RETURN_TYPE(compute_return_type); gb_internal void classify_with(LLVMTypeRef t, Array *cls, i64 ix, i64 off); gb_internal void fixup(LLVMTypeRef t, Array *cls); gb_internal lbArgType amd64_type(LLVMContextRef c, LLVMTypeRef type, Amd64TypeAttributeKind attribute_kind, ProcCallingConvention calling_convention); @@ -796,10 +795,10 @@ namespace lbAbiAmd64SysV { } } + i64 sz = lb_sizeof(type); if (all_ints) { - i64 sz = lb_sizeof(type); for_array(i, reg_classes) { - GB_ASSERT(sz != 0); + GB_ASSERT(sz > 0); // TODO(bill): is this even correct? BECAUSE LLVM DOES NOT DOCUMENT ANY OF THIS!!! if (sz >= 8) { array_add(&types, LLVMIntTypeInContext(c, 64)); @@ -811,12 +810,16 @@ namespace lbAbiAmd64SysV { } } else { for (isize i = 0; i < reg_classes.count; /**/) { + GB_ASSERT(sz > 0); RegClass reg_class = reg_classes[i]; switch (reg_class) { case RegClass_Int: - // TODO(bill): is this even correct? BECAUSE LLVM DOES NOT DOCUMENT ANY OF THIS!!! - array_add(&types, LLVMIntTypeInContext(c, 64)); - break; + { + i64 rs = gb_min(sz, 8); + array_add(&types, LLVMIntTypeInContext(c, cast(unsigned)(rs*8))); + sz -= rs; + break; + } case RegClass_SSEFv: case RegClass_SSEDv: case RegClass_SSEInt8: @@ -856,15 +859,18 @@ namespace lbAbiAmd64SysV { unsigned vec_len = llvec_len(reg_classes, i+1); LLVMTypeRef vec_type = LLVMVectorType(elem_type, vec_len * elems_per_word); array_add(&types, vec_type); + sz -= lb_sizeof(vec_type); i += vec_len; continue; } break; case RegClass_SSEFs: array_add(&types, LLVMFloatTypeInContext(c)); + sz -= 4; break; case RegClass_SSEDs: array_add(&types, LLVMDoubleTypeInContext(c)); + sz -= 8; break; default: GB_PANIC("Unhandled RegClass"); @@ -876,8 +882,8 @@ namespace lbAbiAmd64SysV { if (types.count == 1) { return types[0]; } - // TODO(bill): this should be packed but it causes code generation issues - return LLVMStructTypeInContext(c, types.data, cast(unsigned)types.count, false); + + return LLVMStructTypeInContext(c, types.data, cast(unsigned)types.count, sz == 0); } gb_internal void classify_with(LLVMTypeRef t, Array *cls, i64 ix, i64 off) { @@ -980,28 +986,6 @@ namespace lbAbiAmd64SysV { break; } } - - gb_internal LB_ABI_COMPUTE_RETURN_TYPE(compute_return_type) { - if (!return_is_defined) { - return lb_arg_type_direct(LLVMVoidTypeInContext(c)); - } else if (lb_is_type_kind(return_type, LLVMStructTypeKind)) { - i64 sz = lb_sizeof(return_type); - switch (sz) { - case 1: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 8), nullptr, nullptr); - case 2: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 16), nullptr, nullptr); - case 4: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 32), nullptr, nullptr); - case 8: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 64), nullptr, nullptr); - } - - LB_ABI_MODIFY_RETURN_IF_TUPLE_MACRO(); - - LLVMAttributeRef attr = lb_create_enum_attribute_with_type(c, "sret", return_type); - return lb_arg_type_indirect(return_type, attr); - } else if (build_context.metrics.os == TargetOs_windows && lb_is_type_kind(return_type, LLVMIntegerTypeKind) && lb_sizeof(return_type) == 16) { - return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 128), nullptr, nullptr); - } - return non_struct(c, return_type); - } }; @@ -1166,8 +1150,7 @@ namespace lbAbiArm64 { size_copy -= 8; } GB_ASSERT(size_copy <= 0); - // TODO(bill): this should be packed but it causes code generation issues - cast_type = LLVMStructTypeInContext(c, types, count, false); + cast_type = LLVMStructTypeInContext(c, types, count, true); } return lb_arg_type_direct(return_type, cast_type, nullptr, nullptr); } else { diff --git a/tests/internal/Makefile b/tests/internal/Makefile index daefd5959..c5c612cdd 100644 --- a/tests/internal/Makefile +++ b/tests/internal/Makefile @@ -1,6 +1,6 @@ ODIN=../../odin -all: rtti_test map_test pow_test 128_test +all: rtti_test map_test pow_test 128_test asan_test rtti_test: $(ODIN) run test_rtti.odin -file -vet -strict-style -o:minimal @@ -13,3 +13,6 @@ pow_test: 128_test: $(ODIN) run test_128.odin -file -vet -strict-style -o:minimal + +asan_test: + $(ODIN) run test_asan.odin -file -sanitize:address -debug diff --git a/tests/internal/test_asan.odin b/tests/internal/test_asan.odin new file mode 100644 index 000000000..2384ada76 --- /dev/null +++ b/tests/internal/test_asan.odin @@ -0,0 +1,62 @@ +// Intended to contain code that would trigger asan easily if the abi was set up badly. +package test_asan + +import "core:fmt" +import "core:testing" +import "core:os" + +TEST_count := 0 +TEST_fail := 0 + +when ODIN_TEST { + expect :: testing.expect + log :: testing.log +} else { + expect :: proc(t: ^testing.T, condition: bool, message: string, loc := #caller_location) { + TEST_count += 1 + if !condition { + TEST_fail += 1 + fmt.printf("[%v] %v\n", loc, message) + return + } + } + log :: proc(t: ^testing.T, v: any, loc := #caller_location) { + fmt.printf("[%v] ", loc) + fmt.printf("log: %v\n", v) + } +} + +main :: proc() { + t := testing.T{} + + test_12_bytes(&t) + test_12_bytes_two(&t) + + fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count) + if TEST_fail > 0 { + os.exit(1) + } +} + +@(test) +test_12_bytes :: proc(t: ^testing.T) { + internal :: proc() -> (a, b: f32, ok: bool) { + return max(f32), 0, true + } + + a, b, ok := internal() + expect(t, a == max(f32), fmt.tprintf("a (%v) != max(f32)", a)) + expect(t, b == 0, fmt.tprintf("b (%v) != 0", b)) + expect(t, ok, fmt.tprintf("ok (%v) != true", ok)) +} + +@(test) +test_12_bytes_two :: proc(t: ^testing.T) { + internal :: proc() -> (a: f32, b: int) { + return 100., max(int) + } + + a, b := internal() + expect(t, a == 100., fmt.tprintf("a (%v) != 100.", a)) + expect(t, b == max(int), fmt.tprintf("b (%v) != max(int)", b)) +} From 8d399fa7c098bc7dcdb11de3cfa72537b6b722f1 Mon Sep 17 00:00:00 2001 From: Christopher Kaster Date: Fri, 5 Apr 2024 09:00:57 +0200 Subject: [PATCH 39/43] add missing SDL2_SemPost binding --- vendor/sdl2/sdl_mutex.odin | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/sdl2/sdl_mutex.odin b/vendor/sdl2/sdl_mutex.odin index 1fd5849e0..6ff7e5d2b 100644 --- a/vendor/sdl2/sdl_mutex.odin +++ b/vendor/sdl2/sdl_mutex.odin @@ -34,6 +34,7 @@ foreign lib { SemWait :: proc(s: ^sem) -> c.int --- SemTryWait :: proc(s: ^sem) -> c.int --- SemWaitTimeout :: proc(s: ^sem, ms: u32) -> c.int --- + SemPost :: proc(s: ^sem) -> c.int --- SemValue :: proc(s: ^sem) -> u32 --- CreateCond :: proc() -> ^cond --- From a45721e9ad0a48198533434acbca0fbfb974e115 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Fri, 5 Apr 2024 23:45:41 +0900 Subject: [PATCH 40/43] core/crypto/poly1305: The final addition is NOT mod p --- core/crypto/poly1305/poly1305.odin | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/core/crypto/poly1305/poly1305.odin b/core/crypto/poly1305/poly1305.odin index fa57c6c06..4ca4f75e1 100644 --- a/core/crypto/poly1305/poly1305.odin +++ b/core/crypto/poly1305/poly1305.odin @@ -9,6 +9,7 @@ package poly1305 import "core:crypto" import field "core:crypto/_fiat/field_poly1305" import "core:encoding/endian" +import "core:math/bits" import "core:mem" // KEY_SIZE is the Poly1305 key size in bytes. @@ -50,7 +51,7 @@ verify :: proc(tag, msg, key: []byte) -> bool { Context :: struct { _r: field.Tight_Field_Element, _a: field.Tight_Field_Element, - _s: field.Tight_Field_Element, + _s: [2]u64, _buffer: [_BLOCK_SIZE]byte, _leftover: int, _is_initialized: bool, @@ -66,11 +67,12 @@ init :: proc(ctx: ^Context, key: []byte) { // r = le_bytes_to_num(key[0..15]) // r = clamp(r) (r &= 0xffffffc0ffffffc0ffffffc0fffffff) tmp_lo := endian.unchecked_get_u64le(key[0:]) & 0x0ffffffc0fffffff - tmp_hi := endian.unchecked_get_u64le(key[8:]) & 0xffffffc0ffffffc + tmp_hi := endian.unchecked_get_u64le(key[8:]) & 0x0ffffffc0ffffffc field.fe_from_u64s(&ctx._r, tmp_lo, tmp_hi) // s = le_bytes_to_num(key[16..31]) - field.fe_from_bytes(&ctx._s, key[16:32], 0) + ctx._s[0] = endian.unchecked_get_u64le(key[16:]) + ctx._s[1] = endian.unchecked_get_u64le(key[24:]) // a = 0 field.fe_zero(&ctx._a) @@ -138,14 +140,20 @@ final :: proc(ctx: ^Context, dst: []byte) { _blocks(ctx, ctx._buffer[:], true) } - // a += s - field.fe_add(field.fe_relax_cast(&ctx._a), &ctx._a, &ctx._s) // _a unreduced - field.fe_carry(&ctx._a, field.fe_relax_cast(&ctx._a)) // _a reduced - - // return num_to_16_le_bytes(a) + // a += s (NOT mod p) tmp: [32]byte = --- field.fe_to_bytes(&tmp, &ctx._a) - copy_slice(dst, tmp[0:16]) + + c: u64 + lo := endian.unchecked_get_u64le(tmp[0:]) + hi := endian.unchecked_get_u64le(tmp[8:]) + + lo, c = bits.add_u64(lo, ctx._s[0], 0) + hi, _ = bits.add_u64(hi, ctx._s[1], c) + + // return num_to_16_le_bytes(a) + endian.unchecked_put_u64le(dst[0:], lo) + endian.unchecked_put_u64le(dst[8:], hi) } // reset sanitizes the Context. The Context must be re-initialized to From ca46484ae3ee548745992e6ad1435255e3ff604b Mon Sep 17 00:00:00 2001 From: oskarnp Date: Sat, 6 Apr 2024 11:02:43 +0200 Subject: [PATCH 41/43] Fix checker crash when `or_return`/`or_break`/`or_continue` used for non-existing proc --- src/check_stmt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index a543ed9b0..fc3b9aa43 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2075,13 +2075,13 @@ gb_internal void check_expr_stmt(CheckerContext *ctx, Ast *node) { } Ast *expr = strip_or_return_expr(operand.expr); - if (expr->kind == Ast_CallExpr) { + if (expr && expr->kind == Ast_CallExpr) { BuiltinProcId builtin_id = BuiltinProc_Invalid; bool do_require = false; AstCallExpr *ce = &expr->CallExpr; Type *t = base_type(type_of_expr(ce->proc)); - if (t->kind == Type_Proc) { + if (t && t->kind == Type_Proc) { do_require = t->Proc.require_results; } else if (check_stmt_internal_builtin_proc_id(ce->proc, &builtin_id)) { auto const &bp = builtin_procs[builtin_id]; @@ -2093,7 +2093,7 @@ gb_internal void check_expr_stmt(CheckerContext *ctx, Ast *node) { gb_string_free(expr_str); } return; - } else if (expr->kind == Ast_SelectorCallExpr) { + } else if (expr && expr->kind == Ast_SelectorCallExpr) { BuiltinProcId builtin_id = BuiltinProc_Invalid; bool do_require = false; From fde4e8c9054cad0246cf4847f5e02a19d8c3af6d Mon Sep 17 00:00:00 2001 From: blob1807 <12388588+blob1807@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:49:50 +1000 Subject: [PATCH 42/43] Removed undefined & usused vars Removed undefined& usused vars in init_from_parts --- core/math/fixed/fixed.odin | 1 - 1 file changed, 1 deletion(-) diff --git a/core/math/fixed/fixed.odin b/core/math/fixed/fixed.odin index b8000a5c6..21fab5faf 100644 --- a/core/math/fixed/fixed.odin +++ b/core/math/fixed/fixed.odin @@ -39,7 +39,6 @@ init_from_f64 :: proc(x: ^$T/Fixed($Backing, $Fraction_Width), val: f64) { } init_from_parts :: proc(x: ^$T/Fixed($Backing, $Fraction_Width), integer, fraction: Backing) { - i, f := math.modf(val) x.i = fraction x.i &= 1< Date: Sat, 6 Apr 2024 16:59:02 +0100 Subject: [PATCH 43/43] Remove duplicate table --- core/unicode/utf8/utf8.odin | 41 ++++++++++++------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/core/unicode/utf8/utf8.odin b/core/unicode/utf8/utf8.odin index 3642b8078..67f8a8be9 100644 --- a/core/unicode/utf8/utf8.odin +++ b/core/unicode/utf8/utf8.odin @@ -45,18 +45,18 @@ accept_ranges := [5]Accept_Range{ {0x80, 0x8f}, } -accept_sizes := [256]u8{ - 0x00..=0x7f = 0xf0, - 0x80..=0xc1 = 0xf1, - 0xc2..=0xdf = 0x02, - 0xe0 = 0x13, - 0xe1..=0xec = 0x03, - 0xed = 0x23, - 0xee..=0xef = 0x03, - 0xf0 = 0x34, - 0xf1..=0xf3 = 0x04, - 0xf4 = 0x44, - 0xf5..=0xff = 0xf1, +accept_sizes := [256]u8{ + 0x00..=0x7f = 0xf0, // ascii, size 1 + 0x80..=0xc1 = 0xf1, // invalid, size 1 + 0xc2..=0xdf = 0x02, // accept 1, size 2 + 0xe0 = 0x13, // accept 1, size 3 + 0xe1..=0xec = 0x03, // accept 0, size 3 + 0xed = 0x23, // accept 2, size 3 + 0xee..=0xef = 0x03, // accept 0, size 3 + 0xf0 = 0x34, // accept 3, size 4 + 0xf1..=0xf3 = 0x04, // accept 0, size 4 + 0xf4 = 0x44, // accept 4, size 4 + 0xf5..=0xff = 0xf1, // ascii, size 1 } encode_rune :: proc "contextless" (c: rune) -> ([4]u8, int) { @@ -385,7 +385,7 @@ full_rune_in_bytes :: proc "contextless" (b: []byte) -> bool { if n == 0 { return false } - x := _first[b[0]] + x := accept_sizes[b[0]] if n >= int(x & 7) { return true } @@ -403,18 +403,3 @@ full_rune_in_bytes :: proc "contextless" (b: []byte) -> bool { full_rune_in_string :: proc "contextless" (s: string) -> bool { return full_rune_in_bytes(transmute([]byte)s) } - - -_first := [256]u8{ - 0x00..=0x7f = 0xf0, // ascii, size 1 - 0x80..=0xc1 = 0xf1, // invalid, size 1 - 0xc2..=0xdf = 0x02, // accept 1, size 2 - 0xe0 = 0x13, // accept 1, size 3 - 0xe1..=0xec = 0x03, // accept 0, size 3 - 0xed = 0x23, // accept 2, size 3 - 0xee..=0xef = 0x03, // accept 0, size 3 - 0xf0 = 0x34, // accept 3, size 4 - 0xf1..=0xf3 = 0x04, // accept 0, size 4 - 0xf4 = 0x44, // accept 4, size 4 - 0xf5..=0xff = 0xf1, // ascii, size 1 -}