mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
6857159: local schedule failed with checkcast of Thread.currentThread()
Reviewed-by: kvn
This commit is contained in:
parent
7229ae9b95
commit
62ca1df1dd
4 changed files with 170 additions and 0 deletions
|
@ -420,6 +420,13 @@ Form::DataType InstructForm::is_ideal_load() const {
|
||||||
return _matrule->is_ideal_load();
|
return _matrule->is_ideal_load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return 'true' if this instruction matches an ideal 'LoadKlass' node
|
||||||
|
bool InstructForm::skip_antidep_check() const {
|
||||||
|
if( _matrule == NULL ) return false;
|
||||||
|
|
||||||
|
return _matrule->skip_antidep_check();
|
||||||
|
}
|
||||||
|
|
||||||
// Return 'true' if this instruction matches an ideal 'Load?' node
|
// Return 'true' if this instruction matches an ideal 'Load?' node
|
||||||
Form::DataType InstructForm::is_ideal_store() const {
|
Form::DataType InstructForm::is_ideal_store() const {
|
||||||
if( _matrule == NULL ) return Form::none;
|
if( _matrule == NULL ) return Form::none;
|
||||||
|
@ -567,6 +574,8 @@ bool InstructForm::rematerialize(FormDict &globals, RegisterForm *registers ) {
|
||||||
|
|
||||||
// loads from memory, so must check for anti-dependence
|
// loads from memory, so must check for anti-dependence
|
||||||
bool InstructForm::needs_anti_dependence_check(FormDict &globals) const {
|
bool InstructForm::needs_anti_dependence_check(FormDict &globals) const {
|
||||||
|
if ( skip_antidep_check() ) return false;
|
||||||
|
|
||||||
// Machine independent loads must be checked for anti-dependences
|
// Machine independent loads must be checked for anti-dependences
|
||||||
if( is_ideal_load() != Form::none ) return true;
|
if( is_ideal_load() != Form::none ) return true;
|
||||||
|
|
||||||
|
@ -3957,6 +3966,28 @@ Form::DataType MatchRule::is_ideal_load() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool MatchRule::skip_antidep_check() const {
|
||||||
|
// Some loads operate on what is effectively immutable memory so we
|
||||||
|
// should skip the anti dep computations. For some of these nodes
|
||||||
|
// the rewritable field keeps the anti dep logic from triggering but
|
||||||
|
// for certain kinds of LoadKlass it does not since they are
|
||||||
|
// actually reading memory which could be rewritten by the runtime,
|
||||||
|
// though never by generated code. This disables it uniformly for
|
||||||
|
// the nodes that behave like this: LoadKlass, LoadNKlass and
|
||||||
|
// LoadRange.
|
||||||
|
if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
|
||||||
|
const char *opType = _rChild->_opType;
|
||||||
|
if (strcmp("LoadKlass", opType) == 0 ||
|
||||||
|
strcmp("LoadNKlass", opType) == 0 ||
|
||||||
|
strcmp("LoadRange", opType) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Form::DataType MatchRule::is_ideal_store() const {
|
Form::DataType MatchRule::is_ideal_store() const {
|
||||||
Form::DataType ideal_store = Form::none;
|
Form::DataType ideal_store = Form::none;
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,9 @@ public:
|
||||||
|
|
||||||
virtual Form::CallType is_ideal_call() const; // matches ideal 'Call'
|
virtual Form::CallType is_ideal_call() const; // matches ideal 'Call'
|
||||||
virtual Form::DataType is_ideal_load() const; // node matches ideal 'LoadXNode'
|
virtual Form::DataType is_ideal_load() const; // node matches ideal 'LoadXNode'
|
||||||
|
// Should antidep checks be disabled for this Instruct
|
||||||
|
// See definition of MatchRule::skip_antidep_check
|
||||||
|
bool skip_antidep_check() const;
|
||||||
virtual Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
|
virtual Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
|
||||||
bool is_ideal_mem() const { return is_ideal_load() != Form::none || is_ideal_store() != Form::none; }
|
bool is_ideal_mem() const { return is_ideal_load() != Form::none || is_ideal_store() != Form::none; }
|
||||||
virtual uint two_address(FormDict &globals); // output reg must match input reg
|
virtual uint two_address(FormDict &globals); // output reg must match input reg
|
||||||
|
@ -1003,6 +1006,9 @@ public:
|
||||||
bool is_ideal_loopEnd() const; // node matches ideal 'LoopEnd'
|
bool is_ideal_loopEnd() const; // node matches ideal 'LoopEnd'
|
||||||
bool is_ideal_bool() const; // node matches ideal 'Bool'
|
bool is_ideal_bool() const; // node matches ideal 'Bool'
|
||||||
Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode'
|
Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode'
|
||||||
|
// Should antidep checks be disabled for this rule
|
||||||
|
// See definition of MatchRule::skip_antidep_check
|
||||||
|
bool skip_antidep_check() const;
|
||||||
Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
|
Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
|
||||||
|
|
||||||
// Check if 'mRule2' is a cisc-spill variant of this MatchRule
|
// Check if 'mRule2' is a cisc-spill variant of this MatchRule
|
||||||
|
|
68
hotspot/test/compiler/6857159/Test6857159.java
Normal file
68
hotspot/test/compiler/6857159/Test6857159.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6857159
|
||||||
|
* @summary local schedule failed with checkcast of Thread.currentThread()
|
||||||
|
*
|
||||||
|
* @run shell Test6857159.sh
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Test6857159 extends Thread {
|
||||||
|
static class ct0 extends Test6857159 {
|
||||||
|
public void message() {
|
||||||
|
// System.out.println("message");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
message();
|
||||||
|
ct0 ct = (ct0) Thread.currentThread();
|
||||||
|
ct.message();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static class ct1 extends ct0 {
|
||||||
|
public void message() {
|
||||||
|
// System.out.println("message");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static class ct2 extends ct0 {
|
||||||
|
public void message() {
|
||||||
|
// System.out.println("message");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
for (int i = 0; i < 100000; i++) {
|
||||||
|
Thread t = null;
|
||||||
|
switch (i % 3) {
|
||||||
|
case 0: t = new ct0(); break;
|
||||||
|
case 1: t = new ct1(); break;
|
||||||
|
case 2: t = new ct2(); break;
|
||||||
|
}
|
||||||
|
t.start();
|
||||||
|
t.join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
hotspot/test/compiler/6857159/Test6857159.sh
Normal file
65
hotspot/test/compiler/6857159/Test6857159.sh
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
# CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
# have any questions.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${TESTSRC}" = "" ]
|
||||||
|
then
|
||||||
|
echo "TESTSRC not set. Test cannot execute. Failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "TESTSRC=${TESTSRC}"
|
||||||
|
if [ "${TESTJAVA}" = "" ]
|
||||||
|
then
|
||||||
|
echo "TESTJAVA not set. Test cannot execute. Failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "TESTJAVA=${TESTJAVA}"
|
||||||
|
if [ "${TESTCLASSES}" = "" ]
|
||||||
|
then
|
||||||
|
echo "TESTCLASSES not set. Test cannot execute. Failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "TESTCLASSES=${TESTCLASSES}"
|
||||||
|
echo "CLASSPATH=${CLASSPATH}"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
cp ${TESTSRC}/Test6857159.java .
|
||||||
|
cp ${TESTSRC}/Test6857159.sh .
|
||||||
|
|
||||||
|
${TESTJAVA}/bin/javac -d . Test6857159.java
|
||||||
|
|
||||||
|
${TESTJAVA}/bin/java ${TESTVMOPTS} -Xbatch -XX:+PrintCompilation -XX:CompileOnly=Test6857159\$ct.run Test6857159 > test.out 2>&1
|
||||||
|
|
||||||
|
grep "COMPILE SKIPPED" test.out
|
||||||
|
|
||||||
|
result=$?
|
||||||
|
if [ $result -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "Passed"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue