I just pushed an update which fixed the stack pointer smashing problem we ran into at JavaOne. Since C2 stack frames do not use EBP for a frame pointer (EBP is a regular register) there is no way to checkpoint the current ESP just before a method handle call. This is unfortunate, since method handles can rearrange the stack as they insert or delete arguments.
The solution is pretty simple: Use EBP itself to hold a checkpointed value of ESP. (It is already the case that all calling sequences save and restore EBP, for the sake of the interpreter and its adapters.) This means a method handle call looks like this: mov rbp, rsp call MH.invoke.from_compiled_entry mov rsp, rbp That's not too bad, except of course that we need to inline these guys routinely. (I had considered more exotic solutions, like inventing new frame types or checkpointing the ESP on a thread-local variable. This solution is pleasantly simple.) The stack frame walking code had to be per-kludged (i.e., another kludge on top of kludges) to know about this convention. It wants a clean-up. And there's a deoptimization bug in there somewhere; yuck. The resulting JVM runs the 1600 unit tests of MethodHandlesTest with CompileThreshold set to 1 (usually it's 10000). It almost runs in - Xcomp mode also, but crashes very late trying to deoptimize in a catchException combinator. In my previous push I put the compiler patch into the series file, but it only applies if the "testable" guard is removed. I suppose it's actually testable now. Your turn, Christian! -- John On Jun 18, 2009, at 4:30 AM, Christian Thalinger wrote: > [email protected] wrote: >> Changeset: aeb8308e7dfe >> Author: twisti >> Date: 2009-06-17 15:24 +0200 >> URL: http://hg.openjdk.java.net/mlvm/mlvm/hotspot/rev/aeb8308e7dfe >> >> indy.compiler: First commit, not enabled in series file. >> >> + indy.compiler.patch > > Although it's not working yet, this is the first commit for compiler > support for invokedynamic. More to come. _______________________________________________ mlvm-dev mailing list [email protected] http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
