8075921: assert assert(allocx == alloc) fails in library_call.cpp

Control becomes top after arraycopy guards and confuses tighly coupled allocation logic

Reviewed-by: kvn, vlivanov
This commit is contained in:
Roland Westrelin 2015-03-27 08:58:45 +01:00
parent 2a18e44777
commit 61aa1cfdef
3 changed files with 66 additions and 1 deletions

View file

@ -2530,6 +2530,11 @@ static IfNode* gen_subtype_check_compare(Node* ctrl, Node* in1, Node* in2, BoolT
// prior to coming here.
Node* Phase::gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, MergeMemNode* mem, PhaseGVN* gvn) {
Compile* C = gvn->C;
if ((*ctrl)->is_top()) {
return C->top();
}
// Fast check for identical types, perhaps identical constants.
// The types can even be identical non-constants, in cases
// involving Array.newInstance, Object.clone, etc.
@ -2793,6 +2798,10 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj,
Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
ciKlass* type,
bool not_null) {
if (stopped()) {
return obj;
}
// type == NULL if profiling tells us this object is always null
if (type != NULL) {
Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;

View file

@ -3670,6 +3670,11 @@ bool LibraryCallKit::inline_native_subtype_check() {
//---------------------generate_array_guard_common------------------------
Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region,
bool obj_array, bool not_array) {
if (stopped()) {
return NULL;
}
// If obj_array/non_array==false/false:
// Branch around if the given klass is in fact an array (either obj or prim).
// If obj_array/non_array==false/true:
@ -4761,7 +4766,7 @@ JVMState* LibraryCallKit::arraycopy_restore_alloc_state(AllocateArrayNode* alloc
// guarantees there's no observer of the allocated array at this point
// and the control flow is simple enough.
void LibraryCallKit::arraycopy_move_allocation_here(AllocateArrayNode* alloc, Node* dest, JVMState* saved_jvms, int saved_reexecute_sp) {
if (saved_jvms != NULL) {
if (saved_jvms != NULL && !stopped()) {
assert(alloc != NULL, "only with a tightly coupled allocation");
// restore JVM state to the state at the arraycopy
saved_jvms->map()->set_control(map()->control());

View file

@ -0,0 +1,51 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8075921
* @summary control becomes top after arraycopy guards and confuses tighly coupled allocation logic
* @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCopyStoppedAfterGuards.test,System.arraycopy TestArrayCopyStoppedAfterGuards
*
*/
public class TestArrayCopyStoppedAfterGuards {
static void test() {
Object src = new Object();
int[] dst = new int[10];
System.arraycopy(src, 0, dst, 0, 10);
}
static public void main(String[] args) {
// warmup
Object o = new Object();
int[] src = new int[10];
int[] dst = new int[10];
System.arraycopy(src, 0, dst, 0, 10);
try {
test();
} catch(ArrayStoreException ase) {}
}
}