changeset 52996:2e72562697bf

8211394: CHECK_ must be used in the rhs of an assignment statement within a block Summary: replace "return foo(CHECK_X);" with "return foo(THREAD);" Reviewed-by: iklam, phh, stuefe, lfoltan
author dholmes
date Tue, 09 Oct 2018 20:38:13 -0400
parents 49a21be61dcd
children 218b5b64f102
files src/hotspot/share/classfile/verificationType.cpp src/hotspot/share/classfile/verificationType.hpp src/hotspot/share/jvmci/jvmciEnv.cpp src/hotspot/share/oops/constantPool.cpp src/hotspot/share/oops/instanceMirrorKlass.cpp src/hotspot/share/runtime/javaCalls.cpp src/hotspot/share/services/management.cpp src/hotspot/share/utilities/exceptions.hpp
diffstat 8 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/verificationType.cpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/classfile/verificationType.cpp	Tue Oct 09 20:38:13 2018 -0400
@@ -111,7 +111,7 @@
     VerificationType comp_from = from.get_component(context, CHECK_false);
     if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
       return comp_this.is_component_assignable_from(comp_from, context,
-                                          from_field_is_protected, CHECK_false);
+                                                    from_field_is_protected, THREAD);
     }
   }
   return false;
--- a/src/hotspot/share/classfile/verificationType.hpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/classfile/verificationType.hpp	Tue Oct 09 20:38:13 2018 -0400
@@ -312,7 +312,7 @@
         case Short:
           return false;
         default:
-          return is_assignable_from(from, context, from_field_is_protected, CHECK_false);
+          return is_assignable_from(from, context, from_field_is_protected, THREAD);
       }
     }
   }
--- a/src/hotspot/share/jvmci/jvmciEnv.cpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/jvmci/jvmciEnv.cpp	Tue Oct 09 20:38:13 2018 -0400
@@ -148,7 +148,7 @@
                              require_local);
     if (elem_klass != NULL) {
       // Now make an array for it
-      return elem_klass->array_klass(CHECK_NULL);
+      return elem_klass->array_klass(THREAD);
     }
   }
 
--- a/src/hotspot/share/oops/constantPool.cpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/oops/constantPool.cpp	Tue Oct 09 20:38:13 2018 -0400
@@ -472,7 +472,7 @@
     // or any internal exception fields such as cause or stacktrace.  But since the
     // detail message is often a class name or other literal string, we will repeat it
     // if we can find it in the symbol table.
-    throw_resolution_error(this_cp, which, CHECK_0);
+    throw_resolution_error(this_cp, which, CHECK_NULL);
     ShouldNotReachHere();
   }
 
--- a/src/hotspot/share/oops/instanceMirrorKlass.cpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/oops/instanceMirrorKlass.cpp	Tue Oct 09 20:38:13 2018 -0400
@@ -52,7 +52,7 @@
 
   // Since mirrors can be variable sized because of the static fields, store
   // the size in the mirror itself.
-  return (instanceOop)Universe::heap()->class_allocate(this, size, CHECK_NULL);
+  return (instanceOop)Universe::heap()->class_allocate(this, size, THREAD);
 }
 
 int InstanceMirrorKlass::oop_size(oop obj) const {
--- a/src/hotspot/share/runtime/javaCalls.cpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/runtime/javaCalls.cpp	Tue Oct 09 20:38:13 2018 -0400
@@ -307,25 +307,26 @@
   JavaCalls::call_special(&void_result, klass,
                           vmSymbols::object_initializer_name(),
                           constructor_signature, args, CHECK_NH);
+  // Already returned a Null Handle if any exception is pending.
   return obj;
 }
 
 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, TRAPS) {
   JavaCallArguments args;
-  return JavaCalls::construct_new_instance(klass, constructor_signature, &args, CHECK_NH);
+  return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
 }
 
 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, Handle arg1, TRAPS) {
   JavaCallArguments args;
   args.push_oop(arg1);
-  return JavaCalls::construct_new_instance(klass, constructor_signature, &args, CHECK_NH);
+  return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
 }
 
 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, Handle arg1, Handle arg2, TRAPS) {
   JavaCallArguments args;
   args.push_oop(arg1);
   args.push_oop(arg2);
-  return JavaCalls::construct_new_instance(klass, constructor_signature, &args, CHECK_NH);
+  return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
 }
 
 // -------------------------------------------------
--- a/src/hotspot/share/services/management.cpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/services/management.cpp	Tue Oct 09 20:38:13 2018 -0400
@@ -178,7 +178,7 @@
 
 InstanceKlass* Management::load_and_initialize_klass(Symbol* sh, TRAPS) {
   Klass* k = SystemDictionary::resolve_or_fail(sh, true, CHECK_NULL);
-  return initialize_klass(k, CHECK_NULL);
+  return initialize_klass(k, THREAD);
 }
 
 InstanceKlass* Management::load_and_initialize_klass_or_null(Symbol* sh, TRAPS) {
@@ -186,7 +186,7 @@
   if (k == NULL) {
      return NULL;
   }
-  return initialize_klass(k, CHECK_NULL);
+  return initialize_klass(k, THREAD);
 }
 
 InstanceKlass* Management::initialize_klass(Klass* k, TRAPS) {
--- a/src/hotspot/share/utilities/exceptions.hpp	Tue Oct 09 20:19:22 2018 -0400
+++ b/src/hotspot/share/utilities/exceptions.hpp	Tue Oct 09 20:38:13 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -211,7 +211,7 @@
 //
 // CAUTION: make sure that the function call using a CHECK macro is not the only statement of a
 // conditional branch w/o enclosing {} braces, since the CHECK macros expand into several state-
-// ments!
+// ments! Also make sure it is not used on a function call that is part of a return statement!
 
 #define PENDING_EXCEPTION                        (((ThreadShadow*)THREAD)->pending_exception())
 #define HAS_PENDING_EXCEPTION                    (((ThreadShadow*)THREAD)->has_pending_exception())