Skip to content

Commit 0a10865

Browse files
committed
snapshot
1 parent bfc2fc2 commit 0a10865

File tree

6 files changed

+18
-282
lines changed

6 files changed

+18
-282
lines changed

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 5 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -398974,94 +398974,6 @@ let simplify_lets (lam : Lam.t) : Lam.t =
398974398974

398975398975
apply_lets occ lam
398976398976

398977-
end
398978-
module Lam_inline_util : sig
398979-
#1 "lam_inline_util.mli"
398980-
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
398981-
*
398982-
* This program is free software: you can redistribute it and/or modify
398983-
* it under the terms of the GNU Lesser General Public License as published by
398984-
* the Free Software Foundation, either version 3 of the License, or
398985-
* (at your option) any later version.
398986-
*
398987-
* In addition to the permissions granted to you by the LGPL, you may combine
398988-
* or link a "work that uses the Library" with a publicly distributed version
398989-
* of this file to produce a combined library or application, then distribute
398990-
* that combined work under the terms of your choosing, with no requirement
398991-
* to comply with the obligations normally placed on you by section 4 of the
398992-
* LGPL version 3 (or the corresponding section of a later version of the LGPL
398993-
* should you choose to use a later version).
398994-
*
398995-
* This program is distributed in the hope that it will be useful,
398996-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
398997-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
398998-
* GNU Lesser General Public License for more details.
398999-
*
399000-
* You should have received a copy of the GNU Lesser General Public License
399001-
* along with this program; if not, write to the Free Software
399002-
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
399003-
399004-
399005-
399006-
399007-
399008-
399009-
399010-
399011-
(** Utilities for lambda inlining *)
399012-
399013-
val maybe_functor : string -> bool
399014-
399015-
val should_be_functor : string -> Lam.t -> bool
399016-
399017-
end = struct
399018-
#1 "lam_inline_util.ml"
399019-
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
399020-
*
399021-
* This program is free software: you can redistribute it and/or modify
399022-
* it under the terms of the GNU Lesser General Public License as published by
399023-
* the Free Software Foundation, either version 3 of the License, or
399024-
* (at your option) any later version.
399025-
*
399026-
* In addition to the permissions granted to you by the LGPL, you may combine
399027-
* or link a "work that uses the Library" with a publicly distributed version
399028-
* of this file to produce a combined library or application, then distribute
399029-
* that combined work under the terms of your choosing, with no requirement
399030-
* to comply with the obligations normally placed on you by section 4 of the
399031-
* LGPL version 3 (or the corresponding section of a later version of the LGPL
399032-
* should you choose to use a later version).
399033-
*
399034-
* This program is distributed in the hope that it will be useful,
399035-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
399036-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
399037-
* GNU Lesser General Public License for more details.
399038-
*
399039-
* You should have received a copy of the GNU Lesser General Public License
399040-
* along with this program; if not, write to the Free Software
399041-
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
399042-
399043-
399044-
399045-
399046-
399047-
399048-
399049-
(* TODO: add a context, like
399050-
[args]
399051-
[Lfunction(params,body)]
399052-
*)
399053-
399054-
399055-
let maybe_functor (name : string) =
399056-
name.[0] >= 'A' && name.[0] <= 'Z'
399057-
399058-
399059-
let should_be_functor (name : string) (lam : Lam.t) =
399060-
maybe_functor name &&
399061-
(match lam with Lfunction {attr = {is_a_functor = Functor_yes}} -> true | _ -> false)
399062-
399063-
399064-
399065398977
end
399066398978
module Lam_pass_remove_alias : sig
399067398979
#1 "lam_pass_remove_alias.mli"
@@ -399275,14 +399187,14 @@ let simplify_alias
399275399187
let normal () = Lam.apply ( simpl fn) (Ext_list.map args simpl) loc status in
399276399188
begin
399277399189
match Hash_ident.find_opt meta.ident_tbl v with
399278-
| Some (FunctionId {lambda = Some(Lfunction ({params; body} as m),
399190+
| Some (FunctionId {lambda = Some(Lfunction ({params; body; attr = {is_a_functor}} as m),
399279399191
rec_flag)
399280399192
})
399281399193
->
399282399194

399283399195
if Ext_list.same_length args params (* && false *)
399284399196
then
399285-
if Lam_inline_util.maybe_functor v.name
399197+
if is_a_functor = Functor_yes
399286399198
(* && (Set_ident.mem v meta.export_idents) && false *)
399287399199
then
399288399200
(* TODO: check l1 if it is exported,
@@ -399613,12 +399525,12 @@ let values_of_export
399613399525
only truly immutable values can be inlined
399614399526
*)
399615399527
then
399616-
if Lam_inline_util.should_be_functor x.name lambda (* can also be submodule *)
399617-
then
399528+
match lambda with
399529+
| Lfunction {attr = {is_a_functor = Functor_yes}} ->
399618399530
if Lam_closure.is_closed lambda (* TODO: seriealize more*)
399619399531
then Some lambda
399620399532
else None
399621-
else
399533+
| _ ->
399622399534
let lam_size = Lam_analysis.size lambda in
399623399535
(* TODO:
399624399536
1. global need re-assocate when do the beta reduction

lib/4.06.1/unstable/js_compiler.ml.d

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 5 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -398974,94 +398974,6 @@ let simplify_lets (lam : Lam.t) : Lam.t =
398974398974

398975398975
apply_lets occ lam
398976398976

398977-
end
398978-
module Lam_inline_util : sig
398979-
#1 "lam_inline_util.mli"
398980-
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
398981-
*
398982-
* This program is free software: you can redistribute it and/or modify
398983-
* it under the terms of the GNU Lesser General Public License as published by
398984-
* the Free Software Foundation, either version 3 of the License, or
398985-
* (at your option) any later version.
398986-
*
398987-
* In addition to the permissions granted to you by the LGPL, you may combine
398988-
* or link a "work that uses the Library" with a publicly distributed version
398989-
* of this file to produce a combined library or application, then distribute
398990-
* that combined work under the terms of your choosing, with no requirement
398991-
* to comply with the obligations normally placed on you by section 4 of the
398992-
* LGPL version 3 (or the corresponding section of a later version of the LGPL
398993-
* should you choose to use a later version).
398994-
*
398995-
* This program is distributed in the hope that it will be useful,
398996-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
398997-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
398998-
* GNU Lesser General Public License for more details.
398999-
*
399000-
* You should have received a copy of the GNU Lesser General Public License
399001-
* along with this program; if not, write to the Free Software
399002-
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
399003-
399004-
399005-
399006-
399007-
399008-
399009-
399010-
399011-
(** Utilities for lambda inlining *)
399012-
399013-
val maybe_functor : string -> bool
399014-
399015-
val should_be_functor : string -> Lam.t -> bool
399016-
399017-
end = struct
399018-
#1 "lam_inline_util.ml"
399019-
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
399020-
*
399021-
* This program is free software: you can redistribute it and/or modify
399022-
* it under the terms of the GNU Lesser General Public License as published by
399023-
* the Free Software Foundation, either version 3 of the License, or
399024-
* (at your option) any later version.
399025-
*
399026-
* In addition to the permissions granted to you by the LGPL, you may combine
399027-
* or link a "work that uses the Library" with a publicly distributed version
399028-
* of this file to produce a combined library or application, then distribute
399029-
* that combined work under the terms of your choosing, with no requirement
399030-
* to comply with the obligations normally placed on you by section 4 of the
399031-
* LGPL version 3 (or the corresponding section of a later version of the LGPL
399032-
* should you choose to use a later version).
399033-
*
399034-
* This program is distributed in the hope that it will be useful,
399035-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
399036-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
399037-
* GNU Lesser General Public License for more details.
399038-
*
399039-
* You should have received a copy of the GNU Lesser General Public License
399040-
* along with this program; if not, write to the Free Software
399041-
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
399042-
399043-
399044-
399045-
399046-
399047-
399048-
399049-
(* TODO: add a context, like
399050-
[args]
399051-
[Lfunction(params,body)]
399052-
*)
399053-
399054-
399055-
let maybe_functor (name : string) =
399056-
name.[0] >= 'A' && name.[0] <= 'Z'
399057-
399058-
399059-
let should_be_functor (name : string) (lam : Lam.t) =
399060-
maybe_functor name &&
399061-
(match lam with Lfunction {attr = {is_a_functor = Functor_yes}} -> true | _ -> false)
399062-
399063-
399064-
399065398977
end
399066398978
module Lam_pass_remove_alias : sig
399067398979
#1 "lam_pass_remove_alias.mli"
@@ -399275,14 +399187,14 @@ let simplify_alias
399275399187
let normal () = Lam.apply ( simpl fn) (Ext_list.map args simpl) loc status in
399276399188
begin
399277399189
match Hash_ident.find_opt meta.ident_tbl v with
399278-
| Some (FunctionId {lambda = Some(Lfunction ({params; body} as m),
399190+
| Some (FunctionId {lambda = Some(Lfunction ({params; body; attr = {is_a_functor}} as m),
399279399191
rec_flag)
399280399192
})
399281399193
->
399282399194

399283399195
if Ext_list.same_length args params (* && false *)
399284399196
then
399285-
if Lam_inline_util.maybe_functor v.name
399197+
if is_a_functor = Functor_yes
399286399198
(* && (Set_ident.mem v meta.export_idents) && false *)
399287399199
then
399288399200
(* TODO: check l1 if it is exported,
@@ -399613,12 +399525,12 @@ let values_of_export
399613399525
only truly immutable values can be inlined
399614399526
*)
399615399527
then
399616-
if Lam_inline_util.should_be_functor x.name lambda (* can also be submodule *)
399617-
then
399528+
match lambda with
399529+
| Lfunction {attr = {is_a_functor = Functor_yes}} ->
399618399530
if Lam_closure.is_closed lambda (* TODO: seriealize more*)
399619399531
then Some lambda
399620399532
else None
399621-
else
399533+
| _ ->
399622399534
let lam_size = Lam_analysis.size lambda in
399623399535
(* TODO:
399624399536
1. global need re-assocate when do the beta reduction

0 commit comments

Comments
 (0)