1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-19 07:04:48 +00:00

Changes to let circlet test app work.

Change cook tool linking for executables, disable
GC while constructing marhsalling codebook (mdict).
This commit is contained in:
Calvin Rose 2019-07-28 17:55:37 -05:00
parent 8bbe518696
commit 4809867b33

View File

@ -386,12 +386,12 @@
(loop [[prefix name] :pairs prefixes] (loop [[prefix name] :pairs prefixes]
(def meta (eval-string (slurp (modpath-to-meta name)))) (def meta (eval-string (slurp (modpath-to-meta name))))
(buffer/push-string lookup-into-invocations (buffer/push-string lookup-into-invocations
" " " temptab = janet_table(0);\n"
(meta :static-entry) " temptab->proto = env;\n"
"(temptab = janet_table(0));\n" " " (meta :static-entry) "(temptab);\n"
" janet_env_lookup_into(lookup, temptab, \"" " janet_env_lookup_into(lookup, temptab, \""
prefix prefix
"\", 0);\n") "\", 0);\n\n")
(buffer/push-string declarations (buffer/push-string declarations
"extern void " "extern void "
(meta :static-entry) (meta :static-entry)
@ -415,13 +415,13 @@ int main(int argc, const char **argv) {
JanetTable *env = janet_core_env(NULL); JanetTable *env = janet_core_env(NULL);
JanetTable *lookup = janet_env_lookup(env); JanetTable *lookup = janet_env_lookup(env);
JanetTable *temptab; JanetTable *temptab;
int handle = janet_gclock();
/* Load natives into unmarshalling dictionary */ /* Load natives into unmarshalling dictionary */
``` ```
lookup-into-invocations lookup-into-invocations
``` ```
/* Unmarshal bytecode */ /* Unmarshal bytecode */
Janet marsh_out = janet_unmarshal( Janet marsh_out = janet_unmarshal(
janet_payload_image_embed, janet_payload_image_embed,
@ -448,6 +448,9 @@ int main(int argc, const char **argv) {
janet_table_put(runtimeEnv, janet_ckeywordv("args"), janet_wrap_array(args)); janet_table_put(runtimeEnv, janet_ckeywordv("args"), janet_wrap_array(args));
janet_gcroot(janet_wrap_table(runtimeEnv)); janet_gcroot(janet_wrap_table(runtimeEnv));
/* Unlock GC */
janet_gcunlock(handle);
/* Run everything */ /* Run everything */
JanetFiber *fiber = janet_fiber(janet_unwrap_function(marsh_out), 64, argc, args->data); JanetFiber *fiber = janet_fiber(janet_unwrap_function(marsh_out), 64, argc, args->data);
fiber->env = runtimeEnv; fiber->env = runtimeEnv;
@ -455,8 +458,10 @@ int main(int argc, const char **argv) {
JanetSignal result = janet_continue(fiber, janet_wrap_nil(), &out); JanetSignal result = janet_continue(fiber, janet_wrap_nil(), &out);
if (result) { if (result) {
janet_stacktrace(fiber, out); janet_stacktrace(fiber, out);
janet_deinit();
return result; return result;
} }
janet_deinit();
return 0; return 0;
} }
@ -471,13 +476,13 @@ int main(int argc, const char **argv) {
#default #default
["-lm"])) ["-lm"]))
(def cc (opt opts :compiler default-compiler)) (def cc (opt opts :compiler default-compiler))
(def lflags [(libjanet) ;(opt opts :lflags default-lflags) ;extra-lflags]) (def lflags [;(opt opts :lflags default-lflags) ;extra-lflags])
(def cflags (getcflags opts)) (def cflags (getcflags opts))
(def defines (make-defines (opt opts :defines {}))) (def defines (make-defines (opt opts :defines {})))
(print "compiling and linking " dest "...") (print "compiling and linking " dest "...")
(if is-win (if is-win
(shell cc ;cflags ;lflags (string "/OUT:" dest) cimage_dest ;static-libs) (shell cc ;cflags (libjanet) ;lflags (string "/OUT:" dest) cimage_dest ;static-libs)
(shell cc ;cflags `-o` dest cimage_dest ;lflags ;static-libs))))) (shell cc ;cflags `-o` dest cimage_dest ;lflags ;static-libs (libjanet))))))
(defn- abspath (defn- abspath
"Create an absolute path. Does not resolve . and .. (useful for "Create an absolute path. Does not resolve . and .. (useful for