< prev index next >

src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp

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

@@ -25,14 +25,17 @@
  
  #include "asm/macroAssembler.inline.hpp"
  #include "c1/c1_MacroAssembler.hpp"
  #include "c1/c1_Runtime1.hpp"
  #include "gc/shared/collectedHeap.hpp"
+ #include "gc/shared/barrierSet.hpp"
+ #include "gc/shared/barrierSetAssembler.hpp"
  #include "gc/shared/tlab_globals.hpp"
  #include "interpreter/interpreter.hpp"
  #include "oops/arrayOop.hpp"
  #include "oops/markWord.hpp"
+ #include "runtime/arguments.hpp"
  #include "runtime/basicLock.hpp"
  #include "runtime/os.hpp"
  #include "runtime/sharedRuntime.hpp"
  #include "runtime/stubRoutines.hpp"
  #include "utilities/align.hpp"

@@ -43,23 +46,46 @@
  void C1_MacroAssembler::explicit_null_check(Register base) {
    Unimplemented();
  }
  
  
- void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes) {
+ void C1_MacroAssembler::build_frame_helper(int frame_size_in_bytes, int sp_offset_for_orig_pc, int sp_inc, bool reset_orig_pc, bool needs_stack_repair) {
    const Register return_pc = R20;
    mflr(return_pc);
+   std(return_pc, _abi0(lr), R1_SP);    // SP->lr = return_pc
+   push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
+ 
+   if (needs_stack_repair) {
+     // Save stack increment (also account for fixed framesize and rbp)
+     Unimplemented();
+   }
+   if (reset_orig_pc) {
+     // Zero orig_pc to detect deoptimization during buffering in the entry points
+     li(R0, 0);
+     untested("build_frame_helper reset_orig_pc");
+     std(R0, sp_offset_for_orig_pc, R1_SP);
+   }
+ }
+ 
  
+ void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes,
+                                     int sp_offset_for_orig_pc,
+                                     bool needs_stack_repair, bool has_scalarized_args,
+                                     Label* verified_inline_entry_label) {
    // Make sure there is enough stack space for this method's activation.
    assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
    generate_stack_overflow_check(bang_size_in_bytes);
  
-   std(return_pc, _abi0(lr), R1_SP);     // SP->lr = return_pc
-   push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
+   build_frame_helper(frame_size_in_bytes, sp_offset_for_orig_pc, 0, has_scalarized_args, needs_stack_repair);
  
    BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
    bs->nmethod_entry_barrier(this, R20);
+ 
+   if (verified_inline_entry_label != nullptr) {
+     // Jump here from the scalarized entry points that already created the frame.
+     bind(*verified_inline_entry_label);
+   }
  }
  
  
  void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
    if (breakAtEntry) illtrap();

@@ -131,16 +157,24 @@
  
  
  void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
    assert_different_registers(obj, klass, len, t1, t2);
  
-   if (UseCompactObjectHeaders) {
+   if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) {
+     // COH: Markword contains class pointer which is only known at runtime.
+     // Valhalla: Could have value class which has a different prototype header to a normal object.
+     // In both cases, we need to fetch dynamically.
      ld(t1, in_bytes(Klass::prototype_header_offset()), klass);
-     std(t1, oopDesc::mark_offset_in_bytes(), obj);
    } else {
+     // Otherwise: Can use the statically computed prototype header which is the same for every object.
      load_const_optimized(t1, (intx)markWord::prototype().value());
-     std(t1, oopDesc::mark_offset_in_bytes(), obj);
+   }
+   std(t1, oopDesc::mark_offset_in_bytes(), obj);
+ 
+   if (!UseCompactObjectHeaders) {
+     // COH: Markword already contains class pointer. Nothing else to do.
+     // Otherwise: Store encoded klass pointer following the markword
      store_klass(obj, klass);
    }
  
    if (len->is_valid()) {
      stw(len, arrayOopDesc::length_offset_in_bytes(), obj);

@@ -330,5 +364,10 @@
      assert(Lnull != nullptr, "must have Label for explicit check");
      cmpdi(CR0, r, 0);
      bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CR0, Assembler::equal), *Lnull);
    }
  }
+ 
+ int C1_MacroAssembler::scalarized_entry(const CompiledEntrySignature* ces, int frame_size_in_bytes, int bang_size_in_bytes, int sp_offset_for_orig_pc, Label& verified_inline_entry_label, bool is_inline_ro_entry) {
+   Unimplemented();
+ }
+ 
< prev index next >