Skip to content

Commit 450ddbb

Browse files
committed
Compiler: revert 1647
1 parent fea3899 commit 450ddbb

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

CHANGES.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
* Compiler: improved global dead code elimination (#2206)
1010
* Compiler: speedup json parsing, relying on Yojson.Raw (#1640)
1111
* Compiler: Decode sourcemap mappings only when necessary (#1664)
12-
* Compiler: make indirect call using sequence instead of using the call method
13-
[f.call(null, args)] becomes [(0,f)(args)]
1412
* Compiler: mark [TextEncoder] as reserved
1513
* Compiler: add support for the Wasm backend in parts of the pipeline, in
1614
prevision for the merge of wasm_of_ocaml

compiler/lib/generate.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,8 @@ let apply_fun_raw ctx f params exact trampolined loc =
898898
(* Make sure we are performing a regular call, not a (slower)
899899
method call *)
900900
match f with
901-
| J.EAccess _ | J.EDot _ -> J.call (J.ESeq (int 0, f)) params loc
901+
| J.EAccess _ | J.EDot _ ->
902+
J.call (J.dot f (Utf8_string.of_string_exn "call")) (s_var "null" :: params) loc
902903
| _ -> J.call f params loc
903904
in
904905
let apply =

compiler/tests-compiler/direct_calls.ml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ let%expect_test "direct calls without --enable effects" =
8484
//end
8585
function test3(x){
8686
function F(symbol){function f(x){return x + 1 | 0;} return [0, f];}
87-
var M1 = F([0]), M2 = F([0]), _b_ = (0, M2[1])(2);
88-
return [0, (0, M1[1])(1), _b_];
87+
var M1 = F([0]), M2 = F([0]), _b_ = M2[1].call(null, 2);
88+
return [0, M1[1].call(null, 1), _b_];
8989
}
9090
//end
9191
function test4(x){
@@ -94,11 +94,10 @@ let%expect_test "direct calls without --enable effects" =
9494
return [0, f];
9595
}
9696
var M1 = F([0]), M2 = F([0]);
97-
(0, M1[1])(1);
98-
return (0, M2[1])(2);
97+
M1[1].call(null, 1);
98+
return M2[1].call(null, 2);
9999
}
100-
//end
101-
|}]
100+
//end |}]
102101

103102
let%expect_test "direct calls with --enable effects" =
104103
let code =
@@ -179,8 +178,8 @@ let%expect_test "direct calls with --enable effects" =
179178
//end
180179
function test3(x, cont){
181180
function F(symbol){function f(x){return x + 1 | 0;} return [0, f];}
182-
var M1 = F(), M2 = F(), _c_ = (0, M2[1])(2);
183-
return cont([0, (0, M1[1])(1), _c_]);
181+
var M1 = F(), M2 = F(), _c_ = M2[1].call(null, 2);
182+
return cont([0, M1[1].call(null, 1), _c_]);
184183
}
185184
//end
186185
function test4(x, cont){

0 commit comments

Comments
 (0)