Skip to content

Commit

Permalink
Merge jdk-11.0.23+9
Browse files Browse the repository at this point in the history
  • Loading branch information
benty-amzn committed Apr 9, 2024
2 parents f719787 + 7a35698 commit 1e3fe62
Show file tree
Hide file tree
Showing 24 changed files with 862 additions and 191 deletions.
2 changes: 1 addition & 1 deletion make/autoconf/version-numbers
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DEFAULT_VERSION_DATE=2024-04-16
DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11"
DEFAULT_PROMOTED_VERSION_PRE=ea
DEFAULT_PROMOTED_VERSION_PRE=

LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
Expand Down
8 changes: 5 additions & 3 deletions src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -166,8 +166,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
if (index->is_register()) {
// apply the shift and accumulate the displacement
if (shift > 0) {
LIR_Opr tmp = new_pointer_register();
__ shift_left(index, shift, tmp);
// Use long register to avoid overflow when shifting large index values left.
LIR_Opr tmp = new_register(T_LONG);
__ convert(Bytecodes::_i2l, index, tmp);
__ shift_left(tmp, shift, tmp);
index = tmp;
}
if (large_disp != 0) {
Expand Down
8 changes: 5 additions & 3 deletions src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -162,8 +162,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
if (index->is_register()) {
// Apply the shift and accumulate the displacement.
if (shift > 0) {
LIR_Opr tmp = new_pointer_register();
__ shift_left(index, shift, tmp);
// Use long register to avoid overflow when shifting large index values left.
LIR_Opr tmp = new_register(T_LONG);
__ convert(Bytecodes::_i2l, index, tmp);
__ shift_left(tmp, shift, tmp);
index = tmp;
}
if (large_disp != 0) {
Expand Down
8 changes: 5 additions & 3 deletions src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -156,8 +156,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
return new LIR_Address(base, index, type);
} else {
if (shift > 0) {
LIR_Opr tmp = new_pointer_register();
__ shift_left(index, shift, tmp);
// Use long register to avoid overflow when shifting large index values left.
LIR_Opr tmp = new_register(T_LONG);
__ convert(Bytecodes::_i2l, index, tmp);
__ shift_left(tmp, shift, tmp);
index = tmp;
}
return new LIR_Address(base, index, disp, type);
Expand Down
8 changes: 5 additions & 3 deletions src/hotspot/cpu/sparc/c1_LIRGenerator_sparc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, 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
Expand Down Expand Up @@ -160,8 +160,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
if (index->is_register()) {
// apply the shift and accumulate the displacement
if (shift > 0) {
LIR_Opr tmp = new_pointer_register();
__ shift_left(index, shift, tmp);
// Use long register to avoid overflow when shifting large index values left.
LIR_Opr tmp = new_register(T_LONG);
__ convert(Bytecodes::_i2l, index, tmp);
__ shift_left(tmp, shift, tmp);
index = tmp;
}
if (large_disp != 0) {
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/adlc/output_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3040,6 +3040,9 @@ static void define_fill_new_machnode(bool used, FILE *fp_cpp) {
fprintf(fp_cpp, " if( i != cisc_operand() ) \n");
fprintf(fp_cpp, " to[i] = _opnds[i]->clone();\n");
fprintf(fp_cpp, " }\n");
fprintf(fp_cpp, " // Do not increment node index counter, since node reuses my index\n");
fprintf(fp_cpp, " Compile* C = Compile::current();\n");
fprintf(fp_cpp, " C->set_unique(C->unique() - 1);\n");
fprintf(fp_cpp, "}\n");
}
fprintf(fp_cpp, "\n");
Expand Down
13 changes: 6 additions & 7 deletions src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,14 +1921,13 @@ oop java_lang_Throwable::message(oop throwable) {
}


// Return Symbol for detailed_message or NULL
Symbol* java_lang_Throwable::detail_message(oop throwable) {
PRESERVE_EXCEPTION_MARK; // Keep original exception
oop detailed_message = java_lang_Throwable::message(throwable);
if (detailed_message != NULL) {
return java_lang_String::as_symbol(detailed_message, THREAD);
const char* java_lang_Throwable::message_as_utf8(oop throwable) {
oop msg = java_lang_Throwable::message(throwable);
const char* msg_utf8 = NULL;
if (msg != NULL) {
msg_utf8 = java_lang_String::as_utf8_string(msg);
}
return NULL;
return msg_utf8;
}

void java_lang_Throwable::set_message(oop throwable, oop value) {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/classfile/javaClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,11 @@ class java_lang_Throwable: AllStatic {
static void set_depth(oop throwable, int value);
// Needed by JVMTI to filter out this internal field.
static int get_backtrace_offset() { return backtrace_offset;}
static int get_detailMessage_offset() { return detailMessage_offset;}
// Message
static int get_detailMessage_offset() { return detailMessage_offset;}
static oop message(oop throwable);
static const char* message_as_utf8(oop throwable);
static void set_message(oop throwable, oop value);
static Symbol* detail_message(oop throwable);
static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
static void print_stack_usage(Handle stream);

Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/share/classfile/resolutionErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// add new entry to the table
void ResolutionErrorTable::add_entry(int index, unsigned int hash,
const constantPoolHandle& pool, int cp_index,
Symbol* error, Symbol* message)
Symbol* error, const char* message)
{
assert_locked_or_safepoint(SystemDictionary_lock);
assert(!pool.is_null() && error != NULL, "adding NULL obj");
Expand Down Expand Up @@ -64,16 +64,14 @@ void ResolutionErrorEntry::set_error(Symbol* e) {
_error->increment_refcount();
}

void ResolutionErrorEntry::set_message(Symbol* c) {
assert(c != NULL, "must set a value");
_message = c;
_message->increment_refcount();
void ResolutionErrorEntry::set_message(const char* c) {
_message = c != NULL ? os::strdup(c) : NULL;
}

// create new error entry
ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, ConstantPool* pool,
int cp_index, Symbol* error,
Symbol* message)
const char* message)
{
ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::new_entry(hash, pool);
entry->set_cp_index(cp_index);
Expand All @@ -87,7 +85,9 @@ void ResolutionErrorTable::free_entry(ResolutionErrorEntry *entry) {
// decrement error refcount
assert(entry->error() != NULL, "error should be set");
entry->error()->decrement_refcount();
entry->message()->decrement_refcount();
if (entry->message() != NULL) {
FREE_C_HEAP_ARRAY(char, entry->message());
}
Hashtable<ConstantPool*, mtClass>::free_entry(entry);
}

Expand Down
11 changes: 6 additions & 5 deletions src/hotspot/share/classfile/resolutionErrors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ResolutionErrorTable : public Hashtable<ConstantPool*, mtClass> {
ResolutionErrorTable(int table_size);

ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index,
Symbol* error, Symbol* message);
Symbol* error, const char* message);
void free_entry(ResolutionErrorEntry *entry);

ResolutionErrorEntry* bucket(int i) {
Expand All @@ -62,7 +62,7 @@ class ResolutionErrorTable : public Hashtable<ConstantPool*, mtClass> {
}

void add_entry(int index, unsigned int hash,
const constantPoolHandle& pool, int which, Symbol* error, Symbol* message);
const constantPoolHandle& pool, int cp_index, Symbol* error, const char* error_msg);


// find error given the constant pool and constant pool index
Expand Down Expand Up @@ -94,7 +94,7 @@ class ResolutionErrorEntry : public HashtableEntry<ConstantPool*, mtClass> {
private:
int _cp_index;
Symbol* _error;
Symbol* _message;
const char* _message;

public:
ConstantPool* pool() const { return literal(); }
Expand All @@ -105,8 +105,9 @@ class ResolutionErrorEntry : public HashtableEntry<ConstantPool*, mtClass> {
Symbol* error() const { return _error; }
void set_error(Symbol* e);

Symbol* message() const { return _message; }
void set_message(Symbol* c);
const char* message() const { return _message; }
// The incoming message is copied to the C-Heap.
void set_message(const char* c);

ResolutionErrorEntry* next() const {
return (ResolutionErrorEntry*)HashtableEntry<ConstantPool*, mtClass>::next();
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/classfile/systemDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,7 @@ bool SystemDictionary::add_loader_constraint(Symbol* class_name,
// Add entry to resolution error table to record the error when the first
// attempt to resolve a reference to a class has failed.
void SystemDictionary::add_resolution_error(const constantPoolHandle& pool, int which,
Symbol* error, Symbol* message) {
Symbol* error, const char* message) {
unsigned int hash = resolution_errors()->compute_hash(pool, which);
int index = resolution_errors()->hash_to_index(hash);
{
Expand All @@ -2306,7 +2306,7 @@ void SystemDictionary::delete_resolution_error(ConstantPool* pool) {

// Lookup resolution error table. Returns error if found, otherwise NULL.
Symbol* SystemDictionary::find_resolution_error(const constantPoolHandle& pool, int which,
Symbol** message) {
const char** message) {
unsigned int hash = resolution_errors()->compute_hash(pool, which);
int index = resolution_errors()->hash_to_index(hash);
{
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/classfile/systemDictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ class SystemDictionary : AllStatic {
// Record the error when the first attempt to resolve a reference from a constant
// pool entry to a class fails.
static void add_resolution_error(const constantPoolHandle& pool, int which, Symbol* error,
Symbol* message);
const char* message);
static void delete_resolution_error(ConstantPool* pool);
static Symbol* find_resolution_error(const constantPoolHandle& pool, int which,
Symbol** message);
const char** message);


static ProtectionDomainCacheEntry* cache_get(Handle protection_domain);
Expand Down
23 changes: 14 additions & 9 deletions src/hotspot/share/oops/constantPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,13 +734,16 @@ void ConstantPool::resolve_string_constants_impl(const constantPoolHandle& this_
}
}

Symbol* ConstantPool::exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception) {
const char* ConstantPool::exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception) {
// Note: caller needs ResourceMark

// Dig out the detailed message to reuse if possible
Symbol* message = java_lang_Throwable::detail_message(pending_exception);
if (message != NULL) {
return message;
const char* msg = java_lang_Throwable::message_as_utf8(pending_exception);
if (msg != NULL) {
return msg;
}

Symbol* message = NULL;
// Return specific message for the tag
switch (tag.value()) {
case JVM_CONSTANT_UnresolvedClass:
Expand All @@ -763,16 +766,16 @@ Symbol* ConstantPool::exception_message(const constantPoolHandle& this_cp, int w
ShouldNotReachHere();
}

return message;
return message != NULL ? message->as_C_string() : NULL;
}

void ConstantPool::throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS) {
Symbol* message = NULL;
ResourceMark rm(THREAD);
const char* message = NULL;
Symbol* error = SystemDictionary::find_resolution_error(this_cp, which, &message);
assert(error != NULL && message != NULL, "checking");
CLEAR_PENDING_EXCEPTION;
ResourceMark rm;
THROW_MSG(error, message->as_C_string());
THROW_MSG(error, message);
}

// If resolution for Class, Dynamic constant, MethodHandle or MethodType fails, save the
Expand All @@ -790,7 +793,9 @@ void ConstantPool::save_and_throw_exception(const constantPoolHandle& this_cp, i
// and OutOfMemoryError, etc, or if the thread was hit by stop()
// Needs clarification to section 5.4.3 of the VM spec (see 6308271)
} else if (this_cp->tag_at(which).value() != error_tag) {
Symbol* message = exception_message(this_cp, which, tag, PENDING_EXCEPTION);
ResourceMark rm(THREAD);

const char* message = exception_message(this_cp, which, tag, PENDING_EXCEPTION);
SystemDictionary::add_resolution_error(this_cp, which, error, message);
// CAS in the tag. If a thread beat us to registering this error that's fine.
// If another thread resolved the reference, this is a race condition. This
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/constantPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ class ConstantPool : public Metadata {
bool must_resolve, Handle if_not_available, TRAPS);

// Exception handling
static Symbol* exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception);
static const char* exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception);
static void save_and_throw_exception(const constantPoolHandle& this_cp, int which, constantTag tag, TRAPS);

public:
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/oops/cpCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@ bool ConstantPoolCacheEntry::save_and_throw_indy_exc(
CLEAR_PENDING_EXCEPTION;
return false;
}

ResourceMark rm(THREAD);
Symbol* error = PENDING_EXCEPTION->klass()->name();
Symbol* message = java_lang_Throwable::detail_message(PENDING_EXCEPTION);
const char* message = java_lang_Throwable::message_as_utf8(PENDING_EXCEPTION);
assert(message != NULL, "Missing detail message");

SystemDictionary::add_resolution_error(cpool, index, error, message);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/utilities/exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,11 @@ void Exceptions::debug_check_abort_helper(Handle exception, const char* message)
// for logging exceptions
void Exceptions::log_exception(Handle exception, const char* message) {
ResourceMark rm;
Symbol* detail_message = java_lang_Throwable::detail_message(exception());
const char* detail_message = java_lang_Throwable::message_as_utf8(exception());
if (detail_message != NULL) {
log_info(exceptions)("Exception <%s: %s>\n thrown in %s",
exception->print_value_string(),
detail_message->as_C_string(),
detail_message,
message);
} else {
log_info(exceptions)("Exception <%s>\n thrown in %s",
Expand Down
Loading

0 comments on commit 1e3fe62

Please sign in to comment.