Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
theaoqi committed Apr 26, 2024
2 parents 2e3590a + 05f18b1 commit 9888334
Show file tree
Hide file tree
Showing 22 changed files with 364 additions and 132 deletions.
4 changes: 2 additions & 2 deletions make/conf/version-numbers.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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 @@ -39,4 +39,4 @@ DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="20 21"
DEFAULT_JDK_SOURCE_TARGET_VERSION=21
DEFAULT_PROMOTED_VERSION_PRE=ea
DEFAULT_PROMOTED_VERSION_PRE=
6 changes: 4 additions & 2 deletions src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,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, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -165,8 +165,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, 2023, 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 @@ -157,8 +157,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
19 changes: 9 additions & 10 deletions src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2073,18 +2073,17 @@ oop java_lang_Throwable::message(oop throwable) {
return throwable->obj_field(_detailMessage_offset);
}

oop java_lang_Throwable::cause(oop throwable) {
return throwable->obj_field(_cause_offset);
const char* java_lang_Throwable::message_as_utf8(oop throwable) {
oop msg = java_lang_Throwable::message(throwable);
const char* msg_utf8 = nullptr;
if (msg != nullptr) {
msg_utf8 = java_lang_String::as_utf8_string(msg);
}
return msg_utf8;
}

// Return Symbol for detailed_message or null
Symbol* java_lang_Throwable::detail_message(oop throwable) {
PreserveExceptionMark pm(Thread::current());
oop detailed_message = java_lang_Throwable::message(throwable);
if (detailed_message != nullptr) {
return java_lang_String::as_symbol(detailed_message);
}
return nullptr;
oop java_lang_Throwable::cause(oop throwable) {
return throwable->obj_field(_cause_offset);
}

void java_lang_Throwable::set_message(oop throwable, oop value) {
Expand Down
8 changes: 5 additions & 3 deletions src/hotspot/share/classfile/javaClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,14 @@ class java_lang_Throwable: AllStatic {
static void set_backtrace(oop throwable, oop value);
static int depth(oop throwable);
static void set_depth(oop throwable, int value);
static int get_detailMessage_offset() { CHECK_INIT(_detailMessage_offset); }
// Message
static int get_detailMessage_offset() { CHECK_INIT(_detailMessage_offset); }
static oop message(oop throwable);
static oop cause(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 oop cause(oop throwable);

static void print_stack_element(outputStream *st, Method* method, int bci);

static void compute_offsets();
Expand Down
24 changes: 14 additions & 10 deletions src/hotspot/share/classfile/resolutionErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ void ResolutionErrorTable::initialize() {

// create new error entry
void ResolutionErrorTable::add_entry(const constantPoolHandle& pool, int cp_index,
Symbol* error, Symbol* message,
Symbol* cause, Symbol* cause_msg)
Symbol* error, const char* message,
Symbol* cause, const char* cause_msg)
{
assert_locked_or_safepoint(SystemDictionary_lock);
assert(!pool.is_null() && error != nullptr, "adding null obj");
Expand Down Expand Up @@ -97,26 +97,30 @@ ResolutionErrorEntry* ResolutionErrorTable::find_entry(const constantPoolHandle&
return entry == nullptr ? nullptr : *entry;
}

ResolutionErrorEntry::ResolutionErrorEntry(Symbol* error, Symbol* message,
Symbol* cause, Symbol* cause_msg):
ResolutionErrorEntry::ResolutionErrorEntry(Symbol* error, const char* message,
Symbol* cause, const char* cause_msg):
_error(error),
_message(message),
_message(message != nullptr ? os::strdup(message) : nullptr),
_cause(cause),
_cause_msg(cause_msg),
_cause_msg(cause_msg != nullptr ? os::strdup(cause_msg) : nullptr),
_nest_host_error(nullptr) {

Symbol::maybe_increment_refcount(_error);
Symbol::maybe_increment_refcount(_message);
Symbol::maybe_increment_refcount(_cause);
Symbol::maybe_increment_refcount(_cause_msg);
}

ResolutionErrorEntry::~ResolutionErrorEntry() {
// decrement error refcount
Symbol::maybe_decrement_refcount(_error);
Symbol::maybe_decrement_refcount(_message);
Symbol::maybe_decrement_refcount(_cause);
Symbol::maybe_decrement_refcount(_cause_msg);

if (_message != nullptr) {
FREE_C_HEAP_ARRAY(char, _message);
}

if (_cause_msg != nullptr) {
FREE_C_HEAP_ARRAY(char, _cause_msg);
}

if (nest_host_error() != nullptr) {
FREE_C_HEAP_ARRAY(char, nest_host_error());
Expand Down
31 changes: 18 additions & 13 deletions src/hotspot/share/classfile/resolutionErrors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ class ResolutionErrorTable : AllStatic {

public:
static void initialize();
static void add_entry(const constantPoolHandle& pool, int which, Symbol* error, Symbol* message,
Symbol* cause, Symbol* cause_msg);
static void add_entry(const constantPoolHandle& pool, int cp_index,
Symbol* error, const char* error_msg,
Symbol* cause, const char* cause_msg);

static void add_entry(const constantPoolHandle& pool, int which, const char* message);
static void add_entry(const constantPoolHandle& pool, int cp_index, const char* message);

// find error given the constant pool and constant pool index
static ResolutionErrorEntry* find_entry(const constantPoolHandle& pool, int cp_index);
Expand Down Expand Up @@ -69,34 +70,38 @@ class ResolutionErrorTable : AllStatic {
class ResolutionErrorEntry : public CHeapObj<mtClass> {
private:
Symbol* _error;
Symbol* _message;
const char* _message;
Symbol* _cause;
Symbol* _cause_msg;
const char* _cause_msg;
const char* _nest_host_error;

NONCOPYABLE(ResolutionErrorEntry);

public:
ResolutionErrorEntry(Symbol* error, Symbol* message, Symbol* cause, Symbol* cause_msg);
// The incoming message and cause_msg are copied to the C-Heap.
ResolutionErrorEntry(Symbol* error, const char* message,
Symbol* cause, const char* cause_msg);

ResolutionErrorEntry(const char* message):
// The incoming nest host error message is already in the C-Heap.
ResolutionErrorEntry(const char* message):
_error(nullptr),
_message(nullptr),
_cause(nullptr),
_cause_msg(nullptr),
_nest_host_error(message) {}

~ResolutionErrorEntry();
~ResolutionErrorEntry();

void set_nest_host_error(const char* message) {
_nest_host_error = message;
}
// The incoming nest host error message is already in the C-Heap.
void set_nest_host_error(const char* message) {
_nest_host_error = message;
}


Symbol* error() const { return _error; }
Symbol* message() const { return _message; }
const char* message() const { return _message; }
Symbol* cause() const { return _cause; }
Symbol* cause_msg() const { return _cause_msg; }
const char* cause_msg() const { return _cause_msg; }
const char* nest_host_error() const { return _nest_host_error; }
};

Expand Down
7 changes: 4 additions & 3 deletions src/hotspot/share/classfile/systemDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1797,8 +1797,8 @@ 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* cause, Symbol* cause_msg) {
Symbol* error, const char* message,
Symbol* cause, const char* cause_msg) {
{
MutexLocker ml(Thread::current(), SystemDictionary_lock);
ResolutionErrorEntry* entry = ResolutionErrorTable::find_entry(pool, which);
Expand All @@ -1815,7 +1815,8 @@ 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, Symbol** cause, Symbol** cause_msg) {
const char** message,
Symbol** cause, const char** cause_msg) {

{
MutexLocker ml(Thread::current(), SystemDictionary_lock);
Expand Down
9 changes: 5 additions & 4 deletions src/hotspot/share/classfile/systemDictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,13 @@ 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, Symbol* cause = nullptr, Symbol* cause_msg = nullptr);
static void add_resolution_error(const constantPoolHandle& pool, int which,
Symbol* error, const char* message,
Symbol* cause = nullptr, const char* cause_msg = nullptr);
static void delete_resolution_error(ConstantPool* pool);
static Symbol* find_resolution_error(const constantPoolHandle& pool, int which,
Symbol** message, Symbol** cause, Symbol** cause_msg);

const char** message,
Symbol** cause, const char** cause_msg);

// Record a nest host resolution/validation error
static void add_nest_host_error(const constantPoolHandle& pool, int which,
Expand Down
Loading

0 comments on commit 9888334

Please sign in to comment.