Skip to content

Commit d1b6fab

Browse files
committed
Merge branch 'master' into JDK-8224922
2 parents 9cdb6c9 + 2eafa03 commit d1b6fab

File tree

29 files changed

+739
-190
lines changed

29 files changed

+739
-190
lines changed

src/hotspot/cpu/x86/x86_32.ad

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7203,6 +7203,7 @@ instruct castLL( eRegL dst ) %{
72037203
%}
72047204

72057205
instruct castFF( regF dst ) %{
7206+
predicate(UseSSE >= 2);
72067207
match(Set dst (CastFF dst));
72077208
format %{ "#castFF of $dst" %}
72087209
ins_encode( /*empty encoding*/ );
@@ -7211,6 +7212,25 @@ instruct castFF( regF dst ) %{
72117212
%}
72127213

72137214
instruct castDD( regD dst ) %{
7215+
predicate(UseSSE >= 2);
7216+
match(Set dst (CastDD dst));
7217+
format %{ "#castDD of $dst" %}
7218+
ins_encode( /*empty encoding*/ );
7219+
ins_cost(0);
7220+
ins_pipe( empty );
7221+
%}
7222+
7223+
instruct castFF_PR( regFPR dst ) %{
7224+
predicate(UseSSE < 2);
7225+
match(Set dst (CastFF dst));
7226+
format %{ "#castFF of $dst" %}
7227+
ins_encode( /*empty encoding*/ );
7228+
ins_cost(0);
7229+
ins_pipe( empty );
7230+
%}
7231+
7232+
instruct castDD_PR( regDPR dst ) %{
7233+
predicate(UseSSE < 2);
72147234
match(Set dst (CastDD dst));
72157235
format %{ "#castDD of $dst" %}
72167236
ins_encode( /*empty encoding*/ );

src/hotspot/os/posix/os_posix.cpp

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include <sys/mman.h>
6161
#include <sys/resource.h>
6262
#include <sys/socket.h>
63+
#include <spawn.h>
6364
#include <sys/time.h>
6465
#include <sys/times.h>
6566
#include <sys/types.h>
@@ -1955,40 +1956,16 @@ char** os::get_environ() { return environ; }
19551956
// doesn't block SIGINT et al.
19561957
// -this function is unsafe to use in non-error situations, mainly
19571958
// because the child process will inherit all parent descriptors.
1958-
int os::fork_and_exec(const char* cmd, bool prefer_vfork) {
1959-
const char * argv[4] = {"sh", "-c", cmd, NULL};
1960-
1961-
pid_t pid ;
1962-
1959+
int os::fork_and_exec(const char* cmd) {
1960+
const char* argv[4] = {"sh", "-c", cmd, NULL};
1961+
pid_t pid = -1;
19631962
char** env = os::get_environ();
1964-
1965-
// Use always vfork on AIX, since its safe and helps with analyzing OOM situations.
1966-
// Otherwise leave it up to the caller.
1967-
AIX_ONLY(prefer_vfork = true;)
1968-
#ifdef __APPLE__
1969-
pid = ::fork();
1970-
#else
1971-
pid = prefer_vfork ? ::vfork() : ::fork();
1972-
#endif
1973-
1974-
if (pid < 0) {
1975-
// fork failed
1976-
return -1;
1977-
1978-
} else if (pid == 0) {
1979-
// child process
1980-
1981-
::execve("/bin/sh", (char* const*)argv, env);
1982-
1983-
// execve failed
1984-
::_exit(-1);
1985-
1986-
} else {
1987-
// copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't
1988-
// care about the actual exit code, for now.
1989-
1963+
// Note: cast is needed because posix_spawn() requires - for compatibility with ancient
1964+
// C-code - a non-const argv/envp pointer array. But it is fine to hand in literal
1965+
// strings and just cast the constness away. See also ProcessImpl_md.c.
1966+
int rc = ::posix_spawn(&pid, "/bin/sh", NULL, NULL, (char**) argv, env);
1967+
if (rc == 0) {
19901968
int status;
1991-
19921969
// Wait for the child process to exit. This returns immediately if
19931970
// the child has already exited. */
19941971
while (::waitpid(pid, &status, 0) < 0) {
@@ -1998,7 +1975,6 @@ int os::fork_and_exec(const char* cmd, bool prefer_vfork) {
19981975
default: return -1;
19991976
}
20001977
}
2001-
20021978
if (WIFEXITED(status)) {
20031979
// The child exited normally; get its exit code.
20041980
return WEXITSTATUS(status);
@@ -2013,6 +1989,9 @@ int os::fork_and_exec(const char* cmd, bool prefer_vfork) {
20131989
// Unknown exit code; pass it through
20141990
return status;
20151991
}
1992+
} else {
1993+
// Don't log, we are inside error handling
1994+
return -1;
20161995
}
20171996
}
20181997

src/hotspot/os/windows/os_windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5624,7 +5624,7 @@ int os::PlatformMonitor::wait(jlong millis) {
56245624

56255625
// Run the specified command in a separate process. Return its exit value,
56265626
// or -1 on failure (e.g. can't create a new process).
5627-
int os::fork_and_exec(const char* cmd, bool dummy /* ignored */) {
5627+
int os::fork_and_exec(const char* cmd) {
56285628
STARTUPINFO si;
56295629
PROCESS_INFORMATION pi;
56305630
DWORD exit_code;

src/hotspot/share/ci/ciEnv.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,9 @@ void ciEnv::dump_replay_data_helper(outputStream* out) {
16461646

16471647
GrowableArray<ciMetadata*>* objects = _factory->get_ci_metadata();
16481648
out->print_cr("# %d ciObject found", objects->length());
1649+
// The very first entry is the InstanceKlass of the root method of the current compilation in order to get the right
1650+
// protection domain to load subsequent classes during replay compilation.
1651+
out->print_cr("instanceKlass %s", CURRENT_ENV->replay_name(task()->method()->method_holder()));
16491652
for (int i = 0; i < objects->length(); i++) {
16501653
objects->at(i)->dump_replay_data(out);
16511654
}

src/hotspot/share/ci/ciReplay.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,12 @@ class CompileReplay : public StackObj {
874874
void process_instanceKlass(TRAPS) {
875875
// just load the referenced class
876876
Klass* k = parse_klass(CHECK);
877+
if (_protection_domain() == NULL) {
878+
// The first entry is the holder class of the method for which a replay compilation is requested.
879+
// Use the same protection domain to load all subsequent classes in order to resolve all classes
880+
// in signatures of inlinees. This ensures that inlining can be done as stated in the replay file.
881+
_protection_domain = Handle(_thread, k->protection_domain());
882+
}
877883
if (k == NULL) {
878884
return;
879885
}

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ bool G1CollectedHeap::expand(size_t expand_bytes, WorkerThreads* pretouch_worker
13101310
vm_exit_out_of_memory(aligned_expand_bytes, OOM_MMAP_ERROR, "G1 heap expansion");
13111311
}
13121312
}
1313-
return regions_to_expand > 0;
1313+
return expanded_by > 0;
13141314
}
13151315

13161316
bool G1CollectedHeap::expand_single_region(uint node_index) {

src/hotspot/share/gc/g1/g1Policy.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,17 +1445,19 @@ bool G1Policy::preventive_collection_required(uint alloc_region_count) {
14451445
uint required_regions = (uint)(get_num_regions_adjust_for_plab_waste(total_young_predicted_surviving_bytes) +
14461446
get_num_regions_adjust_for_plab_waste(_predicted_surviving_bytes_from_old));
14471447

1448-
if (required_regions > _g1h->num_free_regions() - alloc_region_count) {
1449-
log_debug(gc, ergo, cset)("Preventive GC, insufficient free regions. Predicted need %u. Curr Eden %u (Pred %u). Curr Survivor %u (Pred %u). Curr Old %u (Pred %u) Free %u Alloc %u",
1450-
required_regions,
1451-
eden_count,
1452-
(uint)get_num_regions_adjust_for_plab_waste(eden_surv_bytes_pred),
1453-
_g1h->survivor_regions_count(),
1454-
(uint)get_num_regions_adjust_for_plab_waste(_predicted_surviving_bytes_from_survivor),
1455-
_g1h->old_regions_count(),
1456-
(uint)get_num_regions_adjust_for_plab_waste(_predicted_surviving_bytes_from_old),
1457-
_g1h->num_free_regions(),
1458-
alloc_region_count);
1448+
if (required_regions > _g1h->num_free_or_available_regions() - alloc_region_count) {
1449+
log_debug(gc, ergo, cset)("Preventive GC, insufficient free or available regions. "
1450+
"Predicted need %u. Curr Eden %u (Pred %u). Curr Survivor %u (Pred %u). Curr Old %u (Pred %u) Free or Avail %u (Free %u) Alloc %u",
1451+
required_regions,
1452+
eden_count,
1453+
(uint)get_num_regions_adjust_for_plab_waste(eden_surv_bytes_pred),
1454+
_g1h->survivor_regions_count(),
1455+
(uint)get_num_regions_adjust_for_plab_waste(_predicted_surviving_bytes_from_survivor),
1456+
_g1h->old_regions_count(),
1457+
(uint)get_num_regions_adjust_for_plab_waste(_predicted_surviving_bytes_from_old),
1458+
_g1h->num_free_or_available_regions(),
1459+
_g1h->num_free_regions(),
1460+
alloc_region_count);
14591461

14601462
return true;
14611463
}

src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,10 @@
2727

2828
#include "gc/shared/satbMarkQueue.hpp"
2929

30-
class G1CollectedHeap;
3130
class Monitor;
3231
class Thread;
3332

3433
class G1SATBMarkQueueSet : public SATBMarkQueueSet {
35-
G1CollectedHeap* _g1h;
36-
3734
public:
3835
G1SATBMarkQueueSet(BufferNode::Allocator* allocator);
3936

src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,15 @@ ShenandoahCodeRootsIterator::ShenandoahCodeRootsIterator() :
355355
_par_iterator(CodeCache::heaps()),
356356
_table_snapshot(NULL) {
357357
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
358+
MutexLocker locker(CodeCache_lock, Mutex::_no_safepoint_check_flag);
358359
_table_snapshot = ShenandoahCodeRoots::table()->snapshot_for_iteration();
359360
}
360361

361362
ShenandoahCodeRootsIterator::~ShenandoahCodeRootsIterator() {
363+
MonitorLocker locker(CodeCache_lock, Mutex::_no_safepoint_check_flag);
362364
ShenandoahCodeRoots::table()->finish_iteration(_table_snapshot);
363365
_table_snapshot = NULL;
366+
locker.notify_all();
364367
}
365368

366369
void ShenandoahCodeRootsIterator::possibly_parallel_blobs_do(CodeBlobClosure *f) {

src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ void ShenandoahDegenGC::op_degenerated() {
113113
op_mark();
114114

115115
case _degenerated_mark:
116-
// No fallthrough. Continue mark, handed over from concurrent mark
117-
if (_degen_point == ShenandoahDegenPoint::_degenerated_mark) {
116+
// No fallthrough. Continue mark, handed over from concurrent mark if
117+
// concurrent mark has yet completed
118+
if (_degen_point == ShenandoahDegenPoint::_degenerated_mark &&
119+
heap->is_concurrent_mark_in_progress()) {
118120
op_finish_mark();
119121
}
120122
assert(!heap->cancelled_gc(), "STW mark can not OOM");

0 commit comments

Comments
 (0)