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

Stop before emit #8938

Merged
merged 6 commits into from Nov 4, 2019
Merged

Stop before emit #8938

merged 6 commits into from Nov 4, 2019

Conversation

gretay-js
Copy link
Contributor

This PR extends the existing command-line option "-stop-after " to accept the argument "scheduling" in addition to the existing "parsing" and "typing" which were added in #1945.

With "-stop-after scheduling", the native compiler will stop compilation after scheduling pass. It will produce .cmi and .cmx files as usual, and perform the optimizations in the backend, but won't emit
assembly or object files, and won't perform linking, packing, etc. The bytecode compiler will not accept "-stop-after scheduling".

It may be more accurate to call the option "-stop-before emit" rather than "-stop-after scheduling", but it doesn't fit with the existing option's naming convention.

Clflags.Compiler_pass.pass_names is extended to take a filter function as an argument, in preparation for another command-line option I'd like to propose shortly, in a separate PR.

@gretay-js
Copy link
Contributor Author

ping.

@Octachron
Copy link
Member

Looking at the test, I am not sure if it make sense to test the -S -stop-after scheduling case. The two options are contradictory, and it might be better to not rely on the behavior of ocamlopt in this situation.

Also, I am not sure what is the opinion on @shindere on the new asmext ocamltest's variable.

driver/main.ml Outdated Show resolved Hide resolved
@gretay-js
Copy link
Contributor Author

Looking at the test, I am not sure if it make sense to test the -S -stop-after scheduling case. The two options are contradictory, and it might be better to not rely on the behavior of ocamlopt in this situation.

This test was to check that with -stop-after scheduling, cmx is generated but assembly and object files aren't, that's why I added "-S" option.

Also, I am not sure what is the opinion on @shindere on the new asmext ocamltest's variable.

It already has objext.

@shindere
Copy link
Contributor

shindere commented Oct 7, 2019 via email

@gretay-js
Copy link
Contributor Author

@shindere can you please have a look at the new tests and the changes in ocamltest?

Copy link
Member

@Octachron Octachron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation in Asmgen seems ok.
I am not so fond of the Clflags interface: I would rather complexify the API in the PR that makes use of this complexity.

utils/clflags.ml Outdated Show resolved Hide resolved
utils/clflags.ml Show resolved Hide resolved
utils/clflags.mli Outdated Show resolved Hide resolved
@shindere
Copy link
Contributor

shindere commented Oct 23, 2019 via email

@shindere
Copy link
Contributor

shindere commented Oct 23, 2019 via email

driver/optmain.ml Outdated Show resolved Hide resolved
utils/clflags.ml Outdated Show resolved Hide resolved
@shindere
Copy link
Contributor

shindere commented Oct 25, 2019 via email

@gretay-js
Copy link
Contributor Author

I removed the filter function from this PR. Thank you for clarifying this point!

@gretay-js
Copy link
Contributor Author

One thing you may want to do in the test scripts is to provide a reason for test failure. You can do that like this: bash echo "afl-showmap not available" > ${ocamltest_response}

cool, I didn't know we could do that, thanks! I updated the test.

@shindere
Copy link
Contributor

shindere commented Oct 29, 2019 via email

@gretay-js
Copy link
Contributor Author

Rebased, cleaned history, and add Changes entry.

@shindere
Copy link
Contributor

shindere commented Oct 29, 2019 via email

driver/main.ml Outdated
match !stop_after with
| None ->
fatal "Please specify at most one of -pack, -a, -c, -output-obj";
| Some (P.Parsing | P.Typing) ->
| Some _ ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nitpick, it is better to keep an exhaustive list of Clflags.Compiler_flags to remind the reader of all possible interactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This check was also missing from optmain.
I added an assertion because "stop_after p" where p.is_compilation_pass=true implies compile_only=true, but if we ever have p such that p.is_compilation_pass=false, then the length calculation above would need to be updated. Please let me know if it's okay, and I'll need to clean the history again.

@Octachron
Copy link
Member

Octachron commented Oct 30, 2019

(The new test is failing on Windows/Appveyor)

@gretay-js
Copy link
Contributor Author

sorry I haven't noticed earlier. Checking.

@gretay-js
Copy link
Contributor Author

gretay-js commented Oct 30, 2019

The test fails on windows, because the path to the build artifacts is incorrectly formed with a mix of '/' and '\' instead of '\' only.
... testing 'stop_after_scheduling.ml' with 1.1.1.1.1 (script) => failed (not found expected C:\projects\🐫реализация-mingw32\testsuite\_ocamltest\tests/tool-ocamlopt-stop-after\stop_after_scheduling\ocamlopt.byte/stop_after_scheduling.cmx)

Wrong separators come not only from my script - some of them are generated by ocamltest internally for the variable test_build_directory. I can't figure out how to fix it. Also, strangely, there are other tests that use a similar pattern to form filenames and they pass on windows. By the way, it looks like test_source_directory is formed correctly, but not test_build_directory.

Is okay to just disable this test windows (unless @dra27 @shindere have a fix)?

gretay-js added a commit to gretay-js/ocaml that referenced this pull request Nov 21, 2019
Octachron pushed a commit that referenced this pull request Nov 26, 2019
* Check print_types in should_stop after Typing
* Compare rank instead of equals makes should_stop_after monotonic in its pass argument
stedolan added a commit to janestreet/ocaml that referenced this pull request Mar 17, 2020
gretay-js added a commit to gretay-js/ocaml that referenced this pull request Jun 4, 2020
gretay-js pushed a commit to gretay-js/ocaml that referenced this pull request Jun 4, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)
gretay-js pushed a commit to gretay-js/ocaml that referenced this pull request Jun 4, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file
gretay-js pushed a commit to gretay-js/ocaml that referenced this pull request Jun 4, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 16, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 20, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 20, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 21, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 21, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 30, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 30, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 3, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 4, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 5, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 7, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 10, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 10, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 17, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 18, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 19, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 20, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 28, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 2, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 2, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 2, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 7, 2020
ocaml#8938 from upstream trunk (cherry-pick 4353c75)

ocaml#9090 from upstream trunk (cherry-pick fe7c8ed)

ocaml#9097 from upstream trunk (cherry-pick 6daaf62)

ocaml#8939 from gretay-js/save-linear (cherry-pick 1200de9)

ocaml#9003 from gretay-js/start-from-emit (cherry-pick 21d5d26)

Add linear_format to dune file

Update .depend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants