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

Cannot pass jvm parameters to dotr #3509

Closed
nicolasstucki opened this Issue Nov 20, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@nicolasstucki
Contributor

nicolasstucki commented Nov 20, 2017

When calling dotr (without launching the repl) we cannot pass JVM arguments such as -Xmx512. We should probably support the -JXmx512 notation the dotc supports. All flags starting with -J should be passed to the JVM without the J.

@jiminhsieh

This comment has been minimized.

Show comment
Hide comment
@jiminhsieh

jiminhsieh Nov 28, 2017

Contributor

I can give it a shot. :)
If I understand correctly, it would be like how dotc handle -JXmx512. Thanks!

Contributor

jiminhsieh commented Nov 28, 2017

I can give it a shot. :)
If I understand correctly, it would be like how dotc handle -JXmx512. Thanks!

@nicolasstucki

This comment has been minimized.

Show comment
Hide comment
@nicolasstucki

nicolasstucki Nov 28, 2017

Contributor

Similarly. When we run dotr -JXmx512 Foo we should end up executing java -Xms512 -classpath <dotty runtime ...> Foo .

Or maybe it is enough to run dotr -Xmx512 Foo? That might be the case.

Contributor

nicolasstucki commented Nov 28, 2017

Similarly. When we run dotr -JXmx512 Foo we should end up executing java -Xms512 -classpath <dotty runtime ...> Foo .

Or maybe it is enough to run dotr -Xmx512 Foo? That might be the case.

@nicolasstucki

This comment has been minimized.

Show comment
Hide comment
@nicolasstucki

nicolasstucki Nov 28, 2017

Contributor

Maybe wait a day before starting, I will write down the exact way to handle arguments in dotr.

Contributor

nicolasstucki commented Nov 28, 2017

Maybe wait a day before starting, I will write down the exact way to handle arguments in dotr.

@nicolasstucki

This comment has been minimized.

Show comment
Hide comment
@nicolasstucki

nicolasstucki Nov 28, 2017

Contributor
dotr [-repl|-run] <jvmopt>* [<Main> <main-args>*]

<jvmopt> = -classpath <some-classpath>
         | -J<jvm-option>

Run the REPL if -repl is set or if -run is not set and [<Main> <main-args>*] not is present.
Run the app if -run is set or [<Main> <main-args>*] is present.

Running should call java <jvmopt-transformed>* <Main> <main-args>* where jvmopt-transformed removes the J from -J<jvm-option> and merges the classpaths toghether.
-classpath and the dotty library classpath (currently in the script) in that order.

If several -classpath are found in <jvmopt>* then keep the last one. Maybe emit a warning.

For the REPL keep -classpath as is.

@allanrenucci WDYT?

Contributor

nicolasstucki commented Nov 28, 2017

dotr [-repl|-run] <jvmopt>* [<Main> <main-args>*]

<jvmopt> = -classpath <some-classpath>
         | -J<jvm-option>

Run the REPL if -repl is set or if -run is not set and [<Main> <main-args>*] not is present.
Run the app if -run is set or [<Main> <main-args>*] is present.

Running should call java <jvmopt-transformed>* <Main> <main-args>* where jvmopt-transformed removes the J from -J<jvm-option> and merges the classpaths toghether.
-classpath and the dotty library classpath (currently in the script) in that order.

If several -classpath are found in <jvmopt>* then keep the last one. Maybe emit a warning.

For the REPL keep -classpath as is.

@allanrenucci WDYT?

@nicolasstucki

This comment has been minimized.

Show comment
Hide comment
@nicolasstucki

nicolasstucki Nov 28, 2017

Contributor

@jiminhsieh if you are still interested, now you can have a stab at it.

Contributor

nicolasstucki commented Nov 28, 2017

@jiminhsieh if you are still interested, now you can have a stab at it.

@jiminhsieh

This comment has been minimized.

Show comment
Hide comment
@jiminhsieh

jiminhsieh Nov 29, 2017

Contributor

@nicolasstucki If I don't misunderstand, this ticket should change scripts of dotr or dotc. If I'm correct, I have some questions about scripts of dotr and dotc. Should I discuss in gitter or in this ticket? Thanks! :)

Contributor

jiminhsieh commented Nov 29, 2017

@nicolasstucki If I don't misunderstand, this ticket should change scripts of dotr or dotc. If I'm correct, I have some questions about scripts of dotr and dotc. Should I discuss in gitter or in this ticket? Thanks! :)

@nicolasstucki

This comment has been minimized.

Show comment
Hide comment
@nicolasstucki

nicolasstucki Nov 30, 2017

Contributor

This should only change the dotr script. The reason for this special handling of is that when we run a dotty program we do not enter through one of our Mains which handle the args. We instead boot the JVM directly, hence we have to adapt the args that are passed to java .... I belive it would be better to keep discussions on this issue in this GitHub issue to allow others to give their opinion.

Contributor

nicolasstucki commented Nov 30, 2017

This should only change the dotr script. The reason for this special handling of is that when we run a dotty program we do not enter through one of our Mains which handle the args. We instead boot the JVM directly, hence we have to adapt the args that are passed to java .... I belive it would be better to keep discussions on this issue in this GitHub issue to allow others to give their opinion.

@jiminhsieh

This comment has been minimized.

Show comment
Hide comment
@jiminhsieh

jiminhsieh Dec 1, 2017

Contributor

Basically, we introduce a new command line option -run for dotr. It seems -run is used to execute the app, Main directly.

dotr [-repl|-run] <jvmopt>* [<Main> <main-args>*]

<jvmopt> = -classpath <some-classpath> | -J<jvm-option>

This means dotr has to pass JVM option/flag to

  • java... which is used for -run
  • dotc which is used for -repl.

However, I did try to pass JVM option/flag (dotc -J-Xmx1024m) to dotc, but it gave me bad option '-J-Xmx1024m' was ignored. This is because of scala_args in dotc saved those values. This issue isn't exactly about this ticket and didn't cause any issue, but I think it would be better to let you know.

If several -classpath are found in <jvmopt>* then keep the last one. Maybe emit a warning.

Which cases you meant:

  1. -classpath <my/class/path/one> -classpath <my/class/path/two>

  2. -classpath <my/class/path/one> <my/class/path/two>

In the first situation, dotr did keep the last one, but it will not emit a warning. In the second situation, other classpaths will fall into residual_args then cause JVM executes fail.

BTW, I have one question about dotc. In dotc, -run and -repl have no difference because of they do boot dotty.tools.repl.Main.

Thanks! :)

Contributor

jiminhsieh commented Dec 1, 2017

Basically, we introduce a new command line option -run for dotr. It seems -run is used to execute the app, Main directly.

dotr [-repl|-run] <jvmopt>* [<Main> <main-args>*]

<jvmopt> = -classpath <some-classpath> | -J<jvm-option>

This means dotr has to pass JVM option/flag to

  • java... which is used for -run
  • dotc which is used for -repl.

However, I did try to pass JVM option/flag (dotc -J-Xmx1024m) to dotc, but it gave me bad option '-J-Xmx1024m' was ignored. This is because of scala_args in dotc saved those values. This issue isn't exactly about this ticket and didn't cause any issue, but I think it would be better to let you know.

If several -classpath are found in <jvmopt>* then keep the last one. Maybe emit a warning.

Which cases you meant:

  1. -classpath <my/class/path/one> -classpath <my/class/path/two>

  2. -classpath <my/class/path/one> <my/class/path/two>

In the first situation, dotr did keep the last one, but it will not emit a warning. In the second situation, other classpaths will fall into residual_args then cause JVM executes fail.

BTW, I have one question about dotc. In dotc, -run and -repl have no difference because of they do boot dotty.tools.repl.Main.

Thanks! :)

jiminhsieh added a commit to jiminhsieh/dotty that referenced this issue Jan 15, 2018

OlivierBlanvillain added a commit that referenced this issue Jan 19, 2018

Merge pull request #3660 from jiminhsieh/wip/#3509
Pass JVM options to app. (#3509)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment