Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1579,8 +1579,8 @@ void Arguments::set_heap_size() {
// 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 * (julong)MaxRAMPercentage) / 100);
const julong reasonable_min = (julong)((phys_mem * (julong)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 * (julong)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 @@ -2735,7 +2735,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
return JNI_EINVAL;
}

if (FLAG_SET_CMDLINE(MaxTenuringThreshold, (uint)max_tenuring_thresh) != JVMFlag::SUCCESS) {
if (FLAG_SET_CMDLINE(MaxTenuringThreshold, max_tenuring_thresh) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/objectMonitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class ObjectMonitor : public CHeapObj<mtObjectMonitor> {
// to the ObjectMonitor reference manipulation code:
//
#define OM_OFFSET_NO_MONITOR_VALUE_TAG(f) \
((in_bytes(ObjectMonitor::f ## _offset())) - (unsigned)markWord::monitor_value)
((in_bytes(ObjectMonitor::f ## _offset())) - (int)markWord::monitor_value)

markWord header() const;
volatile markWord* header_addr();
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/runtime/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ char* os::iso8601_time(jlong milliseconds_since_19700101, char* buffer, size_t b
assert(false, "buffer_length too small");
return nullptr;
}
const int milliseconds_per_microsecond = 1000;
const int milliseconds_per_second = 1000;
const time_t seconds_since_19700101 =
milliseconds_since_19700101 / milliseconds_per_microsecond;
milliseconds_since_19700101 / milliseconds_per_second;
const int milliseconds_after_second =
checked_cast<int>(milliseconds_since_19700101 % milliseconds_per_microsecond);
checked_cast<int>(milliseconds_since_19700101 % milliseconds_per_second);
// Convert the time value to a tm and timezone variable
struct tm time_struct;
if (utc) {
Expand Down
18 changes: 9 additions & 9 deletions src/hotspot/share/runtime/sharedRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2343,22 +2343,22 @@ class MethodArityHistogram {

void print_histogram_helper(int n, uint64_t* histo, const char* name) {
const int N = MIN2(9, n);
double sum = 0;
double weighted_sum = 0;
for (int i = 0; i <= n; i++) { sum += (double)histo[i]; weighted_sum += (double)(i*histo[i]); }
if (sum >= 1.0) { // prevent divide by zero or divide overflow
double rest = sum;
uint64_t sum = 0;
uint64_t weighted_sum = 0;
for (int i = 0; i <= n; i++) { sum += histo[i]; weighted_sum += (i*histo[i]); }
if (sum >= 1) { // prevent divide by zero or divide overflow
uint64_t rest = sum;
double percent = (double)sum / 100;
for (int i = 0; i <= N; i++) {
rest -= (double)histo[i];
rest -= histo[i];
tty->print_cr("%4d: " UINT64_FORMAT_W(12) " (%5.1f%%)", i, histo[i], (double)histo[i] / percent);
}
tty->print_cr("rest: " INT64_FORMAT_W(12) " (%5.1f%%)", (int64_t)rest, rest / percent);
tty->print_cr("(avg. %s = %3.1f, max = %d)", name, weighted_sum / sum, n);
tty->print_cr("rest: " INT64_FORMAT_W(12) " (%5.1f%%)", rest, (double)rest / percent);
tty->print_cr("(avg. %s = %3.1f, max = %d)", name, (double)weighted_sum / (double)sum, n);
tty->print_cr("(total # of compiled calls = " INT64_FORMAT_W(14) ")", _total_compiled_calls);
tty->print_cr("(max # of compiled calls = " INT64_FORMAT_W(14) ")", _max_compiled_calls_per_method);
} else {
tty->print_cr("Histogram generation failed for %s. n = %d, sum = %7.5f", name, n, sum);
tty->print_cr("Histogram generation failed for %s. n = %d, sum = %zu", name, n, sum);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/threadHeapSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ double ThreadHeapSampler::fast_log2(const double& d) {
assert(sizeof(d) == sizeof(x),
"double and uint64_t do not have the same size");
x = *reinterpret_cast<const uint64_t*>(&d);
const uint32_t x_high = (uint32_t)(x >> 32);
const uint32_t x_high = checked_cast<uint32_t>(x >> 32);
assert(FastLogNumBits <= 20, "FastLogNumBits should be less than 20.");
const uint32_t y = x_high >> (20 - FastLogNumBits) & FastLogMask;
const int32_t exponent = ((x_high >> 20) & 0x7FF) - 1023;
Expand Down