diff options
| author | Alain Frisch <alain@frisch> | 2021-11-10 16:55:07 +0100 |
|---|---|---|
| committer | Alain Frisch <alain@frisch> | 2021-11-10 16:55:07 +0100 |
| commit | efb4a8d5cf0bb77fb8bba41e1d76172af7f78162 (patch) | |
| tree | e4b3ff3df5ab90695af6d3f6401d7ad5e71ad931 /lambda | |
| parent | d0c2c382cf84588a0135edf0ed28208730adc99b (diff) | |
| download | ocaml-efb4a8d5cf0bb77fb8bba41e1d76172af7f78162.tar.gz | |
Restore optim for objects directly under a top-level module
Diffstat (limited to 'lambda')
| -rw-r--r-- | lambda/translclass.ml | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lambda/translclass.ml b/lambda/translclass.ml index 29547d5201..ef07150232 100644 --- a/lambda/translclass.ml +++ b/lambda/translclass.ml @@ -529,12 +529,19 @@ let transl_class_rebind ~scopes cl vf = (* Rewrite a closure using builtins. Improves native code size. *) +let module_path = function + Lvar id -> + let s = Ident.name id in s <> "" && s.[0] >= 'A' && s.[0] <= 'Z' + | Lprim(Pgetglobal _, [], _) -> true + | _ -> false + let const_path local = function Lvar id -> not (List.mem id local) | Lconst _ -> true | Lfunction {kind = Curried; body} -> let fv = free_variables body in List.for_all (fun x -> not (Ident.Set.mem x fv)) local + | Lprim(Pfield _, [p], _) -> module_path p | _ -> false let rec builtin_meths self env env2 body = |
