--- a/hotspot/src/share/vm/runtime/sweeper.cpp Fri Jul 21 09:50:12 2017 +0200
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp Fri Jul 07 12:49:11 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -53,7 +53,7 @@
public:
int traversal;
int compile_id;
- long traversal_mark;
+ jlong traversal_mark;
int state;
const char* kind;
address vep;
@@ -62,7 +62,7 @@
void print() {
tty->print_cr("traversal = %d compile_id = %d %s uep = " PTR_FORMAT " vep = "
- PTR_FORMAT " state = %d traversal_mark %ld line = %d",
+ PTR_FORMAT " state = %d traversal_mark "JLONG_FORMAT" line = %d",
traversal,
compile_id,
kind == NULL ? "" : kind,
@@ -114,7 +114,7 @@
void NMethodSweeper::record_sweep(CompiledMethod* nm, int line) {
if (_records != NULL) {
_records[_sweep_index].traversal = _traversals;
- _records[_sweep_index].traversal_mark = nm->is_nmethod() ? ((nmethod*)nm)->_stack_traversal_mark : 0;
+ _records[_sweep_index].traversal_mark = nm->is_nmethod() ? ((nmethod*)nm)->stack_traversal_mark() : 0;
_records[_sweep_index].compile_id = nm->compile_id();
_records[_sweep_index].kind = nm->compile_kind();
_records[_sweep_index].state = nm->get_state();
@@ -201,11 +201,18 @@
* safepoint.
*/
void NMethodSweeper::mark_active_nmethods() {
+ CodeBlobClosure* cl = prepare_mark_active_nmethods();
+ if (cl != NULL) {
+ Threads::nmethods_do(cl);
+ }
+}
+
+CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() {
assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
// If we do not want to reclaim not-entrant or zombie methods there is no need
// to scan stacks
if (!MethodFlushing) {
- return;
+ return NULL;
}
// Increase time so that we can estimate when to invoke the sweeper again.
@@ -233,14 +240,13 @@
if (PrintMethodFlushing) {
tty->print_cr("### Sweep: stack traversal %ld", _traversals);
}
- Threads::nmethods_do(&mark_activation_closure);
+ return &mark_activation_closure;
} else {
// Only set hotness counter
- Threads::nmethods_do(&set_hotness_closure);
+ return &set_hotness_closure;
}
- OrderAccess::storestore();
}
/**