Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
10 changes: 5 additions & 5 deletions src/hotspot/share/interpreter/bytecode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class Bytecode_checkcast: public Bytecode {
void verify() const { assert(Bytecodes::java_code(code()) == Bytecodes::_checkcast, "check checkcast"); }

// Returns index
long index() const { return get_index_u2(Bytecodes::_checkcast); };
u2 index() const { return get_index_u2(Bytecodes::_checkcast); };
};

// Abstraction for instanceof
Expand All @@ -284,7 +284,7 @@ class Bytecode_instanceof: public Bytecode {
void verify() const { assert(code() == Bytecodes::_instanceof, "check instanceof"); }

// Returns index
long index() const { return get_index_u2(Bytecodes::_instanceof); };
u2 index() const { return get_index_u2(Bytecodes::_instanceof); };
};

class Bytecode_new: public Bytecode {
Expand All @@ -293,7 +293,7 @@ class Bytecode_new: public Bytecode {
void verify() const { assert(java_code() == Bytecodes::_new, "check new"); }

// Returns index
long index() const { return get_index_u2(Bytecodes::_new); };
u2 index() const { return get_index_u2(Bytecodes::_new); };
};

class Bytecode_multianewarray: public Bytecode {
Expand All @@ -302,7 +302,7 @@ class Bytecode_multianewarray: public Bytecode {
void verify() const { assert(java_code() == Bytecodes::_multianewarray, "check new"); }

// Returns index
long index() const { return get_index_u2(Bytecodes::_multianewarray); };
u2 index() const { return get_index_u2(Bytecodes::_multianewarray); };
};

class Bytecode_anewarray: public Bytecode {
Expand All @@ -311,7 +311,7 @@ class Bytecode_anewarray: public Bytecode {
void verify() const { assert(java_code() == Bytecodes::_anewarray, "check anewarray"); }

// Returns index
long index() const { return get_index_u2(Bytecodes::_anewarray); };
u2 index() const { return get_index_u2(Bytecodes::_anewarray); };
};

// Abstraction for ldc, ldc_w and ldc2_w
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jvmci/vmStructs_jvmci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
nonstatic_field(JavaThread, _jni_environment, JNIEnv) \
nonstatic_field(JavaThread, _poll_data, SafepointMechanism::ThreadData) \
nonstatic_field(JavaThread, _stack_overflow_state._reserved_stack_activation, address) \
nonstatic_field(JavaThread, _held_monitor_count, int64_t) \
nonstatic_field(JavaThread, _held_monitor_count, intx) \
JVMTI_ONLY(nonstatic_field(JavaThread, _is_in_VTMS_transition, bool)) \
JVMTI_ONLY(nonstatic_field(JavaThread, _is_in_tmp_VTMS_transition, bool)) \
\
Expand Down
32 changes: 16 additions & 16 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist,
bool in_white_space = true;
bool in_comment = false;
bool in_quote = false;
char quote_c = 0;
int quote_c = 0;
bool result = true;

int c = getc(stream);
Expand All @@ -1189,7 +1189,7 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist,
if (c == '#') in_comment = true;
else if (!isspace(c)) {
in_white_space = false;
token[pos++] = c;
token[pos++] = checked_cast<char>(c);
}
}
} else {
Expand All @@ -1209,7 +1209,7 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist,
} else if (in_quote && (c == quote_c)) {
in_quote = false;
} else {
token[pos++] = c;
token[pos++] = checked_cast<char>(c);
}
}
c = getc(stream);
Expand Down Expand Up @@ -1565,22 +1565,22 @@ void Arguments::set_heap_size() {
// Convert deprecated flags
if (FLAG_IS_DEFAULT(MaxRAMPercentage) &&
!FLAG_IS_DEFAULT(MaxRAMFraction))
MaxRAMPercentage = 100.0 / MaxRAMFraction;
MaxRAMPercentage = 100.0 / (double)MaxRAMFraction;

if (FLAG_IS_DEFAULT(MinRAMPercentage) &&
!FLAG_IS_DEFAULT(MinRAMFraction))
MinRAMPercentage = 100.0 / MinRAMFraction;
MinRAMPercentage = 100.0 / (double)MinRAMFraction;

if (FLAG_IS_DEFAULT(InitialRAMPercentage) &&
!FLAG_IS_DEFAULT(InitialRAMFraction))
InitialRAMPercentage = 100.0 / InitialRAMFraction;
InitialRAMPercentage = 100.0 / (double)InitialRAMFraction;

// If the maximum heap size has not been set with -Xmx,
// then set it as fraction of the size of physical memory,
// respecting the maximum and minimum sizes of the heap.
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100);
const julong reasonable_min = (julong)((phys_mem * MinRAMPercentage) / 100);
julong reasonable_max = (julong)(((double)phys_mem * MaxRAMPercentage) / 100);
const julong reasonable_min = (julong)(((double)phys_mem * MinRAMPercentage) / 100);
if (reasonable_min < MaxHeapSize) {
// Small physical memory, so use a minimum fraction of it for the heap
reasonable_max = reasonable_min;
Expand Down Expand Up @@ -1664,7 +1664,7 @@ void Arguments::set_heap_size() {
reasonable_minimum = limit_heap_by_allocatable_memory(reasonable_minimum);

if (InitialHeapSize == 0) {
julong reasonable_initial = (julong)((phys_mem * InitialRAMPercentage) / 100);
julong reasonable_initial = (julong)(((double)phys_mem * InitialRAMPercentage) / 100);
reasonable_initial = limit_heap_by_allocatable_memory(reasonable_initial);

reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)MinHeapSize);
Expand Down Expand Up @@ -1965,15 +1965,15 @@ static const char* system_assertion_options[] = {
"-dsa", "-esa", "-disablesystemassertions", "-enablesystemassertions", 0
};

bool Arguments::parse_uintx(const char* value,
uintx* uintx_arg,
uintx min_size) {
uintx n;
bool Arguments::parse_uint(const char* value,
uint* uint_arg,
uint min_size) {
uint n;
if (!parse_integer(value, &n)) {
return false;
}
if (n >= min_size) {
*uintx_arg = n;
*uint_arg = n;
return true;
} else {
return false;
Expand Down Expand Up @@ -2728,8 +2728,8 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
return JNI_EINVAL;
}
} else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) {
uintx max_tenuring_thresh = 0;
if (!parse_uintx(tail, &max_tenuring_thresh, 0)) {
uint max_tenuring_thresh = 0;
if (!parse_uint(tail, &max_tenuring_thresh, 0)) {
jio_fprintf(defaultStream::error_stream(),
"Improperly specified VM option \'MaxTenuringThreshold=%s\'\n", tail);
return JNI_EINVAL;
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/arguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ class Arguments : AllStatic {
static jint parse(const JavaVMInitArgs* args);
// Parse a string for a unsigned integer. Returns true if value
// is an unsigned integer greater than or equal to the minimum
// parameter passed and returns the value in uintx_arg. Returns
// false otherwise, with uintx_arg undefined.
static bool parse_uintx(const char* value, uintx* uintx_arg,
uintx min_size);
// parameter passed and returns the value in uint_arg. Returns
// false otherwise, with uint_arg undefined.
static bool parse_uint(const char* value, uint* uintx_arg,
uint min_size);
// Apply ergonomics
static jint apply_ergo();
// Adjusts the arguments after the OS have adjusted the arguments
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/runtime/continuationFreezeThaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class FreezeBase : public StackObj {
// slow path
virtual stackChunkOop allocate_chunk_slow(size_t stack_size) = 0;

int cont_size() { return _cont_stack_bottom - _cont_stack_top; }
int cont_size() { return pointer_delta_as_int(_cont_stack_bottom, _cont_stack_top); }

private:
// slow path
Expand Down Expand Up @@ -1064,7 +1064,7 @@ NOINLINE freeze_result FreezeBase::recurse_freeze_interpreted_frame(frame& f, fr
// The frame's top never includes the stack arguments to the callee
intptr_t* const stack_frame_top = ContinuationHelper::InterpretedFrame::frame_top(f, callee_argsize, callee_interpreted);
intptr_t* const stack_frame_bottom = ContinuationHelper::InterpretedFrame::frame_bottom(f);
const int fsize = stack_frame_bottom - stack_frame_top;
const int fsize = pointer_delta_as_int(stack_frame_bottom, stack_frame_top);

DEBUG_ONLY(verify_frame_top(f, stack_frame_top));

Expand Down Expand Up @@ -1123,7 +1123,7 @@ freeze_result FreezeBase::recurse_freeze_compiled_frame(frame& f, frame& caller,
intptr_t* const stack_frame_bottom = ContinuationHelper::CompiledFrame::frame_bottom(f);
// including metadata between f and its stackargs
const int argsize = ContinuationHelper::CompiledFrame::stack_argsize(f) + frame::metadata_words_at_top;
const int fsize = stack_frame_bottom + argsize - stack_frame_top;
const int fsize = pointer_delta_as_int(stack_frame_bottom + argsize, stack_frame_top);

log_develop_trace(continuations)("recurse_freeze_compiled_frame %s _size: %d fsize: %d argsize: %d",
ContinuationHelper::Frame::frame_method(f) != nullptr ?
Expand Down Expand Up @@ -1627,7 +1627,7 @@ static freeze_result is_pinned0(JavaThread* thread, oop cont_scope, bool safepoi
if (scope == cont_scope) {
break;
}
int monitor_count = entry->parent_held_monitor_count();
intx monitor_count = entry->parent_held_monitor_count();
entry = entry->parent();
if (entry == nullptr) {
break;
Expand Down Expand Up @@ -2068,7 +2068,7 @@ void ThawBase::finalize_thaw(frame& entry, int argsize) {
}
assert(_stream.is_done() == chunk->is_empty(), "");

int total_thawed = _stream.unextended_sp() - _top_unextended_sp_before_thaw;
int total_thawed = pointer_delta_as_int(_stream.unextended_sp(), _top_unextended_sp_before_thaw);
chunk->set_max_thawing_size(chunk->max_thawing_size() - total_thawed);

_cont.set_argsize(argsize);
Expand Down Expand Up @@ -2154,7 +2154,7 @@ NOINLINE void ThawBase::recurse_thaw_interpreted_frame(const frame& hf, frame& c
assert(hf.is_heap_frame(), "should be");
assert(!f.is_heap_frame(), "should not be");

const int fsize = heap_frame_bottom - heap_frame_top;
const int fsize = pointer_delta_as_int(heap_frame_bottom, heap_frame_top);
assert((stack_frame_bottom == stack_frame_top + fsize), "");

// Some architectures (like AArch64/PPC64/RISC-V) add padding between the locals and the fixed_frame to keep the fp 16-byte-aligned.
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/share/runtime/deoptimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ Deoptimization::UnrollBlock::~UnrollBlock() {

int Deoptimization::UnrollBlock::size_of_frames() const {
// Account first for the adjustment of the initial frame
int result = _caller_adjustment;
intptr_t result = _caller_adjustment;
for (int index = 0; index < number_of_frames(); index++) {
result += frame_sizes()[index];
}
return result;
return checked_cast<int>(result);
}

void Deoptimization::UnrollBlock::print() {
Expand Down Expand Up @@ -1081,7 +1081,7 @@ template<typename PrimitiveType, typename CacheType, typename BoxType> class Box
objArrayOop cache = CacheType::cache(ik);
assert(cache->length() > 0, "Empty cache");
_low = BoxType::value(cache->obj_at(0));
_high = _low + cache->length() - 1;
_high = checked_cast<PrimitiveType>(_low + cache->length() - 1);
_cache = JNIHandles::make_global(Handle(thread, cache));
}
}
Expand All @@ -1100,7 +1100,7 @@ template<typename PrimitiveType, typename CacheType, typename BoxType> class Box
}
oop lookup(PrimitiveType value) {
if (_low <= value && value <= _high) {
int offset = value - _low;
int offset = checked_cast<int>(value - _low);
return objArrayOop(JNIHandles::resolve_non_null(_cache))->obj_at(offset);
}
return nullptr;
Expand Down Expand Up @@ -1654,7 +1654,7 @@ vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, Re
// stuff a C2I adapter we can properly fill in the callee-save
// register locations.
frame caller = fr.sender(reg_map);
int frame_size = caller.sp() - fr.sp();
int frame_size = pointer_delta_as_int(caller.sp(), fr.sp());

frame sender = caller;

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,10 @@ const int ObjectAlignmentInBytes = 8;
/* because of overflow issue */ \
product(intx, MonitorDeflationMax, 1000000, DIAGNOSTIC, \
"The maximum number of monitors to deflate, unlink and delete " \
"at one time (minimum is 1024).") \
"at one time (minimum is 1024).") \
range(1024, max_jint) \
\
product(intx, MonitorUsedDeflationThreshold, 90, DIAGNOSTIC, \
product(int, MonitorUsedDeflationThreshold, 90, DIAGNOSTIC, \
"Percentage of used monitors before triggering deflation (0 is " \
"off). The check is performed on GuaranteedSafepointInterval, " \
"AsyncDeflationInterval or GuaranteedAsyncDeflationInterval, " \
Expand Down
17 changes: 9 additions & 8 deletions src/hotspot/share/runtime/java.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,17 @@ void print_method_invocation_histogram() {
total = int_total + comp_total;
special_total = final_total + static_total +synch_total + native_total + access_total;
tty->print_cr("Invocations summary for %d methods:", collected_invoked_methods->length());
double total_div = (double)total;
tty->print_cr("\t" UINT64_FORMAT_W(12) " (100%%) total", total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- interpreted", int_total, 100.0 * int_total / total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- compiled", comp_total, 100.0 * comp_total / total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- interpreted", int_total, 100.0 * (double)int_total / total_div);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- compiled", comp_total, 100.0 * (double)comp_total / total_div);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- special methods (interpreted and compiled)",
special_total, 100.0 * special_total/ total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- synchronized",synch_total, 100.0 * synch_total / total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- final", final_total, 100.0 * final_total / total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- static", static_total, 100.0 * static_total / total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- native", native_total, 100.0 * native_total / total);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- accessor", access_total, 100.0 * access_total / total);
special_total, 100.0 * (double)special_total/ total_div);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- synchronized",synch_total, 100.0 * (double)synch_total / total_div);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- final", final_total, 100.0 * (double)final_total / total_div);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- static", static_total, 100.0 * (double)static_total / total_div);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- native", native_total, 100.0 * (double)native_total / total_div);
tty->print_cr("\t" UINT64_FORMAT_W(12) " (%4.1f%%) |- accessor", access_total, 100.0 * (double)access_total / total_div);
tty->cr();
SharedRuntime::print_call_statistics(comp_total);
}
Expand Down
26 changes: 13 additions & 13 deletions src/hotspot/share/runtime/java.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ class JDK_Version {
static const char* _runtime_vendor_version;
static const char* _runtime_vendor_vm_bug_url;

uint8_t _major;
uint8_t _minor;
uint8_t _security;
uint8_t _patch;
uint8_t _build;
int _major;
int _minor;
int _security;
int _patch;
int _build;

bool is_valid() const {
return (_major != 0);
Expand All @@ -96,16 +96,16 @@ class JDK_Version {
_major(0), _minor(0), _security(0), _patch(0), _build(0)
{}

JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t security = 0,
uint8_t patch = 0, uint8_t build = 0) :
JDK_Version(int major, int minor = 0, int security = 0,
int patch = 0, int build = 0) :
_major(major), _minor(minor), _security(security), _patch(patch), _build(build)
{}

// Returns the current running JDK version
static JDK_Version current() { return _current; }

// Factory methods for convenience
static JDK_Version jdk(uint8_t m) {
static JDK_Version jdk(int m) {
return JDK_Version(m);
}

Expand All @@ -117,11 +117,11 @@ class JDK_Version {
return _major == 0;
}

uint8_t major_version() const { return _major; }
uint8_t minor_version() const { return _minor; }
uint8_t security_version() const { return _security; }
uint8_t patch_version() const { return _patch; }
uint8_t build_number() const { return _build; }
int major_version() const { return _major; }
int minor_version() const { return _minor; }
int security_version() const { return _security; }
int patch_version() const { return _patch; }
int build_number() const { return _build; }

// Performs a full ordering comparison using all fields (patch, build, etc.)
int compare(const JDK_Version& other) const;
Expand Down
20 changes: 10 additions & 10 deletions src/hotspot/share/runtime/javaThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,10 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
// Since above code may not release JNI monitors and if someone forgot to do an
// JNI monitorexit, held count should be equal jni count.
// Consider scan all object monitor for this owner if JNI count > 0 (at least on detach).
assert(this->held_monitor_count() == this->jni_monitor_count(),
"held monitor count should be equal to jni: " INT64_FORMAT " != " INT64_FORMAT,
(int64_t)this->held_monitor_count(), (int64_t)this->jni_monitor_count());
if (CheckJNICalls && this->jni_monitor_count() > 0) {
assert(held_monitor_count() == jni_monitor_count(),
"held monitor count should be equal to jni: " INTX_FORMAT " != " INTX_FORMAT,
held_monitor_count(), jni_monitor_count());
if (CheckJNICalls && jni_monitor_count() > 0) {
// We would like a fatal here, but due to we never checked this before there
// is a lot of tests which breaks, even with an error log.
log_debug(jni)("JavaThread %s (tid: " UINTX_FORMAT ") with Objects still locked by JNI MonitorEnter.",
Expand Down Expand Up @@ -1940,24 +1940,24 @@ void JavaThread::trace_stack() {

#endif // PRODUCT

void JavaThread::inc_held_monitor_count(int i, bool jni) {
void JavaThread::inc_held_monitor_count(intx i, bool jni) {
#ifdef SUPPORT_MONITOR_COUNT
assert(_held_monitor_count >= 0, "Must always be greater than 0: " INT64_FORMAT, (int64_t)_held_monitor_count);
assert(_held_monitor_count >= 0, "Must always be greater than 0: " INTX_FORMAT, _held_monitor_count);
_held_monitor_count += i;
if (jni) {
assert(_jni_monitor_count >= 0, "Must always be greater than 0: " INT64_FORMAT, (int64_t)_jni_monitor_count);
assert(_jni_monitor_count >= 0, "Must always be greater than 0: " INTX_FORMAT, _jni_monitor_count);
_jni_monitor_count += i;
}
#endif
}

void JavaThread::dec_held_monitor_count(int i, bool jni) {
void JavaThread::dec_held_monitor_count(intx i, bool jni) {
#ifdef SUPPORT_MONITOR_COUNT
_held_monitor_count -= i;
assert(_held_monitor_count >= 0, "Must always be greater than 0: " INT64_FORMAT, (int64_t)_held_monitor_count);
assert(_held_monitor_count >= 0, "Must always be greater than 0: " INTX_FORMAT, _held_monitor_count);
if (jni) {
_jni_monitor_count -= i;
assert(_jni_monitor_count >= 0, "Must always be greater than 0: " INT64_FORMAT, (int64_t)_jni_monitor_count);
assert(_jni_monitor_count >= 0, "Must always be greater than 0: " INTX_FORMAT, _jni_monitor_count);
}
#endif
}
Expand Down
Loading