< prev index next >

src/hotspot/share/runtime/handles.inline.hpp

Print this page
@@ -32,23 +32,23 @@
  #include "oops/oop.hpp"
  
  // these inline functions are in a separate file to break an include cycle
  // between Thread and Handle
  
- inline Handle::Handle(Thread* thread, oop obj) {
+ inline Handle::Handle(Thread* thread, oop obj, bool allocNull) {
    assert(thread == Thread::current(), "sanity check");
-   if (obj == NULL) {
+   if (obj == NULL && !allocNull) {
      _handle = NULL;
    } else {
      _handle = thread->handle_area()->allocate_handle(obj);
    }
  }
  
  // Inline constructors for Specific Handles for different oop types
  #define DEF_HANDLE_CONSTR(type, is_a)                   \
- inline type##Handle::type##Handle (Thread* thread, type##Oop obj) : Handle(thread, (oop)obj) { \
-   assert(is_null() || ((oop)obj)->is_a(), "illegal type");                \
+ inline type##Handle::type##Handle (Thread* thread, type##Oop obj, bool allocNull) : Handle(thread, (oop)obj, allocNull) { \
+   assert(is_null() || (allocNull && obj == NULL) || ((oop)obj)->is_a(), "illegal type");                \
  }
  
  DEF_HANDLE_CONSTR(instance , is_instance_noinline )
  DEF_HANDLE_CONSTR(array    , is_array_noinline    )
  DEF_HANDLE_CONSTR(objArray , is_objArray_noinline )
< prev index next >