Skip to content

Commit 1a4722e

Browse files
authored
Merge 5.2.0minus-17 (#178)
* Import ocaml sources for oxcaml/oxcaml@342a11315b4 * Automatic merges * Add new files * Commit merge conflicts * Trivial merge conflict resolution * Fix some type errors * Finish fixing type errors in merged files * Teach merlin about Pexp_idx * Promote tests * Import ocaml sources for oxcaml/oxcaml@d4c133509a1 * Automatic merges * Merge trivial conflicts * Teach merlin about atomic_loc * Import ocaml sources for oxcaml/oxcaml@99a981ed891 * Automatic merges * Commit merge conflicts * Trivial merge conflict resolution * Fix typing errors * Bump magic numbers * Add ignored flags * Import ocaml sources for oxcaml/oxcaml@e50954f1a39 * Automatic merges
1 parent 4c6b9db commit 1a4722e

File tree

161 files changed

+29417
-23382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+29417
-23382
lines changed

src/analysis/tail_analysis.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ let expr_tail_positions = function
8989
| Texp_overwrite _
9090
| Texp_mutvar _
9191
| Texp_setmutvar _
92+
| Texp_idx _
93+
| Texp_atomic_loc _
9294
| Texp_hole _ -> []
9395
| Texp_match (_, _, cs, _) -> List.map cs ~f:(fun c -> Case c)
9496
| Texp_try (_, cs) -> List.map cs ~f:(fun c -> Case c)

src/kernel/mconfig.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,9 @@ let ocaml_ignored_flags =
624624
"-fno-avx";
625625
"-dllvmir";
626626
"-keep-llvmir";
627-
"-llvm-path"
627+
"-llvm-path";
628+
"-ddwarf-types";
629+
"-ocamlcfg"
628630
]
629631

630632
let ocaml_ignored_parametrized_flags =
@@ -700,7 +702,10 @@ let ocaml_ignored_parametrized_flags =
700702
"-dgranularity";
701703
"-flambda2-expert-cont-lifting-budget";
702704
"-vectorize-max-block-size";
703-
"-save-ir-before"
705+
"-save-ir-before";
706+
"-shape-format";
707+
"-gdwarf-compression";
708+
"-gdwarf-fission"
704709
]
705710

706711
let ocaml_warnings_spec ~error =

src/ocaml/merlin_specific/browse_raw.ml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,16 @@ let of_method_call obj meth loc env (f : _ f0) acc =
371371
let loc = { loc with Location.loc_start; loc_end } in
372372
app (Method_call (obj, meth, loc)) env f acc
373373

374+
let of_block_access = function
375+
| Baccess_field (_, _) -> id_fold
376+
| Baccess_array
377+
{ mut = _; index_kind = _; index; base_ty = _; elt_ty = _; elt_sort = _ }
378+
-> of_expression index
379+
| Baccess_block (_, exp) -> of_expression exp
380+
381+
let of_unboxed_access = function
382+
| Uaccess_unboxed_field (_, _) -> id_fold
383+
374384
let rec of_expression_desc loc = function
375385
| Texp_ident _ | Texp_constant _ | Texp_instvar _ | Texp_mutvar _
376386
| Texp_variant (_, None)
@@ -472,6 +482,9 @@ let rec of_expression_desc loc = function
472482
| Texp_probe p -> of_expression p.handler
473483
| Texp_probe_is_enabled _ -> id_fold
474484
| Texp_exclave e -> of_expression e
485+
| Texp_idx (block_access, unboxed_access) ->
486+
of_block_access block_access ** list_fold of_unboxed_access unboxed_access
487+
| Texp_atomic_loc (exp, _, _, _, _) -> of_expression exp
475488
| Texp_hole _ -> id_fold
476489

477490
(* We should consider taking into account param.fp_loc at some point, as it

src/ocaml/parsing/ast_helper.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ module Exp = struct
236236
let unboxed_field ?loc ?attrs a b = mk ?loc ?attrs (Pexp_unboxed_field (a, b))
237237
let setfield ?loc ?attrs a b c = mk ?loc ?attrs (Pexp_setfield (a, b, c))
238238
let array ?loc ?attrs a b = mk ?loc ?attrs (Pexp_array (a, b))
239+
let idx ?loc ?attrs a b = mk ?loc ?attrs (Pexp_idx (a, b))
239240
let ifthenelse ?loc ?attrs a b c = mk ?loc ?attrs (Pexp_ifthenelse (a, b, c))
240241
let sequence ?loc ?attrs a b = mk ?loc ?attrs (Pexp_sequence (a, b))
241242
let while_ ?loc ?attrs a b = mk ?loc ?attrs (Pexp_while (a, b))

src/ocaml/parsing/ast_helper.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ module Exp:
181181
-> expression
182182
val array: ?loc:loc -> ?attrs:attrs -> mutable_flag -> expression list ->
183183
expression
184+
val idx : ?loc:loc -> ?attrs:attrs -> block_access -> unboxed_access list
185+
-> expression
184186
val ifthenelse: ?loc:loc -> ?attrs:attrs -> expression -> expression
185187
-> expression option -> expression
186188
val sequence: ?loc:loc -> ?attrs:attrs -> expression -> expression

src/ocaml/parsing/ast_iterator.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,14 @@ module E = struct
456456

457457
let iter_labeled_tuple sub el = List.iter (iter_snd (sub.expr sub)) el
458458

459+
let iter_block_access sub = function
460+
| Baccess_field lid -> iter_loc sub lid
461+
| Baccess_array (_, _, index) -> sub.expr sub index
462+
| Baccess_block (_, idx) -> sub.expr sub idx
463+
464+
let iter_unboxed_access sub = function
465+
| Uaccess_unboxed_field lid -> iter_loc sub lid
466+
459467
let iter sub {pexp_loc = loc; pexp_desc = desc; pexp_attributes = attrs} =
460468
sub.location sub loc;
461469
sub.attributes sub attrs;
@@ -491,6 +499,9 @@ module E = struct
491499
sub.expr sub e1; iter_loc sub lid;
492500
sub.expr sub e2
493501
| Pexp_array (_mut, el) -> List.iter (sub.expr sub) el
502+
| Pexp_idx (ba, uas) ->
503+
iter_block_access sub ba;
504+
List.iter (iter_unboxed_access sub) uas
494505
| Pexp_ifthenelse (e1, e2, e3) ->
495506
sub.expr sub e1; sub.expr sub e2;
496507
iter_opt (sub.expr sub) e3

src/ocaml/parsing/ast_mapper.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,14 @@ module E = struct
495495
ret_mode_annotations = sub.modes sub ret_mode_annotations
496496
}
497497

498+
let map_block_access sub = function
499+
| Baccess_field lid -> Baccess_field (map_loc sub lid)
500+
| Baccess_array (mut, ik, e) -> Baccess_array (mut, ik, sub.expr sub e)
501+
| Baccess_block (mut, e) -> Baccess_block (mut, sub.expr sub e)
502+
503+
let map_unboxed_access sub = function
504+
| Uaccess_unboxed_field lid -> Uaccess_unboxed_field (map_loc sub lid)
505+
498506
let map_iterator sub = function
499507
| Pcomp_range { start; stop; direction } ->
500508
Pcomp_range { start = sub.expr sub start;
@@ -567,6 +575,9 @@ module E = struct
567575
setfield ~loc ~attrs (sub.expr sub e1) (map_loc sub lid)
568576
(sub.expr sub e2)
569577
| Pexp_array (mut, el) -> array ~loc ~attrs mut (List.map (sub.expr sub) el)
578+
| Pexp_idx (ba, uas) ->
579+
idx ~loc ~attrs (map_block_access sub ba)
580+
(List.map (map_unboxed_access sub) uas)
570581
| Pexp_ifthenelse (e1, e2, e3) ->
571582
ifthenelse ~loc ~attrs (sub.expr sub e1) (sub.expr sub e2)
572583
(map_opt (sub.expr sub) e3)

src/ocaml/parsing/asttypes.mli

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,9 @@ type variance =
6868
type injectivity =
6969
| Injective
7070
| NoInjectivity
71+
72+
type index_kind =
73+
| Index_int
74+
| Index_unboxed_int64
75+
| Index_unboxed_int32
76+
| Index_unboxed_nativeint

src/ocaml/parsing/builtin_attributes.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ let warn_unused () =
7474
misplaced attribute warnings. *)
7575
let builtin_attrs =
7676
[ "inline"
77+
; "atomic"
7778
; "inlined"
7879
; "specialise"
7980
; "specialised"
@@ -1138,6 +1139,8 @@ let get_tracing_probe_payload (payload : Parsetree.payload) =
11381139
in
11391140
Ok { name; name_loc; enabled_at_init; arg }
11401141

1142+
let has_atomic attrs = has_attribute "atomic" attrs
1143+
11411144
(* Merlin specific *)
11421145

11431146
let merlin_let_punned = "merlin.let-punned"

src/ocaml/parsing/builtin_attributes.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ type tracing_probe =
346346
val get_tracing_probe_payload :
347347
Parsetree.payload -> (tracing_probe, unit) result
348348

349+
val has_atomic: Parsetree.attributes -> bool
350+
349351
(* Merlin specific *)
350352

351353
(** The name of the attribute used to identify punned let expressions. When a let

0 commit comments

Comments
 (0)