faster streamline
This commit is contained in:
@@ -376,6 +376,7 @@ static void print_usage(const char *prog)
|
||||
printf(" --core <path> Set core path directly (overrides CELL_CORE)\n");
|
||||
printf(" --shop <path> Set shop path (overrides CELL_SHOP)\n");
|
||||
printf(" --dev Dev mode (shop=.cell, core=.)\n");
|
||||
printf(" --heap <size> Initial heap size (e.g. 256MB, 1GB)\n");
|
||||
printf(" --seed Use seed bootstrap (minimal, for regen)\n");
|
||||
printf(" --test [heap_size] Run C test suite\n");
|
||||
printf(" -h, --help Show this help message\n");
|
||||
@@ -410,6 +411,7 @@ int cell_init(int argc, char **argv)
|
||||
/* Default: run script through bootstrap pipeline */
|
||||
int arg_start = 1;
|
||||
int seed_mode = 0;
|
||||
size_t heap_size = 1024 * 1024; /* 1MB default */
|
||||
const char *shop_override = NULL;
|
||||
const char *core_override = NULL;
|
||||
|
||||
@@ -432,6 +434,17 @@ int cell_init(int argc, char **argv)
|
||||
} else if (strcmp(argv[arg_start], "--seed") == 0) {
|
||||
seed_mode = 1;
|
||||
arg_start++;
|
||||
} else if (strcmp(argv[arg_start], "--heap") == 0) {
|
||||
if (arg_start + 1 >= argc) {
|
||||
printf("ERROR: --heap requires a size argument (e.g. 1GB, 256MB, 65536)\n");
|
||||
return 1;
|
||||
}
|
||||
char *end = NULL;
|
||||
heap_size = strtoull(argv[arg_start + 1], &end, 0);
|
||||
if (end && (*end == 'G' || *end == 'g')) heap_size *= 1024ULL * 1024 * 1024;
|
||||
else if (end && (*end == 'M' || *end == 'm')) heap_size *= 1024ULL * 1024;
|
||||
else if (end && (*end == 'K' || *end == 'k')) heap_size *= 1024ULL;
|
||||
arg_start += 2;
|
||||
} else if (strcmp(argv[arg_start], "--dev") == 0) {
|
||||
shop_override = ".cell";
|
||||
core_override = ".";
|
||||
@@ -480,7 +493,7 @@ int cell_init(int argc, char **argv)
|
||||
free(bin_data);
|
||||
return 1;
|
||||
}
|
||||
JSContext *ctx = JS_NewContextWithHeapSize(g_runtime, 1024 * 1024);
|
||||
JSContext *ctx = JS_NewContextWithHeapSize(g_runtime, heap_size);
|
||||
if (!ctx) {
|
||||
printf("Failed to create JS context\n");
|
||||
free(bin_data); JS_FreeRuntime(g_runtime);
|
||||
|
||||
Reference in New Issue
Block a user