Skip to content

Commit

Permalink
Compiler: revert 1647
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Oct 27, 2024
1 parent fea3899 commit 450ddbb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 0 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* Compiler: improved global dead code elimination (#2206)
* Compiler: speedup json parsing, relying on Yojson.Raw (#1640)
* Compiler: Decode sourcemap mappings only when necessary (#1664)
* Compiler: make indirect call using sequence instead of using the call method
[f.call(null, args)] becomes [(0,f)(args)]
* Compiler: mark [TextEncoder] as reserved
* Compiler: add support for the Wasm backend in parts of the pipeline, in
prevision for the merge of wasm_of_ocaml
Expand Down
3 changes: 2 additions & 1 deletion compiler/lib/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,8 @@ let apply_fun_raw ctx f params exact trampolined loc =
(* Make sure we are performing a regular call, not a (slower)
method call *)
match f with
| J.EAccess _ | J.EDot _ -> J.call (J.ESeq (int 0, f)) params loc
| J.EAccess _ | J.EDot _ ->
J.call (J.dot f (Utf8_string.of_string_exn "call")) (s_var "null" :: params) loc
| _ -> J.call f params loc
in
let apply =
Expand Down
15 changes: 7 additions & 8 deletions compiler/tests-compiler/direct_calls.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ let%expect_test "direct calls without --enable effects" =
//end
function test3(x){
function F(symbol){function f(x){return x + 1 | 0;} return [0, f];}
var M1 = F([0]), M2 = F([0]), _b_ = (0, M2[1])(2);
return [0, (0, M1[1])(1), _b_];
var M1 = F([0]), M2 = F([0]), _b_ = M2[1].call(null, 2);
return [0, M1[1].call(null, 1), _b_];
}
//end
function test4(x){
Expand All @@ -94,11 +94,10 @@ let%expect_test "direct calls without --enable effects" =
return [0, f];
}
var M1 = F([0]), M2 = F([0]);
(0, M1[1])(1);
return (0, M2[1])(2);
M1[1].call(null, 1);
return M2[1].call(null, 2);
}
//end
|}]
//end |}]

let%expect_test "direct calls with --enable effects" =
let code =
Expand Down Expand Up @@ -179,8 +178,8 @@ let%expect_test "direct calls with --enable effects" =
//end
function test3(x, cont){
function F(symbol){function f(x){return x + 1 | 0;} return [0, f];}
var M1 = F(), M2 = F(), _c_ = (0, M2[1])(2);
return cont([0, (0, M1[1])(1), _c_]);
var M1 = F(), M2 = F(), _c_ = M2[1].call(null, 2);
return cont([0, M1[1].call(null, 1), _c_]);
}
//end
function test4(x, cont){
Expand Down

0 comments on commit 450ddbb

Please sign in to comment.