Compare commits
1 Commits
bugs/resum
...
bugs/jit-b
| Author | SHA1 | Date | |
|---|---|---|---|
| ca151d7ed5 |
@@ -355,7 +355,9 @@ let vm_create_closure vm_val frame_val code_val =
|
|||||||
let f = unwrap_frame frame_val in
|
let f = unwrap_frame frame_val in
|
||||||
let uv_count = match code_val with
|
let uv_count = match code_val with
|
||||||
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
||||||
| Some (Number n) -> int_of_float n | _ -> 0)
|
| Some (Integer n) -> n
|
||||||
|
| Some (Number n) -> int_of_float n
|
||||||
|
| _ -> 0)
|
||||||
| _ -> 0
|
| _ -> 0
|
||||||
in
|
in
|
||||||
let upvalues = Array.init uv_count (fun _ ->
|
let upvalues = Array.init uv_count (fun _ ->
|
||||||
|
|||||||
@@ -704,8 +704,10 @@ let () =
|
|||||||
| List (Symbol "code" :: rest) ->
|
| List (Symbol "code" :: rest) ->
|
||||||
let d = Hashtbl.create 8 in
|
let d = Hashtbl.create 8 in
|
||||||
let rec parse_kv = function
|
let rec parse_kv = function
|
||||||
| Keyword "arity" :: Number n :: rest -> Hashtbl.replace d "arity" (Number n); parse_kv rest
|
| Keyword "arity" :: (Number _ as n) :: rest -> Hashtbl.replace d "arity" n; parse_kv rest
|
||||||
| Keyword "upvalue-count" :: Number n :: rest -> Hashtbl.replace d "upvalue-count" (Number n); parse_kv rest
|
| Keyword "arity" :: (Integer _ as n) :: rest -> Hashtbl.replace d "arity" n; parse_kv rest
|
||||||
|
| Keyword "upvalue-count" :: (Number _ as n) :: rest -> Hashtbl.replace d "upvalue-count" n; parse_kv rest
|
||||||
|
| Keyword "upvalue-count" :: (Integer _ as n) :: rest -> Hashtbl.replace d "upvalue-count" n; parse_kv rest
|
||||||
| Keyword "bytecode" :: List nums :: rest ->
|
| Keyword "bytecode" :: List nums :: rest ->
|
||||||
Hashtbl.replace d "bytecode" (List nums); parse_kv rest
|
Hashtbl.replace d "bytecode" (List nums); parse_kv rest
|
||||||
| Keyword "constants" :: List consts :: rest ->
|
| Keyword "constants" :: List consts :: rest ->
|
||||||
|
|||||||
@@ -642,7 +642,9 @@ and run vm =
|
|||||||
(* Read upvalue descriptors from bytecode *)
|
(* Read upvalue descriptors from bytecode *)
|
||||||
let uv_count = match code_val with
|
let uv_count = match code_val with
|
||||||
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
||||||
| Some (Number n) -> int_of_float n | _ -> 0)
|
| Some (Integer n) -> n
|
||||||
|
| Some (Number n) -> int_of_float n
|
||||||
|
| _ -> 0)
|
||||||
| _ -> 0
|
| _ -> 0
|
||||||
in
|
in
|
||||||
let upvalues = Array.init uv_count (fun _ ->
|
let upvalues = Array.init uv_count (fun _ ->
|
||||||
@@ -1307,7 +1309,9 @@ let trace_run src globals =
|
|||||||
let code_val2 = frame.closure.vm_code.vc_constants.(idx) in
|
let code_val2 = frame.closure.vm_code.vc_constants.(idx) in
|
||||||
let uv_count = match code_val2 with
|
let uv_count = match code_val2 with
|
||||||
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
||||||
| Some (Number n) -> int_of_float n | _ -> 0)
|
| Some (Integer n) -> n
|
||||||
|
| Some (Number n) -> int_of_float n
|
||||||
|
| _ -> 0)
|
||||||
| _ -> 0 in
|
| _ -> 0 in
|
||||||
let upvalues = Array.init uv_count (fun _ ->
|
let upvalues = Array.init uv_count (fun _ ->
|
||||||
let is_local = read_u8 frame in
|
let is_local = read_u8 frame in
|
||||||
@@ -1428,7 +1432,9 @@ let disassemble (code : vm_code) =
|
|||||||
if op = 51 && idx < Array.length consts then begin
|
if op = 51 && idx < Array.length consts then begin
|
||||||
let uv_count = match consts.(idx) with
|
let uv_count = match consts.(idx) with
|
||||||
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
||||||
| Some (Number n) -> int_of_float n | _ -> 0)
|
| Some (Integer n) -> n
|
||||||
|
| Some (Number n) -> int_of_float n
|
||||||
|
| _ -> 0)
|
||||||
| _ -> 0 in
|
| _ -> 0 in
|
||||||
ip := !ip + uv_count * 2
|
ip := !ip + uv_count * 2
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -270,7 +270,9 @@ let vm_create_closure vm_val frame_val code_val =
|
|||||||
let f = unwrap_frame frame_val in
|
let f = unwrap_frame frame_val in
|
||||||
let uv_count = match code_val with
|
let uv_count = match code_val with
|
||||||
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
||||||
| Some (Number n) -> int_of_float n | _ -> 0)
|
| Some (Integer n) -> n
|
||||||
|
| Some (Number n) -> int_of_float n
|
||||||
|
| _ -> 0)
|
||||||
| _ -> 0
|
| _ -> 0
|
||||||
in
|
in
|
||||||
let upvalues = Array.init uv_count (fun _ ->
|
let upvalues = Array.init uv_count (fun _ ->
|
||||||
|
|||||||
@@ -265,7 +265,9 @@ let vm_create_closure vm_val frame_val code_val =
|
|||||||
let f = unwrap_frame frame_val in
|
let f = unwrap_frame frame_val in
|
||||||
let uv_count = match code_val with
|
let uv_count = match code_val with
|
||||||
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
| Dict d -> (match Hashtbl.find_opt d "upvalue-count" with
|
||||||
| Some (Number n) -> int_of_float n | _ -> 0)
|
| Some (Integer n) -> n
|
||||||
|
| Some (Number n) -> int_of_float n
|
||||||
|
| _ -> 0)
|
||||||
| _ -> 0
|
| _ -> 0
|
||||||
in
|
in
|
||||||
let upvalues = Array.init uv_count (fun _ ->
|
let upvalues = Array.init uv_count (fun _ ->
|
||||||
|
|||||||
Reference in New Issue
Block a user