< prev index next >

src/hotspot/share/jfr/dcmd/jfrDcmds.cpp

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

@@ -35,10 +35,11 @@
  #include "logging/logMessage.hpp"
  #include "memory/arena.hpp"
  #include "memory/resourceArea.hpp"
  #include "oops/objArrayOop.inline.hpp"
  #include "oops/oop.inline.hpp"
+ #include "oops/oopCast.inline.hpp"
  #include "oops/symbol.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/jniHandles.hpp"
  #include "services/diagnosticArgument.hpp"
  #include "services/diagnosticFramework.hpp"

@@ -110,13 +111,12 @@
      }
    }
  }
  
  static void print_message(outputStream* output, oop content, TRAPS) {
-   objArrayOop lines = objArrayOop(content);
-   assert(lines != nullptr, "invariant");
-   assert(lines->is_array(), "must be array");
+   assert(content != nullptr, "invariant");
+   refArrayOop lines = oop_cast<refArrayOop>(content);
    const int length = lines->length();
    for (int i = 0; i < length; ++i) {
      const char* text = JfrJavaSupport::c_str(lines->obj_at(i), THREAD);
      if (text == nullptr) {
        // An oome has been thrown and is pending.

@@ -126,13 +126,12 @@
    }
  }
  
  static void log(oop content, TRAPS) {
    LogMessage(jfr,startup) msg;
-   objArrayOop lines = objArrayOop(content);
-   assert(lines != nullptr, "invariant");
-   assert(lines->is_array(), "must be array");
+   assert(content != nullptr, "invariant");
+   refArrayOop lines = oop_cast<refArrayOop>(content);
    const int length = lines->length();
    for (int i = 0; i < length; ++i) {
      const char* text = JfrJavaSupport::c_str(lines->obj_at(i), THREAD);
      if (text == nullptr) {
        // An oome has been thrown and is pending.

@@ -350,13 +349,13 @@
      thread->clear_pending_exception();
      initialize_dummy_descriptors(array);
      assert(array->length() == _num_arguments, "invariant");
      return array;
    }
-   objArrayOop arguments = objArrayOop(result.get_oop());
-   assert(arguments != nullptr, "invariant");
-   assert(arguments->is_array(), "must be array");
+   oop oop_args = result.get_oop();
+   assert(oop_args != nullptr, "invariant");
+   refArrayOop arguments = oop_cast<refArrayOop>(oop_args);
    const int num_arguments = arguments->length();
    assert(num_arguments == _num_arguments, "invariant");
    prepare_dcmd_string_arena(thread);
    for (int i = 0; i < num_arguments; ++i) {
      DCmdArgumentInfo* const dai = create_info(arguments->obj_at(i), thread);
< prev index next >