JRuby

Create and consolidate extension and non-standard options

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: JRuby 0.9.9, JRuby 1.0.0RC1, JRuby 1.0.0RC2
  • Fix Version/s: JRuby 1.1RC3
  • Component/s: Extensions
  • Labels:
    None
  • Number of attachments :
    1

Description

We should create a single -X or -XX: extension command-line argument, and map all JRuby system properties into it. This will make it easier to provide well-documented command-line arguments that access the various hooks without having to launch with JAVA_OPTS etc. set.

Current candidates:

  • -C
  • -O/jruby.objectspace.enabled
  • jruby.jit.enabled
  • jruby.jit.threshold
  • jruby.jit.logging
  • jruby.jit.safe
  • jruby.thread.pooling
  • jruby.reflection
  • jruby.dump_invocations
  • jruby.script
  • jruby.shell
  • jruby.home
  • jruby.lib
  • jruby.base (what is this used for, and can it be removed?)
  • jruby.env.method
  • --command (should also consolidate this with -S)

Activity

Hide
Charles Oliver Nutter added a comment -

I want this in JRuby 1.0, along with a working -J that can pass flags directly to the underlying JVM. Marking as a 1.0 blocker.

Show
Charles Oliver Nutter added a comment - I want this in JRuby 1.0, along with a working -J that can pass flags directly to the underlying JVM. Marking as a 1.0 blocker.
Hide
Charles Oliver Nutter added a comment -

Here are the actual changes needed for this:

-C : this switch has been partially added to all JRuby runs, so that now if a script can compile before executing, it will do so. The only purpose of the -C flag now is to *force compilation of the target script or fail with an error. Is this still useful?
*-O/jruby.objectspace.enabled : I think -O is a good one to leave as-is. It doesn't interfere with Ruby's switches and it's still a useful flag
*jruby.jit.enabled : the jit is now enabled by default, so we need a switch to turn it off and we need to move the setting to the run profile stuff so it can be disabled on a per-runtime basis.
*jruby.jit.threshold : I think we need some flag to JRuby that allows setting this and a few others, but no special switch for any of these. This should be a -X or -XX-type setting.
*jruby.jit.logging : ditto
*jruby.jit.logging.verbose : ditto
*jruby.thread.pooling : ditto
*jruby.reflection : ditto...and we need to fix reflection to work with JITed code. I believe reflection is totally broken with JIT enabled right now.
*jruby.dump_invocations : probably shouldn't even be exposed except through JAVA_OPTS
*jruby.script : already handled automatically?
*jruby.shell : ditto?
*jruby.home : ditto?
*jruby.lib : ditto?
*jruby.base : ditto?
*jruby.env.method : This should probably not be exposed, since we make the determination based on what JVM we're running. It also doesn't really need to be per-runtime, since it's based on the JVM version.
*--command/-S : consolidate; the new logic for -S will be that it runs scripts contained on the system path or in an appropriate place in classloader resources, including a few specialized tasks. Very much a task for Nick to look at.
*-J<jvm option> : We need a -J flag that allows passing arbitrary settings to the underlying VM. This eliminates the need for a number of other settings we currently have like SERVER, HPROF, DEBUG, and so on. It may also work well for settings above that can/could have a global component.

Show
Charles Oliver Nutter added a comment - Here are the actual changes needed for this: -C : this switch has been partially added to all JRuby runs, so that now if a script can compile before executing, it will do so. The only purpose of the -C flag now is to *force compilation of the target script or fail with an error. Is this still useful? *-O/jruby.objectspace.enabled : I think -O is a good one to leave as-is. It doesn't interfere with Ruby's switches and it's still a useful flag *jruby.jit.enabled : the jit is now enabled by default, so we need a switch to turn it off and we need to move the setting to the run profile stuff so it can be disabled on a per-runtime basis. *jruby.jit.threshold : I think we need some flag to JRuby that allows setting this and a few others, but no special switch for any of these. This should be a -X or -XX-type setting. *jruby.jit.logging : ditto *jruby.jit.logging.verbose : ditto *jruby.thread.pooling : ditto *jruby.reflection : ditto...and we need to fix reflection to work with JITed code. I believe reflection is totally broken with JIT enabled right now. *jruby.dump_invocations : probably shouldn't even be exposed except through JAVA_OPTS *jruby.script : already handled automatically? *jruby.shell : ditto? *jruby.home : ditto? *jruby.lib : ditto? *jruby.base : ditto? *jruby.env.method : This should probably not be exposed, since we make the determination based on what JVM we're running. It also doesn't really need to be per-runtime, since it's based on the JVM version. *--command/-S : consolidate; the new logic for -S will be that it runs scripts contained on the system path or in an appropriate place in classloader resources, including a few specialized tasks. Very much a task for Nick to look at. *-J<jvm option> : We need a -J flag that allows passing arbitrary settings to the underlying VM. This eliminates the need for a number of other settings we currently have like SERVER, HPROF, DEBUG, and so on. It may also work well for settings above that can/could have a global component.
Hide
Jonathan Paisley added a comment -

An attempt at handling -J option correctly using bash's arrays. The JAVA_DEBUG, JPROFILER etc is still in there.

No idea about windows bat yet!

Show
Jonathan Paisley added a comment - An attempt at handling -J option correctly using bash's arrays. The JAVA_DEBUG, JPROFILER etc is still in there. No idea about windows bat yet!
Hide
Charles Oliver Nutter added a comment -

This looks pretty good...I think I may just go ahead and commit it to get -J working for the sh scripts. We need to get the equivalent for bat scripts, but I haven't been able to make this break yet.

Show
Charles Oliver Nutter added a comment - This looks pretty good...I think I may just go ahead and commit it to get -J working for the sh scripts. We need to get the equivalent for bat scripts, but I haven't been able to make this break yet.
Hide
Charles Oliver Nutter added a comment -

I committed it in 3669, and removed the other all-caps versions of JVM options like SERVER. We need to get a .bat version of these changes too for 1.0, however.

Show
Charles Oliver Nutter added a comment - I committed it in 3669, and removed the other all-caps versions of JVM options like SERVER. We need to get a .bat version of these changes too for 1.0, however.
Hide
Charles Oliver Nutter added a comment -

Not going to be completed for RC2, but I think we can still get it in for 1.0 final.

Show
Charles Oliver Nutter added a comment - Not going to be completed for RC2, but I think we can still get it in for 1.0 final.
Hide
Charles Oliver Nutter added a comment -

-J has also been implemented for the .bat files, thanks to Nick. I'm going to look at the other options and see if any can be added as CLI options...but -J does a lot to make it easier to set them.

Show
Charles Oliver Nutter added a comment - -J has also been implemented for the .bat files, thanks to Nick. I'm going to look at the other options and see if any can be added as CLI options...but -J does a lot to make it easier to set them.
Hide
Nick Sieger added a comment -

I still think we should either have short names for them and/or document them in jruby -h (or maybe something like java -X does).

Show
Nick Sieger added a comment - I still think we should either have short names for them and/or document them in jruby -h (or maybe something like java -X does).
Hide
Charles Oliver Nutter added a comment -

With -J working now for both unix and windows, I'm downgrading this to minor. Since there's a perfectly acceptable way to set all properties now, this is only a "nice to have" in 1.0, and it won't block release.

Show
Charles Oliver Nutter added a comment - With -J working now for both unix and windows, I'm downgrading this to minor. Since there's a perfectly acceptable way to set all properties now, this is only a "nice to have" in 1.0, and it won't block release.
Hide
Charles Oliver Nutter added a comment -

It's possible, if not super easy, to configure everything right now with -J...and since this requires a nontrivial effort for what's a pure enhancement, it will be post 1.0.

Show
Charles Oliver Nutter added a comment - It's possible, if not super easy, to configure everything right now with -J...and since this requires a nontrivial effort for what's a pure enhancement, it will be post 1.0.
Hide
Charles Oliver Nutter added a comment -

I think we need to settle on the final set of flags to call JRuby and pass VM options and JRuby impl options for 1.1. I'd also especially like a flag that can turn off the compiler without needing to use -J-Djruby.jit.enabled=false.

Show
Charles Oliver Nutter added a comment - I think we need to settle on the final set of flags to call JRuby and pass VM options and JRuby impl options for 1.1. I'd also especially like a flag that can turn off the compiler without needing to use -J-Djruby.jit.enabled=false.
Hide
Charles Oliver Nutter added a comment -

We now have a +O flag to turn on ObjectSpace...I think perhaps what we could do for the compiler would be to have the following two flags:

  • The -C flag would disable all compilation
  • The +C flag would try to force compilation of scripts as they're loaded

The default situation would be somewhere between the two, where the main script executed would try to compile, and future scripts would not try to precompile, though the methods they contain would eventually JIT.

Show
Charles Oliver Nutter added a comment - We now have a +O flag to turn on ObjectSpace...I think perhaps what we could do for the compiler would be to have the following two flags:
  • The -C flag would disable all compilation
  • The +C flag would try to force compilation of scripts as they're loaded
The default situation would be somewhere between the two, where the main script executed would try to compile, and future scripts would not try to precompile, though the methods they contain would eventually JIT.
Hide
Charles Oliver Nutter added a comment -

Another update:

We have added +C for "force compilation" and -C for "disable compilation". The default lives somewhere in the middle, with the target script being compiled if possible and remaining code only compiled on a JIT basis.

I added a --properties flag that displays all Java properties you can use to configure JRuby.

I still think it would be nice to tidy these up and maybe implement a single -X flag to JRuby that allows specifying short, friendly names for all those properties.

Show
Charles Oliver Nutter added a comment - Another update: We have added +C for "force compilation" and -C for "disable compilation". The default lives somewhere in the middle, with the target script being compiled if possible and remaining code only compiled on a JIT basis. I added a --properties flag that displays all Java properties you can use to configure JRuby. I still think it would be nice to tidy these up and maybe implement a single -X flag to JRuby that allows specifying short, friendly names for all those properties.
Hide
Charles Oliver Nutter added a comment -

Punting issues from 1.1 RC2 to 1.1 final.

Show
Charles Oliver Nutter added a comment - Punting issues from 1.1 RC2 to 1.1 final.
Hide
Charles Oliver Nutter added a comment -

Some of this has been done. There is now a --properties flag to list all known properties, and the +C, -C, +O, -O and a few other nonstandard flags have been moved into -X, as in -X+C. There's a bit more work left to clean these up for 1.1 final, but it's close.

Show
Charles Oliver Nutter added a comment - Some of this has been done. There is now a --properties flag to list all known properties, and the +C, -C, +O, -O and a few other nonstandard flags have been moved into -X, as in -X+C. There's a bit more work left to clean these up for 1.1 final, but it's close.
Hide
Charles Oliver Nutter added a comment -

I'm going to mark this resolved because it's pretty clean now. We can move more properties from props to flags in the future as we deem it necessary.

Show
Charles Oliver Nutter added a comment - I'm going to mark this resolved because it's pretty clean now. We can move more properties from props to flags in the future as we deem it necessary.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: