提交 4c1f83e0 编写于 作者: N never

6857159: local schedule failed with checkcast of Thread.currentThread()

Reviewed-by: kvn
上级 fd5f88b7
......@@ -420,6 +420,13 @@ Form::DataType InstructForm::is_ideal_load() const {
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
Form::DataType InstructForm::is_ideal_store() const {
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
bool InstructForm::needs_anti_dependence_check(FormDict &globals) const {
if ( skip_antidep_check() ) return false;
// Machine independent loads must be checked for anti-dependences
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 ideal_store = Form::none;
......
......@@ -158,6 +158,9 @@ public:
virtual Form::CallType is_ideal_call() const; // matches ideal 'Call'
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'
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
......@@ -1003,6 +1006,9 @@ public:
bool is_ideal_loopEnd() const; // node matches ideal 'LoopEnd'
bool is_ideal_bool() const; // node matches ideal 'Bool'
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'
// Check if 'mRule2' is a cisc-spill variant of this MatchRule
......
/*
* 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();
}
}
}
#!/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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册