Skip to content

Commit 7f722b9

Browse files
committed
Merge branch 'master' into backport-raneashay-f4209dff-master
2 parents 9a372d8 + 2dd96cd commit 7f722b9

153 files changed

Lines changed: 10222 additions & 7156 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

make/autoconf/flags-other.m4

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -115,7 +115,11 @@ AC_DEFUN([FLAGS_SETUP_ASFLAGS],
115115
# Force preprocessor to run, just to make sure
116116
BASIC_ASFLAGS="-x assembler-with-cpp"
117117
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
118-
BASIC_ASFLAGS="-nologo -c"
118+
if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
119+
BASIC_ASFLAGS="-nologo"
120+
else
121+
BASIC_ASFLAGS="-nologo -c"
122+
fi
119123
fi
120124
AC_SUBST(BASIC_ASFLAGS)
121125

make/autoconf/toolchain.m4

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,11 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
655655
if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
656656
AS="$CC -c"
657657
else
658-
if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
659-
# On 64 bit windows, the assembler is "ml64.exe"
658+
if test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
659+
# On Windows aarch64, the assembler is "armasm64.exe"
660+
UTIL_LOOKUP_TOOLCHAIN_PROGS(AS, armasm64)
661+
elif test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
662+
# On Windows x64, the assembler is "ml64.exe"
660663
UTIL_LOOKUP_TOOLCHAIN_PROGS(AS, ml64)
661664
else
662665
# otherwise, the assembler is "ml.exe"

make/common/native/CompileFile.gmk

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ define CreateCompiledNativeFileBody
155155
endif
156156
$1_FLAGS := $$($1_FLAGS) -DASSEMBLY_SRC_FILE='"$$($1_REL_ASM_SRC)"' \
157157
-include $(TOPDIR)/make/data/autoheaders/assemblyprefix.h
158+
else ifeq ($(TOOLCHAIN_TYPE), microsoft)
159+
ifeq ($(OPENJDK_TARGET_CPU), aarch64)
160+
$1_NON_ASM_EXTENSION_FLAG :=
161+
else
162+
$1_NON_ASM_EXTENSION_FLAG := "-Ta"
163+
endif
158164
endif
159165
else ifneq ($$(filter %.cpp %.cc %.mm, $$($1_FILENAME)), )
160166
# Compile as a C++ or Objective-C++ file
@@ -236,7 +242,7 @@ define CreateCompiledNativeFileBody
236242
# For assembler calls just create empty dependency lists
237243
$$(call ExecuteWithLog, $$@, $$(call MakeCommandRelative, \
238244
$$($1_COMPILER) $$($1_FLAGS) \
239-
$(CC_OUT_OPTION)$$($1_OBJ) -Ta $$($1_SRC_FILE))) \
245+
$(CC_OUT_OPTION)$$($1_OBJ) $$($1_NON_ASM_EXTENSION_FLAG) $$($1_SRC_FILE))) \
240246
| $(TR) -d '\r' | $(GREP) -v -e "Assembling:" || test "$$$$?" = "1" ; \
241247
$(ECHO) > $$($1_DEPS_FILE) ; \
242248
$(ECHO) > $$($1_DEPS_TARGETS_FILE)

src/hotspot/share/cds/aotConstantPoolResolver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ bool AOTConstantPoolResolver::check_lambda_metafactory_signature(ConstantPool* c
408408
}
409409

410410
bool AOTConstantPoolResolver::check_lambda_metafactory_methodtype_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i) {
411-
int mt_index = cp->operand_argument_index_at(bsms_attribute_index, arg_i);
411+
int mt_index = cp->bsm_attribute_entry(bsms_attribute_index)->argument_index(arg_i);
412412
if (!cp->tag_at(mt_index).is_method_type()) {
413413
// malformed class?
414414
return false;
@@ -424,7 +424,7 @@ bool AOTConstantPoolResolver::check_lambda_metafactory_methodtype_arg(ConstantPo
424424
}
425425

426426
bool AOTConstantPoolResolver::check_lambda_metafactory_methodhandle_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i) {
427-
int mh_index = cp->operand_argument_index_at(bsms_attribute_index, arg_i);
427+
int mh_index = cp->bsm_attribute_entry(bsms_attribute_index)->argument_index(arg_i);
428428
if (!cp->tag_at(mh_index).is_method_handle()) {
429429
// malformed class?
430430
return false;
@@ -563,7 +563,7 @@ bool AOTConstantPoolResolver::is_indy_resolution_deterministic(ConstantPool* cp,
563563
}
564564

565565
int bsms_attribute_index = cp->bootstrap_methods_attribute_index(cp_index);
566-
int arg_count = cp->operand_argument_count_at(bsms_attribute_index);
566+
int arg_count = cp->bsm_attribute_entry(bsms_attribute_index)->argument_count();
567567
if (arg_count != 3) {
568568
// Malformed class?
569569
return false;

src/hotspot/share/oops/constantPool.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,18 +1937,20 @@ int ConstantPool::find_matching_entry(int pattern_i,
19371937
// Compare this constant pool's bootstrap specifier at idx1 to the constant pool
19381938
// cp2's bootstrap specifier at idx2.
19391939
bool ConstantPool::compare_operand_to(int idx1, const constantPoolHandle& cp2, int idx2) {
1940-
int k1 = operand_bootstrap_method_ref_index_at(idx1);
1941-
int k2 = cp2->operand_bootstrap_method_ref_index_at(idx2);
1940+
BSMAttributeEntry* e1 = bsm_attribute_entry(idx1);
1941+
BSMAttributeEntry* e2 = cp2->bsm_attribute_entry(idx2);
1942+
int k1 = e1->bootstrap_method_index();
1943+
int k2 = e2->bootstrap_method_index();
19421944
bool match = compare_entry_to(k1, cp2, k2);
19431945

19441946
if (!match) {
19451947
return false;
19461948
}
1947-
int argc = operand_argument_count_at(idx1);
1948-
if (argc == cp2->operand_argument_count_at(idx2)) {
1949+
int argc = e1->argument_count();
1950+
if (argc == e2->argument_count()) {
19491951
for (int j = 0; j < argc; j++) {
1950-
k1 = operand_argument_index_at(idx1, j);
1951-
k2 = cp2->operand_argument_index_at(idx2, j);
1952+
k1 = e1->argument_index(j);
1953+
k2 = e2->argument_index(j);
19521954
match = compare_entry_to(k1, cp2, k2);
19531955
if (!match) {
19541956
return false;

src/hotspot/share/oops/constantPool.hpp

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,43 @@ class CPKlassSlot {
7777
}
7878
};
7979

80+
class BSMAttributeEntry {
81+
friend class ConstantPool;
82+
u2 _bootstrap_method_index;
83+
u2 _argument_count;
84+
85+
// The argument indexes are stored right after the object, in a contiguous array.
86+
// [ bsmi_0 argc_0 arg_00 arg_01 ... arg_0N bsmi_1 argc_1 arg_10 ... arg_1N ... ]
87+
// So in order to find the argument array, jump over ourselves.
88+
const u2* argument_indexes() const {
89+
return reinterpret_cast<const u2*>(this + 1);
90+
}
91+
u2* argument_indexes() {
92+
return reinterpret_cast<u2*>(this + 1);
93+
}
94+
// These are overlays on top of the operands array. Do not construct.
95+
BSMAttributeEntry() = delete;
96+
97+
public:
98+
// Offsets for SA
99+
enum {
100+
_bsmi_offset = 0,
101+
_argc_offset = 1,
102+
_argv_offset = 2
103+
};
104+
105+
int bootstrap_method_index() const {
106+
return _bootstrap_method_index;
107+
}
108+
int argument_count() const {
109+
return _argument_count;
110+
}
111+
int argument_index(int n) const {
112+
assert(checked_cast<u2>(n) < _argument_count, "oob");
113+
return argument_indexes()[n];
114+
}
115+
};
116+
80117
class ConstantPool : public Metadata {
81118
friend class VMStructs;
82119
friend class JVMCIVMStructs;
@@ -519,10 +556,6 @@ class ConstantPool : public Metadata {
519556
assert(tag_at(cp_index).has_bootstrap(), "Corrupted constant pool");
520557
return extract_low_short_from_int(*int_at_addr(cp_index));
521558
}
522-
int bootstrap_operand_base(int cp_index) {
523-
int bsms_attribute_index = bootstrap_methods_attribute_index(cp_index);
524-
return operand_offset_at(operands(), bsms_attribute_index);
525-
}
526559
// The first part of the operands array consists of an index into the second part.
527560
// Extract a 32-bit index value from the first part.
528561
static int operand_offset_at(Array<u2>* operands, int bsms_attribute_index) {
@@ -560,47 +593,26 @@ class ConstantPool : public Metadata {
560593
else
561594
return operand_offset_at(operands, nextidx);
562595
}
563-
int bootstrap_operand_limit(int cp_index) {
564-
int bsms_attribute_index = bootstrap_methods_attribute_index(cp_index);
565-
return operand_limit_at(operands(), bsms_attribute_index);
566-
}
567596
#endif //ASSERT
568597

569-
// Layout of InvokeDynamic and Dynamic bootstrap method specifier
570-
// data in second part of operands array. This encodes one record in
571-
// the BootstrapMethods attribute. The whole specifier also includes
572-
// the name and type information from the main constant pool entry.
573-
enum {
574-
_indy_bsm_offset = 0, // CONSTANT_MethodHandle bsm
575-
_indy_argc_offset = 1, // u2 argc
576-
_indy_argv_offset = 2 // u2 argv[argc]
577-
};
578-
579598
// These functions are used in RedefineClasses for CP merge
580-
581599
int operand_offset_at(int bsms_attribute_index) {
582600
assert(0 <= bsms_attribute_index &&
583601
bsms_attribute_index < operand_array_length(operands()),
584602
"Corrupted CP operands");
585603
return operand_offset_at(operands(), bsms_attribute_index);
586604
}
587-
u2 operand_bootstrap_method_ref_index_at(int bsms_attribute_index) {
588-
int offset = operand_offset_at(bsms_attribute_index);
589-
return operands()->at(offset + _indy_bsm_offset);
590-
}
591-
u2 operand_argument_count_at(int bsms_attribute_index) {
592-
int offset = operand_offset_at(bsms_attribute_index);
593-
u2 argc = operands()->at(offset + _indy_argc_offset);
594-
return argc;
595-
}
596-
u2 operand_argument_index_at(int bsms_attribute_index, int j) {
605+
606+
BSMAttributeEntry* bsm_attribute_entry(int bsms_attribute_index) {
597607
int offset = operand_offset_at(bsms_attribute_index);
598-
return operands()->at(offset + _indy_argv_offset + j);
608+
return reinterpret_cast<BSMAttributeEntry*>(operands()->adr_at(offset));
599609
}
610+
600611
int operand_next_offset_at(int bsms_attribute_index) {
601-
int offset = operand_offset_at(bsms_attribute_index) + _indy_argv_offset
602-
+ operand_argument_count_at(bsms_attribute_index);
603-
return offset;
612+
BSMAttributeEntry* bsme = bsm_attribute_entry(bsms_attribute_index);
613+
u2* argv_start = bsme->argument_indexes();
614+
int offset = argv_start - operands()->data();
615+
return offset + bsme->argument_count();
604616
}
605617
// Compare a bootstrap specifier data in the operands arrays
606618
bool compare_operand_to(int bsms_attribute_index1, const constantPoolHandle& cp2,
@@ -617,23 +629,19 @@ class ConstantPool : public Metadata {
617629

618630
u2 bootstrap_method_ref_index_at(int cp_index) {
619631
assert(tag_at(cp_index).has_bootstrap(), "Corrupted constant pool");
620-
int op_base = bootstrap_operand_base(cp_index);
621-
return operands()->at(op_base + _indy_bsm_offset);
632+
int bsmai = bootstrap_methods_attribute_index(cp_index);
633+
return bsm_attribute_entry(bsmai)->bootstrap_method_index();
622634
}
623635
u2 bootstrap_argument_count_at(int cp_index) {
624636
assert(tag_at(cp_index).has_bootstrap(), "Corrupted constant pool");
625-
int op_base = bootstrap_operand_base(cp_index);
626-
u2 argc = operands()->at(op_base + _indy_argc_offset);
627-
DEBUG_ONLY(int end_offset = op_base + _indy_argv_offset + argc;
628-
int next_offset = bootstrap_operand_limit(cp_index));
629-
assert(end_offset == next_offset, "matched ending");
630-
return argc;
637+
int bsmai = bootstrap_methods_attribute_index(cp_index);
638+
return bsm_attribute_entry(bsmai)->argument_count();
631639
}
632640
u2 bootstrap_argument_index_at(int cp_index, int j) {
633-
int op_base = bootstrap_operand_base(cp_index);
634-
DEBUG_ONLY(int argc = operands()->at(op_base + _indy_argc_offset));
635-
assert((uint)j < (uint)argc, "oob");
636-
return operands()->at(op_base + _indy_argv_offset + j);
641+
int bsmai = bootstrap_methods_attribute_index(cp_index);
642+
BSMAttributeEntry* bsme = bsm_attribute_entry(bsmai);
643+
assert((uint)j < (uint)bsme->argument_count(), "oob");
644+
return bsm_attribute_entry(bsmai)->argument_index(j);
637645
}
638646

639647
// The following methods (name/signature/klass_ref_at, klass_ref_at_noresolve,

src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ void JvmtiClassFileReconstituter::write_bootstrapmethod_attribute() {
396396
// calculate length of attribute
397397
u4 length = sizeof(u2); // num_bootstrap_methods
398398
for (int n = 0; n < num_bootstrap_methods; n++) {
399-
u2 num_bootstrap_arguments = cpool()->operand_argument_count_at(n);
399+
u2 num_bootstrap_arguments = cpool()->bsm_attribute_entry(n)->argument_count();
400400
length += sizeof(u2); // bootstrap_method_ref
401401
length += sizeof(u2); // num_bootstrap_arguments
402402
length += (u4)sizeof(u2) * num_bootstrap_arguments; // bootstrap_arguments[num_bootstrap_arguments]
@@ -406,12 +406,12 @@ void JvmtiClassFileReconstituter::write_bootstrapmethod_attribute() {
406406
// write attribute
407407
write_u2(checked_cast<u2>(num_bootstrap_methods));
408408
for (int n = 0; n < num_bootstrap_methods; n++) {
409-
u2 bootstrap_method_ref = cpool()->operand_bootstrap_method_ref_index_at(n);
410-
u2 num_bootstrap_arguments = cpool()->operand_argument_count_at(n);
411-
write_u2(bootstrap_method_ref);
409+
BSMAttributeEntry* bsme = cpool()->bsm_attribute_entry(n);
410+
u2 num_bootstrap_arguments = bsme->argument_count();
411+
write_u2(bsme->bootstrap_method_index());
412412
write_u2(num_bootstrap_arguments);
413413
for (int arg = 0; arg < num_bootstrap_arguments; arg++) {
414-
u2 bootstrap_argument = cpool()->operand_argument_index_at(n, arg);
414+
u2 bootstrap_argument = bsme->argument_index(arg);
415415
write_u2(bootstrap_argument);
416416
}
417417
}

src/hotspot/share/prims/jvmtiRedefineClasses.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,11 @@ u2 VM_RedefineClasses::find_or_append_indirect_entry(const constantPoolHandle& s
662662
// Append a bootstrap specifier into the merge_cp operands that is semantically equal
663663
// to the scratch_cp operands bootstrap specifier passed by the old_bs_i index.
664664
// Recursively append new merge_cp entries referenced by the new bootstrap specifier.
665-
void VM_RedefineClasses::append_operand(const constantPoolHandle& scratch_cp, int old_bs_i,
665+
void VM_RedefineClasses::append_operand(const constantPoolHandle& scratch_cp, const int old_bs_i,
666666
constantPoolHandle *merge_cp_p, int *merge_cp_length_p) {
667667

668-
u2 old_ref_i = scratch_cp->operand_bootstrap_method_ref_index_at(old_bs_i);
668+
BSMAttributeEntry* old_bsme = scratch_cp->bsm_attribute_entry(old_bs_i);
669+
u2 old_ref_i = old_bsme->bootstrap_method_index();
669670
u2 new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p,
670671
merge_cp_length_p);
671672
if (new_ref_i != old_ref_i) {
@@ -679,14 +680,14 @@ void VM_RedefineClasses::append_operand(const constantPoolHandle& scratch_cp, in
679680
// However, the operand_offset_at(0) was set in the extend_operands() call.
680681
int new_base = (new_bs_i == 0) ? (*merge_cp_p)->operand_offset_at(0)
681682
: (*merge_cp_p)->operand_next_offset_at(new_bs_i - 1);
682-
u2 argc = scratch_cp->operand_argument_count_at(old_bs_i);
683+
u2 argc = old_bsme->argument_count();
683684

684685
ConstantPool::operand_offset_at_put(merge_ops, _operands_cur_length, new_base);
685686
merge_ops->at_put(new_base++, new_ref_i);
686687
merge_ops->at_put(new_base++, argc);
687688

688689
for (int i = 0; i < argc; i++) {
689-
u2 old_arg_ref_i = scratch_cp->operand_argument_index_at(old_bs_i, i);
690+
u2 old_arg_ref_i = old_bsme->argument_index(i);
690691
u2 new_arg_ref_i = find_or_append_indirect_entry(scratch_cp, old_arg_ref_i, merge_cp_p,
691692
merge_cp_length_p);
692693
merge_ops->at_put(new_base++, new_arg_ref_i);

src/hotspot/share/runtime/vmStructs.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,13 +1502,13 @@
15021502
\
15031503
declare_constant(Symbol::max_symbol_length) \
15041504
\
1505-
/***********************************************/ \
1506-
/* ConstantPool* layout enum for InvokeDynamic */ \
1507-
/***********************************************/ \
1505+
/******************************************************/ \
1506+
/* BSMAttributeEntry* - layout enum for InvokeDynamic */ \
1507+
/******************************************************/ \
15081508
\
1509-
declare_constant(ConstantPool::_indy_bsm_offset) \
1510-
declare_constant(ConstantPool::_indy_argc_offset) \
1511-
declare_constant(ConstantPool::_indy_argv_offset) \
1509+
declare_constant(BSMAttributeEntry::_bsmi_offset) \
1510+
declare_constant(BSMAttributeEntry::_argc_offset) \
1511+
declare_constant(BSMAttributeEntry::_argv_offset) \
15121512
\
15131513
/***************************************/ \
15141514
/* JavaThreadStatus enum */ \

0 commit comments

Comments
 (0)