Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8275445: RunThese30M.java failed "assert(ZAddress::is_marked(addr)) failed: Should be marked" #6001

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -26,63 +26,20 @@
#include "utilities/macros.hpp"
#if INCLUDE_MANAGEMENT
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "jfr/jfrEvents.hpp"
#include "jfr/jni/jfrJavaSupport.hpp"
#include "jfr/periodic/jfrFinalizerStatisticsEvent.hpp"
#include "jfr/support/jfrSymbolTable.hpp"
#include "jfr/utilities/jfrTime.hpp"
#include "jfr/utilities/jfrTypes.hpp"
#include "oops/instanceKlass.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.inline.hpp"
#include "services/finalizerService.hpp"

static oop get_codesource(oop pd, Thread* thread) {
assert(pd != NULL, "invariant");
assert(thread != NULL, "invariant");
JavaValue result(T_OBJECT);
JfrJavaArguments args(&result);
args.set_klass(pd->klass());
args.set_name("codesource");
args.set_signature("Ljava/security/CodeSource;");
args.set_receiver(pd);
JfrJavaSupport::get_field(&args, thread);
return result.get_oop();
}

// Caller needs ResourceMark
static const char* get_locationNoFragString(oop codesource, Thread* thread) {
assert(codesource != NULL, "invariant");
assert(thread != NULL, "invariant");
JavaValue result(T_OBJECT);
JfrJavaArguments args(&result);
args.set_klass(codesource->klass());
args.set_name("locationNoFragString");
args.set_signature("Ljava/lang/String;");
args.set_receiver(codesource);
JfrJavaSupport::get_field(&args, thread);
const oop string_oop = result.get_oop();
return string_oop != NULL ? JfrJavaSupport::c_str(string_oop, thread) : NULL;
}

// Caller needs ResourceMark
static const char* codesource(const InstanceKlass* ik, Thread* thread) {
assert(ik != NULL, "invariant");
assert(thread != NULL, "invariant");
oop pd = java_lang_Class::protection_domain(ik->java_mirror());
if (pd == NULL) {
return NULL;
}
oop codesource = get_codesource(pd, thread);
return codesource != NULL ? get_locationNoFragString(codesource, thread) : NULL;
}

static void send_event(const FinalizerEntry* fe, const InstanceKlass* ik, const JfrTicks& timestamp, Thread* thread) {
assert(ik != NULL, "invariant");
assert(ik->has_finalizer(), "invariant");
assert(thread != NULL, "invariant");
const char* const url = codesource(ik, thread);
const char* const url = fe != nullptr ? fe->codesource() : nullptr;
const traceid url_symbol_id = url != NULL ? JfrSymbolTable::add(url) : 0;
EventFinalizerStatistics event(UNTIMED);
event.set_endtime(timestamp);
@@ -26,9 +26,12 @@
#include "utilities/macros.hpp"
#if INCLUDE_MANAGEMENT
#include "classfile/classLoaderDataGraph.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/symbolTable.hpp"
#include "memory/resourceArea.hpp"
#include "logging/log.hpp"
#include "runtime/atomic.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/synchronizer.hpp"
@@ -37,15 +40,72 @@
#include "utilities/concurrentHashTableTasks.inline.hpp"
#include "utilities/debug.hpp"

static const char* allocate(oop string) {
char* str = nullptr;
const typeArrayOop value = java_lang_String::value(string);
if (value != nullptr) {
const int length = java_lang_String::utf8_length(string, value);
str = NEW_C_HEAP_ARRAY(char, length, mtServiceability);
java_lang_String::as_utf8_string(string, value, str, length + 1);
}
return str;
}

static int compute_field_offset(const Klass* klass, const char* field_name, const char* field_signature) {
assert(klass != nullptr, "invariant");
Symbol* const name = SymbolTable::new_symbol(field_name);
assert(name != nullptr, "invariant");
Symbol* const signature = SymbolTable::new_symbol(field_signature);
assert(signature != nullptr, "invariant");
assert(klass->is_instance_klass(), "invariant");
fieldDescriptor fd;
InstanceKlass::cast(klass)->find_field(name, signature, false, &fd);
return fd.offset();
}

static const char* location_no_frag_string(oop codesource) {
assert(codesource != nullptr, "invariant");
static int loc_no_frag_offset = compute_field_offset(codesource->klass(), "locationNoFragString", "Ljava/lang/String;");
oop string = codesource->obj_field(loc_no_frag_offset);
return string != nullptr ? allocate(string) : nullptr;
}

static oop codesource(oop pd) {
assert(pd != nullptr, "invariant");
static int codesource_offset = compute_field_offset(pd->klass(), "codesource", "Ljava/security/CodeSource;");
return pd->obj_field(codesource_offset);
}

static const char* get_codesource(const InstanceKlass* ik) {
assert(ik != nullptr, "invariant");
oop pd = java_lang_Class::protection_domain(ik->java_mirror());
if (pd == nullptr) {
return nullptr;
}
oop cs = codesource(pd);
return cs != nullptr ? location_no_frag_string(cs) : nullptr;
}

FinalizerEntry::FinalizerEntry(const InstanceKlass* ik) :
_ik(ik),
_codesource(get_codesource(ik)),
_objects_on_heap(0),
_total_finalizers_run(0) {}

FinalizerEntry::~FinalizerEntry() {
if (_codesource != nullptr) {
FREE_C_HEAP_ARRAY(char, _codesource);
}
}

const InstanceKlass* FinalizerEntry::klass() const {
return _ik;
}

const char* FinalizerEntry::codesource() const {
return _codesource;
}

uintptr_t FinalizerEntry::objects_on_heap() const {
return Atomic::load(&_objects_on_heap);
}
@@ -35,11 +35,14 @@ class Thread;
class FinalizerEntry : public CHeapObj<mtServiceability> {
private:
const InstanceKlass* const _ik;
const char* _codesource;
uintptr_t _objects_on_heap;
uintptr_t _total_finalizers_run;
public:
FinalizerEntry(const InstanceKlass* ik);
~FinalizerEntry();
const InstanceKlass* klass() const NOT_MANAGEMENT_RETURN_(nullptr);
const char* codesource() const NOT_MANAGEMENT_RETURN_(nullptr);
uintptr_t objects_on_heap() const NOT_MANAGEMENT_RETURN_(0L);
uintptr_t total_finalizers_run() const NOT_MANAGEMENT_RETURN_(0L);
void on_register() NOT_MANAGEMENT_RETURN;
@@ -99,7 +99,6 @@ private static void verify(Recording recording) throws Throwable {
break;
}
case TEST_CLASS_UNLOAD_NAME: {
Asserts.assertTrue(event.getString("codeSource").startsWith("file://"));
foundTestClassUnloadName = true;
break;
}