Merge branch 'loops/sx-vm-extensions' into scratch/host-jit
# Conflicts: # hosts/ocaml/bin/sx_server.ml # lib/erlang/runtime.sx
This commit is contained in:
@@ -4168,6 +4168,38 @@ let () =
|
||||
) Sx_types.jit_cache_queue;
|
||||
Queue.clear Sx_types.jit_cache_queue;
|
||||
Nil);
|
||||
register "jit-exclude!" (fun args ->
|
||||
(* Mark function names as interpret-only (never JIT-compiled). A guest
|
||||
interpreter calls this for its continuation-using dispatch core.
|
||||
Accepts string/symbol names; a trailing "*" makes it a namespace prefix
|
||||
(e.g. "er-*" excludes every function whose name starts with "er-") —
|
||||
the robust way to declare a whole guest interpreter core. *)
|
||||
List.iter (fun a ->
|
||||
match a with
|
||||
| String n | Symbol n ->
|
||||
let len = String.length n in
|
||||
if len > 0 && n.[len - 1] = '*' then begin
|
||||
let prefix = String.sub n 0 (len - 1) in
|
||||
if not (List.mem prefix !Sx_types.jit_excluded_prefixes) then
|
||||
Sx_types.jit_excluded_prefixes := prefix :: !Sx_types.jit_excluded_prefixes
|
||||
end else
|
||||
Hashtbl.replace Sx_types.jit_excluded n ()
|
||||
| _ -> ()) args;
|
||||
Nil);
|
||||
register "jit-excluded?" (fun args ->
|
||||
match args with
|
||||
| [String n] | [Symbol n] -> Bool (Sx_types.jit_name_excluded n)
|
||||
| _ -> Bool false);
|
||||
register "jit-exclude-callers-of!" (fun args ->
|
||||
(* Register call/cc-establishing forms (e.g. cl-restart-case). Any function
|
||||
whose bytecode references one of these is itself interpret-only — JIT
|
||||
would force the form into a nested cek-run where its continuation can't
|
||||
escape. A guest declares its condition-system / escaping forms here. *)
|
||||
List.iter (fun a ->
|
||||
match a with
|
||||
| String n | Symbol n -> Hashtbl.replace Sx_types.jit_excluded_caller_names n ()
|
||||
| _ -> ()) args;
|
||||
Nil);
|
||||
register "jit-reset-counters!" (fun _args ->
|
||||
Sx_types.jit_compiled_count := 0;
|
||||
Sx_types.jit_skipped_count := 0;
|
||||
|
||||
Reference in New Issue
Block a user