提交 f16dced3 编写于 作者: P poonam

8187577: JVM crash during gc doing concurrent marking

Summary: Inform G1's SATB that a klass has been resurrected and it should not be unloaded
Reviewed-by: coleenp, tschatzl, kbarrett
上级 682fb626
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
......@@ -27,6 +27,9 @@
#include "memory/universe.inline.hpp"
#include "prims/jvmtiGetLoadedClasses.hpp"
#include "runtime/thread.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#endif
// The closure for GetLoadedClasses
......@@ -35,6 +38,20 @@ private:
Stack<jclass, mtInternal> _classStack;
JvmtiEnv* _env;
// Tell the GC to keep this klass alive
static void ensure_klass_alive(oop o) {
// A klass that was previously considered dead can be looked up in the
// CLD/SD, and its _java_mirror or _class_loader can be stored in a root
// or a reachable object making it alive again. The SATB part of G1 needs
// to get notified about this potential resurrection, otherwise the marking
// might not find the object.
#if INCLUDE_ALL_GCS
if (UseG1GC && o != NULL) {
G1SATBCardTableModRefBS::enqueue(o);
}
#endif
}
public:
LoadedClassesClosure(JvmtiEnv* env) {
_env = env;
......@@ -43,6 +60,7 @@ public:
void do_klass(Klass* k) {
// Collect all jclasses
_classStack.push((jclass) _env->jni_reference(k->java_mirror()));
ensure_klass_alive(k->java_mirror());
}
int extract(jclass* result_list) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册