8155643: Java crash with assert in Xcomp mode and disabled ReduceInitialCardMarks
We should not emit a subtype check for CloneOop arraycopy. Reviewed-by: kvn
This commit is contained in:
parent
536db8741f
commit
cf5a61530f
@ -503,6 +503,10 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode*
|
|||||||
// further to JVM_ArrayCopy on the first per-oop check that fails.
|
// further to JVM_ArrayCopy on the first per-oop check that fails.
|
||||||
// (Actually, we don't move raw bits only; the GC requires card marks.)
|
// (Actually, we don't move raw bits only; the GC requires card marks.)
|
||||||
|
|
||||||
|
// We don't need a subtype check for validated copies and Object[].clone()
|
||||||
|
bool skip_subtype_check = ac->is_arraycopy_validated() || ac->is_copyof_validated() ||
|
||||||
|
ac->is_copyofrange_validated() || ac->is_cloneoop();
|
||||||
|
if (!skip_subtype_check) {
|
||||||
// Get the klass* for both src and dest
|
// Get the klass* for both src and dest
|
||||||
Node* src_klass = ac->in(ArrayCopyNode::SrcKlass);
|
Node* src_klass = ac->in(ArrayCopyNode::SrcKlass);
|
||||||
Node* dest_klass = ac->in(ArrayCopyNode::DestKlass);
|
Node* dest_klass = ac->in(ArrayCopyNode::DestKlass);
|
||||||
@ -520,8 +524,7 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode*
|
|||||||
// Test S[] against D[], not S against D, because (probably)
|
// Test S[] against D[], not S against D, because (probably)
|
||||||
// the secondary supertype cache is less busy for S[] than S.
|
// the secondary supertype cache is less busy for S[] than S.
|
||||||
// This usually only matters when D is an interface.
|
// This usually only matters when D is an interface.
|
||||||
Node* not_subtype_ctrl = (ac->is_arraycopy_validated() || ac->is_copyof_validated() || ac->is_copyofrange_validated()) ? top() :
|
Node* not_subtype_ctrl = Phase::gen_subtype_check(src_klass, dest_klass, ctrl, mem, &_igvn);
|
||||||
Phase::gen_subtype_check(src_klass, dest_klass, ctrl, mem, &_igvn);
|
|
||||||
// Plug failing path into checked_oop_disjoint_arraycopy
|
// Plug failing path into checked_oop_disjoint_arraycopy
|
||||||
if (not_subtype_ctrl != top()) {
|
if (not_subtype_ctrl != top()) {
|
||||||
Node* local_ctrl = not_subtype_ctrl;
|
Node* local_ctrl = not_subtype_ctrl;
|
||||||
@ -544,6 +547,7 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode*
|
|||||||
checked_mem = local_mem->memory_at(alias_idx);
|
checked_mem = local_mem->memory_at(alias_idx);
|
||||||
checked_value = cv;
|
checked_value = cv;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// At this point we know we do not need type checks on oop stores.
|
// At this point we know we do not need type checks on oop stores.
|
||||||
|
|
||||||
// Let's see if we need card marks:
|
// Let's see if we need card marks:
|
||||||
|
40
hotspot/test/compiler/arraycopy/TestObjectArrayClone.java
Normal file
40
hotspot/test/compiler/arraycopy/TestObjectArrayClone.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, 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 8155643
|
||||||
|
* @summary Test Object.clone() intrinsic if ReduceInitialCardMarks is disabled.
|
||||||
|
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:CompileOnly=TestObjectArrayClone.test -XX:-ReduceInitialCardMarks TestObjectArrayClone
|
||||||
|
*/
|
||||||
|
public class TestObjectArrayClone {
|
||||||
|
|
||||||
|
public static TestObjectArrayClone[] test(TestObjectArrayClone[] arr) {
|
||||||
|
return arr.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
test(new TestObjectArrayClone[42]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user