diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-11-03 16:26:22 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-11-03 16:26:22 +0000 |
| commit | 6c2772d09338f044096240eeb01aa09d11ddda59 (patch) | |
| tree | 1afd1387e3b1cae497d725773f2c3cbf005eeba1 /src/ssa.cpp | |
| parent | 8534e064b9b4486f3e1c819666b02933387954f5 (diff) | |
Scrap Virtual Machine and begin again
I just didn't like the style of it.
Diffstat (limited to 'src/ssa.cpp')
| -rw-r--r-- | src/ssa.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ssa.cpp b/src/ssa.cpp index 884eef685..58028850e 100644 --- a/src/ssa.cpp +++ b/src/ssa.cpp @@ -1146,9 +1146,11 @@ ssaDefer ssa_add_defer_instr(ssaProcedure *proc, isize scope_index, ssaValue *in ssaValue *ssa_add_module_constant(ssaModule *m, Type *type, ExactValue value) { + gbAllocator a = m->allocator; + // gbAllocator a = gb_heap_allocator(); + if (is_type_slice(type)) { ast_node(cl, CompoundLit, value.value_compound); - gbAllocator a = m->allocator; isize count = cl->elems.count; if (count == 0) { @@ -1174,11 +1176,14 @@ ssaValue *ssa_add_module_constant(ssaModule *m, Type *type, ExactValue value) { return ssa_make_value_constant_slice(a, type, g, count); } - return ssa_make_value_constant(m->allocator, type, value); + return ssa_make_value_constant(a, type, value); } ssaValue *ssa_add_global_string_array(ssaModule *m, String string) { + // TODO(bill): Should this use the arena allocator or the heap allocator? + // Strings could be huge! gbAllocator a = m->allocator; + // gbAllocator a = gb_heap_allocator(); isize max_len = 6+8+1; u8 *str = cast(u8 *)gb_alloc_array(a, u8, max_len); @@ -5334,6 +5339,13 @@ void ssa_gen_tree(ssaGen *s) { ssa_build_proc(m->procs[i], m->procs[i]->Proc.parent); } + // { + // DWORD old_protect = 0; + // DWORD new_protect = PAGE_READONLY; + // BOOL ok = VirtualProtect(m->arena.physical_start, m->arena.total_size, new_protect, &old_protect); + // } + + // m->layout = make_string("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"); } |