< prev index next >

src/hotspot/share/ci/ciObjArray.cpp

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
+  * 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.

@@ -24,19 +24,21 @@
  
  #include "ci/ciNullObject.hpp"
  #include "ci/ciObjArray.hpp"
  #include "ci/ciUtilities.inline.hpp"
  #include "oops/objArrayOop.inline.hpp"
+ #include "oops/oopCast.inline.hpp"
  
  // ciObjArray
  //
  // This class represents an objArrayOop in the HotSpot virtual
  // machine.
  
  ciObject* ciObjArray::obj_at(int index) {
    VM_ENTRY_MARK;
-   objArrayOop array = get_objArrayOop();
+   // The array should be a refArray, otherwise a ciFlatArray object would have been used
+   refArrayOop array = oop_cast<refArrayOop>(get_objArrayOop());
    assert(index >= 0 && index < array->length(), "OOB access");
    oop o = array->obj_at(index);
    if (o == nullptr) {
      return ciNullObject::make();
    } else {
< prev index next >