ThinkOpenly / sail

Sail architecture definition language
Other
11 stars 12 forks source link

Improved Reserved Field Mechanism #35

Open joydeep049 opened 5 months ago

joydeep049 commented 5 months ago

Changes in support of https://github.com/ThinkOpenly/sail-riscv/pull/24/

joydeep049 commented 4 months ago

(Waiting for @ThinkOpenly to approve workflows.)

joydeep049 commented 4 months ago

I think there should be no problem here. Here's an output when I use make on my branch.

jd@jd-virtual-machine:~/Desktop/New Folder/sail$ git checkout reserved-fields
Branch 'reserved-fields' set up to track remote branch 'reserved-fields' from 'origin'.
Switched to a new branch 'reserved-fields'
jd@jd-virtual-machine:~/Desktop/New Folder/sail$ make
dune build --release
(cd _build/default/src/lib && /home/jd/.opam/default/bin/ott -sort false -generate_aux_rules true -o ast.lem -picky_multiple_parses true ../../language/sail.ott)
Ott version 0.33   distribution of Mon 16 Jan 15:32:01 GMT 2023
(cd _build/default/src/lib && /home/jd/.opam/default/bin/ott -sort false -generate_aux_rules true -o jib.lem -picky_multiple_parses true ../../language/jib.ott)
Ott version 0.33   distribution of Mon 16 Jan 15:32:01 GMT 2023
jd@jd-virtual-machine:~/Desktop/New Folder/sail$ 

@ThinkOpenly

joydeep049 commented 3 months ago

CI is failing with the error message :

#=== ERROR while compiling sail_json_backend.0.17 =============================#
# context              2.2.0 | macos/x86_64 | ocaml-base-compiler.4.08.1 | pinned(git+file:///Users/runner/work/sail/sail#HEAD#3ce8299ccf1e955dde1e8cc1586c69163de2f553)
# path                 ~/.opam/4.08.1/.opam-switch/build/sail_json_backend.0.17
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p sail_json_backend -j 3 --promote-install-files=false @install
# exit-code            1
# env-file             ~/.opam/log/sail_json_backend-21990-5f8711.env
# output-file          ~/.opam/log/sail_json_backend-21990-5f8711.out
### output ###
# (cd _build/default && /Users/runner/.opam/4.08.1/bin/ocamlc.opt -w -40 -w -33 -w -27 -w -32 -w -26 -w -37 -g -bin-annot -I src/sail_json_backend/.sail_plugin_json.eobjs/byte -I /Users/runner/.opam/4.08.1/lib/bytes -I /Users/runner/.opam/4.08.1/lib/dune-private-libs/dune-section -I /Users/runner/.opam/4.08.1/lib/dune-site -I /Users/runner/.opam/4.08.1/lib/dune-site/private -I /Users/runner/.op[...]
# File "src/sail_json_backend/json.ml", line 97, characters 5-23:
# 97 |   if String.starts_with ~prefix:"\"" qs && String.ends_with ~suffix:"\"" qs then
#           ^^^^^^^^^^^^^^^^^^
# Error: Unbound value String.starts_with

Which is totally unrelated to the changes I made. There is no error when I am running it using make in local. How should we deal with this? @ThinkOpenly

ThinkOpenly commented 3 months ago

CI is failing with the error message :

#=== ERROR while compiling sail_json_backend.0.17 =============================#
# context              2.2.0 | macos/x86_64 | ocaml-base-compiler.4.08.1 | pinned(git+file:///Users/runner/work/sail/sail#HEAD#3ce8299ccf1e955dde1e8cc1586c69163de2f553)
# path                 ~/.opam/4.08.1/.opam-switch/build/sail_json_backend.0.17
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p sail_json_backend -j 3 --promote-install-files=false @install
# exit-code            1
# env-file             ~/.opam/log/sail_json_backend-21990-5f8711.env
# output-file          ~/.opam/log/sail_json_backend-21990-5f8711.out
### output ###
# (cd _build/default && /Users/runner/.opam/4.08.1/bin/ocamlc.opt -w -40 -w -33 -w -27 -w -32 -w -26 -w -37 -g -bin-annot -I src/sail_json_backend/.sail_plugin_json.eobjs/byte -I /Users/runner/.opam/4.08.1/lib/bytes -I /Users/runner/.opam/4.08.1/lib/dune-private-libs/dune-section -I /Users/runner/.opam/4.08.1/lib/dune-site -I /Users/runner/.opam/4.08.1/lib/dune-site/private -I /Users/runner/.op[...]
# File "src/sail_json_backend/json.ml", line 97, characters 5-23:
# 97 |   if String.starts_with ~prefix:"\"" qs && String.ends_with ~suffix:"\"" qs then
#           ^^^^^^^^^^^^^^^^^^
# Error: Unbound value String.starts_with

Which is totally unrelated to the changes I made. There is no error when I am running it using make in local. How should we deal with this? @ThinkOpenly

If I understand correctly, this is only failing in the macOS-12 build, and not macOS-latest, nor ubuntu-latest. Given how OS-agnostic this project is, I think we should drop macOS-12 from CI if it causes us any issues. The failure you are seeing appears to be some dependency is installed at a level where String.starts_with is not supported.

joydeep049 commented 3 months ago

CI is failing with the error message :

#=== ERROR while compiling sail_json_backend.0.17 =============================#
# context              2.2.0 | macos/x86_64 | ocaml-base-compiler.4.08.1 | pinned(git+file:///Users/runner/work/sail/sail#HEAD#3ce8299ccf1e955dde1e8cc1586c69163de2f553)
# path                 ~/.opam/4.08.1/.opam-switch/build/sail_json_backend.0.17
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p sail_json_backend -j 3 --promote-install-files=false @install
# exit-code            1
# env-file             ~/.opam/log/sail_json_backend-21990-5f8711.env
# output-file          ~/.opam/log/sail_json_backend-21990-5f8711.out
### output ###
# (cd _build/default && /Users/runner/.opam/4.08.1/bin/ocamlc.opt -w -40 -w -33 -w -27 -w -32 -w -26 -w -37 -g -bin-annot -I src/sail_json_backend/.sail_plugin_json.eobjs/byte -I /Users/runner/.opam/4.08.1/lib/bytes -I /Users/runner/.opam/4.08.1/lib/dune-private-libs/dune-section -I /Users/runner/.opam/4.08.1/lib/dune-site -I /Users/runner/.opam/4.08.1/lib/dune-site/private -I /Users/runner/.op[...]
# File "src/sail_json_backend/json.ml", line 97, characters 5-23:
# 97 |   if String.starts_with ~prefix:"\"" qs && String.ends_with ~suffix:"\"" qs then
#           ^^^^^^^^^^^^^^^^^^
# Error: Unbound value String.starts_with

Which is totally unrelated to the changes I made. There is no error when I am running it using make in local. How should we deal with this? @ThinkOpenly

If I understand correctly, this is only failing in the macOS-12 build, and not macOS-latest, nor ubuntu-latest. Given how OS-agnostic this project is, I think we should drop macOS-12 from CI if it causes us any issues. The failure you are seeing appears to be some dependency is installed at a level where String.starts_with is not supported.

Yes. Should I make the changes in the GH Action to drop that particular job?

joydeep049 commented 3 months ago

Also, If it is required in the future, we could replace String.starts_with with our own implementation closer to something like what I implemented here:

let is_reserved_field field_name =
   let reserved_prefix = "reserved_bits_" in
   String.length field_name >= String.length reserved_prefix
   && String.sub field_name 0 (String.length reserved_prefix) = reserved_prefix

This also checks if the reserved bits string starts with the substring reserved_bits_.

@ThinkOpenly

ThinkOpenly commented 3 months ago

CI is failing[...]:

If I understand correctly, this is only failing in the macOS-12 build, and not macOS-latest, nor ubuntu-latest. Given how OS-agnostic this project is, I think we should drop macOS-12 from CI if it causes us any issues. The failure you are seeing appears to be some dependency is installed at a level where String.starts_with is not supported.

Yes. Should I make the changes in the GH Action to drop that particular job?

That would be fine with me, yes.

joydeep049 commented 3 months ago

The macos-12 4.08.1 build has been removed from CI. Can we merge this now? Or should I add an empty commit and let the new CI run once more?? @ThinkOpenly