Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit

Permalink
Automatic merge of jdk:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Jan 27, 2021
2 parents fe6142e + e1411fd commit 9116da9
Show file tree
Hide file tree
Showing 92 changed files with 1,319 additions and 1,210 deletions.
21 changes: 1 addition & 20 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2021, 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 @@ -605,25 +605,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
fi
fi
# Optional POSIX functionality needed by the JVM
#
# Check if clock_gettime is available and in which library. This indicates
# availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
# don't let it update LIBS.
save_LIBS="$LIBS"
AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
if test "x$LIBS" = "x-lrt "; then
CLOCK_GETTIME_IN_LIBRT=true
fi
LIBS="$save_LIBS"
if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC"
if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
fi
fi
# Extra flags needed when building optional static versions of certain
# JDK libraries.
STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1"
Expand Down
9 changes: 8 additions & 1 deletion make/autoconf/flags-ldflags.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2021, 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 @@ -108,6 +108,13 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
OS_LDFLAGS="-mmacosx-version-min=$MACOSX_VERSION_MIN"
fi
if test "x$OPENJDK_TARGET_OS" = xlinux; then
# Hotspot needs to link librt to get the clock_* functions.
# But once our supported minimum build and runtime platform
# has glibc 2.17, this can be removed as the functions are
# in libc.
OS_LDFLAGS_JVM_ONLY="-lrt"
fi
fi
# Setup debug level-dependent LDFLAGS
Expand Down
5 changes: 2 additions & 3 deletions make/hotspot/lib/JvmOverrideFiles.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ ifeq ($(TOOLCHAIN_TYPE), gcc)
BUILD_LIBJVM_cardTableBarrierSetAssembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized
BUILD_LIBJVM_interp_masm_x86.cpp_CXXFLAGS := -Wno-uninitialized
ifeq ($(DEBUG_LEVEL), release)
# Need extra inlining to collapse all marking code into the hot marking loop
BUILD_LIBJVM_shenandoahConcurrentMark.cpp_CXXFLAGS := --param inline-unit-growth=1000
BUILD_LIBJVM_shenandoahTraversalGC.cpp_CXXFLAGS := --param inline-unit-growth=1000
# Need extra inlining to collapse shared marking code into the hot marking loop
BUILD_LIBJVM_shenandoahMark.cpp_CXXFLAGS := --param inline-unit-growth=1000
endif
endif

Expand Down
10 changes: 1 addition & 9 deletions make/modules/java.base/gensrc/GensrcCharacterData.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2021, 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 @@ -62,14 +62,6 @@ $(eval $(call SetupCharacterData,CharacterData02, -string -plane 2, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData03, -string -plane 3, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData0E, -string -plane 14, 11 4 1))

# Copy two Java files that need no preprocessing.
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
$(call LogInfo, Generating $(@F))
$(call install-file)

GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataPrivateUse.java

$(GENSRC_CHARACTERDATA): $(BUILD_TOOLS_JDK)

TARGETS += $(GENSRC_CHARACTERDATA)
18 changes: 1 addition & 17 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -959,21 +959,6 @@ double os::elapsedVTime() {
}
}

jlong os::javaTimeMillis() {
timeval time;
int status = gettimeofday(&time, NULL);
assert(status != -1, "aix error at gettimeofday()");
return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000);
}

void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
timeval time;
int status = gettimeofday(&time, NULL);
assert(status != -1, "aix error at gettimeofday()");
seconds = jlong(time.tv_sec);
nanos = jlong(time.tv_usec) * 1000;
}

// We use mread_real_time here.
// On AIX: If the CPU has a time register, the result will be RTC_POWER and
// it has to be converted to real time. AIX documentations suggests to do
Expand Down Expand Up @@ -3290,4 +3275,3 @@ bool os::supports_map_sync() {
}

void os::print_memory_mappings(char* addr, size_t bytes, outputStream* st) {}

5 changes: 0 additions & 5 deletions src/hotspot/os/aix/os_aix.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ inline struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}

inline bool os::supports_monotonic_clock() {
// mread_real_time() is monotonic on AIX (see os::javaTimeNanos() comments)
return true;
}

inline void os::exit(int num) {
::exit(num);
}
Expand Down
72 changes: 6 additions & 66 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ julong os::Bsd::_physical_memory = 0;
#ifdef __APPLE__
mach_timebase_info_data_t os::Bsd::_timebase_info = {0, 0};
volatile uint64_t os::Bsd::_max_abstime = 0;
#else
int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL;
#endif
pthread_t os::Bsd::_main_thread;
int os::Bsd::_page_size = -1;
Expand Down Expand Up @@ -789,40 +787,13 @@ double os::elapsedVTime() {
return elapsedTime();
}

jlong os::javaTimeMillis() {
timeval time;
int status = gettimeofday(&time, NULL);
assert(status != -1, "bsd error");
return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000);
}

void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
timeval time;
int status = gettimeofday(&time, NULL);
assert(status != -1, "bsd error");
seconds = jlong(time.tv_sec);
nanos = jlong(time.tv_usec) * 1000;
}

#ifndef __APPLE__
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (1)
#endif
#endif

#ifdef __APPLE__
void os::Bsd::clock_init() {
mach_timebase_info(&_timebase_info);
}
#else
void os::Bsd::clock_init() {
struct timespec res;
struct timespec tp;
if (::clock_getres(CLOCK_MONOTONIC, &res) == 0 &&
::clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
// yes, monotonic clock is supported
_clock_gettime = ::clock_gettime;
}
// Nothing to do
}
#endif

Expand Down Expand Up @@ -854,45 +825,15 @@ jlong os::javaTimeNanos() {
return (prev == obsv) ? now : obsv;
}

#else // __APPLE__

jlong os::javaTimeNanos() {
if (os::supports_monotonic_clock()) {
struct timespec tp;
int status = Bsd::_clock_gettime(CLOCK_MONOTONIC, &tp);
assert(status == 0, "gettime error");
jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) + jlong(tp.tv_nsec);
return result;
} else {
timeval time;
int status = gettimeofday(&time, NULL);
assert(status != -1, "bsd error");
jlong usecs = jlong(time.tv_sec) * (1000 * 1000) + jlong(time.tv_usec);
return 1000 * usecs;
}
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
info_ptr->max_value = ALL_64_BITS;
info_ptr->may_skip_backward = false; // not subject to resetting or drifting
info_ptr->may_skip_forward = false; // not subject to resetting or drifting
info_ptr->kind = JVMTI_TIMER_ELAPSED; // elapsed not CPU time
}

#endif // __APPLE__

void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
if (os::supports_monotonic_clock()) {
info_ptr->max_value = ALL_64_BITS;

// CLOCK_MONOTONIC - amount of time since some arbitrary point in the past
info_ptr->may_skip_backward = false; // not subject to resetting or drifting
info_ptr->may_skip_forward = false; // not subject to resetting or drifting
} else {
// gettimeofday - based on time in seconds since the Epoch thus does not wrap
info_ptr->max_value = ALL_64_BITS;

// gettimeofday is a real time clock so it skips
info_ptr->may_skip_backward = true;
info_ptr->may_skip_forward = true;
}

info_ptr->kind = JVMTI_TIMER_ELAPSED; // elapsed not CPU time
}

// Return the real, user, and system times in seconds from an
// arbitrary fixed point in the past.
bool os::getTimesSecs(double* process_real_time,
Expand Down Expand Up @@ -2812,4 +2753,3 @@ bool os::start_debugging(char *buf, int buflen) {
}

void os::print_memory_mappings(char* addr, size_t bytes, outputStream* st) {}

4 changes: 1 addition & 3 deletions src/hotspot/os/bsd/os_bsd.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, 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 @@ -37,8 +37,6 @@ class Bsd {
// mach_absolute_time
static mach_timebase_info_data_t _timebase_info;
static volatile uint64_t _max_abstime;
#else
static int (*_clock_gettime)(clockid_t, struct timespec *);
#endif

static GrowableArray<int>* _cpu_to_node;
Expand Down
8 changes: 0 additions & 8 deletions src/hotspot/os/bsd/os_bsd.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ inline struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}

inline bool os::supports_monotonic_clock() {
#ifdef __APPLE__
return true;
#else
return Bsd::_clock_gettime != NULL;
#endif
}

inline void os::exit(int num) {
::exit(num);
}
Expand Down
11 changes: 6 additions & 5 deletions src/hotspot/os/bsd/os_perf_bsd.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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 @@ -56,12 +56,13 @@ class CPUPerformanceInterface::CPUPerformance : public CHeapObj<mtInternal> {
int _active_processor_count;

bool now_in_nanos(long* resultp) {
timeval current_time;
if (gettimeofday(&current_time, NULL) != 0) {
// Error getting current time
struct timespec tp;
int status = clock_gettime(CLOCK_REALTIME, &tp);
assert(status == 0, "clock_gettime error: %s", os::strerror(errno));
if (status != 0) {
return false;
}
*resultp = current_time.tv_sec * NANOS_PER_SEC + 1000L * current_time.tv_usec;
*resultp = tp.tv_sec * NANOS_PER_SEC + tp.tv_nsec;
return true;
}

Expand Down
Loading

0 comments on commit 9116da9

Please sign in to comment.