compiler.c (548B)
1 /* Copyright (c) 2020 tevador <tevador@gmail.com> */ 2 /* See LICENSE for licensing information */ 3 4 #include <stdbool.h> 5 6 #include "compiler.h" 7 #include "virtual_memory.h" 8 #include "program.h" 9 #include "context.h" 10 11 void hashx_compiler_init(hashx_ctx* ctx) { 12 /* This can fail, but it's uncommon. We report this up the call chain 13 * later, at the same time as an mprotect or similar failure. */ 14 ctx->compiler_mem = hashx_vm_alloc(COMP_CODE_SIZE); 15 } 16 17 void hashx_compiler_destroy(hashx_ctx* ctx) { 18 hashx_vm_free(ctx->compiler_mem, COMP_CODE_SIZE); 19 }