Reorganize package runtime

Separates out the OS specific stuff into different files
This commit is contained in:
gingerBill
2020-09-15 11:52:19 +01:00
parent 4930a9c1a4
commit f48a873954
6 changed files with 497 additions and 479 deletions
+1 -19
View File
@@ -3,7 +3,6 @@
// The compiler relies upon this _exact_ order
package runtime
import "core:os"
import "intrinsics"
_ :: intrinsics;
@@ -510,15 +509,11 @@ __init_context :: proc "contextless" (c: ^Context) {
c.temp_allocator.procedure = default_temp_allocator_proc;
c.temp_allocator.data = &global_default_temp_allocator_data;
c.thread_id = os.current_thread_id(); // NOTE(bill): This is "contextless" so it is okay to call
c.thread_id = current_thread_id(); // NOTE(bill): This is "contextless" so it is okay to call
c.assertion_failure_proc = default_assertion_failure_proc;
c.logger.procedure = default_logger_proc;
c.logger.data = nil;
// c.stdin = os.stdin;
// c.stdout = os.stdout;
// c.stderr = os.stderr;
}
@builtin
@@ -526,19 +521,6 @@ init_global_temporary_allocator :: proc(data: []byte, backup_allocator := contex
default_temp_allocator_init(&global_default_temp_allocator_data, data, backup_allocator);
}
default_assertion_failure_proc :: proc(prefix, message: string, loc: Source_Code_Location) {
fd := os.stderr;
print_caller_location(fd, loc);
os.write_string(fd, " ");
os.write_string(fd, prefix);
if len(message) > 0 {
os.write_string(fd, ": ");
os.write_string(fd, message);
}
os.write_byte(fd, '\n');
debug_trap();
}
@builtin