diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.hpp b/src/hotspot/cpu/aarch64/frame_aarch64.hpp index ac4740645b8..55a6dde38f5 100644 --- a/src/hotspot/cpu/aarch64/frame_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/frame_aarch64.hpp @@ -186,8 +186,6 @@ // deoptimization support void interpreter_frame_set_last_sp(intptr_t* sp); - static jint interpreter_frame_expression_stack_direction() { return -1; } - // returns the sending frame, without applying any barriers inline frame sender_raw(RegisterMap* map) const; diff --git a/src/hotspot/cpu/arm/frame_arm.hpp b/src/hotspot/cpu/arm/frame_arm.hpp index 2ef44414e1c..8ca7a555b93 100644 --- a/src/hotspot/cpu/arm/frame_arm.hpp +++ b/src/hotspot/cpu/arm/frame_arm.hpp @@ -122,6 +122,4 @@ // helper to update a map with callee-saved FP static void update_map_with_saved_link(RegisterMap* map, intptr_t** link_addr); - static jint interpreter_frame_expression_stack_direction() { return -1; } - #endif // CPU_ARM_FRAME_ARM_HPP diff --git a/src/hotspot/cpu/ppc/frame_ppc.hpp b/src/hotspot/cpu/ppc/frame_ppc.hpp index bf49bbb7e01..43d5fd41068 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.hpp @@ -407,8 +407,6 @@ align_wiggle = 1 }; - static jint interpreter_frame_expression_stack_direction() { return -1; } - // returns the sending frame, without applying any barriers inline frame sender_raw(RegisterMap* map) const; diff --git a/src/hotspot/cpu/riscv/frame_riscv.hpp b/src/hotspot/cpu/riscv/frame_riscv.hpp index d5f04ee3ff7..5cf341aa21b 100644 --- a/src/hotspot/cpu/riscv/frame_riscv.hpp +++ b/src/hotspot/cpu/riscv/frame_riscv.hpp @@ -218,8 +218,6 @@ // deoptimization support void interpreter_frame_set_last_sp(intptr_t* last_sp); - static jint interpreter_frame_expression_stack_direction() { return -1; } - // returns the sending frame, without applying any barriers inline frame sender_raw(RegisterMap* map) const; diff --git a/src/hotspot/cpu/s390/frame_s390.hpp b/src/hotspot/cpu/s390/frame_s390.hpp index 36fc5970cd8..8a99bdb8df5 100644 --- a/src/hotspot/cpu/s390/frame_s390.hpp +++ b/src/hotspot/cpu/s390/frame_s390.hpp @@ -572,8 +572,6 @@ align_wiggle = 0 }; - static jint interpreter_frame_expression_stack_direction() { return -1; } - // returns the sending frame, without applying any barriers inline frame sender_raw(RegisterMap* map) const; diff --git a/src/hotspot/cpu/x86/frame_x86.hpp b/src/hotspot/cpu/x86/frame_x86.hpp index d97e6b847b4..50f0c6b7eb6 100644 --- a/src/hotspot/cpu/x86/frame_x86.hpp +++ b/src/hotspot/cpu/x86/frame_x86.hpp @@ -170,8 +170,6 @@ // deoptimization support void interpreter_frame_set_last_sp(intptr_t* sp); - static jint interpreter_frame_expression_stack_direction() { return -1; } - // returns the sending frame, without applying any barriers inline frame sender_raw(RegisterMap* map) const; diff --git a/src/hotspot/cpu/zero/frame_zero.hpp b/src/hotspot/cpu/zero/frame_zero.hpp index 45d1cb82e82..514b134e36b 100644 --- a/src/hotspot/cpu/zero/frame_zero.hpp +++ b/src/hotspot/cpu/zero/frame_zero.hpp @@ -82,8 +82,6 @@ char* buf, int buflen) const; - static jint interpreter_frame_expression_stack_direction() { return -1; } - inline address* sender_pc_addr() const; template diff --git a/src/hotspot/share/interpreter/abstractInterpreter.hpp b/src/hotspot/share/interpreter/abstractInterpreter.hpp index 23618cb037e..6c555f0c008 100644 --- a/src/hotspot/share/interpreter/abstractInterpreter.hpp +++ b/src/hotspot/share/interpreter/abstractInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -262,8 +262,8 @@ class AbstractInterpreter: AllStatic { #endif // Local values relative to locals[n] - static int local_offset_in_bytes(int n) { - return ((frame::interpreter_frame_expression_stack_direction() * n) * stackElementSize); + static int local_offset_in_bytes(int n) { + return -n * stackElementSize; } // access to stacked values according to type: diff --git a/src/hotspot/share/runtime/frame.cpp b/src/hotspot/share/runtime/frame.cpp index 3e45b6fe310..2b0dd59deba 100644 --- a/src/hotspot/share/runtime/frame.cpp +++ b/src/hotspot/share/runtime/frame.cpp @@ -500,23 +500,16 @@ intptr_t* frame::interpreter_frame_local_at(int index) const { } intptr_t* frame::interpreter_frame_expression_stack_at(jint offset) const { - const int i = offset * interpreter_frame_expression_stack_direction(); - const int n = i * Interpreter::stackElementWords; - return &(interpreter_frame_expression_stack()[n]); + const int n = offset * Interpreter::stackElementWords; + return interpreter_frame_expression_stack() - n; } jint frame::interpreter_frame_expression_stack_size() const { // Number of elements on the interpreter expression stack // Callers should span by stackElementWords int element_size = Interpreter::stackElementWords; - size_t stack_size = 0; - if (frame::interpreter_frame_expression_stack_direction() < 0) { - stack_size = (interpreter_frame_expression_stack() - - interpreter_frame_tos_address() + 1)/element_size; - } else { - stack_size = (interpreter_frame_tos_address() - - interpreter_frame_expression_stack() + 1)/element_size; - } + size_t stack_size = (interpreter_frame_expression_stack() - + interpreter_frame_tos_address() + 1)/element_size; assert(stack_size <= (size_t)max_jint, "stack size too big"); return (jint)stack_size; } @@ -791,14 +784,8 @@ class InterpreterFrameClosure : public OffsetClosure { } else { addr = (oop*) _fr->interpreter_frame_expression_stack_at((offset - _max_locals)); // In case of exceptions, the expression stack is invalid and the esp will be reset to express - // this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp for Intel). - bool in_stack; - if (frame::interpreter_frame_expression_stack_direction() > 0) { - in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address(); - } else { - in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address(); - } - if (in_stack) { + // this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp). + if ((intptr_t*)addr >= _fr->interpreter_frame_tos_address()) { _f->do_oop(addr); } } diff --git a/src/hotspot/share/runtime/vframe.cpp b/src/hotspot/share/runtime/vframe.cpp index c9628255e45..02386537004 100644 --- a/src/hotspot/share/runtime/vframe.cpp +++ b/src/hotspot/share/runtime/vframe.cpp @@ -318,13 +318,9 @@ static StackValue* create_stack_value_from_oop_map(const InterpreterOopMap& oop_ static bool is_in_expression_stack(const frame& fr, const intptr_t* const addr) { assert(addr != nullptr, "invariant"); - // Ensure to be 'inside' the expression stack (i.e., addr >= sp for Intel). + // Ensure to be 'inside' the expression stack (i.e., addr >= sp). // In case of exceptions, the expression stack is invalid and the sp // will be reset to express this condition. - if (frame::interpreter_frame_expression_stack_direction() > 0) { - return addr <= fr.interpreter_frame_tos_address(); - } - return addr >= fr.interpreter_frame_tos_address(); } diff --git a/src/hotspot/share/runtime/vframeArray.cpp b/src/hotspot/share/runtime/vframeArray.cpp index 6810d7bb8d3..0885262eefb 100644 --- a/src/hotspot/share/runtime/vframeArray.cpp +++ b/src/hotspot/share/runtime/vframeArray.cpp @@ -473,12 +473,7 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters, "expression stack size should have been extended"); #endif // ASSERT int top_element = iframe()->interpreter_frame_expression_stack_size()-1; - intptr_t* base; - if (frame::interpreter_frame_expression_stack_direction() < 0) { - base = iframe()->interpreter_frame_expression_stack_at(top_element); - } else { - base = iframe()->interpreter_frame_expression_stack(); - } + intptr_t* base = iframe()->interpreter_frame_expression_stack_at(top_element); Copy::conjoint_jbytes(saved_args, base, popframe_preserved_args_size_in_bytes);