< prev index next >

src/hotspot/share/ci/ciInstance.cpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1999, 2025, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 1999, 2026, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 22,10 ***
--- 22,11 ---
   *
   */
  
  #include "ci/ciConstant.hpp"
  #include "ci/ciField.hpp"
+ #include "ci/ciInlineKlass.hpp"
  #include "ci/ciInstance.hpp"
  #include "ci/ciInstanceKlass.hpp"
  #include "ci/ciNullObject.hpp"
  #include "ci/ciUtilities.inline.hpp"
  #include "classfile/javaClasses.inline.hpp"

*** 98,18 ***
    }
    add_to_constant_value_cache(offset, value);
    return value;
  }
  
  // ------------------------------------------------------------------
  // ciInstance::field_value
  //
  // Constant value of a field.
  ciConstant ciInstance::field_value(ciField* field) {
    assert(is_loaded(), "invalid access - must be loaded");
    assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
!   assert(field->is_static() || klass()->is_subclass_of(field->holder()), "invalid access - must be subclass");
    return field_value_impl(field->type()->basic_type(), field->offset_in_bytes());
  }
  
  // ------------------------------------------------------------------
  // ciInstance::field_value_by_offset
--- 99,29 ---
    }
    add_to_constant_value_cache(offset, value);
    return value;
  }
  
+ // Constant value of the null marker.
+ ciConstant ciInstance::null_marker_value() {
+   if (!klass()->is_inlinetype()) {
+     return ciConstant();
+   }
+   ciInlineKlass* ik = klass()->as_inline_klass();
+   return field_value_impl(T_BOOLEAN, ik->null_marker_offset_in_payload() + ik->payload_offset());
+ }
+ 
  // ------------------------------------------------------------------
  // ciInstance::field_value
  //
  // Constant value of a field.
  ciConstant ciInstance::field_value(ciField* field) {
    assert(is_loaded(), "invalid access - must be loaded");
    assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
!   assert(field->is_static() || field->holder()->is_inlinetype() || klass()->is_subclass_of(field->holder()),
+          "invalid access - must be subclass");
+ 
    return field_value_impl(field->type()->basic_type(), field->offset_in_bytes());
  }
  
  // ------------------------------------------------------------------
  // ciInstance::field_value_by_offset
< prev index next >