hg: mlvm/mlvm/hotspot: indy.compiler: First commit, not enabled in series file.
Christian Thalinger
Christian.Thalinger at Sun.COM
Tue Jun 23 01:39:47 PDT 2009
John Rose wrote:
> 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!
Cool! Thanks a lot for fixing that problem!
-- Christian
More information about the mlvm-dev
mailing list