8154589: assert(k != NULL) failed: preloaded klass not initialized

Reviewed-by: sspitsyn, hseigel
This commit is contained in:
David Holmes 2016-05-26 20:43:13 -04:00
parent 33dc2cac3c
commit 6253b1d251
2 changed files with 20 additions and 14 deletions

View File

@ -420,9 +420,9 @@ public:
// Initialization
static void initialize(TRAPS);
// Fast access to commonly used classes (preloaded)
// Checked fast access to commonly used classes - mostly preloaded
static InstanceKlass* check_klass(InstanceKlass* k) {
assert(k != NULL, "preloaded klass not initialized");
assert(k != NULL, "klass not loaded");
return k;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -201,10 +201,12 @@ void VM_Verify::doit() {
}
bool VM_PrintThreads::doit_prologue() {
assert(Thread::current()->is_Java_thread(), "just checking");
// Make sure AbstractOwnableSynchronizer is loaded
java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
JavaThread* jt = JavaThread::current();
java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(jt);
if (jt->has_pending_exception()) {
return false;
}
// Get Heap_lock if concurrent locks will be dumped
if (_print_concurrent_locks) {
@ -240,11 +242,13 @@ VM_FindDeadlocks::~VM_FindDeadlocks() {
}
bool VM_FindDeadlocks::doit_prologue() {
assert(Thread::current()->is_Java_thread(), "just checking");
// Load AbstractOwnableSynchronizer class
if (_concurrent_locks) {
java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
// Make sure AbstractOwnableSynchronizer is loaded
JavaThread* jt = JavaThread::current();
java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(jt);
if (jt->has_pending_exception()) {
return false;
}
}
return true;
@ -298,10 +302,12 @@ VM_ThreadDump::VM_ThreadDump(ThreadDumpResult* result,
}
bool VM_ThreadDump::doit_prologue() {
assert(Thread::current()->is_Java_thread(), "just checking");
// Load AbstractOwnableSynchronizer class before taking thread snapshots
java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
// Make sure AbstractOwnableSynchronizer is loaded
JavaThread* jt = JavaThread::current();
java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(jt);
if (jt->has_pending_exception()) {
return false;
}
if (_with_locked_synchronizers) {
// Acquire Heap_lock to dump concurrent locks