Skip to content

Commit

Permalink
fixup! Add an Event instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Oct 23, 2024
1 parent f51b3ba commit 63964e9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 41 deletions.
6 changes: 5 additions & 1 deletion compiler/lib/inline.ml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,11 @@ let inline ~first_class_primitives live_vars closures name pc (outer, p) =
match block with
| { body =
( [ (Let (y, Prim (Extern prim, args)), _loc) ]
| [ (Event _, _); (Let (y, Prim (Extern prim, args)), _loc) ] )
| [ (Event _, _); (Let (y, Prim (Extern prim, args)), _loc) ]
| [ (Event _, _)
; (Let (y, Prim (Extern prim, args)), _loc)
; (Event _, _)
] )
; branch = Return y', _
; params = []
} ->
Expand Down
61 changes: 21 additions & 40 deletions compiler/tests-full/stdlib.cma.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -4832,8 +4832,7 @@
cst_String_contains_from_Bytes =
"String.contains_from / Bytes.contains_from",
cst_String_rcontains_from_Byte =
"String.rcontains_from / Bytes.rcontains_from",
cst_Bytes_of_seq_cannot_grow_b = "Bytes.of_seq: cannot grow bytes";
"String.rcontains_from / Bytes.rcontains_from";
function copy(s){
var
len = /*<<bytes.ml:56:2>>*/ caml_ml_bytes_length(s),
Expand Down Expand Up @@ -5464,9 +5463,9 @@
/*<<bytes.ml:386:4>>*/ return caml_call1
(Stdlib[1], cst_String_rcontains_from_Byte) /*<<bytes.ml:388:63>>*/ ;
}
function compare(x, y){
/*<<bytes.ml:393:28>>*/ return runtime.caml_bytes_compare(x, y) /*<<bytes.ml:393:46>>*/ ;
}
var
compare = /*<<bytes.ml:53:20>>*/ runtime.caml_bytes_compare,
cst_Bytes_of_seq_cannot_grow_b = "Bytes.of_seq: cannot grow bytes";
function split_on_char(sep, s){
var
r = /*<<bytes.ml:398:2>>*/ [0, 0],
Expand Down Expand Up @@ -6727,9 +6726,7 @@
var _t_ = /*<<string.ml:234:2>>*/ r[1];
return [0, sub(s, 0, j[1]), _t_] /*<<string.ml:234:12>>*/ ;
/*<<string.ml:234:18>>*/ }
function compare(x, y){
/*<<string.ml:238:28>>*/ return runtime.caml_string_compare(x, y) /*<<string.ml:238:46>>*/ ;
}
var compare = /*<<?>>*/ runtime.caml_string_compare;
function to_seq(s){
var _r_ = /*<<string.ml:243:15>>*/ caml_call1(bos, s);
/*<<string.ml:243:20>>*/ return caml_call1(Stdlib_Bytes[47], _r_) /*<<string.ml:243:32>>*/ ;
Expand Down Expand Up @@ -9106,12 +9103,7 @@
/*<<?>>*/ throw caml_maybe_attach_backtrace(_c_, 0);
}
/*<<int32.ml:78:24>>*/ }
function compare(x, y){
/*<<int32.ml:82:28>>*/ return caml_int_compare(x, y) /*<<int32.ml:82:46>>*/ ;
}
function equal(x, y){
/*<<int32.ml:83:26>>*/ return runtime.caml_equal(x, y) /*<<int32.ml:83:31>>*/ ;
}
var compare = /*<<?>>*/ caml_int_compare, equal = runtime.caml_equal;
function unsigned_compare(n, m){
var
y = /*<<int32.ml:86:26>>*/ m + 2147483648 | 0,
Expand Down Expand Up @@ -9248,9 +9240,7 @@
function compare(x, y){
/*<<int64.ml:79:28>>*/ return caml_int64_compare(x, y) /*<<int64.ml:79:46>>*/ ;
}
function equal(x, y){
/*<<int64.ml:80:26>>*/ return runtime.caml_equal(x, y) /*<<int64.ml:80:31>>*/ ;
}
var equal = /*<<int64.ml:55:2>>*/ runtime.caml_equal;
function unsigned_compare(n, m){
var
y = /*<<int64.ml:83:26>>*/ caml_int64_sub(m, min_int),
Expand Down Expand Up @@ -9379,9 +9369,7 @@
/*<<?>>*/ throw caml_maybe_attach_backtrace(_a_, 0);
}
/*<<nativeint.ml:67:24>>*/ }
function compare(x, y){
/*<<nativeint.ml:71:28>>*/ return caml_int_compare(x, y) /*<<nativeint.ml:71:46>>*/ ;
}
var compare = /*<<nativeint.ml:54:2>>*/ caml_int_compare;
function equal(x, y){
/*<<nativeint.ml:71:28>>*/ return 0 === caml_int_compare(x, y) ? 1 : 0 /*<<nativeint.ml:72:37>>*/ ;
/*<<nativeint.ml:72:41>>*/ }
Expand Down Expand Up @@ -25231,11 +25219,7 @@
cst_Random_full_int = "Random.full_int",
cst_Random_int_in_range = "Random.int_in_range",
cst_Random_int32 = "Random.int32",
cst_Random_int32_in_range = "Random.int32_in_range",
_f_ = runtime.caml_int64_create_lo_mi_hi(1, 0, 0),
_g_ = runtime.caml_int64_create_lo_mi_hi(0, 0, 0),
cst_Random_int64 = "Random.int64",
cst_Random_int64_in_range = "Random.int64_in_range";
cst_Random_int32_in_range = "Random.int32_in_range";
function bits(s){
/*<<random.ml:129:17>>*/ return /*<<random.ml:129:25>>*/ caml_int64_to_int32
( /*<<random.ml:129:17>>*/ caml_lxm_next(s))
Expand Down Expand Up @@ -25337,9 +25321,12 @@
/*<<random.ml:243:67>>*/ return r;
}
/*<<random.ml:254:39>>*/ }
function bits64(s){
/*<<random.ml:258:4>>*/ return caml_lxm_next(s) /*<<random.ml:258:10>>*/ ;
}
var
bits64 = /*<<?>>*/ caml_lxm_next,
_f_ = runtime.caml_int64_create_lo_mi_hi(1, 0, 0),
_g_ = runtime.caml_int64_create_lo_mi_hi(0, 0, 0),
cst_Random_int64 = "Random.int64",
cst_Random_int64_in_range = "Random.int64_in_range";
function int64aux(s, n){
/*<<random.ml:262:38>>*/ for(;;){
var
Expand Down Expand Up @@ -31759,10 +31746,8 @@
runtime = globalThis.jsoo_runtime,
caml_register_named_value = runtime.caml_register_named_value,
global_data = runtime.caml_get_global_data(),
Stdlib_Obj = global_data.Stdlib__Obj;
function register(name, v){
/*<<callback.ml:22:2>>*/ return caml_register_named_value(name, v) /*<<callback.ml:22:40>>*/ ;
}
Stdlib_Obj = global_data.Stdlib__Obj,
register = caml_register_named_value;
function register_exception(name, exn){
var
_a_ = /*<<callback.ml:26:16>>*/ Stdlib_Obj[10],
Expand Down Expand Up @@ -31853,15 +31838,11 @@
: accu[1];
/*<<camlinternalOO.ml:78:2>>*/ return tag;
/*<<camlinternalOO.ml:78:15>>*/ }
function compare(x, y){
/*<<camlinternalOO.ml:83:56>>*/ return caml_string_compare(x, y) /*<<camlinternalOO.ml:83:67>>*/ ;
}
var Vars = /*<<?>>*/ caml_call1(Stdlib_Map[1], [0, compare]);
function compare$0(x, y){
/*<<camlinternalOO.ml:87:56>>*/ return caml_string_compare(x, y) /*<<camlinternalOO.ml:87:67>>*/ ;
}
var
Meths = /*<<?>>*/ caml_call1(Stdlib_Map[1], [0, compare$0]),
compare = /*<<?>>*/ caml_string_compare,
Vars = caml_call1(Stdlib_Map[1], [0, compare]),
compare$0 = caml_string_compare,
Meths = caml_call1(Stdlib_Map[1], [0, compare$0]),
compare$1 = runtime.caml_int_compare,
Labs = caml_call1(Stdlib_Map[1], [0, compare$1]),
dummy_table = [0, 0, [0, 0], Meths[1], Labs[1], 0, 0, Vars[1], 0],
Expand Down

0 comments on commit 63964e9

Please sign in to comment.