Skip to content

Commit

Permalink
Squashed 'ocaml/' changes from c703f5f..bcae5ff
Browse files Browse the repository at this point in the history
bcae5ff flambda-backend: Bump buffer size to avoid gcc warning (#1247)
d6c170b flambda-backend: Remove `-absname` to improve dune build errors (#1233)
1b2bcb4 flambda-backend: Put frametables in .text with relative offsets for return addresses. (#1227)
999d523 flambda-backend: Small optimisation for caml_modify (#1226)
b16493b flambda-backend: Add timestamps to GC logs (#1229)
95f7e80 flambda-backend: Provide a no-naked-pointers runtime and use it for the compiler (#1224)
ba77581 flambda-backend: Replace assertion with a match statement (#1225)
cfb3cd2 flambda-backend: Memoise last substitution composition (#1209)
1c4db44 flambda-backend: Port PR1202 and PR1205 to the ocaml/ subtree (#1211)
577410e flambda-backend: Correctly stack debuginfo for inlined body in classic mode (#1152)
6733de6 flambda-backend: Fix dune install in otherlibs: missing cmt and typo. (#1194)
4c97d26 flambda-backend: Unboxed numbers (#1165)
1ad7252 flambda-backend: Revert "Revert "Add a proper top and bottom layout" (#1169)" (#1191)
dea4b3e flambda-backend: Don't get the layout of arguments from patterns (#1179)
6d3e85b flambda-backend: Don't copy when resolving aliases in try_modtypes (#1184)
73e52b7 flambda-backend: Clarify the types used for static jump/catch (#1180)
273a40d flambda-backend: Reenable backtrace testsuite folder for flambda2 (#1161)
77434f0 flambda-backend: Bump magic numbers for 4.14.1-5 (#1190)
3a78e83 flambda-backend: Revert "Instance compilation units" (#1175)
9a683c9 flambda-backend: Move compute_layout to Lambda (#1167)
0ea58e9 flambda-backend: Revert "Add a proper top and bottom layout" (#1169)
1e5e23a flambda-backend: Add hint for common misplaced [@unboxed] attribute (#1164)
10f870a flambda-backend: Add a proper top and bottom layout (#1158)
d1be563 flambda-backend: Don't warn about misplaced attributes in -i mode (#1163)
feefcaa flambda-backend: Remove immutable arrays from stdlib.ml and stdlib.mli (#1154)
ba101be flambda-backend: Shrink the ref_table if it grows large (#1156)
777fda7 flambda-backend: Preserve backtraces from failing `Lazy_backtrack` computations (#805)
56d014e flambda-backend: Remove remaining `layout_top` after #1084 (#1138)
dc1c1ce flambda-backend: Layouts for parameters in lambda & remove most layout_top (#1084)
49fea78 flambda-backend: Instance compilation units (#1113)
1127fd2 flambda-backend: Merge pull request #1143 from riaqn/merge-ocaml-jst
f458733 flambda-backend: fix things after merge
b43d385 flambda-backend: File magic updates (#306)
9f604aa flambda-backend: Merge ocaml-jst
1f54613 flambda-backend: More assertions for local alloc and letrec (#1081)
0c95280 flambda-backend: Remove most layout_top in closure (#1127)
8ad48b5 flambda-backend: Use only `.ocamlformat*` to enable or disable ocamlformat (#1135)
1aa2885 flambda-backend: Build all boot targets in `make hacking` (#1133)
6b6c25a flambda-backend: Hide `Compilation_unit.t`'s definition in a submodule (#1134)
529d66b flambda-backend: Compile refactor (#1096)
df798c1 flambda-backend: Propagates layouts through Flambda1 (#1115)
9bce50b flambda-backend: Add `gc-timings` to collect timing information from the GC (#1089)
d431d3b flambda-backend: Use the type of primitive declarations to make their layout (#1118)
8da887e flambda-backend: Changes to arity in clambda (#1106)
db20e97 flambda-backend: Fix simplify-exits (#1108)
6a63906 flambda-backend: Add layout on Lregion (#1107)
c562fb3 flambda-backend: caml_{curry,apply,send}* for unboxed types (#1104)
50ee311 flambda-backend: Temporary fix for incorrect layout for result of custom and operators (#1119)
c89512d flambda-backend: More error checking for natdynlink symbols (#1005)
27d68bf flambda-backend: Flambda1 region deletion and locals fixes (#1000)
0e3e057 flambda-backend: Add identifiers for instantiated functor units (#1092)
4b75b46 flambda-backend: Fix build system under ocaml/runtime (#1085)
7c9fc32 flambda-backend: Fix valid character range computation for compilation units (#1110)
40c754a flambda-backend: Add result layout in Lapply and Lsend (#1102)
cedaea1 flambda-backend: Add layout type in Lambda (#1032)
47c0e23 flambda-backend: Configure: Add flag to use legacy library layout (#1098)
eed5888 flambda-backend: Restructure LIBDIR: Move Dynlink, Str and Unix to sub-directories (port part of ocaml/PR11198) (#1094)
5b98caf flambda-backend: Revert "Restructure LIBDIR" (#1093)
46f1b16 flambda-backend: Remove a stray character from dynlink Makefile (#1090)
e515442 flambda-backend: Restructure LIBDIR: Move Dynlink, Str and Unix to sub-directories (port PR#11198) (#895)
9307e7c flambda-backend: inline fast path of caml_applyN (#934)
3244386 flambda-backend: Bump magic numbers (#1077)
7c9e15d flambda-backend: Fix bug in arguments to `get_unit_info` (#1069)
a2f4c9e flambda-backend: Closure rename static catch (#1070)
2ee705a flambda-backend: Backport #946 to ocaml/ subfolder (#1061)
569703f flambda-backend: Merge ocaml-jst#97 (#1063)
7b1779a flambda-backend: Port value_kind changes to testsuite/tools to fix parsecmm.mly (#1060)
49505d1 flambda-backend: Bugfix for Ctype.nondep_type (#1059)
654c63c flambda-backend: Backport #295 kind changes to ocaml/ subfolder (#1018)
50a9ce0 flambda-backend: Fix extern_closure_up_to_env (#1053)
bc2c78d flambda-backend: Remove obsolete pack-related code (#1051)
872ff38 flambda-backend: Fix error-prone syntax resulting from reformatting (#1050)
d03b346 flambda-backend: Fix different .cmi files being produced by ocamlopt and ocamlc when using -pack (#1049)
90ee37b flambda-backend: Revert "Revert "Use Import_info.t in Cmt_format"" (#1045)
ac12d90 flambda-backend: Fix version number (#1043)
75e0154 flambda-backend: Revert "Use Import_info.t in Cmt_format" (#1042)
ecab74c flambda-backend: Use Import_info.t in Cmt_format (#1037)
7661d4d flambda-backend: Bootstrap
1098a56 flambda-backend: Update .depend files
a7292da flambda-backend: Revert ocaml/toplevel/native/dune
7584479 flambda-backend: Remove alloc-check from ocaml/

git-subtree-dir: ocaml
git-subtree-split: bcae5ff
  • Loading branch information
ccasin committed Mar 24, 2023
1 parent bcec5fe commit 2376a0b
Show file tree
Hide file tree
Showing 224 changed files with 4,887 additions and 2,904 deletions.
33 changes: 22 additions & 11 deletions Makefile.common-jst
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ endef
.DEFAULT_GOAL := compiler
.PHONY: boot-compiler boot-runtest runtime-stdlib compiler runtest

boot_targets = \
$(boot_ocamlc) \
$(boot_ocamlopt) \
$(boot_ocamlmklib) \
$(boot_ocamldep) \
$(boot_ocamlobjinfo)

boot-compiler: _build/_bootinstall
$(dune) build $(ws_boot) $(coverage_dune_flags) \
$(boot_ocamlc) \
$(boot_ocamlopt) \
$(boot_ocamlmklib) \
$(boot_ocamldep) \
$(boot_ocamlobjinfo)
$(dune) build $(ws_boot) $(coverage_dune_flags) $(boot_targets)

boot-runtest: boot-compiler
$(dune) runtest $(ws_boot) $(coverage_dune_flags) --force
Expand Down Expand Up @@ -139,6 +141,13 @@ _install: compiler
$(cpl) -R _build/install/runtime_stdlib/lib/ocaml_runtime_stdlib/* _install/lib/ocaml/
rm -f _install/lib/ocaml/{META,dune-package,Makefile.config,dynlink.cmxa}
$(cpl) -R _build/install/main/lib/ocaml/* _install/lib/ocaml/
if [ "x$(legacy_layout)" == "xyes" ] ; \
then \
for libdir in unix str dynlink bigarray ; do \
mv _install/lib/ocaml/$${libdir}/* _install/lib/ocaml/ ; \
rmdir _install/lib/ocaml/$${libdir} ; \
done \
fi
rm -f _install/lib/ocaml/{META,dune-package}
rm -f _install/lib/ocaml/compiler-libs/*.cmo
$(cpl) {_build/install/main,_install}/lib/ocaml/compiler-libs/topstart.cmo
Expand Down Expand Up @@ -202,11 +211,12 @@ install_for_test: _install
done; \
ln -s . lex; ln -s . yacc; \
ln -s _install/lib/ocaml/compiler-libs compilerlibs; \
mkdir -p otherlibs/{unix,dynlink/native,str}; \
mkdir -p otherlibs/{unix,dynlink/native,str,bigarray}; \
ln -s ../stdlib/threads otherlibs/systhreads; \
$(cpl) stdlib/{lib,}unix* otherlibs/unix; \
$(cpl) stdlib/dynlink* otherlibs/dynlink; \
$(cpl) stdlib/{lib,}str* otherlibs/str; \
$(cpl) stdlib/unix/{lib,}unix* otherlibs/unix; \
$(cpl) stdlib/dynlink/dynlink* otherlibs/dynlink; \
$(cpl) stdlib/str/{lib,}str* otherlibs/str; \
${cpl} stdlib/bigarray/bigarray* otherlibs/bigarray; \
ln -s ../_build/main/$(ocamldir)/toplevel/byte/.ocamltoplevel.objs/byte toplevel; \
)

Expand All @@ -218,6 +228,7 @@ install_for_test: _install
cp $(main_build)/$(ocamldir)/.ocamlcommon.objs/byte/*.cmo _runtest/utils
rm -f _runtest/utils/{topdirs,opttopdirs}.cmi
cp _install/lib/ocaml/*.{cmi,cma,a,cmxa} _runtest/utils
cp _install/lib/ocaml/{unix,str,dynlink,bigarray}/*.{cmi,cma,a,cmxa} _runtest/utils
cp $(main_build)/$(ocamldir)/.ocamlcommon.objs/native/config.o _runtest/utils
# Needed for tests/warnings
cp $(ocamldir)/utils/warnings.ml _runtest/utils
Expand Down Expand Up @@ -302,4 +313,4 @@ promote-one: install_for_test
# This target is like a polling version of upstream "make ocamlopt"
.PHONY: hacking
hacking: _build/_bootinstall
$(dune) build $(ws_boot) -w $(boot_ocamlopt)
$(dune) build $(ws_boot) -w $(boot_targets)
3 changes: 3 additions & 0 deletions Makefile.menhir
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ import-menhirLib:
@ cp \
$(addprefix `$(MENHIR) --suggest-menhirLib`/menhirLib.,ml mli) \
boot/menhir
# Partial applications of the form Obj.magic f x in menhirLib cause an issue with locals,
# so rewrite these to Obj.magic (f x)
@ sed -i 's/\b\(in\|then\|with\|else\)\b/@@@\1/g; s/Obj.magic \([a-z0-9_]\+\( [a-z0-9_]\+\)\+\)/Obj.magic (\1)/g; s/@@@//g' boot/menhir/menhirLib.ml


## demote-menhir
Expand Down
16 changes: 8 additions & 8 deletions asmcomp/afl_instrument.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ let rec with_afl_logging b dbg =

and instrument = function
(* these cases add logging, as they may be targets of conditional branches *)
| Cifthenelse (cond, t_dbg, t, f_dbg, f, dbg) ->
| Cifthenelse (cond, t_dbg, t, f_dbg, f, dbg, kind) ->
Cifthenelse (instrument cond, t_dbg, with_afl_logging t t_dbg,
f_dbg, with_afl_logging f f_dbg, dbg)
| Ctrywith (e, ex, handler, dbg) ->
Ctrywith (instrument e, ex, with_afl_logging handler dbg, dbg)
| Cswitch (e, cases, handlers, dbg) ->
f_dbg, with_afl_logging f f_dbg, dbg, kind)
| Ctrywith (e, ex, handler, dbg, value_kind) ->
Ctrywith (instrument e, ex, with_afl_logging handler dbg, dbg, value_kind)
| Cswitch (e, cases, handlers, dbg, value_kind) ->
let handlers =
Array.map (fun (handler, handler_dbg) ->
let handler = with_afl_logging handler handler_dbg in
handler, handler_dbg)
handlers
in
Cswitch (instrument e, cases, handlers, dbg)
Cswitch (instrument e, cases, handlers, dbg, value_kind)

(* these cases add no logging, but instrument subexpressions *)
| Clet (v, e, body) -> Clet (v, instrument e, instrument body)
Expand All @@ -80,12 +80,12 @@ and instrument = function
| Ctuple es -> Ctuple (List.map instrument es)
| Cop (op, es, dbg) -> Cop (op, List.map instrument es, dbg)
| Csequence (e1, e2) -> Csequence (instrument e1, instrument e2)
| Ccatch (isrec, cases, body) ->
| Ccatch (isrec, cases, body, kind) ->
let cases =
List.map (fun (nfail, ids, e, dbg) -> nfail, ids, instrument e, dbg)
cases
in
Ccatch (isrec, cases, instrument body)
Ccatch (isrec, cases, instrument body, kind)
| Cexit (ex, args) -> Cexit (ex, List.map instrument args)
| Cregion e -> Cregion (instrument e)
| Ctail e -> Ctail (instrument e)
Expand Down
2 changes: 2 additions & 0 deletions asmcomp/amd64/emit.mlp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,7 @@ let end_assembly() =
emit_global_label "data_end";
D.qword (const 0);

D.text ();
D.align 8; (* PR#7591 *)
emit_global_label "frametable";

Expand Down Expand Up @@ -1465,6 +1466,7 @@ let end_assembly() =
D.size frametable (ConstSub (ConstThis, ConstLabel frametable))
end;

D.data ();
emit_probe_notes ();

if system = S_linux then
Expand Down
7 changes: 5 additions & 2 deletions asmcomp/asmlink.ml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ let make_startup_file ~ppf_dump units_list ~crc_interfaces =
List.flatten (List.map (fun (info,_,_) -> info.ui_defines) units_list) in
compile_phrase (Cmm_helpers.entry_point name_list);
let units = List.map (fun (info,_,_) -> info) units_list in
List.iter compile_phrase (Cmm_helpers.generic_functions false units);
List.iter compile_phrase
(Cmm_helpers.emit_preallocated_blocks []
(Cmm_helpers.generic_functions false units));
Array.iteri
(fun i name -> compile_phrase (Cmm_helpers.predef_exception i name))
Runtimedef.builtin_exceptions;
Expand Down Expand Up @@ -309,7 +311,8 @@ let make_shared_startup_file ~ppf_dump units =
Compilenv.reset shared_startup_comp_unit;
Emit.begin_assembly ();
List.iter compile_phrase
(Cmm_helpers.generic_functions true (List.map fst units));
(Cmm_helpers.emit_preallocated_blocks []
(Cmm_helpers.generic_functions true (List.map fst units)));
compile_phrase (Cmm_helpers.plugin_header units);
compile_phrase
(Cmm_helpers.global_table (List.map (fun (ui,_) -> ui.ui_unit) units));
Expand Down
50 changes: 20 additions & 30 deletions asmcomp/asmpackager.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,36 +111,26 @@ let make_package_object ~ppf_dump members targetobj targetname coercion
let compilation_unit = CU.create for_pack_prefix modname in
let prefixname = Filename.remove_extension objtemp in
let required_globals = CU.Set.empty in
let program, middle_end =
if Config.flambda then
let main_module_block_size, code =
Translmod.transl_package_flambda components coercion
in
let code = Simplif.simplify_lambda code in
let program =
{ Lambda.
code;
main_module_block_size;
compilation_unit;
required_globals;
}
in
program, Flambda_middle_end.lambda_to_clambda
else
let main_module_block_size, code =
Translmod.transl_store_package components
compilation_unit coercion
in
let code = Simplif.simplify_lambda code in
let program =
{ Lambda.
code;
main_module_block_size;
compilation_unit;
required_globals;
}
in
program, Closure_middle_end.lambda_to_clambda
let transl_style : Translmod.compilation_unit_style =
if Config.flambda || Config.flambda2 then Plain_block
else Set_individual_fields
in
let main_module_block_size, code =
Translmod.transl_package components compilation_unit coercion
~style:transl_style
in
let code = Simplif.simplify_lambda code in
let program =
{ Lambda.
code;
main_module_block_size;
compilation_unit;
required_globals;
}
in
let middle_end =
if Config.flambda then Flambda_middle_end.lambda_to_clambda
else Closure_middle_end.lambda_to_clambda
in
Asmgen.compile_implementation ~backend
~prefixname
Expand Down
Loading

0 comments on commit 2376a0b

Please sign in to comment.