Skip to content

Commit a3561ae

Browse files
committedJan 12, 2021
8258243: C2: assert failed ("Bad derived pointer") with -XX:+VerifyRegisterAllocator
Reviewed-by: kvn, thartmann
1 parent 4663704 commit a3561ae

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed
 

‎src/hotspot/share/opto/chaitin.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2406,9 +2406,9 @@ void PhaseChaitin::verify_base_ptrs(ResourceArea* a) const {
24062406
worklist.push(check->in(m));
24072407
}
24082408
} else if (check->is_Con()) {
2409-
if (is_derived) {
2410-
// Derived is NULL+offset
2411-
assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null, "Bad derived pointer");
2409+
if (is_derived && check->bottom_type()->is_ptr()->_offset != 0) {
2410+
// Derived is NULL+non-zero offset, base must be NULL.
2411+
assert(check->bottom_type()->is_ptr()->ptr() == TypePtr::Null, "Bad derived pointer");
24122412
} else {
24132413
assert(check->bottom_type()->is_ptr()->_offset == 0, "Bad base pointer");
24142414
// Base either ConP(NULL) or loadConP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8258243
27+
* @requires vm.debug == true & vm.compiler2.enabled
28+
* @summary Sanity check the -XX:+VerifyRegisterAllocator flag in a hello world program.
29+
*
30+
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+VerifyRegisterAllocator
31+
* compiler.regalloc.TestVerifyRegisterAllocator
32+
*/
33+
package compiler.regalloc;
34+
35+
public class TestVerifyRegisterAllocator {
36+
public static void main(String[] strArr) {
37+
System.out.println("Hello world!");
38+
}
39+
}
40+

0 commit comments

Comments
 (0)
Please sign in to comment.