Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reroute legacy immediate support for jkinds #1907

Merged
merged 46 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
65c6399
Change parsetree layouts to strings
ncik-roberts Sep 29, 2023
5f1e6c3
make depend
ncik-roberts Oct 3, 2023
e454d29
Striate jkind annotations from attributes
ncik-roberts Oct 3, 2023
993cb2f
Restore check and add test that `type t : unboxed` isn't allowed
ncik-roberts Oct 3, 2023
42113b1
Fix build
ncik-roberts Oct 5, 2023
aaac3aa
Main changes
ncik-roberts Oct 4, 2023
0bf4f76
Restore a similar behavior to [legacy_immediate]
ncik-roberts Oct 4, 2023
45330e6
Change tests to not use `[@@void]`, `[@@value]`, etc.
ncik-roberts Oct 4, 2023
80fa08f
Change tests to use new error message
ncik-roberts Oct 4, 2023
a8d5366
Disallow multiple sources of jkind
ncik-roberts Oct 4, 2023
99e48fd
Rename `legacy_immediate` to `is_type_decl`
ncik-roberts Oct 4, 2023
e069ab0
`make bootstrap`
ncik-roberts Oct 5, 2023
8bd58ec
Minor changes suggested in review
ncik-roberts Nov 2, 2023
257142d
More minor changes suggested in review
ncik-roberts Nov 2, 2023
27a6a97
More minor changes suggested in review
ncik-roberts Nov 2, 2023
1a6554e
Update ocaml/typing/jkind.ml
ncik-roberts Nov 2, 2023
8d878af
Revert change that I can't explain
ncik-roberts Nov 2, 2023
b0c3e92
Merge remote-tracking branch 'origin/nroberts/layouts-are-strings-in-…
ncik-roberts Nov 2, 2023
b70b61f
Store both typed/untyped jkind annotation in typedtree, and delete `c…
ncik-roberts Nov 2, 2023
9f9809c
Remove misleading comment
ncik-roberts Nov 2, 2023
dac6448
Add CRs for doubling-down on backward-incompatible change
ncik-roberts Nov 2, 2023
48ff923
Update ocaml/typing/types.mli
ncik-roberts Nov 2, 2023
18811e1
Make predefs less confusing if printed
ncik-roberts Nov 2, 2023
88cb0bf
Merge branch 'nroberts/layouts-are-strings-in-parsetree' into nrobert…
ncik-roberts Nov 2, 2023
6cb081e
Resolve merge conflicts and fix build
ncik-roberts Nov 2, 2023
5febf29
Remove obviated module
ncik-roberts Nov 2, 2023
2cf3307
Add missing case to comment
ncik-roberts Nov 2, 2023
9513267
Drop the needless is_type_decl param
ncik-roberts Nov 2, 2023
9ccf2a8
Split Location argument into its components
ncik-roberts Nov 3, 2023
2b55486
Remove no-longer-necessary builtin attrs
ncik-roberts Nov 3, 2023
ff20c84
make depend
ncik-roberts Nov 3, 2023
f80a089
Layout annotations in untypeast
ncik-roberts Nov 3, 2023
ad661f0
Merge remote-tracking branch 'origin/main' into nroberts/layouts-are-…
ncik-roberts Nov 3, 2023
64711b5
Resolve merge conflicts and update whitespace in tests
ncik-roberts Nov 3, 2023
6966628
Merge branch 'nroberts/layouts-are-strings-in-parsetree' into nrobert…
ncik-roberts Nov 3, 2023
783b618
Fix merge conflicts
ncik-roberts Nov 6, 2023
42c9c53
make {depend,boot,parser}
ncik-roberts Nov 7, 2023
9dc1246
Merge branch 'main' into nroberts/jane-syntax-for-layouts
ncik-roberts Nov 7, 2023
f1d53a8
Resolve merge conflicts due to squash+merge
ncik-roberts Nov 8, 2023
4e928f7
Fix tests broken by error message change
ncik-roberts Nov 8, 2023
d28f3c1
Resolve merge conflicts in typing-layouts-float64
ncik-roberts Nov 8, 2023
0a6697c
make fmt
ncik-roberts Nov 8, 2023
7501070
Remove test unintentionally added back in the merge
ncik-roberts Nov 8, 2023
5b2bd0c
Collapse *_beta versions of layouts tests with their stable versions …
ncik-roberts Nov 8, 2023
5b4f845
git rm files that I intended to remove in 5b2bd0c2
ncik-roberts Nov 8, 2023
d160a95
Suggestion from review
ncik-roberts Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/main' into nroberts/layouts-are-…
…strings-in-parsetree
  • Loading branch information
ncik-roberts committed Nov 3, 2023
commit ad661f06779b70492e60b6db511d8df75aa152ba
33 changes: 29 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build
on: [push, pull_request]
on: [push]
jobs:
build:
name: ${{ matrix.name }}
Expand Down Expand Up @@ -112,15 +112,17 @@ jobs:
run: sudo apt-get install afl++

- name: Install AFL (for macOS workers)
# The "afl-fuzz" package is deprecated (2023-10) and can no longer be installed
if: matrix.os == 'macos-latest'
run: HOMEBREW_NO_INSTALL_CLEANUP=TRUE brew install afl-fuzz
run: true
# run: HOMEBREW_NO_INSTALL_CLEANUP=TRUE brew install afl-fuzz

- name: Cache OCaml 4.14 and dune
- name: Cache OCaml 4.14, dune and menhir
uses: actions/cache@v2
id: cache
with:
path: ${{ github.workspace }}/ocaml-414/_install
key: ${{ matrix.os }}-cache-ocaml-414-dune-361
key: ${{ matrix.os }}-cache-ocaml-414-dune-361-menhir-20210419

- name: Checkout OCaml 4.14
uses: actions/checkout@master
Expand Down Expand Up @@ -155,6 +157,29 @@ jobs:
PATH=$GITHUB_WORKSPACE/ocaml-414/_install/bin:$PATH make release
cp _boot/dune.exe $GITHUB_WORKSPACE/ocaml-414/_install/bin/dune

# CR mshinwell: This should use git@gitlab.inria.fr:fpottier/menhir.git
- name: Checkout menhir github repo
uses: actions/checkout@master
if: steps.cache.outputs.cache-hit != 'true'
with:
repository: 'LexiFi/menhir'
ref: '20210419'
path: 'menhir'

- name: Build menhir
working-directory: menhir
if: steps.cache.outputs.cache-hit != 'true'
run: |
PATH=$GITHUB_WORKSPACE/ocaml-414/_install/bin:$PATH dune build
cp _build/install/default/bin/menhir $GITHUB_WORKSPACE/ocaml-414/_install/bin/menhir
# Our dune rule uses `menhirLib.mli`, which we can't simply `cp`
# because it's a symbolic link to a relative path.
export SOURCE_DIR=_build/install/default/lib/menhirLib
export TARGET_DIR=$GITHUB_WORKSPACE/ocaml-414/_install/lib/menhirLib
mkdir -p $TARGET_DIR
cat $SOURCE_DIR/menhirLib.mli > $TARGET_DIR/menhirLib.mli
cat $SOURCE_DIR/menhirLib.ml > $TARGET_DIR/menhirLib.ml

- name: Install GNU parallel
if: matrix.os == 'macos-latest'
run: HOMEBREW_NO_INSTALL_CLEANUP=TRUE brew install parallel
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ jobs:
id: cache
with:
path: ${{ github.workspace }}/_opam
key: ${{ matrix.os }}-cache-ocaml-414-dune-2.9.1-g7606d586
key: ${{ matrix.os }}-cache-ocaml-414-dune-2.9.1-g7606d586-menhir20210419

- name: Install menhir
if: steps.cache.outputs.cache-hit != 'true'
run: |
opam pin menhir 20210419

- name: Build bisect_ppx
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
"ocaml.sandbox": {
"kind": "opam",
"switch": "4.14.1"
},
"files.associations": {
"*.mlp": "ocaml",
"smmintrin.h": "c",
"tmmintrin.h": "c",
"pmmintrin.h": "c"
}
}
}
6 changes: 5 additions & 1 deletion HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ Depending on the initial changes, it might be necessary to do this multiple time
## Rebuilding during dev work

To rebuild after making changes, you can just type `make`. You need to
have a working OCaml 4.14 compiler on your PATH before doing so,
have a working OCaml 4.14 or 4.14.1 compiler on your PATH before doing so,
e.g. installed via OPAM.

<!-- CR someone: investigate this -->
The build currently fails when using the latest version of `dune` (3.11.1).
To install a known-good dune, run `opam pin add dune 3.8.1`.

There is a special target `make hacking` which starts Dune in polling mode. The rebuild
performed here is equivalent to `make ocamlopt` in the upstream distribution: it rebuilds the
compiler itself, but doesn't rebuild the stdlib or anything else with the new compiler.
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ build_and_test_upstream: build_upstream
if $$(which gfortran > /dev/null 2>&1); then \
export LIBRARY_PATH=$$(dirname $$(gfortran -print-file-name=libgfortran.a)); \
fi; \
cd _build_upstream/testsuite \
export OCAMLSRCDIR=$$(pwd)/_build_upstream \
&& cd _build_upstream/testsuite \
&& if $$(which parallel > /dev/null 2>&1); \
then \
echo "Running testsuite in parallel (nproc=$$(nproc))"; \
Expand Down
8 changes: 4 additions & 4 deletions backend/.ocamlformat-enable
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ peephole/**/*.ml
peephole/**/*.mli
regalloc/**/*.ml
regalloc/**/*.mli
amd64/simd.ml
arm64/simd.ml
amd64/simd_selection.ml
arm64/simd_selection.ml
amd64/simd*.ml
arm64/simd*.ml
generic_fns.ml
generic_fns.mli
16 changes: 9 additions & 7 deletions backend/CSEgen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,13 @@ let kill_addr_regs n =

(* Prepend a set of moves before [i] to assign [srcs] to [dsts]. *)

let insert_single_move i src dst = instr_cons (Iop Imove) [|src|] [|dst|] i
let insert_single_move i src dst =
instr_cons_debug (Iop Imove) [|src|] [|dst|] i.dbg i

let insert_move srcs dsts i =
match Array.length srcs with
| 0 -> i
| 1 -> instr_cons (Iop Imove) srcs dsts i
| 1 -> instr_cons_debug (Iop Imove) srcs dsts i.dbg i
| _ -> (* Parallel move: first copy srcs into tmps one by one,
then copy tmps into dsts one by one *)
let tmps = Reg.createv_like srcs in
Expand Down Expand Up @@ -237,12 +238,13 @@ method class_of_operation op =
| Icall_ind | Icall_imm _ | Itailcall_ind | Itailcall_imm _
| Iextcall _ | Iprobe _ | Iopaque -> assert false (* treated specially *)
| Istackoffset _ -> Op_other
| Iload(_,_,mut) -> Op_load mut
| Iload { mutability = Mutable } -> Op_load Mutable
| Iload { mutability = Immutable } -> Op_load Immutable
| Istore(_,_,asg) -> Op_store asg
| Ialloc _ | Ipoll _ -> assert false (* treated specially *)
| Iintop(Icheckbound) -> Op_checkbound
| Iintop(Icheckbound|Icheckalign _) -> Op_checkbound
| Iintop _ -> Op_pure
| Iintop_imm(Icheckbound, _) -> Op_checkbound
| Iintop_imm((Icheckbound|Icheckalign _), _) -> Op_checkbound
| Iintop_imm(_, _) -> Op_pure
| Iintop_atomic _ -> Op_store true
| Icompf _
Expand All @@ -253,6 +255,7 @@ method class_of_operation op =
| Iname_for_debugger _ -> Op_other
| Iprobe_is_enabled _ -> Op_other
| Ibeginregion | Iendregion -> Op_other
| Idls_get -> Op_load Mutable

(* Operations that are so cheap that it isn't worth factoring them. *)

Expand Down Expand Up @@ -321,8 +324,7 @@ method private cse n i k =
(* This operation was computed earlier. *)
(* Are there registers that hold the results computed earlier? *)
begin match find_regs_containing n1 vres with
| Some res when (not (self#is_cheap_operation op))
&& (not (Proc.regs_are_volatile res)) ->
| Some res when (not (self#is_cheap_operation op)) ->
(* We can replace res <- op args with r <- move res,
provided res are stable (non-volatile) registers.
If the operation is very cheap to compute, e.g.
Expand Down
35 changes: 19 additions & 16 deletions backend/afl_instrument.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

(* Insert instrumentation for afl-fuzz *)

open Lambda
open Cmm

module V = Backend_var
Expand Down Expand Up @@ -43,13 +42,19 @@ let rec with_afl_logging b dbg =
let afl_area = V.create_local "shared_mem" in
let op oper args = Cop (oper, args, dbg) in
Clet(VP.create afl_area,
op (Cload (Word_int, Asttypes.Mutable)) [afl_area_ptr dbg],
Clet(VP.create cur_pos, op Cxor [op (Cload (Word_int, Asttypes.Mutable))
op (Cload ({memory_chunk=Word_int;
mutability=Asttypes.Mutable;
is_atomic=false})) [afl_area_ptr dbg],
Clet(VP.create cur_pos, op Cxor [op (Cload {memory_chunk=Word_int;
mutability=Asttypes.Mutable;
is_atomic=false})
[afl_prev_loc dbg]; Cconst_int (cur_location, dbg)],
Csequence(
op (Cstore(Byte_unsigned, Assignment))
[op Cadda [Cvar afl_area; Cvar cur_pos];
op Cadda [op (Cload (Byte_unsigned, Asttypes.Mutable))
op Cadda [op (Cload {memory_chunk=Byte_unsigned;
mutability=Asttypes.Mutable;
is_atomic=false})
[op Cadda [Cvar afl_area; Cvar cur_pos]];
Cconst_int (1, dbg)]],
op (Cstore(Word_int, Assignment))
Expand Down Expand Up @@ -105,15 +110,13 @@ let instrument_initialiser c dbg =
(* Each instrumented module calls caml_setup_afl at
initialisation, which is a no-op on the second and subsequent
calls *)
with_afl_logging
(Csequence
(Cop (Cextcall { func = "caml_setup_afl";
builtin = false;
returns = true;
effects = Arbitrary_effects;
coeffects = Has_coeffects;
ty = typ_int; alloc = false; ty_args = []; },
[Cconst_int (0, dbg ())],
dbg ()),
c))
(dbg ())
Csequence
(Cop (Cextcall { func = "caml_setup_afl";
builtin = false;
returns = true;
effects = Arbitrary_effects;
coeffects = Has_coeffects;
ty = typ_int; alloc = false; ty_args = []; },
[Cconst_int (0, dbg ())],
dbg ()),
with_afl_logging c (dbg ()))
5 changes: 2 additions & 3 deletions backend/amd64/CSE.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ method! class_of_operation op =
| Istore_int(_, _, is_asg) -> Op_store is_asg
| Ioffset_loc(_, _) -> Op_store true
| Ifloatarithmem _ | Ifloatsqrtf _ -> Op_load Mutable
| Ibswap _ | Isqrtf -> super#class_of_operation op
| Ibswap _ -> super#class_of_operation op
| Irdtsc | Irdpmc
| Ilfence | Isfence | Imfence -> Op_other
| Ifloat_iround | Ifloat_min | Ifloat_max | Ifloat_round _ -> Op_pure
| Isimd op ->
begin match Simd.class_of_operation op with
| Pure -> Op_pure
Expand All @@ -53,7 +52,7 @@ method! class_of_operation op =
| Istackoffset _ | Iload _ | Istore _ | Ialloc _
| Iintop _ | Iintop_imm _ | Iintop_atomic _
| Iname_for_debugger _ | Iprobe _ | Iprobe_is_enabled _ | Iopaque
| Ibeginregion | Iendregion | Ipoll _
| Ibeginregion | Iendregion | Ipoll _ | Idls_get
-> super#class_of_operation op

end
Expand Down
2 changes: 2 additions & 0 deletions backend/amd64/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ Debian architecture name: `amd64`
_OS X ABI Function Call Guide: x86-64 Function Calling Conventions_
* Windows 64 application binary interface:
_x64 Software Conventions_ from MSDN
* SIMD Intrinsics API
[Intel Intrinsics Guide](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html)
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.