fix reload module
This commit is contained in:
parent
24002b2de3
commit
e6bc77bb17
2 changed files with 9 additions and 8 deletions
|
|
@ -113,7 +113,7 @@ user_options :: #run -> Simple_Build_Options {
|
||||||
#load "%1";
|
#load "%1";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
(#import "jx/reload").reload_main();
|
(#import "jc/reload").reload_main();
|
||||||
}
|
}
|
||||||
END, file_path);
|
END, file_path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ reload_main :: () {
|
||||||
system_allocator := context.allocator;
|
system_allocator := context.allocator;
|
||||||
|
|
||||||
// Ensure we're not allocating anywhere unexpected
|
// Ensure we're not allocating anywhere unexpected
|
||||||
context.allocator = Crash_Allocator;
|
context.allocator = mem.Crash_Allocator;
|
||||||
|
|
||||||
basic.set_working_directory(strings.path_strip_filename(system.get_path_of_running_executable()));
|
basic.set_working_directory(strings.path_strip_filename(system.get_path_of_running_executable()));
|
||||||
|
|
||||||
|
|
@ -25,17 +25,17 @@ reload_main :: () {
|
||||||
basic.free(lib_versions.data,, allocator = system_allocator);
|
basic.free(lib_versions.data,, allocator = system_allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
print("host: allocating % bytes memory (% for state)\n", H.max_memory, H.state_size);
|
basic.print("host: allocating % bytes memory (% for state)\n", H.max_memory, H.state_size);
|
||||||
|
|
||||||
lib_memory := basic.alloc(xx H.max_memory,, allocator = system_allocator);
|
lib_memory := basic.alloc(xx H.max_memory,, allocator = system_allocator);
|
||||||
assert(lib_memory != null, "host: failed to allocate memory!");
|
assert(lib_memory != null, "host: failed to allocate memory!");
|
||||||
defer free(lib_memory,, allocator = system_allocator);
|
defer free(lib_memory,, allocator = system_allocator);
|
||||||
|
|
||||||
lib_arena: Arena;
|
lib_arena: mem.Arena;
|
||||||
init_arena(*lib_arena, lib_memory, H.max_memory);
|
mem.init_arena(*lib_arena, lib_memory, H.max_memory);
|
||||||
|
|
||||||
lib_allocator := Allocator.{
|
lib_allocator := Allocator.{
|
||||||
proc = arena_allocator_proc,
|
proc = mem.arena_allocator_proc,
|
||||||
data = *lib_arena,
|
data = *lib_arena,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -95,8 +95,7 @@ reload_main :: () {
|
||||||
|
|
||||||
lib_memory = basic.alloc(xx new_msize,, allocator = system_allocator);
|
lib_memory = basic.alloc(xx new_msize,, allocator = system_allocator);
|
||||||
basic.assert(lib_memory != null, "host: failed to allocator new memory");
|
basic.assert(lib_memory != null, "host: failed to allocator new memory");
|
||||||
|
mem.init_arena(*lib_arena, lib_memory, new_msize);
|
||||||
init_arena(*lib_arena, lib_memory, new_msize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// in either case, we want ensure lib_state is at the start of our program's memory.
|
// in either case, we want ensure lib_state is at the start of our program's memory.
|
||||||
|
|
@ -230,6 +229,8 @@ else {
|
||||||
#assert(false, "only windows, mac, and linux are supported for now");
|
#assert(false, "only windows, mac, and linux are supported for now");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mem :: #import "jc/memory";
|
||||||
|
|
||||||
basic :: #import "Basic"; // @future
|
basic :: #import "Basic"; // @future
|
||||||
system :: #import "System"; // @future
|
system :: #import "System"; // @future
|
||||||
file :: #import "File"; // @future
|
file :: #import "File"; // @future
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue