Skip to content
Permalink
Browse files
8280601: ClhsdbThreadContext.java test is triggering codecache relate…
…d asserts

Reviewed-by: kevinw, sspitsyn
  • Loading branch information
plummercj committed Feb 1, 2022
1 parent 9ca7ff3 commit 85d839fb4f3f820d130ea95f9a54ae137a95c20a
Showing 2 changed files with 29 additions and 14 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2022, 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
@@ -135,9 +135,17 @@ public static PointerLocation find(Address a) {
CodeCache c = VM.getVM().getCodeCache();
if (c.contains(a)) {
loc.inCodeCache = true;
loc.blob = c.findBlobUnsafe(a);
if (Assert.ASSERTS_ENABLED) {
Assert.that(loc.blob != null, "Should have found CodeBlob");
try {
loc.blob = c.findBlobUnsafe(a);
} catch (Exception e) {
// Since we potentially have a random address in the codecache and therefore could
// be dealing with a freed or partialy intialized blob, exceptions are possible.
}
if (loc.blob == null) {
// It's possible that there is no CodeBlob for this address. Let
// PointerLocation deal with it.
loc.inBlobUnknownLocation = true;
return loc;
}
loc.inBlobCode = loc.blob.codeContains(a);
loc.inBlobData = loc.blob.dataContains(a);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2022, 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
@@ -301,18 +301,25 @@ public void printOn(PrintStream tty, boolean printAddress, boolean verbose) {
} else if (isInBlobOops()) {
tty.print("oops");
} else {
if (Assert.ASSERTS_ENABLED) {
Assert.that(isInBlobUnknownLocation(), "Should have known location in CodeBlob");
}
tty.print("unknown location");
tty.print("unknown CodeCache location");
}
tty.print(" in ");
if (verbose) {
b.printOn(tty); // includes "\n"
if (b == null) {
tty.println();
} else {
tty.println(b.toString());
tty.print(" in ");
// Since we potentially have a random address in the codecache and therefore could
// be dealing with a freed or partialy intialized blob, exceptions are possible.
// One known case is an NMethod where the method is still null, resulting in an NPE.
try {
if (verbose) {
b.printOn(tty); // includes "\n"
} else {
tty.println(b.toString());
}
} catch (Exception e) {
tty.println("<unknown>");
}
}

// FIXME: add more detail
} else if (isInStrongGlobalJNIHandles()) {
tty.println("In JNI strong global");

1 comment on commit 85d839f

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 85d839f Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.