mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-12 03:18:37 +00:00
8247524: Remove unnecessary volatile qualifiers from member functions
Remove qualifiers for oopDesc and metadata-related member functions. Reviewed-by: stefank, dholmes, stuefe, coleenp
This commit is contained in:
parent
0be5b7d66e
commit
c1cd3893bd
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2020, 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
|
||||
@ -158,7 +158,7 @@ class TreeChunk : public Chunk_t {
|
||||
|
||||
Chunk_t* next() const { return Chunk_t::next(); }
|
||||
Chunk_t* prev() const { return Chunk_t::prev(); }
|
||||
size_t size() const volatile { return Chunk_t::size(); }
|
||||
size_t size() const { return Chunk_t::size(); }
|
||||
|
||||
static size_t min_size();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, 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
|
||||
@ -48,8 +48,7 @@ class Metabase {
|
||||
void clear_next() { set_next(NULL); }
|
||||
void clear_prev() { set_prev(NULL); }
|
||||
|
||||
size_t size() const volatile { return _word_size; }
|
||||
void set_size(size_t v) { _word_size = v; }
|
||||
size_t size() const { return _word_size; }
|
||||
|
||||
void link_next(T* ptr) { set_next(ptr); }
|
||||
void link_prev(T* ptr) { set_prev(ptr); }
|
||||
|
||||
@ -189,7 +189,7 @@ class ConstantPool : public Metadata {
|
||||
public:
|
||||
static ConstantPool* allocate(ClassLoaderData* loader_data, int length, TRAPS);
|
||||
|
||||
bool is_constantPool() const volatile { return true; }
|
||||
virtual bool is_constantPool() const { return true; }
|
||||
|
||||
Array<u1>* tags() const { return _tags; }
|
||||
Array<u2>* operands() const { return _operands; }
|
||||
|
||||
@ -201,7 +201,7 @@ protected:
|
||||
enum StaticLookupMode { find_static, skip_static };
|
||||
enum PrivateLookupMode { find_private, skip_private };
|
||||
|
||||
bool is_klass() const volatile { return true; }
|
||||
virtual bool is_klass() const { return true; }
|
||||
|
||||
// super() cannot be InstanceKlass* -- Java arrays are covariant, and _super is used
|
||||
// to implement that. NB: the _super of "[Ljava/lang/Integer;" is "[Ljava/lang/Number;"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2020, 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
|
||||
@ -34,17 +34,17 @@ class Metadata : public MetaspaceObj {
|
||||
// Debugging hook to check that the metadata has not been deleted.
|
||||
NOT_PRODUCT(int _valid;)
|
||||
public:
|
||||
NOT_PRODUCT(Metadata() { _valid = 0; })
|
||||
NOT_PRODUCT(bool is_valid() const volatile { return _valid == 0; })
|
||||
NOT_PRODUCT(Metadata() : _valid(0) {})
|
||||
NOT_PRODUCT(bool is_valid() const { return _valid == 0; })
|
||||
|
||||
int identity_hash() { return (int)(uintptr_t)this; }
|
||||
|
||||
virtual bool is_metadata() const volatile { return true; }
|
||||
virtual bool is_klass() const volatile { return false; }
|
||||
virtual bool is_method() const volatile { return false; }
|
||||
virtual bool is_methodData() const volatile { return false; }
|
||||
virtual bool is_constantPool() const volatile { return false; }
|
||||
virtual bool is_methodCounters() const volatile { return false; }
|
||||
virtual bool is_metadata() const { return true; }
|
||||
virtual bool is_klass() const { return false; }
|
||||
virtual bool is_method() const { return false; }
|
||||
virtual bool is_methodData() const { return false; }
|
||||
virtual bool is_constantPool() const { return false; }
|
||||
virtual bool is_methodCounters() const { return false; }
|
||||
virtual int size() const = 0;
|
||||
virtual MetaspaceObj::Type type() const = 0;
|
||||
virtual const char* internal_name() const = 0;
|
||||
|
||||
@ -130,7 +130,7 @@ class Method : public Metadata {
|
||||
// CDS and vtbl checking can create an empty Method to get vtbl pointer.
|
||||
Method(){}
|
||||
|
||||
bool is_method() const volatile { return true; }
|
||||
virtual bool is_method() const { return true; }
|
||||
|
||||
void restore_unshareable_info(TRAPS);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2020, 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
|
||||
@ -113,7 +113,7 @@ class MethodCounters : public Metadata {
|
||||
}
|
||||
|
||||
public:
|
||||
virtual bool is_methodCounters() const volatile { return true; }
|
||||
virtual bool is_methodCounters() const { return true; }
|
||||
|
||||
static MethodCounters* allocate(const methodHandle& mh, TRAPS);
|
||||
|
||||
|
||||
@ -1957,7 +1957,7 @@ public:
|
||||
static MethodData* allocate(ClassLoaderData* loader_data, const methodHandle& method, TRAPS);
|
||||
MethodData() : _extra_data_lock(Mutex::leaf, "MDO extra data lock") {}; // For ciMethodData
|
||||
|
||||
bool is_methodData() const volatile { return true; }
|
||||
virtual bool is_methodData() const { return true; }
|
||||
void initialize();
|
||||
|
||||
// Whole-method sticky bits and flags
|
||||
|
||||
@ -78,8 +78,8 @@ class oopDesc {
|
||||
inline void init_mark_raw();
|
||||
|
||||
inline Klass* klass() const;
|
||||
inline Klass* klass_or_null() const volatile;
|
||||
inline Klass* klass_or_null_acquire() const volatile;
|
||||
inline Klass* klass_or_null() const;
|
||||
inline Klass* klass_or_null_acquire() const;
|
||||
static inline Klass** klass_addr(HeapWord* mem);
|
||||
static inline narrowKlass* compressed_klass_addr(HeapWord* mem);
|
||||
inline Klass** klass_addr();
|
||||
|
||||
@ -96,7 +96,7 @@ Klass* oopDesc::klass() const {
|
||||
}
|
||||
}
|
||||
|
||||
Klass* oopDesc::klass_or_null() const volatile {
|
||||
Klass* oopDesc::klass_or_null() const {
|
||||
if (UseCompressedClassPointers) {
|
||||
return CompressedKlassPointers::decode(_metadata._compressed_klass);
|
||||
} else {
|
||||
@ -104,12 +104,10 @@ Klass* oopDesc::klass_or_null() const volatile {
|
||||
}
|
||||
}
|
||||
|
||||
Klass* oopDesc::klass_or_null_acquire() const volatile {
|
||||
Klass* oopDesc::klass_or_null_acquire() const {
|
||||
if (UseCompressedClassPointers) {
|
||||
// Workaround for non-const load_acquire parameter.
|
||||
const volatile narrowKlass* addr = &_metadata._compressed_klass;
|
||||
volatile narrowKlass* xaddr = const_cast<volatile narrowKlass*>(addr);
|
||||
return CompressedKlassPointers::decode(Atomic::load_acquire(xaddr));
|
||||
narrowKlass nklass = Atomic::load_acquire(&_metadata._compressed_klass);
|
||||
return CompressedKlassPointers::decode(nklass);
|
||||
} else {
|
||||
return Atomic::load_acquire(&_metadata._klass);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user