|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
"Compiler #2" as it has been affectionately called is a compiler to turn normal Ruby classes into Java classes, so they can be constructed and called by normal Java code. When I asked for 1.3 priorities, this came out way at the top. Tom thought
... [More]
perhaps I asked for trouble putting it on the list, and he's probably right (like asking "prioritize these: sandwich, pencil, shiny gold ring with 5kt diamond, banana"), but I know this has been a pain point for people.I have just landed an early prototype of the compiler on trunk. I made a few decisions about it today:It will use my bytecode DSL "BiteScript", just like Duby doesIt will use the *runtime* definition of a class to generate the Java versionThe second point is an important one. Instead of having an offline compiler that inspects a file and generates code from it, the compiler will actually used the runtime class to create a Java version. This means you'll be able to use all the usual metaprogramming facilities, and at whatever point the compiler picks up your class it will see all those methods.Here's an example:# myruby.rbrequire 'rbconfig'class MyRubyClass def helloWorld puts "Hello from Ruby" end if Config::CONFIG['host_os'] =~ /mswin32/ def goodbyeWorld(a) puts a end else def nevermore(*a) puts a end endendHere we have a class that defines two methods. The first, always defined, is helloWorld. The second is conditionally either goodbyeWorld or nevermore, based on whether we're on Windows. Yes, it's a contrived example...bear with me.The compiler2 prototype can be invoked as follows (assuming bitescript is checked out into ../bitescript):jruby -I ../bitescript/lib/ tool/compiler2.rb MyObject MyRubyClass myrubyA breakdown of these arguments is as follows:-I ../bitescript/lib includes bitescripttool/compiler2.rb is the compiler itselfMyObject is the name we'd like the Java class to haveMyRubyClass is the name of the Ruby class we want it to frontmyruby is the library we want it to require to load that classRunning this on OS X and dumping the resulting Java class gives us:Compiled from "MyObject.java.rb"public class MyObject extends org.jruby.RubyObject{ static {}; public MyObject(); public org.jruby.runtime.builtin.IRubyObject helloWorld(); public org.jruby.runtime.builtin.IRubyObject nevermore(org.jruby.runtime.builtin.IRubyObject[]);}The first thing to notice is that the compiler has generated a method for nevermore, since I'm not on Windows. I believe this will be unique among dynamic languages on the JVM: we will make the *runtime* set of methods available through the Java type, not just the static set present at compile time.Because there are no type signatures specified for MyRubyClass, all types have defaulted to IRubyObject. Type signature logic will come along shortly. And notice also this extends RubyObject; a limitation of the current setup is that you won't be able to use compiler2 to create subclasses. That will come later.Once you've run this, you've got a MyObject that can be instantiated and used directly. Behind the scenes, it uses a global JRuby instance, so JRuby's still there and you still need it in classpath, but you won't have to instantiate a runtime, pass it around, and so on. It should make integrating JRuby into Java frameworks that want a real class much easier.So, thoughts? Questions? Have a look at the code under tool/compiler2.rb in JRuby's repository. The entire compiler is so far only 78 lines of Ruby code. [Less]
|
|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
With JRuby 1.2 almost out the door, I want to talk a bit about where we should go with JRuby 1.3. There's always more work to do, but in this case there's a few different directions we could probably go.Some obvious items will continue to see
... [More]
work:1.9 libraries, interp, compiler, parser1.8.6 bugs"Pure ruby" application support, like Rails deployment stuff (Warbler, AR-JDBC)But there's other areas that we may want to prioritize:1.8.7 supportRuby execution performance (how fast do you want it?)Specific library performance (YAML, IO, Java)More Java integration improvement/refactoring (esp. subclassing)"Compiler #2" to produce normal Java classes from RubyImprovements to AOT compilation (all-at-once, eliminate runtime codegen)Expand support for embedded/mobile platformsAnd there's a number of internal chores to work on too:Start generating most of the call path, to reduce duplicate codeSpecific-arity optimizations for block yield (could be big)Compiler cleanup and refactoringModularization of core classes that aren't valid on applet, Android, secured envs, etc; also may allow shipping smaller runtimesMore startup perf work; I have a few ideasAs always, there's way more tasks than the few of us committing to JRuby can work on, so I think we need to hear from users what's important. Any of these? Other items? [Less]
|
|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
A number of folks have asked us over the years whether JRuby could run on a Java ME-enabled device. I've always said I believed it would be possible with enough trimming. Strip out all the libraries that ME doesn't support, and you should be left
... [More]
with a runnable "core" of JRuby. Roy Ben Hayun, formerly of Symbian and (I believe) now working at Sun, actually proved it possible but difficult back in 2006 with his JRubyME project, a stripped down JRuby 0.9.8. But that didn't have compiler support, and we were still dog slow in 2006. Has JRuby, with two years of work behind it, grown too complex to run on an embedded device? Is the Rhodes project right when they say JRuby is too large for this to work?Tony Arcieri, of Revactor fame, put a bug in my ear about Java ME again this week. He's interested in running Ruby on a device hosting the Connected Device Configuration (CDC) level of Java ME. Specifically, the device in question supports CDC plus the APIs included in the Personal Basis Profile (PBP). CDC is probably about the smallest ME profile JRuby could reasonably run in, since anything lower (like CLDC, the Connected Limited Device Configuration) and you're reduced to the most basic collections, IO, and utility APIs.So, I'm happy to announce that the JRuby CDC Project has spawned out of the JRuby codebase.Here's what it looks like running, using Sun's reference implementation of CDC PBP:~/cdc/Optimized_nosym$ bin/cvm -classpath ../jruby.jar org.jruby.Main -X-C -e "[1,2,3].each {|i| puts i}"123The "cvm" is Sun's reference implementation of an embedded JVM, and this particular package includes the PBP level APIs as well. The jruby.jar here is the one I've stripped in the jruby-cdc project, but with the additional step of retroweaving it back to Java 1.3-compatible bytecode.My intention with this is to get it running with a base set of Ruby classes but with Java integration still functional. That will allow most basic Ruby scripts to work while providing access to the rest of the Java APIs for bits I had to rip out (like IO APIs)It's only running interpreted right now, just like the Android version of JRuby, but as in that case I expect most people will want to precompile Ruby code and ship it all as one unit.Why bother? Well, there are still a lot of Java ME devices out there. And while the device you carry in your pocket may be growing beyond Java ME, the set-top box or Blu-Ray player in your living room is just starting to reach that level. The technology is still sound, if perhaps less obvious than an iPhone or Android. And hey, we want "Ruby everywhere," don't we?Where do we go from here? I think this and Ruboto are proof that damn near anything is possible with JRuby. It really only took me a couple days of trimming to get this far. Fully supporting Android in Ruboto will not take long, and other "mini ruby" profiles are possible for other platforms and use cases as well. It just takes a little imagination, and maybe a few late-night hacking sessions.Now...for my next trick... [Less]
|
|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
Ok, so I intentionally made my last post a bit of a "tease". You can't fault me for trying to drum up a little buzz, yeah? And hey, I spent almost as long fiddling with that logo as I did hacking JRuby to run on Android. Here it is again, just for
... [More]
good measure:On Monday night, the local Ruby group (Ruby Users of Minnesota, or RUM...great buncha guys) hosted three talks: one on Android development, one on iPhone development, and one on migrating from Struts to JRuby a bit at a time. The Android talk kinda hooked me, even though I was working on last-minute JRuby 1.2RC1 issues and not really paying much attention (sorry, Justin).I'd considered getting JRuby working on Android before, since it's compatible with most Java 1.5 language features, has a much more extensive library than any of the Java ME profiles (which hopefully will be remedied in future ME profiles), and represented the best chance for "mobile JRuby" to date. I had tweeted about it, scammed for a free G1 phone, and briefly browsed the online docs. I had even downloaded it back in early January...but I'd never bothered to try.So late Monday night, I tried. And about an hour later it was running.What I DidThere's really two sides to the Android SDK. There's the drag-and-drop fluffy-stuffy GUI in the form of a plugin for Eclipse. That was my first stop; I got it installed, created a sample project, and ran it in the emulator. It worked as expected, and I'll admit it made me want an Android phone a bit more. I'll be the first to admit I've been skeptical of Android, but at this point it's hard to argue with a totally open platform, especially since it has a shipping device now. So yeah, SDK plus sample app was easy and appetite-whetting.Then I tried to pull in JRuby's main jar file. Nothing seemed to work right. I got errors about not having defined an "application" in some XML file, even though it was there. There was no obvious information on how to add third-party libraries to my app, and I certainly may have done it the wrong way. And of course my lack of knowledge about the structure of an Android app probably didn't help. But ultimately, since I didn't really need a full-on application, I started to dig around in the SDK for "another way".Not one for reading documentation, I immediately started running the executables under "tools" with --help and guessing at combinations of arguments. Immediately I saw "emulator" and started that. Yay, an emulator! Then I saw dx, which looked intriguing. A-ha! It's the tool for converting an existing class or jar into Dalvik bytecode. A bit more fidding with flags, and I finally found the right incantation:dx -JXmx1024M --dex --output=ruboto.jar jruby.jarFor the newbs: that's -JXmx1024M to allow dx to use up to a gig of memory, --dex to convert to Dalvik bytecode, and --output to specify an output file.So, suddenly I had what I assumed was a Dalvik-ready ruboto.jar file. A quick jar -t confirmed that everything appeared to be there, along with a "classes.dex" file....builtin/yaml.rbbuiltin/yaml/store.rbbuiltin/yaml/syck.rbclasses.dexcom/sun/jna/darwin/libjnidispatch.jnilibcom/sun/jna/freebsd-amd64/libjnidispatch.socom/sun/jna/freebsd-i386/libjnidispatch.so...There were also a bunch of warnings about "Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute." but warnings don't stop a true adventurer. I pressed on!So, the next step was getting it into the emulator, eh? Hmm. Well there's no "upload" option in the emulator's OS X menu, and nothing obvious in the Android UI. There must be a tool. Like maybe a debugging tool of some kind... like a "jdb" but for Android. Hmm.....this "adb" executable looks promising...$ ~/android-sdk-mac_x86-1.0_r2/tools/adb --helpAndroid Debug Bridge version 1.0.20...Ahh, bingo. And one of the adb subcommands was "push" for pushing files to the device. A few minutes and experiments later, I figured out incantation #2:$ ~/android-sdk-mac_x86-1.0_r2/tools/adb push ruboto.jar ruboto.jarfailed to copy 'ruboto.jar' to 'ruboto.jar': Read-only file systemOr at least, I almost had it. Obviously the device was being closed-minded about the whole thing. So back to adb to run another subcommand and have a look around:$ ~/android-sdk-mac_x86-1.0_r2/tools/adb shell# lssqlite_stmt_journalscachesdcardetcsystemsyssbinprocinit.rcinit.goldfish.rcinitdefault.propdatarootdevHmm. "data". That looks promising. I mean, a "data" directory couldn't possibly be read-only, right? So let's give that a try.$ ~/android-sdk-mac_x86-1.0_r2/tools/adb push ruboto.jar data/ruboto.jar1702 KB/s (3249363 bytes in 1.863s)BING! We have liftoff!Ok, so we've "dexed" the jar, uploaded it to the emulator, and now we want to run it. Back into the shell we go!There's obviously an sbin above, but it's pretty slim:# ls sbinadbdAnother debugging thingy I suppose. Maybe I'll have a look at that later. What about under "system"? I've gotten used to the bulk of my system living under something called "system" from running OS X. And as in that case, "system" was much more populous, with a bin directory containing all sorts of goodies. However one of them jumped out at me immediately:# ls system/binamapp_processcatchmodcmpdalvikvmdatedbus-daemondd...Oh, goodie, "dalvikvm". Could it possibly be the equivalent of the "java" command on a desktop? Could it really be that easy?# dalvikvm -helpdalvikvm: [options] class [argument ...]dalvikvm: [options] -jar file.jar [argument ...]The following standard options are recognized:-classpath classpath...It could! My hands began to tremble. My heart began to pound. Could I simply dodalvikvm -jar ruboto.jar -e "puts 'hello'"And expect it to work?# dalvikvm -jar data/ruboto.jar -e "puts 'hello'"-jar not yet handledDalvik VM unable to locate class 'data/ruboto/jar'java.lang.NoClassDefFoundError: data.ruboto.jar...Curses! Ignoring for the moment how strange it seemed to have a -jar flag that simply doesn't work, I tried specifying -classpath and org.jruby.Main.Aaaaaaaand...It blew up with my first official JRuby-on-Android exception!# dalvikvm -classpath ruboto.jar org.jruby.Main -e "puts 'hello'"HugeEnumSet.java:102:in `next': java.lang.ArrayIndexOutOfBoundsExceptionfrom HugeEnumSet.java:52:in `next'from Ruby.java:1237:in `initErrno'...Hmm. The code in question simply iterated over an EnumSet. After thinking through a few scenarios, I concluded this was not JRuby's fault. It seemed that I had discovered my first Android bug, the first time I tried to run anything on it. And that made me sad.But only for a moment! The code in question turned out to be unimportant for a normal application; it was simply iterating over a set of Errno enums we use to report errors. Commented it out, and I was on to my next issue:(I've lost the original error, but it was a VerifyError loading org.jruby.Ruby since it referenced BeanManager which referenced JMX classes. There is no JMX on Android.Ok, VerifyError because of missing JMX stuff...that's no problem, I can just disable it for now. So, one more attempt, and if it fails I'm going to start doing iPhone development I SWEAR.# dalvikvm -classpath data/ruboto.jar org.jruby.Main -e "puts 'hello'"Error, could not compile; pass -d or -J-Djruby.jit.logging.verbose=true for more detailshelloSUCCESS!More DetailsOk, so we all agree Android dodged a bullet there. But what's the real status of JRuby on Android?It turns out there were very few changes necessary. I fixed the EnumSet stuff by just iterating over an Errno[] (EnumSet was not actually needed). I fixed the JMX stuff by creating a BeanManagerFactory (yay GOF) that loaded the JMX version via reflection, falling back on a dummy if that failed. And I fixed some warnings Dalvik was spouting about default BufferedReader and BufferedInputStream constructors by hardcoding specific buffer sizes (I think Dalvik is wrong here, and I'm arguing my case on the android-platform ML). And that's really all there was to it. JRuby pretty much "just worked".Of course you see the "could not compile" error up there. What's up with that?JRuby normally runs mixed-mode, interpreting Ruby code for a while and eventually compiling it down to Java bytecode if it's used enough. But we do try to immediately compile the target script, since it doesn't cost much and gives you better cold-start performance for simple scripts. The error above was simply JRuby reporting that it could not compile my little -e script. Why couldn't it? Because the JRuby compiler is generating JVM bytecode, not Dalvik bytecode. Dalvik does not run JVM bytecode. Here's the actual error you get:# dalvikvm -classpath data/ruboto.jar org.jruby.Main -d -e "puts 'hello'"could not compile: -e because of: "can't load this type of class file"java.lang.UnsupportedOperationException: can't load this type of class fileat java.lang.VMClassLoader.defineClass(Native Method)at java.lang.ClassLoader.defineClass(ClassLoader.java:261)at org.jruby.util.JRubyClassLoader.defineClass(JRubyClassLoader.java:22) ...So that's caveat #1: this is currently only running in interpreted mode. To avoid the compiler warning, you can pass -X-C to JRuby to disable compilation entirely.Unfortunately, interpretation means JRuby is none too fast at the moment. That may not matter if you're scripting a "real" app, but we'll definitely find ways to improve performance soon. That may mean providing an all-at-once compilation tool for Ruby code (we have an ahead-of-time (AOT) compiler right now, but it's per-file, and still expects to generate some code at runtime), or it may mean a second compiler that generates Dalvik bytecode. Either way...it's coming.Caveat #2 is that a large number of libraries aren't working, especially any that depend on native code:# dalvikvm -classpath data/ruboto.jar org.jruby.Main -X-C -e "require 'readline'"-e:1:in `require': library `readline' could not be loaded: java.lang.VerifyError: org.jruby.ext.Readline (LoadError)from -e:1# dalvikvm -classpath data/ruboto.jar org.jruby.Main -X-C -e "require 'ffi'"-e:1:in `require': library `ffi' could not be loaded: java.lang.ExceptionInInitializerError (LoadError)from -e:1And so on. There's nothing to say these libraries can't be made to work, but they're not working yet. And thankfully, our most important library seems to work fine:# dalvikvm -classpath data/ruboto.jar org.jruby.Main -X-C -e "require 'java'; puts java.lang.System.get_property('java.vendor')"The Android ProjectAnd that leads me to caveat #3, better demonstrated than explained:# dalvikvm -classpath data/ruboto.jar org.jruby.Main -X-C -e "require 'java'; import 'android.content.Context'"Class.java:-2:in `getDeclaredMethods': java.lang.NoSuchMethodExceptionfrom ClassCache.java:137:in `getDeclaredMethods'from Class.java:666:in `getDeclaredMethods'from JavaClass.java:1738:in `getMethods' ...Bummer, dude. There seems to be some feature (i.e. a bug) preventing some Android core classes from reflecting properly, which means that for the moment you may not be able to access them in JRuby.Next StepsOverall, I think it was a great success. We obviously weren't doing anything in critical JRuby code that Android could not handle. Kudos to the Android team for that, and kudos to us for still supporting Java 1.5. But success in software only leads to more opportunities:All the changes necessary to run JRuby on Android have already been shipped in JRuby 1.2RC1. So you can grab those files and dex them yourself, or wait for me to add Android-related build targets.Android's default stack size is incredibly small, 8kb. So for all but the most trivial Ruby code you're going to want to bump it up with -Xss. See the final snippit at the bottom of this post for an example. And of course you all know about using -Xmx to increase the max heap; it applies to Android as well.I need to report the bugs I've found in Android's bug tracker and provide some steps to reproduce them. I'll probably get to this in the next couple days. Hopefully they can be fixed quickly, and hopefully patched Android doesn't take too long to filter out to users.Meanwhile, I'll probably start poking at an all-at-once compilation mode, since I think that's simpler initially than emitting Dalvik bytecode. It's already done in my head. You'll run a command to "fully compile" a target script or scripts, and it will create the .class file it does now along with all the method binding .class files it normally generates at runtime. I've been planning this feature for a while anyway. With the "completely compiled" Ruby code you should be able to just "dex" it and upload to the device.Given that most people will probably want to ship precompiled code, and given the fact that many libraries will never work, we need to modularize JRuby a bit more so we can rip out unsupported libraries, parser guts, interpreter guts, and compiler guts. That should shrink the total size of the binary substantially. And I have other ideas for shrinking it too.We in the JRuby community also need to start brainstorming how to use this newfound power. Assuming the above items are all completed soon, what will we want to do with JRuby on Android? Build apps entirely in Ruby? Script existing ones? What Ruby features would we be willing to drop in order to boost Android-based performance a bit more? Hopefully this discussion can start in the comments and continue on the JRuby mailing lists.The Bottom LineJRuby works on Android, that much is certain. The remaining issues will get worked out. And I dare say this is probably the best way to get Ruby on any embedded device yet; after dexing, it's literally just "upload and run". So there's a great opportunity here. I'm excited.And just one more example to show that not just JRuby itself, but also Ruby libraries that ship with it work (using the "complete" JRuby jar in this case):# dalvikvm -Xss128k -classpath data/ruboto.jar org.jruby.Main -X-C -e "require 'irb'; IRB.start"trap not supported or not allowed by this VMirb(main):001:0> puts "Hello, JRuby on Android!"Hello, JRuby on Android!=> nilirb(main):002:0> [Less]
|
|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
# cat test.rbrequire 'java'import java.lang.Systemclass Rubotodef greet(who) puts "Hello, #{who}!"endendname = System.get_property('java.runtime.name')Ruboto.new.greet(name)# dalvikvm -classpath ruboto.jar org.jruby.Main -X-C test.rbHello, Android
... [More]
Runtime!Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 2.5 Attribution License. [Less]
|
|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
We get a lot of bug reports on the JRuby project. No, it's not because JRuby's a buggy POS. It's because we're implementing the core of an entire platform. It's hard.Over the past year or so we kinda let the bug tracker go a little wild. We've never
... [More]
had more than two full-time people on the project, and community contributions wax and wane with the seasons, so we've had to choose our battles. For some amount of time, we would focus on performance, since without a reasonably-performing implementation, nobody would choose to use JRuby. Then we'd cycle back to fixing bugs, usually in the last couple weeks before a release. So the flow of bug fixes waxed and waned with our release cycles.The problem with this approach was that we really couldn't keep up with all the reports coming in and continue to work on the "unreported issues" of JRuby like performance. So something had to give, and it was sometimes the bugs.Roughly around September, we crossed an important threshold: 500 open bugs. They dated as far back as 2006 (we moved to Codehaus in 2006), and across the entire release sequence of JRuby; there were even some bug reports against pre-1.0 versions. From September until about mid-January, we worked to keep the number of open bugs below 500. Sometimes it would peek above, but we were generally successful.About mid-January, I figured it was time to really bite the bullet, and I started walking from the oldest bug forward. It has been a long slog, but I'm making great progress.So far, I've managed to whittle the total number of bugs down from 506 to 326, and that's with a couple dozen more filed in the past two weeks. The majority of these were either already fixed or invalid/incomplete bugs, but I've also made a concentrated effort to focus on and fix as many as possible. At the very least, I've made an attempt on every single one.During that process, I learned a bit about how my brain works. During the past year, if I didn't know immediately how to fix a bug I often walked away from it and worked on something fun like compiler optimization. But during this latest bug hunt, because I did not want to just punt all those bugs one more time, I did something a little different.Whenever I encountered a bug that seemed difficult or that I simply didn't want to fix, I would do one of two things:Take a break. Often this meant I had reached my limit and needed a breather. A little Wii, a glass of scotch, a movie...anything to take my mind of it for a bit.Count to ten. Sometimes, after reading through the bug, all I really needed was a moment for my brain to start "wondering" about the solution. Once the wheels started turning, I was almost compelled to dig deeper.As a result, many long-standing bugs--including bugs I thought we would never fix--are now resolved and ready for the 1.2 release. I'm going on three weeks now of 12-hour days trying to fix what seems like an endless stream of bugs, but the end is in sight. And I want to stress that this level of effort has never happened in a single release. There's as much work in JRuby 1.2 as in multiple 1.1.x releases combined. I'll be blogging more of these posts over the next couple weeks.For your amusement, here is the complete list of bugs we have resolved during the past nine weeks, since shortly after the 1.1.6 release. These aren't all fixes, but even the "already fixed", "won't fix", "not a bug", or "incomplete" ones were reviewed, tested, and considered. A couple of these I just applied patches or marked resolved based on someone else's work. And of course we're not done with JRuby 1.2 yet. Just you wait and see :)Bugs Resolved (Fixed, Won't Fix, Not A Bug, or Incomplete Information), Past Nine Weeks:(in the order they were resolved) JRUBY-2538 File#chmod always returns -1, fails rubyspec JRUBY-1505 Solidify public APIs separate from those that might change JRUBY-3208 ant task api-docs runs out of memory, patch included JRUBY-3221 Rubinius -bad instanceof tests in RubiniusMachine for attempt at fast path evaluation JRUBY-3232 Zlib::GzipReader.each_line yields compressed data JRUBY-3244 [PATCH] Support atime updates via utime JRUBY-3249 Testing errors in test_java_mime.rb JRUBY-3250 test_java_pkcs7.rb - Problem coercing Bignum into class java.math.BigInteger JRUBY-2992 Bad cast in jruby-openssl X509Utils JRUBY-3204 IO.read and IO.readlines do not take a block JRUBY-3251 ConcurrencyError bug when installing Merb on JRuby JRUBY-3248 jruby can't load file produced with jrubyc JRUBY-3257 RaiseException#printStrackTrace doesn't deal well with nil messages JRUBY-3259 sqlite db file on MRI is put in db dir. We put it in CWD. JRUBY-3260 :date is stored as integer (not date) in sqlite3 JRUBY-2425 NPE at Connection Shutdown JRUBY-2329 java.lang.NullPointerException when trying to connect to a Oracle XE database JRUBY-3023 Renaming indexed columns fails JRUBY-2384 Rails migrations fail with: undefined method `create_database' for class `#' JRUBY-2400 ActiveRecord/JRuby Memory leak in update_attributes!() JRUBY-2040 new samples/jnlp dir: includes both unsigned and signed examples that work in Java 1.5 and 1.6 JRUBY-3270 using activerecord 'to_xml' method crashes JRuby (and debugger) JRUBY-3277 Constant lookup should omit topmost lexical scope; not bail out on first Object-hosting lexical scope JRUBY-3278 Array#reduce is undefined JRUBY-3187 JRuby command line scripts do not work with spaces in the path JRUBY-3267 patch attached to update eclipse .classpath to refer to bytelist-1.0.1.jar JRUBY-3280 patch attached to update eclipse .classpath to add new jars in build_lib/ JRUBY-3276 New IO#readpartial and IO#seek spec failures JRUBY-3256 jruby -S script/console fails in Rails application JRUBY-3199 IllegalArgumentException in X509V3CertificateGenerator when executing Hoe's rake gem running on SoyLatte JDK JRUBY-3275 New ARGF spec failures JRUBY-3287 Add public RubyInstanceConfig#setCompatVersion JRUBY-3171 loading rake breaks import JRUBY-3290 Float range to restrictive in FFI code JRUBY-2826 Array#pack('w') is broken (exceptions and wrong results) JRUBY-3116 ArrayIndexOutOfBoundsException in tmail JRUBY-2522 Can not execute JRuby 1.1.1 "ant test" with IBM JDK JRUBY-2426 JRuby trunk does not build with IBM JVM 1.5 JRUBY-3042 undefined method `quote' for Regexp:Class (NoMethodError) when runs gem list on AIX with IBM JAVA 1.5 JRUBY-1950 '-i flag not supported JRUBY-3302 Doesn't biuld on windows for ffi problem JRUBY-3303 [1.9] splat of array at front of assignment broken (same for other grammatical constructs) JRUBY-3307 tempfile.rb sucks in JRuby JRUBY-3305 Fixnums & Floats should be coerced to the narrowest java.lang.Number when passed to a java method that expects Object JRUBY-2768 jdbc_mysql.rb should not enforce the utf8_bin collation on table creation JRUBY-2115 Error doing add_column with Derby and jdbc-adapter-0.7.2 JRUBY-2967 [PATCH] Derby handling of binary/date/time fields. hsqldb handling of binary fields. JRUBY-2647 [activerecord-jdbcsqlite3 adapter] Date/Datetime/Time fields simplification to INTEGER sqlite storage type is not correctly handled JRUBY-3073 JRuby script engine does not load on IBM JDK JRUBY-3109 Update stdlib to an appropriate 1.8.6 patchlevel JRUBY-2541 Time assumes UTC timezone JRUBY-3254 Make JRuby's Time#local behave more like MRI JRUBY-2740 BigDecimal#precs fails two new rubyspec tests JRUBY-3298 Kernel.srand calls #to_i on number JRUBY-2987 Kernel#system does not work correctly JRUBY-3242 Performance degradation on write operations JRUBY-2128 error accessing JRuby DRb server from MRI DRb client JRUBY-3268 JRuby DRb client cannot connect to MRI DRb server JRUBY-3274 Many new Array#pack failures in updated RubySpecs JRUBY-3147 Time#_load RubySpec failures JRUBY-3146 Time#_dump RubySpec failures JRUBY-3148 Array#fill spec failures JRUBY-3142 Dir.pwd correctly displays dirs with unicode characters in them JRUBY-2609 spec --line does not work with JRuby JRUBY-3317 require "tempfile"; Dir.tmpdir fails JRUBY-2364 The private keyword doesn't change visiblity of previously called methods with same send/call site JRUBY-2796 Missing constant in Process::Constants on Mac OS X (darwin) JRUBY-3226 Including more than one java interface stops Test::Unit execution JRUBY-3035 Get Rails tests running in a CI server somewhere before 1.1.6 release, to ensure no future breakages JRUBY-3318 If 'jruby' executable is a relative symlink, JRuby won't start JRUBY-3328 Incorrect behavior for case/when when true or false are the first conditions JRUBY-3269 SystemStackError with YAML.dump JRUBY-3229 Javasand does not compile with JRuby 1.1.5 JRUBY-3333 idea JRUBY-3332 ConcurrentModificationException In Application Startup JRUBY-3329 Major divergence in threading behaviour between Ruby 1.8.6 and JRuby 1.1.6 JRUBY-3308 Deadlock between RubyModule.includeModule() and RubyClass.invalidateCacheDescendants() JRUBY-3324 Error in string encoding conversion JRUBY-3340 String#unpack('m') fails with ArrayIndexOutOfBoundsException JRUBY-3341 The body of POST requests is not passing through jruby-rack JRUBY-3312 JRuby can double slash ("//") the directory given by __FILE__ when "everything" suits this thing to happen. :-) JRUBY-2884 jdbc_postgre.rb issue handling nil booleans JRUBY-2208 Memory Leak in ActiveRecord-jdbc or JRubyEngine used with BeanScriptingFramework JRUBY-2897 jdbc_postgre.rb needs microsecond support JRUBY-2995 activerecord jdbc derby adapter should quote columns called "year" JRUBY-2949 jdbcderby adapter should ignore :limit for INTEGER JRUBY-2718 jdbcsqlite3 at JRuby on Rails do not work properly JRUBY-3344 Update H2 to a later version JRUBY-3342 Wrabler escapes config.ru twice JRUBY-3282 Upgrade to derby 10.4.2.0 to allow unique constraints with nullable columns JRUBY-2767 Mistake in selecting identity with H2/HSQLDB JRUBY-2433 java.lang.IllegalArgumentException in debug mode when using CLOB JRUBY-3310 Race condition in JRuby when Active Support is overriding Kernel.require JRUBY-3127 Inconsistent DynamicScope instances in evalScriptlet JRUBY-3339 java.lang.ArrayIndexOutOfBoundsException in RubyArray.java JRUBY-3351 Tempfile defaults to a directory that does not exist on Windows JRUBY-3353 String#unpack invalid output JRUBY-3361 Compiled case/when blows up with arrays as when clauses JRUBY-3362 attr_accessor, attr_reader, attr_writer, and attr not obeying visibility JRUBY-1034 Post parse processing of the result comment placing as example JRUBY-48 Ability to write JUnit4 tests in JRuby JRUBY-1572 Allow visible fields from inherited Java classes show up as instance variables (@foo) JRUBY-2108 IOWaitLibrary ready? returns nil when ready JRUBY-1895 JRUBY-1890 IO.popen does not support "-" JRUBY-852 jirb exits on ESC followed by any arrow key followed by return JRUBY-2015 "RAILS_ROOT" cannot be put on a place different from "Context root" in Goldspike. JRUBY-2139 jruby.compile.frameless=true cause "Superclass method 'initialize' disabled." JRUBY-2174 Method#to_proc.call invocations much slower than normal Method#call invocations JRUBY-2170 Very unverbose message when problem with native library exists JRUBY-3338 jIRB cannot get any input with Polish characters (utf-8) on Mac OSX JRUBY-2252 Kernel#exec should not raise SystemExit JRUBY-1855 EOF handling in case of reading program from standard input JRUBY-1997 System.gc() is extremely expensive when calling Java code from JRuby JRUBY-821 getting in $SAFE level 4 freezes JRUBY-1770 weakref-based singleton class "attached" can blow up in certain unusual circumstances JRUBY-1555 DST bug in second form of Time.local JRUBY-1872 next statement should return the argument passed, not nil JRUBY-2214 Pure-Java version of lstat doesn't fail on non-existing file JRUBY-1901 standardize and publish public API for embedders JRUBY-2211 SNMP Requests does not timeout properly JRUBY-2298 We should generate method binding code with APT JRUBY-2305 File output cuts off at a certain point? JRUBY-2306 NPE in org.jruby.RubyIO.flush JRUBY-2288 UDP locking problems when receiving from multiple senders on same port JRUBY-2333 usage of unexistant variable in REXML::SourceFactory JRUBY-2346 Nailgun does not compile under HP-UX JRUBY-2353 Process.kill breaks up JRuby, while works in MRI on Windows JRUBY-2369 'ant spec' failures on on MacOS JRUBY-2168 test_io (test_copy_dev_null) fails under WinXP JRUBY-2410 Multiple assignment could be made faster by not returning unused array JRUBY-2389 java.util.ConcurrentModificationException JRUBY-929 Java input/output streams from Ruby string's backing byte array JRUBY-1681 Pathological slowdown in Array#insert JRUBY-1470 FileTest methods only work with string arguments JRUBY-1576 multi-byte character encoding probrem JRUBY-2119 Jruby shell script don't work on KSH shell JRUBY-3360 Pure-Java tempfile does not use a #make_tmpname callback JRUBY-2518 Dir["some glob"] doesn't work for files inside a jar JRUBY-3367 Dir.glob processes nested braces incorrectly JRUBY-3366 Faulty marshalling error blows up in ActiveSupport JRUBY-2027 Problems with the H2 jdbc adapter, schema metadata behavior JRUBY-2417 Make fields immutable where possible JRUBY-1565 ReWriteVisitor transforms Fixnums into base 10 despite their original format JRUBY-2917 Missing peephole optimizations in parser, compiler JRUBY-2542 DATA.flock causes ClassCastException JRUBY-2545 Recursively locking on a mutex results in deadlock JRUBY-2285 Regression: rubyspec run with -V option breaks JRuby JRUBY-2120 Wrong stacktraces from exceptions about wrong number of arguments JRUBY-1639 Exception when stopping WEBrick running the new rails application JRUBY-2534 jdbcpostgresql adapter inserts invalid number literals into generated SQL, causes exceptions JRUBY-3375 'attr' implementation is incompatible with MRI 1.9.1 behavior JRUBY-3365 Objects with custom to_yaml methods break collection to_yaml JRUBY-2603 Couple of new rubyspec failures for URI library JRUBY-2465 2 digit year resolves to 1st century rather than 20th when using postgres timestamp with timezone activerecord-jdbcpostgresql-adapter JRUBY-2672 BasicSocket#close_read and #close_write not working JRUBY-2655 TCPSocket.new('localhost', 2001) connects on the wrong interface JRUBY-2759 Time Zone "MET" maps to Asia/Tehran JRUBY-2758 Class Socket is missing #bind JRUBY-2761 Thread#wakeup fails when sleep is called with a parameter JRUBY-2772 Zlib::Deflate doesn't appear to deflate JRUBY-3289 ArgumentError: dump format error() when unmarshalling Rails session and EOFError when unmarshalling hash with containing value of type ActionController::Flash::FlashHash JRUBY-3228 Some error saving to a Rails session [Marshalling bug?] JRUBY-2792 Net::HTTP spec failures in get_print spec; IO not getting expected "print" call JRUBY-2804 IO.popen of 'yes' process hangs on close JRUBY-2755 Precompiled scripts do not set initial position information correctly JRUBY-2484 unicode symbol not supported as in MRI JRUBY-2817 File.chown works with 64bit JDK, but raises NotImplementedError on 32 bit JDK JRUBY-2912 MS SQL-Server - Create/Drop Database bug JRUBY-2815 System triggered from inside of tracing behaves oddly JRUBY-3069 dbd-jdbc: Support Ruby DBI Statement.fetch_scroll JRUBY-3235 dbd-jdbc: Add helper functions to wrap already existing jdbc Connection and Statement objects JRUBY-3068 dbd-jdbc: Override Ruby DBI's default database return value coercion for Date / Time / Timestamp columns JRUBY-3067 dbd-jdbc: Register a handler for DBI 0.4.x's default parameter binding type coercion JRUBY-1345 Files added to a module via Kernel.autoload are not automatically loaded if the class they contain is extended JRUBY-2727 ActiveScaffold 1.1.1 fails with JRuby 1.1.2, probable path problem JRUBY-2699 If user's PATH contains '.' and 'jruby' resolves to './jruby', JRUBY_HOME is incorrectly set to '.', leading to 'NoClassDefFoundError' JRUBY-2820 Most Etc methods behave diferently on Windows under x32 and x64 JVMs JRUBY-2841 String#<<> JRUBY-2844 Memcache session store does not work across multiple application servers JRUBY-2845 '-S switch breaks if you have directory in pwd matching name of file in bin/PATH JRUBY-2849 CCE using proc{} in AR callbacks JRUBY-2862 Improve JRuby::Commands' handling of bindir JRUBY-2861 Cannot call super inside a method that overrides a protected method on Java base class JRUBY-2868 ThreadService.getRubyThreadFromThread supports only one non-rubynative thread at a time. JRUBY-2782 "No such file or directory (IOError)" when JAR file named in java.class.path but not active filesystem JRUBY-2901 JRuby does not support options in shebang line JRUBY-2846 gem generate_index broken JRUBY-2832 Rails static page caching won't generally work with Java ServletFilter unless some serious hack with the cache directory is found JRUBY-414 Serialization of wrapped Java objects could be handled as user-marshalled data by Marshal JRUBY-2921 Newly overridden methods are not called if the old superclass method has already been called JRUBY-2661 specs hang under Apple Java 5 JRUBY-2933 Ruby runtimes are pinned to memory due to ChannelStream JRUBY-1578 Incomplete HTTS response from Microsoft IIS servers using net/https JRUBY-2941 popen IO lockup with multiple threads JRUBY-2925 Java Integration can now instantiate Java classes with no public constructor JRUBY-2802 JRuby wrapped Java objects formerly exposed readers for non-public fields JRUBY-2504 JAR URLs are inconsistently supported by APIs that access the filesystem JRUBY-1846 Kernel::fork should use forkall(2) on solaris instead of fork(2) JRUBY-2395 Have to call setPaint instead of assigning to g.paint JRUBY-1401 Pathname#realpath fails for Windows drive letters JRUBY-2296 convertToRuby does not work if to_s does not return a String (but for example nil) JRUBY-2904 Need a better solution for tracking Java object wrappers JRUBY-1327 When define_method replaces an inherited Java method, the ruby_case_version is not replaced JRUBY-2951 repeated popen call may throw NULL pointer exception JRUBY-2974 multi-byte exception message turned into garbled characters when Java Exception nested NativeException. JRUBY-2980 String#<<> JRUBY-2981 alias_method_chain pattern is extremely show on jruby JRUBY-2982 Unicode regular expressions by UTF-8 don't work JRUBY-2988 jirb does not echo characters to the terminal after suspend and resume in the shell JRUBY-2997 Dir[] results in NPE depending on permissions JRUBY-3000 integration issues with Java classes containing inner classes JRUBY-3007 Message method value of Exception is missing in Java when exception raised in ruby JRUBY-3016 Nested Class/Enum issue with JRockit JRUBY-3011 java classes with non-public constructors are incorrectly instantiated JRUBY-2999 Regression: Inheriting method with same name from two Java interfaces causes Java classloader error JRUBY-2700 jdbcsqlite3 adapter does not respect default parameter JRUBY-3026 [Derby] Allow select/delete/update conditions with comparison to NULL using '=' JRUBY-3288 jruby-openssl: SSLSocket.syswrite error for big (>16k) data JRUBY-3017 DRb "premature header" error on JRuby client JRUBY-2766 Create caching mechanism for all our many calls to callMethod from Java code JRUBY-3200 insert statement returns null from the postgresql jdbc adapter JRUBY-2996 Migration step with create_table with string column with :default => "" fails due to missing default value in SQL JRUBY-2184 ActiveRecord is slower on JRuby than on MRI JRUBY-3202 url style Postgres configuration is broken in rake. JRUBY-1854 def is almost 3x slower in JRuby JRUBY-2618 Table does not exist error possibly caused by upper case table name JRUBY-3003 ArrayStoreException in compiler when calling Array.fill JRUBY-2180 break performance is slower than MRI, sometimes slower than interpreted JRUBY-2304 active_scaffold - No such file or directory JRUBY-3386 Array#eql? rubyspec failure JRUBY-3387 Array#== rubyspec failure JRUBY-3054 Thread#status is "run" when thread is blocking on condition variable JRUBY-3390 RubySpec: Numeric#coerce calls #to_f to convert other if self responds to #to_f JRUBY-3055 permission javax.management.MBeanServerPermission "createMBeanServer"; JRUBY-3072 Using a ruby Numeric to set a parameter with a signature of java.lang.Integer causes a java.lang.ClassCastException JRUBY-3082 1.1.4 unable to use 'logging' gem (works in 1.1.3) JRUBY-3398 Attributes defined from Java tried to use current frame for visibility JRUBY-3397 defined? CONST is not following proper constant lookup rules JRUBY-3089 Digest::Base stores in memory all bytes passed to the digest, causing OutOfMemoryError JRUBY-3125 Some Socket constants not supported. JRUBY-3128 Different jruby behaviour that ruby 1.8.6/1.8.7/1.9 when running file that is named as one of required file. JRUBY-3175 Cloning java byte array returns incorrect object JRUBY-3177 ConcurrentModificationException JRUBY-3178 http spec tests fail when webrick starts on address 0.0.0.0 JRUBY-2548 JRuby conversion of String to Java String is arcane JRUBY-3174 FFI MemoryPointer#get_string(0, x) gets confused by null byte in the buffer JRUBY-2896 jruby -S picks up script from local directory JRUBY-3163 Incorrect namespace for CipherError JRUBY-1853 define_method methods do not display the correct stack trace, may not be using frame safely JRUBY-2855 Classpath search order is not respected by require when classpath includes both jars and directories JRUBY-3222 Problems with migrations where direct type specified JRUBY-2424 running with -rprofile with multithreaded test causes NPE JRUBY-2691 Update sybase driver to pass simple unit tests with jtds and verify it works with the new dialect keyword JRUBY-3065 New public LoadService#findFileToLoad method JRUBY-2261 ThreadContext should use SoftReference instead of WeakReference JRUBY-2116 import org.eclipse.jface.dialogs.MessageDialog -- causes java.lang.NullPointerException JRUBY-2898 Exception trying to use BSF (java.lang.NoClassDefFoundError: org/apache/bsf/util/BSFEngineImp) JRUBY-2003 rexml pretty printing wrap() error JRUBY-752 undef'ing and redef'ing methods should give disabled message? JRUBY-2262 Java toString() mapping to invoke(... to_s ...).toString() doesn JRUBY-3121 Glassfish Gem 0.9.0 does not work with JRuby 1.1.5 JRUBY-551 JRUBY-549 bfts test_file_test failures JRUBY-2248 Problem with active_scaffold defaults defined in application.rb JRUBY-2446 httprequest error for a SOAP request to a Rails ActiveWebService JRUBY-3005 Stomp gem hangs in Stomp::Client#subscribe JRUBY-3180 Class in default package can't be reopened under Java namespace JRUBY-3047 IO.select sometime reports Unable to establish loopback JRUBY-2851 JDBC adapter in JAR file not being picked up by java.lang.Class.forName in 1.1.3 (worked in 1.1.2) JRUBY-2313 Automatically convert RubyFile to java.io.File JRUBY-2328 Overriding require causes eval to give wrong __FILE__ in certain circumstances JRUBY-2794 Failure in String#crypt specs, Mac OS X, Soylatte JRUBY-2137 ENV[] is case sensitive on Windows JRUBY-2797 File.expand_path rubyspec failure on Mac OS X, Soylatte JRUBY-2608 Examine whether -Xrs flag to JVM could be used to improve our signal-handling logic JRUBY-2675 jirb jline do not work in cygwin JRUBY-2521 Compilation Warning for Sun proprietary API using JRUBY-2263 Running merb under a concurrent load causes ArrayIndexOutOfBoundsExceptions JRUBY-2706 File.stat('/home') treated as a relative path JRUBY-2557 NPE when yielding method JRUBY-2860 EOFError while consuming REST web service from glassfish v3 JRUBY-2835 rails image_tag generates url get 404 JRUBY-3095 chmod_R broken JRUBY-2830 String#unpack with 'w' is completely unimplemented JRUBY-3038 Unable to insert YAML into t.text field (behavior different from Ruby 1.8.6) JRUBY-3004 Excess warnings when using rake TestTask JRUBY-1606 File.expand_path does not work as expected JRUBY-750 defineAlias reports original name and not aliased one in stack traces JRUBY-1201 TCPSocket.new(dest_adrr, dest_port, src_addr, src_port) missing from JRuby JRUBY-3160 REXML returns error for add_attribute JRUBY-2732 org.jruby.util.RubyInputStream is unused JRUBY-2455 "jruby" script failed to find JRUBY_HOME leads to class not found JRUBY-3190 method `module_eval' for main:Object should be undefined? JRUBY-2950 Net::IMAP#authenticate stalls / blocks in recent versions of JRuby JRUBY-1542 1.1b1 doesn't build with gcj 4.2 JRUBY-2788 Make Time.now monotonically increasing JRUBY-3296 Etc.getpwuid should raise TypeError if invalid type JRUBY-3167 loadpath and classpath problem JRUBY-2983 JRuby crashes after running 110 RSpec examples JRUBY-3085 Add constant caching for Colon2 and Colon3 (specific module and Object cases) JRUBY-3207 super error message is inaccurate when superclass doesn't implement method. JRUBY-2979 File#getc fails on illegal seek when reading from /dev/ttyS0 on Linux JRUBY-3076 RubyUDPSocket.send tries to do inet address lookup, pauses too long for inet6 failure JRUBY-2555 CLONE -JIT max and JIT threshold should be adjusted for improvements in JRuby over the past months JRUBY-3407 FFI Stack Level Too Deep on Library.send(:method, args) JRUBY-3410 Add -y flag to debug the parser JRUBY-3103 Compiler closures use two different binding mechanisms, need better construction and caching logic JRUBY-3179 JRuby can't handle do/end blocks within String-inlined expressions JRUBY-3316 Group expression class path fails to parse JRUBY-3151 OpenSSL::Random#pseudo_bytes raises ArgumentError on negative arguments JRUBY-3088 "RStone" port of PyStone is slower on JRuby than 1.9 JRUBY-3120 Regression: error serializing array of objects with custom to_yaml def to yaml JRUBY-3211 builder library is slower in JRuby than in MRI JRUBY-1884 handling of file close while reading differs from mri JRUBY-3214 load and require don't work correctly for .class files JRUBY-3218 Import is sometimes confused by unquoted class name JRUBY-3224 Array#to_java with java object reference doesn't carry over object identity JRUBY-1079 IO.sysopen not defined JRUBY-3071 Illegal seek error trying to read() from pipe JRUBY-3152 Process.times returns invalid values JRUBY-3064 Process.uid does not work on non-natve platforms (jna-posix) JRUBY-2757 Compiled argument processing and arity checking are too large, too much bytecode JRUBY-3061 NKF(unsupported Q encode stream) JRUBY-3105 Embedding JRuby-Rack (non-war deployment) JRUBY-3077 Update ruby_test tests and incorporate changes into build JRUBY-2970 Timeout.rb is not working in special cases (Thread may block whole application). JRUBY-3253 Lack of default jruby.home in embedded usage causes NPE JRUBY-3063 File::link using CIFS raises Errno::EEXIST error if the 'old_file' is open while Matz Ruby raises Errno::ETXTBSY JRUBY-3252 Iterative String concatenation operations in JRuby degrade faster than in MRI. JRUBY-3255 jruby -S script/server fails in Rails application JRUBY-3258 after installing minigems (and after minigem setup gems not working on 1.1.6) JRUBY-1235 DRb hangs when transferring Ruby objects created in Java JRUBY-3271 Java Stacktrace and exception is swallowed JRUBY-2063 Wrong monitor handling in o.j.util.ChannelStream.read JRUBY-2131 Select with nil arrays should throw an exception [Less]
|
|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
I just love the JRuby version string. I love it so much, I'm microblogging what each piece means.jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-01-29 rev 8947 3) [x86_64-java]Obviously "jruby 1.2.0" is the name of the impl and the version number.
... [More]
We'll probably modify this to suffix "-dev" on trunk."ruby 1.8.6 patchlevel 287" roughly identifies which release of Ruby the current mode is intended to be compatible with."2009-01-29" is the date it was built.The revision number "8947 3" indicates the base SVN revision is 8947 and I'm three commits ahead of it on my local git-svn clone. If I were using straight-up SVN it would just show current revision. Once we move to git it will just show the current hash, plus possibly the hash of origin's HEAD.And finally "x86_64-java" identifies the hardware and platform we report to Ruby programs.Now what I really like is what happens when you specify the --1.9 flag:jruby 1.2.0 (ruby 1.9.1 patchlevel 0) (2009-01-29 rev 8947 3) [x86_64-java]How cool is that? [Less]
|
|
Posted
almost 17 years
ago
by
[email protected] (Charles Oliver Nutter)
I probably start up a JVM a thousand times a day. Test runs, benchmark runs, bug confirmation, API exploration, or running actual apps. And in many of these runs, I use various JVM switches to tweak performance or investigate runtime metrics. Here's
... [More]
a short list of my favorite JVM switches (note these are Hotspot/OpenJDK/SunJDK switches, and may or may not work on yours. Apple JVM is basically the same, so these work).The BasicsMost runs will want to tweak a few simple flags:-server turns on the optimizing JIT along with a few other "server-class" settings. Generally you get the best performance out of this setting. The default VM is -client, unless you're on 64-bit (it only has -server).-Xms and -Xmx set the minimum and maximum sizes for the heap. Touted as a feature, Hotspot puts a cap on heap size to prevent it from blowing out your system. So once you figure out the max memory your app needs, you cap it to keep rogue code from impacting other apps. Use these flags like -Xmx512M, where the M stands for MB. If you don't include it, you're specifying bytes. Several flags use this format. You can also get a minor startup perf boost by setting minimum higher, since it doesn't have to grow the heap right away.-Xshare:dump can help improve startup performance on some installations. When run as root (or whatever user you have the JVM installed as) it will dump a shared-memory file to disk containing all of the core class data. This file is much faster to load then re-verifying and re-loading all the individual classes, and once in memory it's shared by all JVMs on the system. Note that -Xshare:off, -Xshare:on, -Xshare:auto set whether "Class Data Sharing" is enabled, and it's not available on the -server VM or on 64-bit systems. Mac users: you're already using Apple's version of this feature, upon which Hotspot's version is based.There are also some basic flags for logging runtime information:-verbose:gc logs garbage collector runs and how long they're taking. I generally use this as my first tool to investigate if GC is a bottleneck for a given application.-Xprof turns on a low-impact sampling profiler. I've had Hotspot engineers recommend I "don't use this" but I still think it's a decent (albeit very blunt) tool for finding bottlenecks. Just don't use the results as anything more than a guide.-Xrunhprof turns on a higher-impact instrumenting profiler. The default invocation with no extra parameters records object allocations and high-allocation sites, which is useful for finding excess object creation. -Xrunhprof:cpu=times instruments all Java code in the JVM and records the actual CPU time calls take. I generally only use this to profile JRuby internals because it's extremely slow, but it's also much more accurate than -Xprof.Deeper MagicEventually you may want to tweak deeper details of the JVM:-XX: UseParallelGC turns on the parallel young-generation garbage collector. This is a stop-the-world collector that uses several threads to reduce pause times. There's also -XX: UseParallelOldGC to use a parallel collector for the old generation, but it's generally only useful if you often have large numbers of old objects getting collected.-XX: UseConcMarkSweepGC turns on the concurrent mark-sweep collector. This one runs most GC operations in parallel to your application's execution, reducing pauses significantly. It still stops the world for its compact phase, but that's usually quicker than pausing for the whole set of GC operations. This is useful if you need to reduce the impact GC has on an application run and don't mind that it's a little slower than the full stop-the-world versions. Also, you obviously would need multiple processors to see full effect. (Incidentally, if you're interested in GC tuning, you should look at Java SE 6 HotSpot Virtual Machine Garbage Collection Tuning. There's a lot more there.)-XX:NewRatio=# sets the desired ratio of "new" to "old" generations in the heap. The defaults are 1:12 in the -client VM and 1:8 in the -server VM. You often want a higher ratio if you have a lot more transient data flowing through your application than long-lived data. For example, Ruby's high object churn often means a lower NewRatio (i.e. larger "new" versus "old") helps performance, since it prevents transient objects from getting promoted to old generations.-XX:MaxPermSize=###M sets the maximum "permanent generation" size. Hotspot is unusual in that several types of data get stored in the "permanent generation", a separate area of the heap that is only rarely (or never) garbage-collected. The list of perm-gen hosted data is a little fuzzy, but it generally contains things like class metadata, bytecode, interned strings, and so on (and this certainly varies across Hotspot versions). Because this generation is rarely or never collected, you may need to increase its size (or turn on perm-gen sweeping with a couple other flags). In JRuby especially we generate a lot of adapter bytecode, which usually demands more perm gen space.And there are a few more advanced logging and profiling options as well:-XX: PrintCompilation prints out the name of each Java method Hotspot decides to JIT compile. The list will usually show a bunch of core Java class methods initially, and then turn to methods in your application. In JRuby, it eventually starts to show Ruby methods as well.-XX: PrintGCDetails includes the data from -verbose:gc but also adds information about the size of the new generation and more accurate timings.-XX: TraceClassLoading and -XX: TraceClassUnloading print information class loads and unloads. Useful for investigating if you have a class leak or if old classes (like JITed Ruby methods in JRuby) are getting collected or not.Into The BellyFinally here's a list of the deepest options we use to investigate performance. Some of these require a debug build of the JVM, which you can download from java.net.Also, some of these may require you also pass -XX: UnlockDiagnosticVMOptions to enable them.-XX:MaxInlineSize=# sets the maximum size method Hotspot will consider for inlining. By default it's set at 35 *bytes* of bytecode (i.e. pretty small). This is largely why Hotspot really like lots of small methods; it can then decide the best way to inline them based on runtime profiling. You can bump it up, and sometimes it will produce better performance, but at some point the compilation units get large enough that many of Hotspot's optimizations are skipped. Fun to play with though.-XX:CompileThreshold=# sets the number of method invocations before Hotspot will compile a method to native code. The -server VM defaults to 10000 and -client defaults to 1500. Large numbers allow Hotspot to gather more profile data and make better decisions about inlining and optimizations. Smaller numbers reduce "warm up" time.-XX: LogCompilation is like -XX: PrintCompilation on steroids. It not only prints out methods that are being JITed, it also prints out why methods may be deoptimized (like if new code is loaded or a new call target is discovered) and information about which methods are being inlined. There's a caveat though: the output is seriously nasty XML without any real structure to it. I use a Sun-internal tool for rendering it in a nicer format, which I'm trying to get open-sourced. Hopefully that will happen soon. Note, this option requires -XX: UnlockDiagnosticVMOptions.And finally, my current absolute favorite option, which requires a debug build of the JVM:-XX: PrintOptoAssembly dumps to the console a log of all assembly being generated for JITed methods. The instructions are basically x86 assembly with a few Hotspot-specific instruction names that get replaced with hardware-specific instructions during the final assembly phase. In addition to the JITed assembly, this flag also shows how registers are being allocated, the probability of various branches being followed (along with multiple assembly blocks for the different paths), and information about calls back into the JVM. Outside the logging options for the final generated assembly (which requires a separate plugin) this is the best tool for discovering what optimizations are actually happening. I use this at least a couple times a week to investigate JRuby performance enhancements.And So Much MoreHotspot has literally hundreds of different flags (and here's another list specific to Java 6), and dozens of them that might be useful to you. I may add a few more to this post as I remember them, but this list includes all those I use on a regular basis. If you're using JRuby, you can use the -J flag to pass any of these flags through to the JVM, as in -J-XX: PrintCompilation.What are some of your favorite Hotspot JVM flags?Update: Another couple that commenters added or reminded me of:Marcus Kohler commented on -XX: HeapDumpOnOutOfMemoryError, useful if you have a slow-leaking application you can't pin down. It will dump heap information to disk whenever there's an OutOfMemoryError, allowing you to do offline analysis.j6wbs mentioned that you can send SIGQUIT (or hit Ctrl Backslash or Ctrl Break in the console) to dump the current execution stack of all running threads. This is especially nice if you have a runaway app or if an app appears to have frozen.karld offers up -XX:OnOutOfMemoryError="mail -s 'OOM on `hostname` at `date`' [email protected] <<< ''" as a way to send out email when there's an OutOfMemoryError. Poor-man's monitoring!I also remembered a very important option for JRuby: -Xbootclasspath specifies classpath entries you want loaded without verification. The JVM verifies all classes it loads to ensure they don't try to dereference an object with an int, pop extra entries off the stack or push too many, and so on. This verification is part of the reason why the JVM is very stable, but it's also rather costly, and responsible for a large part of startup delay. Putting classes on the bootclasspath skips this cost, but should only be used when you know the classes have been verified many times before. In JRuby, this reduced startup time by half or more for a simple script. Use -Xbootclasspath/a: and -Xbootclasspath/p: to append and prepend to the default bootclasspath or -Xbootclasspath: to completely set your own. [Less]
|
|
Posted
about 17 years
ago
by
[email protected] (Charles Oliver Nutter)
I've been a bit quiet on the blog over the past couple months, and for that I apologize. JRuby is moving very quickly now, and we'll have some pretty big announcements soon. For now, I figured I'd let my friends in Europe and the British Isles know
... [More]
I'll be in your back yard again soon!I'm going to be speaking at the Irish Java Technologies Conference in January. The conference is the 7th and 8th, and I'll be doing two talks.The first is going to be a talk on JRuby, with all the usual trimmings to show Ruby's power and the strength of the Ruby community and ecosystem at large. I'll give a brief intro to Ruby, and then do a few live-coded demonstrations of Ruby calling Java libraries.The second talk will be on the future of the JVM and the Java platform in light of this renewed interest in alternative languages. I'll be discussion the challenges of implementing a language like JRuby, walking through some of the work we've done to make JRuby the fastest Ruby implementation. Then we'll dive into the future of languages like JRuby on the JVM, going through upcoming changes in Java 7 and talking about how they'll affect the average developer on the Java platform.The second talk will be the first of it's kind I've ever presented, but it's a topic very dear to me. I think we have a responsibility to ensure that the JVM, especially OpenJDK, become the VM and platform of choice for all kinds of application development, and our work on JRuby is directly related to that goal. What we've learned from JRuby, and what others have learned implementing their languages, will directly affect the future of the platform.So, if you're anywhere near Dublin around 7th-8th January, come on by the conference! [Less]
|
|
Posted
about 17 years
ago
by
[email protected] (Charles Oliver Nutter)
It's that time of year again, and the call for papers for JavaOne and CommunityOne is closing soon! We're hoping for a lot more diverse JRuby presentations and speakers this year, so don't think you have to be doing Rails to get in. There's room for
... [More]
GUI dev, Game dev, automation, services, anything you might be doing with JRuby. So don't miss the deadline, and consider submitting a couple talks if you have a couple good topics!CommunityOneCommunityOne East - March 18-19, 2009 - New York CityCommunityOne West - June 1-2, 2009 - San FranciscoDeadline to submit speaking abstracts: Dec. 11, 2008Where to make submissions: Click HereEvent Details (external): Click HereQuestions/Inquiries: [email protected] - June 2-5, 2009 - San FranciscoDeadline to submit speaking abstracts: December 19, 2008Where to make submissions: Click HereEven Details (external): Click HereQuestions/Inquiries: [email protected] early! Submit often! [Less]
|