Update Tilde

This commit is contained in:
gingerBill
2023-07-24 10:27:55 +01:00
parent 2f9c5d2d0b
commit 241a939c29
8 changed files with 35 additions and 23 deletions
+9 -9
View File
@@ -235,7 +235,7 @@ make_slice_error_loc :: #force_inline proc "contextless" (loc := #caller_locatio
handle_error(loc, len)
}
make_dynamic_array_error_loc :: #force_inline proc "contextless" (using loc := #caller_location, len, cap: int) {
make_dynamic_array_error_loc :: #force_inline proc "contextless" (loc := #caller_location, len, cap: int) {
if 0 <= len && len <= cap {
return
}
@@ -271,18 +271,18 @@ make_map_expr_error_loc :: #force_inline proc "contextless" (loc := #caller_loca
bounds_check_error_loc :: #force_inline proc "contextless" (using loc := #caller_location, index, count: int) {
bounds_check_error(file_path, line, column, index, count)
bounds_check_error_loc :: #force_inline proc "contextless" (loc := #caller_location, index, count: int) {
bounds_check_error(loc.file_path, loc.line, loc.column, index, count)
}
slice_expr_error_hi_loc :: #force_inline proc "contextless" (using loc := #caller_location, hi: int, len: int) {
slice_expr_error_hi(file_path, line, column, hi, len)
slice_expr_error_hi_loc :: #force_inline proc "contextless" (loc := #caller_location, hi: int, len: int) {
slice_expr_error_hi(loc.file_path, loc.line, loc.column, hi, len)
}
slice_expr_error_lo_hi_loc :: #force_inline proc "contextless" (using loc := #caller_location, lo, hi: int, len: int) {
slice_expr_error_lo_hi(file_path, line, column, lo, hi, len)
slice_expr_error_lo_hi_loc :: #force_inline proc "contextless" (loc := #caller_location, lo, hi: int, len: int) {
slice_expr_error_lo_hi(loc.file_path, loc.line, loc.column, lo, hi, len)
}
dynamic_array_expr_error_loc :: #force_inline proc "contextless" (using loc := #caller_location, low, high, max: int) {
dynamic_array_expr_error(file_path, line, column, low, high, max)
dynamic_array_expr_error_loc :: #force_inline proc "contextless" (loc := #caller_location, low, high, max: int) {
dynamic_array_expr_error(loc.file_path, loc.line, loc.column, low, high, max)
}
+11 -2
View File
@@ -11,7 +11,7 @@ RUNTIME_LINKAGE :: "strong" when (
ODIN_BUILD_MODE == .Dynamic ||
!ODIN_NO_CRT) &&
!IS_WASM) else "internal"
RUNTIME_REQUIRE :: true
RUNTIME_REQUIRE :: !ODIN_TILDE
@(private)
@@ -218,10 +218,18 @@ memory_equal :: proc "contextless" (x, y: rawptr, n: int) -> bool {
case n == 0: return true
case x == y: return true
}
a, b := ([^]byte)(x), ([^]byte)(y)
length := uint(n)
for i := uint(0); i < length; i += 1 {
if a[i] != b[i] {
return false
}
}
return true
/*
when size_of(uint) == 8 {
if word_length := length >> 3; word_length != 0 {
for _ in 0..<word_length {
@@ -276,6 +284,7 @@ memory_equal :: proc "contextless" (x, y: rawptr, n: int) -> bool {
return true
}
*/
}
memory_compare :: proc "contextless" (a, b: rawptr, n: int) -> int #no_bounds_check {
+6 -6
View File
@@ -215,19 +215,19 @@ print_uint :: proc "contextless" (x: uint) { print_u64(u64(x)) }
print_uintptr :: proc "contextless" (x: uintptr) { print_u64(u64(x)) }
print_int :: proc "contextless" (x: int) { print_i64(i64(x)) }
print_caller_location :: proc "contextless" (using loc: Source_Code_Location) {
print_string(file_path)
print_caller_location :: proc "contextless" (loc: Source_Code_Location) {
print_string(loc.file_path)
when ODIN_ERROR_POS_STYLE == .Default {
print_byte('(')
print_u64(u64(line))
print_u64(u64(loc.line))
print_byte(':')
print_u64(u64(column))
print_u64(u64(loc.column))
print_byte(')')
} else when ODIN_ERROR_POS_STYLE == .Unix {
print_byte(':')
print_u64(u64(line))
print_u64(u64(loc.line))
print_byte(':')
print_u64(u64(column))
print_u64(u64(loc.column))
print_byte(':')
} else {
#panic("unhandled ODIN_ERROR_POS_STYLE")
+2 -2
View File
@@ -31,7 +31,7 @@ when ODIN_NO_CRT && ODIN_OS == .Windows {
if ptr != nil && len != 0 {
b := byte(val)
p := ([^]byte)(ptr)
for i in 0..<len {
for i := 0; i < len; i += 1 {
p[i] = b
}
}
@@ -75,7 +75,7 @@ when ODIN_NO_CRT && ODIN_OS == .Windows {
if ptr != nil && len != 0 {
b := byte(val)
p := ([^]byte)(ptr)
for i in 0..<len {
for i := 0; i < len; i += 1 {
p[i] = b
}
}
-1
View File
@@ -386,7 +386,6 @@ typedef struct TB_Symbol {
} tag;
// refers to the prev or next symbol with the same tag
struct TB_Symbol* prev;
struct TB_Symbol* next;
char* name;
BIN
View File
Binary file not shown.
+1
View File
@@ -887,6 +887,7 @@ gb_internal cgValue cg_const_value(cgProcedure *p, Type *type, ExactValue const
char name[32] = {};
gb_snprintf(name, 31, "csb$%u", 1+m->const_nil_guid.fetch_add(1));
TB_Global *cstr_global = tb_global_create(m->mod, -1, name, nullptr, TB_LINKAGE_PRIVATE);
i64 size = str.len+1;
tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), cstr_global, size, 1, 1);
u8 *data = cast(u8 *)tb_global_add_region(m->mod, cstr_global, 0, size);
+6 -3
View File
@@ -334,8 +334,8 @@ gb_internal void cg_procedure_end(cgProcedure *p) {
}
bool emit_asm = false;
if (string_starts_with(p->name, str_lit("bug@main"))) {
// emit_asm = true;
if (string_starts_with(p->name, str_lit("bug@"))) {
emit_asm = true;
}
TB_FunctionOutput *output = tb_module_compile_function(p->module->mod, p->func, TB_ISEL_FAST, emit_asm);
@@ -357,7 +357,10 @@ gb_internal void cg_procedure_generate(cgProcedure *p) {
cg_build_stmt(p, p->body);
cg_procedure_end(p);
if (string_starts_with(p->name, str_lit("bug@main"))) { // IR Printing
if (
// string_starts_with(p->name, str_lit("bug@")) ||
false
) { // IR Printing
TB_Arena *arena = tb_default_arena();
defer (arena->free(arena));
TB_FuncOpt *opt = tb_funcopt_enter(p->func, arena);