8186837: Memory ordering nmethod, _state and _stack_traversal_mark

Reviewed-by: dholmes, rkennke
This commit is contained in:
Robbin Ehn 2017-08-31 08:18:47 +02:00
parent de3cc93ca6
commit d38975f83c
4 changed files with 9 additions and 8 deletions

View File

@ -1220,7 +1220,7 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
// for stack scanning. // for stack scanning.
if (state == not_entrant) { if (state == not_entrant) {
mark_as_seen_on_stack(); mark_as_seen_on_stack();
OrderAccess::storestore(); OrderAccess::storestore(); // _stack_traversal_mark and _state
} }
// Change state // Change state

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -136,7 +136,7 @@ class nmethod : public CompiledMethod {
// stack. An not_entrant method can be removed when there are no // stack. An not_entrant method can be removed when there are no
// more activations, i.e., when the _stack_traversal_mark is less than // more activations, i.e., when the _stack_traversal_mark is less than
// current sweep traversal index. // current sweep traversal index.
volatile jlong _stack_traversal_mark; volatile long _stack_traversal_mark;
// The _hotness_counter indicates the hotness of a method. The higher // The _hotness_counter indicates the hotness of a method. The higher
// the value the hotter the method. The hotness counter of a nmethod is // the value the hotter the method. The hotness counter of a nmethod is
@ -396,8 +396,8 @@ public:
public: public:
// Sweeper support // Sweeper support
jlong stack_traversal_mark() { return OrderAccess::load_acquire(&_stack_traversal_mark); } long stack_traversal_mark() { return _stack_traversal_mark; }
void set_stack_traversal_mark(jlong l) { OrderAccess::release_store(&_stack_traversal_mark, l); } void set_stack_traversal_mark(long l) { _stack_traversal_mark = l; }
// implicit exceptions support // implicit exceptions support
address continuation_for_implicit_exception(address pc); address continuation_for_implicit_exception(address pc);

View File

@ -53,7 +53,7 @@ class SweeperRecord {
public: public:
int traversal; int traversal;
int compile_id; int compile_id;
jlong traversal_mark; long traversal_mark;
int state; int state;
const char* kind; const char* kind;
address vep; address vep;
@ -62,7 +62,7 @@ class SweeperRecord {
void print() { void print() {
tty->print_cr("traversal = %d compile_id = %d %s uep = " PTR_FORMAT " vep = " tty->print_cr("traversal = %d compile_id = %d %s uep = " PTR_FORMAT " vep = "
PTR_FORMAT " state = %d traversal_mark "JLONG_FORMAT" line = %d", PTR_FORMAT " state = %d traversal_mark %ld line = %d",
traversal, traversal,
compile_id, compile_id,
kind == NULL ? "" : kind, kind == NULL ? "" : kind,
@ -629,6 +629,7 @@ NMethodSweeper::MethodStateChange NMethodSweeper::process_compiled_method(Compil
} else if (cm->is_not_entrant()) { } else if (cm->is_not_entrant()) {
// If there are no current activations of this method on the // If there are no current activations of this method on the
// stack we can safely convert it to a zombie method // stack we can safely convert it to a zombie method
OrderAccess::loadload(); // _stack_traversal_mark and _state
if (cm->can_convert_to_zombie()) { if (cm->can_convert_to_zombie()) {
// Clear ICStubs to prevent back patching stubs of zombie or flushed // Clear ICStubs to prevent back patching stubs of zombie or flushed
// nmethods during the next safepoint (see ICStub::finalize). // nmethods during the next safepoint (see ICStub::finalize).

View File

@ -841,7 +841,7 @@ typedef RehashableHashtable<Symbol*, mtSymbol> RehashableSymbolHashtable;
nonstatic_field(nmethod, _verified_entry_point, address) \ nonstatic_field(nmethod, _verified_entry_point, address) \
nonstatic_field(nmethod, _osr_entry_point, address) \ nonstatic_field(nmethod, _osr_entry_point, address) \
volatile_nonstatic_field(nmethod, _lock_count, jint) \ volatile_nonstatic_field(nmethod, _lock_count, jint) \
volatile_nonstatic_field(nmethod, _stack_traversal_mark, jlong) \ volatile_nonstatic_field(nmethod, _stack_traversal_mark, long) \
nonstatic_field(nmethod, _compile_id, int) \ nonstatic_field(nmethod, _compile_id, int) \
nonstatic_field(nmethod, _comp_level, int) \ nonstatic_field(nmethod, _comp_level, int) \
\ \