8005818: Shark: fix OSR for non-empty incoming stack
Reviewed-by: twisti
Contributed-by: Roman Kennke <rkennke@redhat.com>
--- a/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jan 11 16:47:23 2013 -0800
+++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jan 11 16:47:23 2013 -0800
@@ -185,6 +185,9 @@
// Build the LLVM IR for the method
Function *function = SharkFunction::build(env, &builder, flow, name);
+ if (env->failing()) {
+ return;
+ }
// Generate native code. It's unpleasant that we have to drop into
// the VM to do this -- it blocks safepoints -- but I can't see any
--- a/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jan 11 16:47:23 2013 -0800
+++ b/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jan 11 16:47:23 2013 -0800
@@ -77,6 +77,10 @@
// Walk the tree from the start block to determine which
// blocks are entered and which blocks require phis
SharkTopLevelBlock *start_block = block(flow()->start_block_num());
+ if (is_osr() && start_block->stack_depth_at_entry() != 0) {
+ env()->record_method_not_compilable("can't compile OSR block with incoming stack-depth > 0");
+ return;
+ }
assert(start_block->start() == flow()->start_bci(), "blocks out of order");
start_block->enter();
--- a/hotspot/src/share/vm/shark/sharkInvariants.hpp Fri Jan 11 16:47:23 2013 -0800
+++ b/hotspot/src/share/vm/shark/sharkInvariants.hpp Fri Jan 11 16:47:23 2013 -0800
@@ -68,7 +68,7 @@
//
// Accessing this directly is kind of ugly, so it's private. Add
// new accessors below if you need something from it.
- private:
+ protected:
ciEnv* env() const {
assert(_env != NULL, "env not available");
return _env;