add compiling and saving bytecode

This commit is contained in:
2025-05-29 13:55:03 -05:00
parent c3f07c0ef5
commit da525cd111
5 changed files with 8 additions and 22 deletions

View File

@@ -234,7 +234,7 @@ foreach inc : includes
includers += include_directories(inc)
endforeach
zip_folders = ['scripts', 'fonts', 'icons', 'shaders']
zip_folders = ['scripts', 'fonts', 'icons']
zip_paths = []
foreach folder: zip_folders
zip_paths += meson.project_source_root() / folder
@@ -246,7 +246,7 @@ core = custom_target('core.zip',
command : ['sh', '-c',
'cd ' + meson.project_source_root() +
' && echo "Rebuilding core.zip" && rm -f ' + meson.current_build_dir() + '/core.zip && ' +
'zip -r ' + meson.current_build_dir() + '/core.zip scripts fonts icons shaders'
'zip -r ' + meson.current_build_dir() + '/core.zip scripts fonts icons'
],
build_always_stale: true,
build_by_default: true

View File

@@ -99,17 +99,16 @@ JSC_CCALL(js_eval_compile,
#include "qjs_blob.h"
JSC_CCALL(js_compile_blob,
JSRuntime *rt = JS_GetRuntime(js);
JS_SetStripInfo(rt, JS_STRIP_SOURCE);
JS_SetStripInfo(rt, JS_STRIP_DEBUG);
// JSRuntime *rt = JS_GetRuntime(js);
// JS_SetStripInfo(rt, JS_STRIP_SOURCE);
// JS_SetStripInfo(rt, JS_STRIP_DEBUG);
size_t size;
uint8_t *data = JS_WriteObject(js, &size, argv[0], JS_WRITE_OBJ_BYTECODE);
ret = js_new_blob_stoned_copy(js, data, size);
printf("found size to be %u\n", size);
free(data);
)
JSC_CCAL(js_compile_unblob,
JSC_CCALL(js_compile_unblob,
size_t size;
void *data = js_get_blob_data(js, &size, argv[0]);
if (!data) return JS_ThrowReferenceError(js, "Must be a stoned blob.");
@@ -195,6 +194,7 @@ static const JSCFunctionListEntry js_js_funcs[] = {
MIST_FUNC_DEF(js, compile, 2),
MIST_FUNC_DEF(js, eval_compile, 1),
MIST_FUNC_DEF(js, compile_blob, 1),
MIST_FUNC_DEF(js, compile_unblob, 1),
MIST_FUNC_DEF(os, rt_info, 0),
};

View File

@@ -1814,7 +1814,7 @@ JSValue js_sdl_video_use(JSContext *js) {
"./prosperon",
"spawn",
"--id", id,
"--program", "scripts/core/_sdl_video.js",
"--program", "_sdl_video.js",
"--main", "1"
};
int argc = 8;

View File

@@ -10,10 +10,6 @@
// Attempt to "use" the blob module as if it was installed or compiled in.
var Blob = use('blob')
var pp = new Blob()
log.console(pp.length)
// If you're testing in an environment without a 'use' loader, you might do
// something like importing the compiled C module or linking it differently.

View File

@@ -17,16 +17,6 @@ var tree = {
]
}
stone(tree)
log.console(tree)
log.console(stone.p(tree))
log.console(stone.p("false"))
log.console(stone.p(9))
log.console(stone.p(undefined))
log.console(stone.p({}))
var os = use('os')
var st = os.now()
var actor