From 2fd2b99319e6ac778786fd0e1511c4428c17285b Mon Sep 17 00:00:00 2001 From: hwwang Date: Thu, 6 Jun 2024 15:39:38 +0800 Subject: [PATCH] tree of leftchild --- runtime/Makefile | 4 ++-- runtime/src/current_sandbox.c | 3 ++- runtime/src/listener_thread.c | 3 ++- runtime/src/module.c | 9 +++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/runtime/Makefile b/runtime/Makefile index 0c9be7c..538f6bd 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -10,10 +10,10 @@ PAGE_SIZE := $(shell getconf PAGESIZE) # Compiler Settings CC=clang -CC_OPTIONS = -O3 -flto -g -pthread -D_GNU_SOURCE +# CC_OPTIONS = -O3 -flto -g -pthread -D_GNU_SOURCE # CC_OPTIONS for Debugging -# CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE +CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE # CFI Sanitizer # CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE -flto -fvisibility=default -fsanitize=cfi diff --git a/runtime/src/current_sandbox.c b/runtime/src/current_sandbox.c index 9ef5819..73b5bcf 100644 --- a/runtime/src/current_sandbox.c +++ b/runtime/src/current_sandbox.c @@ -70,7 +70,8 @@ current_sandbox_start(void) char *error_message = ""; sandbox_initialize_stdio(sandbox); - struct module * next_module = sandbox->module->next_module; + //struct module * next_module = sandbox->module->next_module; + struct module * next_module = sandbox->module->left_module; /* * Add the client fd to epoll if it is the first or last sandbox in the chain because they diff --git a/runtime/src/listener_thread.c b/runtime/src/listener_thread.c index e2676f7..c746054 100644 --- a/runtime/src/listener_thread.c +++ b/runtime/src/listener_thread.c @@ -180,7 +180,8 @@ listener_thread_main(void *dummy) struct module * next_module = module; while(next_module) { estimated_execution_time += admission_info_get_percentile(&next_module->admissions_info); - next_module = next_module->next_module; + //next_module = next_module->next_module; + next_module = next_module->left_module; } /* Adding system start timestamp to avoid negative remaining slack in the following update. They are all cycles */ diff --git a/runtime/src/module.c b/runtime/src/module.c index 45c1887..4544c77 100644 --- a/runtime/src/module.c +++ b/runtime/src/module.c @@ -609,7 +609,8 @@ module_new_from_json(char *file_name) { module->is_parent = false; } - + module->left_module = NULL; + module->right_module = NULL; nodes[i] = module; // if (tail_module != NULL) { tail_module->next_module = module; } // tail_module = module; @@ -630,11 +631,11 @@ module_new_from_json(char *file_name) } if (module_count == 0) panic("%s contained no active modules\n", file_name); - for (int i = 0; i <= module_count; i++) { + for (int i = 0; i < module_count; i++) { int left_index = 2 * i + 1; int right_index = 2 * i + 2; - if (left_index <= module_count) nodes[i]->left_module = nodes[left_index]; - if (right_index <= module_count) nodes[i]->right_module = nodes[right_index]; + if (left_index < module_count) nodes[i]->left_module = nodes[left_index]; + if (right_index < module_count) nodes[i]->right_module = nodes[right_index]; } free(nodes); #ifdef LOG_MODULE_LOADING