Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hotspot/cpu/s390/interp_masm_s390.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -780,7 +780,7 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
get_method(R_method);
verify_oop(Z_tos, state);
push(state); // Save tos/result.
testbit(method2_(R_method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
testbit_ushort(method2_(R_method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
z_bfalse(unlocked);

// Don't unlock anything if the _do_not_unlock_if_synchronized flag
Expand Down
14 changes: 13 additions & 1 deletion src/hotspot/cpu/s390/macroAssembler_s390.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* Copyright 2024 IBM Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -1015,6 +1015,18 @@ void MacroAssembler::load_and_test_long(Register dst, const Address &a) {
z_ltg(dst, a);
}

// Test a bit in memory for 2 byte datatype.
void MacroAssembler::testbit_ushort(const Address &a, unsigned int bit) {
assert(a.index() == noreg, "no index reg allowed in testbit");
if (bit <= 7) {
z_tm(a.disp() + 1, a.base(), 1 << bit);
} else if (bit <= 15) {
z_tm(a.disp() + 0, a.base(), 1 << (bit - 8));
} else {
ShouldNotReachHere();
}
}

// Test a bit in memory.
void MacroAssembler::testbit(const Address &a, unsigned int bit) {
assert(a.index() == noreg, "no index reg allowed in testbit");
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/cpu/s390/macroAssembler_s390.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* Copyright (c) 2024 IBM Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -199,6 +199,7 @@ class MacroAssembler: public Assembler {

// Test a bit in memory. Result is reflected in CC.
void testbit(const Address &a, unsigned int bit);
void testbit_ushort(const Address &a, unsigned int bit);
// Test a bit in a register. Result is reflected in CC.
void testbit(Register r, unsigned int bitPos);

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/s390/sharedRuntime_s390.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -2395,7 +2395,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;

{ // Bypass the barrier for non-static methods
__ testbit(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT);
__ testbit_ushort(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT);
__ z_bfalse(L_skip_barrier); // non-static
}

Expand Down
24 changes: 13 additions & 11 deletions src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -164,7 +164,7 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
// Therefore add 3 to address that byte within "_flags".
// Reload method. VM call above may have destroyed register contents
__ get_method(method);
__ testbit(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
__ testbit_ushort(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
method = noreg; // end of life
__ z_btrue(isStatic);

Expand Down Expand Up @@ -883,7 +883,7 @@ void TemplateInterpreterGenerator::lock_method(void) {
address reentry = nullptr;
{
Label L;
__ testbit(method2_(method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ testbit_ushort(method2_(method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ z_btrue(L);
reentry = __ stop_chain_static(reentry, "method doesn't need synchronization");
__ bind(L);
Expand All @@ -897,7 +897,7 @@ void TemplateInterpreterGenerator::lock_method(void) {
Label done;
Label static_method;

__ testbit(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
__ testbit_ushort(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
__ z_btrue(static_method);

// non-static method: Load receiver obj from stack.
Expand Down Expand Up @@ -1349,15 +1349,17 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {

// Make sure method is native and not abstract.
#ifdef ASSERT
// _access_flags must be a 16 bit value.
assert(sizeof(AccessFlags) == 2, "testbit_ushort will fail");
address reentry = nullptr;
{ Label L;
__ testbit(method_(access_flags), JVM_ACC_NATIVE_BIT);
__ testbit_ushort(method_(access_flags), JVM_ACC_NATIVE_BIT);
__ z_btrue(L);
reentry = __ stop_chain_static(reentry, "tried to execute non-native method as native");
__ bind(L);
}
{ Label L;
__ testbit(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
__ testbit_ushort(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "tried to execute abstract method as non-abstract");
__ bind(L);
Expand Down Expand Up @@ -1403,7 +1405,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
#ifdef ASSERT
{ Label L;
__ get_method(Z_R1_scratch);
__ testbit(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "method needs synchronization");
__ bind(L);
Expand Down Expand Up @@ -1461,7 +1463,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Pass mirror handle if static call.
{
Label method_is_not_static;
__ testbit(method2_(Rmethod, access_flags), JVM_ACC_STATIC_BIT);
__ testbit_ushort(method2_(Rmethod, access_flags), JVM_ACC_STATIC_BIT);
__ z_bfalse(method_is_not_static);
// Load mirror from interpreter frame.
__ z_lg(Z_R1, _z_ijava_state_neg(mirror), Z_fp);
Expand Down Expand Up @@ -1719,13 +1721,13 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
address reentry = nullptr;
{ Label L;
__ testbit(method_(access_flags), JVM_ACC_NATIVE_BIT);
__ testbit_ushort(method_(access_flags), JVM_ACC_NATIVE_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "tried to execute native method as non-native");
__ bind(L);
}
{ Label L;
__ testbit(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
__ testbit_ushort(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "tried to execute abstract method as non-abstract");
__ bind(L);
Expand Down Expand Up @@ -1775,7 +1777,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
{ Label L;
__ get_method(Z_R1_scratch);
__ testbit(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "method needs synchronization");
__ bind(L);
Expand Down