< prev index next >

src/hotspot/share/interpreter/bootstrapInfo.cpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2019, 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) 2019, 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.

*** 34,10 ***
--- 34,11 ---
  #include "memory/oopFactory.hpp"
  #include "memory/resourceArea.hpp"
  #include "oops/constantPool.inline.hpp"
  #include "oops/cpCache.inline.hpp"
  #include "oops/objArrayOop.inline.hpp"
+ #include "oops/oopCast.inline.hpp"
  #include "oops/resolvedIndyEntry.hpp"
  #include "oops/typeArrayOop.inline.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/javaThread.hpp"
  #include "runtime/vmThread.hpp"

*** 185,12 ***
        use_BSCI = false;
    }
  
    if (!use_BSCI) {
      // return {arg...}; resolution of arguments is done immediately, before JDK code is called
!     objArrayOop args_oop = oopFactory::new_objArray(vmClasses::Object_klass(), _argc, CHECK);
!     objArrayHandle args(THREAD, args_oop);
      _pool->copy_bootstrap_arguments_at(_bss_index, 0, _argc, args, 0, true, Handle(), CHECK);
      oop arg_oop = ((_argc == 1) ? args->obj_at(0) : (oop)nullptr);
      // try to discard the singleton array
      if (arg_oop != nullptr && !arg_oop->is_array()) {
        // JVM treats arrays and nulls specially in this position,
--- 186,12 ---
        use_BSCI = false;
    }
  
    if (!use_BSCI) {
      // return {arg...}; resolution of arguments is done immediately, before JDK code is called
!     refArrayOop args_oop = oopFactory::new_refArray(vmClasses::Object_klass(),_argc, CHECK);
!     refArrayHandle args(THREAD, args_oop);
      _pool->copy_bootstrap_arguments_at(_bss_index, 0, _argc, args, 0, true, Handle(), CHECK);
      oop arg_oop = ((_argc == 1) ? args->obj_at(0) : (oop)nullptr);
      // try to discard the singleton array
      if (arg_oop != nullptr && !arg_oop->is_array()) {
        // JVM treats arrays and nulls specially in this position,

*** 268,18 ***
    // How the array of resolved arguments is printed depends highly
    // on how BootstrapInfo::resolve_args structures the array based on
    // the use_BSCI setting.
    if (_arg_values.not_null()) {
      // Find the static arguments within the first element of _arg_values.
!     objArrayOop static_args = (objArrayOop)_arg_values();
      if (!static_args->is_array()) {
        assert(_argc == 1, "Invalid BSM _arg_values for non-array");
        st->print("  resolved arg[0]: "); static_args->print_on(st);
!     } else if (static_args->is_objArray()) {
        int lines = 0;
        for (int i = 0; i < _argc; i++) {
!         oop x = static_args->obj_at(i);
          if (x != nullptr) {
            if (++lines > 6) {
              st->print_cr("  resolved arg[%d]: ...", i);
              break;
            }
--- 269,19 ---
    // How the array of resolved arguments is printed depends highly
    // on how BootstrapInfo::resolve_args structures the array based on
    // the use_BSCI setting.
    if (_arg_values.not_null()) {
      // Find the static arguments within the first element of _arg_values.
!     oop static_args = _arg_values();
      if (!static_args->is_array()) {
        assert(_argc == 1, "Invalid BSM _arg_values for non-array");
        st->print("  resolved arg[0]: "); static_args->print_on(st);
!     } else if (static_args->is_refArray()) {
+       refArrayOop static_args_array = oop_cast<refArrayOop>(static_args);
        int lines = 0;
        for (int i = 0; i < _argc; i++) {
!         oop x = static_args_array->obj_at(i);
          if (x != nullptr) {
            if (++lines > 6) {
              st->print_cr("  resolved arg[%d]: ...", i);
              break;
            }

*** 289,8 ***
--- 291,10 ---
      } else if (static_args->is_typeArray()) {
        typeArrayOop tmp_array = (typeArrayOop) static_args;
        assert(tmp_array->length() == 2, "Invalid BSM _arg_values type array");
        st->print_cr("  resolved arg[0]: %d", tmp_array->int_at(0));
        st->print_cr("  resolved arg[1]: %d", tmp_array->int_at(1));
+     } else if (static_args->is_flatArray()) {
+       ShouldNotReachHere();
      }
    }
  }
< prev index next >