# HG changeset patch # User hseigel # Date 1533579658 14400 # Node ID 82adcc8ad853af288ac5122ecc1e29b28881cd24 # Parent f7236b46b60c50b75b1bd146548bfe3cfa1130e4 8208604: Metadata::print_value_string() compares 'this' to NULL Summary: Remove the comparison and add asserts to check for NULL Reviewed-by: coleenp, gziemski diff -r f7236b46b60c -r 82adcc8ad853 src/hotspot/share/c1/c1_Runtime1.cpp --- a/src/hotspot/share/c1/c1_Runtime1.cpp Mon Aug 06 13:57:26 2018 -0400 +++ b/src/hotspot/share/c1/c1_Runtime1.cpp Mon Aug 06 14:20:58 2018 -0400 @@ -568,6 +568,7 @@ if (log_is_enabled(Info, exceptions)) { ResourceMark rm; stringStream tempst; + assert(nm->method() != NULL, "Unexpected NULL method()"); tempst.print("compiled method <%s>\n" " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, nm->method()->print_value_string(), p2i(pc), p2i(thread)); diff -r f7236b46b60c -r 82adcc8ad853 src/hotspot/share/code/compiledIC.cpp --- a/src/hotspot/share/code/compiledIC.cpp Mon Aug 06 13:57:26 2018 -0400 +++ b/src/hotspot/share/code/compiledIC.cpp Mon Aug 06 14:20:58 2018 -0400 @@ -252,6 +252,7 @@ if (TraceICs) { ResourceMark rm; + assert(!call_info->selected_method().is_null(), "Unexpected null selected method"); tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT, p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry)); } diff -r f7236b46b60c -r 82adcc8ad853 src/hotspot/share/jvmci/jvmciRuntime.cpp --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp Mon Aug 06 13:57:26 2018 -0400 +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp Mon Aug 06 14:20:58 2018 -0400 @@ -281,6 +281,7 @@ if (log_is_enabled(Info, exceptions)) { ResourceMark rm; stringStream tempst; + assert(cm->method() != NULL, "Unexpected null method()"); tempst.print("compiled method <%s>\n" " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, cm->method()->print_value_string(), p2i(pc), p2i(thread)); diff -r f7236b46b60c -r 82adcc8ad853 src/hotspot/share/oops/metadata.cpp --- a/src/hotspot/share/oops/metadata.cpp Mon Aug 06 13:57:26 2018 -0400 +++ b/src/hotspot/share/oops/metadata.cpp Mon Aug 06 14:20:58 2018 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -44,10 +44,6 @@ char* Metadata::print_value_string() const { char buf[256]; stringStream st(buf, sizeof(buf)); - if (this == NULL) { - st.print("NULL"); - } else { - print_value_on(&st); - } + print_value_on(&st); return st.as_string(); }