Skip to content

Commit ad425f2

Browse files
committed
clean up
1 parent f8271f7 commit ad425f2

File tree

8 files changed

+380
-371
lines changed

8 files changed

+380
-371
lines changed

jscomp/bin/whole_compiler.ml

Lines changed: 186 additions & 185 deletions
Large diffs are not rendered by default.

jscomp/core/global_exports.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
Global exports identifiers are extracted from {!Translmod.get_export_identifiers}
4+
instead of inferred from lambda expression or cmi file.
5+
6+
1. We need be careful about externals.
7+
2. Reading from fresh generated cmi is expensive.

jscomp/core/lam.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type primitive =
4545
| Pbytes_of_string
4646
(* Globals *)
4747
| Pgetglobal of ident
48-
| Psetglobal of ident
48+
(* | Psetglobal of ident *)
4949
| Pglobal_exception of ident
5050
(* Operations on heap blocks *)
5151
| Pmakeblock of int * tag_info * mutable_flag
@@ -996,7 +996,13 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : t =
996996
prim ~primitive:(Pglobal_exception id) ~args loc
997997
else
998998
prim ~primitive:(Pgetglobal id) ~args loc
999-
| Psetglobal id -> prim ~primitive:(Psetglobal id) ~args loc
999+
| Psetglobal id ->
1000+
(* we discard [Psetglobal] in the beginning*)
1001+
begin match args with
1002+
| [biglambda] -> biglambda
1003+
| _ -> assert false
1004+
end
1005+
(* prim ~primitive:(Psetglobal id) ~args loc *)
10001006
| Pmakeblock (tag,info, mutable_flag)
10011007
-> prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args loc
10021008
| Pfield (id,info)

jscomp/core/lam.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type primitive =
5050
| Pbytes_to_string
5151
| Pbytes_of_string
5252
| Pgetglobal of ident
53-
| Psetglobal of ident
53+
(* | Psetglobal of ident *)
5454
| Pglobal_exception of ident
5555
| Pmakeblock of int * Lambda.tag_info * Asttypes.mutable_flag
5656
| Pfield of int * Lambda.field_dbg_info

jscomp/core/lam_analysis.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ let rec no_side_effects (lam : Lam.t) : bool =
171171
| Plazyforce
172172
| Psetfield _
173173
| Psetfloatfield _
174-
| Psetglobal _ -> false
174+
(* | Psetglobal _ *)
175+
-> false
175176
)
176177
| Llet (_,_, arg,body) -> no_side_effects arg && no_side_effects body
177178
| Lswitch (_,_) -> false

0 commit comments

Comments
 (0)