# HG changeset patch # User rehn # Date 1504160327 -7200 # Node ID 49f5fa3fc2ae362d4e829aa9395be0f16cf8efb4 # Parent e704f55561c3af127a2e715eacea5b8ac89c73f0 8186837: Memory ordering nmethod, _state and _stack_traversal_mark Reviewed-by: dholmes, rkennke diff -r e704f55561c3 -r 49f5fa3fc2ae hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Wed Aug 30 19:18:22 2017 -0400 +++ b/hotspot/src/share/vm/code/nmethod.cpp Thu Aug 31 08:18:47 2017 +0200 @@ -1220,7 +1220,7 @@ // for stack scanning. if (state == not_entrant) { mark_as_seen_on_stack(); - OrderAccess::storestore(); + OrderAccess::storestore(); // _stack_traversal_mark and _state } // Change state diff -r e704f55561c3 -r 49f5fa3fc2ae hotspot/src/share/vm/code/nmethod.hpp --- a/hotspot/src/share/vm/code/nmethod.hpp Wed Aug 30 19:18:22 2017 -0400 +++ b/hotspot/src/share/vm/code/nmethod.hpp Thu Aug 31 08:18:47 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 @@ -136,7 +136,7 @@ // stack. An not_entrant method can be removed when there are no // more activations, i.e., when the _stack_traversal_mark is less than // 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 value the hotter the method. The hotness counter of a nmethod is @@ -396,8 +396,8 @@ public: // Sweeper support - jlong stack_traversal_mark() { return OrderAccess::load_acquire(&_stack_traversal_mark); } - void set_stack_traversal_mark(jlong l) { OrderAccess::release_store(&_stack_traversal_mark, l); } + long stack_traversal_mark() { return _stack_traversal_mark; } + void set_stack_traversal_mark(long l) { _stack_traversal_mark = l; } // implicit exceptions support address continuation_for_implicit_exception(address pc); diff -r e704f55561c3 -r 49f5fa3fc2ae hotspot/src/share/vm/runtime/sweeper.cpp --- a/hotspot/src/share/vm/runtime/sweeper.cpp Wed Aug 30 19:18:22 2017 -0400 +++ b/hotspot/src/share/vm/runtime/sweeper.cpp Thu Aug 31 08:18:47 2017 +0200 @@ -53,7 +53,7 @@ public: int traversal; int compile_id; - jlong traversal_mark; + long 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 "JLONG_FORMAT" line = %d", + PTR_FORMAT " state = %d traversal_mark %ld line = %d", traversal, compile_id, kind == NULL ? "" : kind, @@ -629,6 +629,7 @@ } else if (cm->is_not_entrant()) { // If there are no current activations of this method on the // stack we can safely convert it to a zombie method + OrderAccess::loadload(); // _stack_traversal_mark and _state if (cm->can_convert_to_zombie()) { // Clear ICStubs to prevent back patching stubs of zombie or flushed // nmethods during the next safepoint (see ICStub::finalize). diff -r e704f55561c3 -r 49f5fa3fc2ae hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Wed Aug 30 19:18:22 2017 -0400 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Aug 31 08:18:47 2017 +0200 @@ -841,7 +841,7 @@ nonstatic_field(nmethod, _verified_entry_point, address) \ nonstatic_field(nmethod, _osr_entry_point, address) \ 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, _comp_level, int) \ \