From 3a49192f3a1e8a5d348cdbfccd0a16d74ba61e3d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 6 Feb 2022 00:12:48 +0100 Subject: treewide: rework function memory model - Instead of treating individual program functions as managed ucode types, demote uc_function_t values to pointers into a uc_program_t entity - Promote uc_program_t to a managed type - Let uc_closure_t claim references to the owning program of the enclosed uc_function_t - Redefine public APIs uc_compile() and uc_vm_execute() APIs to return and expect an uc_program_t object respectively - Remove vallist indirection for function loading and let the compiler emit the function id directly when producing function construction code Signed-off-by: Jo-Philipp Wich --- examples/execute-file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/execute-file.c') diff --git a/examples/execute-file.c b/examples/execute-file.c index 12910e3..1895cda 100644 --- a/examples/execute-file.c +++ b/examples/execute-file.c @@ -49,13 +49,13 @@ int main(int argc, char **argv) /* compile source buffer into function */ char *syntax_error = NULL; - uc_function_t *progfunc = uc_compile(&config, src, &syntax_error); + uc_program_t *program = uc_compile(&config, src, &syntax_error); /* release source buffer */ uc_source_put(src); /* check if compilation failed */ - if (!progfunc) { + if (!program) { fprintf(stderr, "Failed to compile program: %s\n", syntax_error); return 1; @@ -74,7 +74,7 @@ int main(int argc, char **argv) /* execute compiled program function */ uc_value_t *last_expression_result = NULL; - int return_code = uc_vm_execute(&vm, progfunc, &last_expression_result); + int return_code = uc_vm_execute(&vm, program, &last_expression_result); /* handle return status */ switch (return_code) { -- cgit v1.2.3