8191102: Incorrect include file use in classLoader.hpp

Move appropriate methods to <fiile>.inline.hpp files.  Create <file>.inline.hpp files when needed.

Reviewed-by: coleenp, dholmes
This commit is contained in:
Harold Seigel 2018-03-05 10:29:23 -05:00
parent 8d5496fd27
commit c0bc887c36
58 changed files with 629 additions and 208 deletions

View file

@ -34,7 +34,7 @@
#include "interpreter/abstractInterpreter.hpp"
#include "jvmci/compilerRuntime.hpp"
#include "jvmci/jvmciRuntime.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/vm_operations.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -35,7 +35,7 @@
#include "gc/shared/gcLocker.hpp"
#include "jvmci/compilerRuntime.hpp"
#include "jvmci/jvmciRuntime.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/os.hpp"
#include "runtime/sharedRuntime.hpp"

View file

@ -46,6 +46,9 @@
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/method.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"

View file

@ -42,6 +42,7 @@
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/generateOopMap.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/nativeLookup.hpp"
#include "runtime/deoptimization.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -33,6 +33,7 @@
#include "memory/allocation.inline.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/copy.hpp"
#include "utilities/macros.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -46,6 +46,7 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/annotations.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/fieldStreams.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/instanceMirrorKlass.hpp"

View file

@ -26,7 +26,7 @@
#include "jvm.h"
#include "jimage.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoader.inline.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/javaClasses.hpp"
@ -51,6 +51,7 @@
#include "memory/universe.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/instanceRefKlass.hpp"
#include "oops/method.inline.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"

View file

@ -27,7 +27,6 @@
#include "jimage.hpp"
#include "runtime/handles.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/perfData.hpp"
#include "utilities/exceptions.hpp"
#include "utilities/macros.hpp"
@ -49,13 +48,9 @@ class ClassPathEntry : public CHeapObj<mtClass> {
private:
ClassPathEntry* volatile _next;
public:
// Next entry in class path
ClassPathEntry* next() const { return OrderAccess::load_acquire(&_next); }
ClassPathEntry* next() const;
virtual ~ClassPathEntry() {}
void set_next(ClassPathEntry* next) {
// may have unlocked readers, so ensure visibility.
OrderAccess::release_store(&_next, next);
}
void set_next(ClassPathEntry* next);
virtual bool is_modules_image() const = 0;
virtual bool is_jar_file() const = 0;
virtual const char* name() const = 0;
@ -396,25 +391,7 @@ class ClassLoader: AllStatic {
static int compute_Object_vtable();
static ClassPathEntry* classpath_entry(int n) {
assert(n >= 0, "sanity");
if (n == 0) {
assert(has_jrt_entry(), "No class path entry at 0 for exploded module builds");
return ClassLoader::_jrt_entry;
} else {
// The java runtime image is always the first entry
// in the FileMapInfo::_classpath_entry_table. Even though
// the _jrt_entry is not included in the _first_append_entry
// linked list, it must be accounted for when comparing the
// class path vs. the shared archive class path.
ClassPathEntry* e = ClassLoader::_first_append_entry;
while (--n >= 1) {
assert(e != NULL, "Not that many classpath entries.");
e = e->next();
}
return e;
}
}
static ClassPathEntry* classpath_entry(int n);
static bool is_in_patch_mod_entries(Symbol* module_name);
@ -423,38 +400,13 @@ class ClassLoader: AllStatic {
// Helper function used by CDS code to get the number of boot classpath
// entries during shared classpath setup time.
static int num_boot_classpath_entries() {
assert(DumpSharedSpaces, "Should only be called at CDS dump time");
assert(has_jrt_entry(), "must have a java runtime image");
int num_entries = 1; // count the runtime image
ClassPathEntry* e = ClassLoader::_first_append_entry;
while (e != NULL) {
num_entries ++;
e = e->next();
}
return num_entries;
}
static int num_boot_classpath_entries();
static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e) {
if (e == ClassLoader::_jrt_entry) {
return ClassLoader::_first_append_entry;
} else {
return e->next();
}
}
static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e);
// Helper function used by CDS code to get the number of app classpath
// entries during shared classpath setup time.
static int num_app_classpath_entries() {
assert(DumpSharedSpaces, "Should only be called at CDS dump time");
int num_entries = 0;
ClassPathEntry* e= ClassLoader::_app_classpath_entries;
while (e != NULL) {
num_entries ++;
e = e->next();
}
return num_entries;
}
static int num_app_classpath_entries();
static void check_shared_classpath(const char *path);
static void finalize_shared_paths_misc_info();

View file

@ -0,0 +1,99 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_CLASSFILE_CLASSLOADER_INLINE_HPP
#define SHARE_VM_CLASSFILE_CLASSLOADER_INLINE_HPP
#include "classfile/classLoader.hpp"
#include "runtime/orderAccess.inline.hpp"
// Next entry in class path
inline ClassPathEntry* ClassPathEntry::next() const { return OrderAccess::load_acquire(&_next); }
inline void ClassPathEntry::set_next(ClassPathEntry* next) {
// may have unlocked readers, so ensure visibility.
OrderAccess::release_store(&_next, next);
}
inline ClassPathEntry* ClassLoader::classpath_entry(int n) {
assert(n >= 0, "sanity");
if (n == 0) {
assert(has_jrt_entry(), "No class path entry at 0 for exploded module builds");
return ClassLoader::_jrt_entry;
} else {
// The java runtime image is always the first entry
// in the FileMapInfo::_classpath_entry_table. Even though
// the _jrt_entry is not included in the _first_append_entry
// linked list, it must be accounted for when comparing the
// class path vs. the shared archive class path.
ClassPathEntry* e = ClassLoader::_first_append_entry;
while (--n >= 1) {
assert(e != NULL, "Not that many classpath entries.");
e = e->next();
}
return e;
}
}
#if INCLUDE_CDS
// Helper function used by CDS code to get the number of boot classpath
// entries during shared classpath setup time.
inline int ClassLoader::num_boot_classpath_entries() {
assert(DumpSharedSpaces, "Should only be called at CDS dump time");
assert(has_jrt_entry(), "must have a java runtime image");
int num_entries = 1; // count the runtime image
ClassPathEntry* e = ClassLoader::_first_append_entry;
while (e != NULL) {
num_entries ++;
e = e->next();
}
return num_entries;
}
inline ClassPathEntry* ClassLoader::get_next_boot_classpath_entry(ClassPathEntry* e) {
if (e == ClassLoader::_jrt_entry) {
return ClassLoader::_first_append_entry;
} else {
return e->next();
}
}
// Helper function used by CDS code to get the number of app classpath
// entries during shared classpath setup time.
inline int ClassLoader::num_app_classpath_entries() {
assert(DumpSharedSpaces, "Should only be called at CDS dump time");
int num_entries = 0;
ClassPathEntry* e= ClassLoader::_app_classpath_entries;
while (e != NULL) {
num_entries ++;
e = e->next();
}
return num_entries;
}
#endif // INCLUDE_CDS
#endif // SHARE_VM_CLASSFILE_CLASSLOADER_INLINE_HPP

View file

@ -22,6 +22,9 @@
*
*/
#ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
#define SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
#include "classfile/classLoaderData.hpp"
#include "classfile/javaClasses.hpp"
#include "oops/oop.inline.hpp"
@ -76,3 +79,5 @@ void ClassLoaderDataGraph::dec_array_classes(size_t count) {
assert(count <= _num_array_classes, "Sanity");
Atomic::sub(count, &_num_array_classes);
}
#endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP

View file

@ -26,7 +26,7 @@
#include "classfile/classFileParser.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classListParser.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoader.inline.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/klassFactory.hpp"

View file

@ -25,7 +25,7 @@
#include "precompiled.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/sharedClassUtil.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/dictionary.inline.hpp"
#include "classfile/protectionDomainCache.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/systemDictionaryShared.hpp"

View file

@ -29,7 +29,6 @@
#include "classfile/systemDictionary.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/oop.hpp"
#include "runtime/orderAccess.hpp"
#include "utilities/hashtable.hpp"
#include "utilities/ostream.hpp"
@ -170,12 +169,8 @@ class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> {
ProtectionDomainEntry* pd_set() const { return _pd_set; }
void set_pd_set(ProtectionDomainEntry* new_head) { _pd_set = new_head; }
ProtectionDomainEntry* pd_set_acquire() const {
return OrderAccess::load_acquire(&_pd_set);
}
void release_set_pd_set(ProtectionDomainEntry* new_head) {
OrderAccess::release_store(&_pd_set, new_head);
}
ProtectionDomainEntry* pd_set_acquire() const;
void release_set_pd_set(ProtectionDomainEntry* new_head);
// Tells whether the initiating class' protection domain can access the klass in this entry
bool is_valid_protection_domain(Handle protection_domain) {

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_CLASSFILE_DICTIONARY_INLINE_HPP
#define SHARE_VM_CLASSFILE_DICTIONARY_INLINE_HPP
#include "classfile/dictionary.hpp"
#include "runtime/orderAccess.inline.hpp"
inline ProtectionDomainEntry* DictionaryEntry::pd_set_acquire() const {
return OrderAccess::load_acquire(&_pd_set);
}
inline void DictionaryEntry::release_set_pd_set(ProtectionDomainEntry* new_head) {
OrderAccess::release_store(&_pd_set, new_head);
}
#endif // SHARE_VM_CLASSFILE_DICTIONARY_INLINE_HPP

View file

@ -43,7 +43,7 @@
#include "oops/instanceKlass.hpp"
#include "oops/instanceMirrorKlass.hpp"
#include "oops/klass.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"

View file

@ -56,6 +56,7 @@
#include "oops/instanceKlass.hpp"
#include "oops/instanceRefKlass.hpp"
#include "oops/klass.inline.hpp"
#include "oops/method.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"

View file

@ -38,6 +38,7 @@
#include "logging/logStream.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/oop.inline.hpp"
#include "oops/typeArrayOop.hpp"

View file

@ -36,7 +36,7 @@
#include "memory/allocation.inline.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/verifyOopClosure.hpp"

View file

@ -34,7 +34,7 @@
#include "memory/metadataFactory.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "runtime/icache.hpp"

View file

@ -28,8 +28,9 @@
#include "code/scopeDesc.hpp"
#include "code/codeCache.hpp"
#include "prims/methodHandles.hpp"
#include "interpreter/bytecode.hpp"
#include "interpreter/bytecode.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.inline.hpp"
#include "runtime/mutexLocker.hpp"
CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -54,9 +54,9 @@ class ExceptionCache : public CHeapObj<mtCode> {
void set_pc_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _pc[index] = a; }
address handler_at(int index) { assert(index >= 0 && index < count(),""); return _handler[index]; }
void set_handler_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _handler[index] = a; }
int count() { return OrderAccess::load_acquire(&_count); }
int count();
// increment_count is only called under lock, but there may be concurrent readers.
void increment_count() { OrderAccess::release_store(&_count, _count + 1); }
void increment_count();
public:
@ -290,7 +290,7 @@ public:
// Note: _exception_cache may be read concurrently. We rely on memory_order_consume here.
ExceptionCache* exception_cache() const { return _exception_cache; }
void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; }
void release_set_exception_cache(ExceptionCache *ec) { OrderAccess::release_store(&_exception_cache, ec); }
void release_set_exception_cache(ExceptionCache *ec);
address handler_for_exception_and_pc(Handle exception, address pc);
void add_handler_for_exception_and_pc(Handle exception, address pc, address handler);
void clean_exception_cache(BoolObjectClosure* is_alive);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -38,6 +38,9 @@ inline bool CompiledMethod::is_deopt_entry(address pc) {
;
}
inline void CompiledMethod::release_set_exception_cache(ExceptionCache *ec) {
OrderAccess::release_store(&_exception_cache, ec);
}
// -----------------------------------------------------------------------------
// CompiledMethod::get_deopt_original_pc
@ -56,4 +59,13 @@ inline address CompiledMethod::get_deopt_original_pc(const frame* fr) {
return NULL;
}
// class ExceptionCache methods
inline int ExceptionCache::count() { return OrderAccess::load_acquire(&_count); }
// increment_count is only called under lock, but there may be concurrent readers.
inline void ExceptionCache::increment_count() { OrderAccess::release_store(&_count, _count + 1); }
#endif //SHARE_VM_CODE_COMPILEDMETHOD_INLINE_HPP

View file

@ -40,6 +40,7 @@
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiImpl.hpp"

View file

@ -39,7 +39,7 @@
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/methodData.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/nativeLookup.hpp"
#include "prims/whitebox.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -23,9 +23,10 @@
*/
#include "precompiled.hpp"
#include "interpreter/bytecode.hpp"
#include "interpreter/bytecode.inline.hpp"
#include "interpreter/linkResolver.hpp"
#include "oops/constantPool.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/fieldType.hpp"
#include "runtime/handles.inline.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -229,7 +229,7 @@ class Bytecode_invoke: public Bytecode_member_ref {
is_invokedynamic() ||
is_invokehandle(); }
bool has_appendix() { return cpcache_entry()->has_appendix(); }
bool has_appendix();
int size_of_parameters() const;

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_INTERPRETER_BYTECODE_INLINE_HPP
#define SHARE_VM_INTERPRETER_BYTECODE_INLINE_HPP
#include "interpreter/bytecode.hpp"
#include "oops/cpCache.inline.hpp"
inline bool Bytecode_invoke::has_appendix() { return cpcache_entry()->has_appendix(); }
#endif // SHARE_VM_INTERPRETER_BYTECODE_INLINE_HPP

View file

@ -33,6 +33,7 @@
#include "interpreter/interpreterRuntime.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.inline.hpp"
#include "oops/methodCounters.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"

View file

@ -30,6 +30,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "memory/resourceArea.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/method.hpp"
#include "runtime/mutexLocker.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -39,6 +39,7 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/constantPool.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -39,6 +39,7 @@
#include "logging/logStream.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/method.hpp"
#include "oops/objArrayKlass.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -26,6 +26,7 @@
#include "classfile/symbolTable.hpp"
#include "interpreter/linkResolver.hpp"
#include "jvmci/compilerRuntime.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/compilationPolicy.hpp"
#include "runtime/deoptimization.hpp"

View file

@ -29,8 +29,10 @@
#include "interpreter/linkResolver.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/generateOopMap.hpp"
#include "oops/fieldStreams.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/typeArrayOop.inline.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2018, 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
@ -38,6 +38,9 @@
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/method.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"

View file

@ -24,7 +24,7 @@
#include "precompiled.hpp"
#include "jvm.h"
#include "classfile/classLoader.hpp"
#include "classfile/classLoader.inline.hpp"
#include "classfile/compactHashtable.inline.hpp"
#include "classfile/sharedClassUtil.hpp"
#include "classfile/stringTable.hpp"

View file

@ -27,7 +27,6 @@
#include "memory/allocation.hpp"
#include "memory/metaspace.hpp"
#include "runtime/orderAccess.hpp"
#include "utilities/align.hpp"
// Array for metadata allocation
@ -122,8 +121,8 @@ protected:
T* adr_at(const int i) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &_data[i]; }
int find(const T& x) { return index_of(x); }
T at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); }
void release_at_put(int which, T contents) { OrderAccess::release_store(adr_at(which), contents); }
T at_acquire(const int which);
void release_at_put(int which, T contents);
static int size(int length) {
size_t bytes = align_up(byte_sizeof(length), BytesPerWord);

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OOPS_ARRAY_INLINE_HPP
#define SHARE_VM_OOPS_ARRAY_INLINE_HPP
#include "oops/array.hpp"
#include "runtime/orderAccess.inline.hpp"
template <typename T>
inline T Array<T>::at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); }
template <typename T>
inline void Array<T>::release_at_put(int which, T contents) { OrderAccess::release_store(adr_at(which), contents); }
#endif // SHARE_VM_OOPS_ARRAY_INLINE_HPP

View file

@ -38,7 +38,9 @@
#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/constantPool.hpp"
#include "oops/array.inline.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"
@ -51,6 +53,10 @@
#include "runtime/vframe.hpp"
#include "utilities/copy.hpp"
constantTag ConstantPool::tag_at(int which) const { return (constantTag)tags()->at_acquire(which); }
void ConstantPool::release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
Array<u1>* tags = MetadataFactory::new_array<u1>(loader_data, length, 0, CHECK_NULL);
int size = ConstantPool::size(length);

View file

@ -131,7 +131,7 @@ class ConstantPool : public Metadata {
void set_tags(Array<u1>* tags) { _tags = tags; }
void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); }
void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
void release_tag_at_put(int which, jbyte t);
u1* tag_addr_at(int which) const { return tags()->adr_at(which); }
@ -143,14 +143,7 @@ class ConstantPool : public Metadata {
private:
intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); }
CPSlot slot_at(int which) const {
assert(is_within_bounds(which), "index out of bounds");
assert(!tag_at(which).is_unresolved_klass() && !tag_at(which).is_unresolved_klass_in_error(), "Corrupted constant pool");
// Uses volatile because the klass slot changes without a lock.
intptr_t adr = OrderAccess::load_acquire(obj_at_addr(which));
assert(adr != 0 || which == 0, "cp entry for klass should not be zero");
return CPSlot(adr);
}
CPSlot slot_at(int which) const;
void slot_at_put(int which, CPSlot s) const {
assert(is_within_bounds(which), "index out of bounds");
@ -380,7 +373,7 @@ class ConstantPool : public Metadata {
// Tag query
constantTag tag_at(int which) const { return (constantTag)tags()->at_acquire(which); }
constantTag tag_at(int which) const;
// Fetching constants
@ -409,16 +402,7 @@ class ConstantPool : public Metadata {
return klass_slot_at(which).name_index();
}
Klass* resolved_klass_at(int which) const { // Used by Compiler
guarantee(tag_at(which).is_klass(), "Corrupted constant pool");
// Must do an acquire here in case another thread resolved the klass
// behind our back, lest we later load stale values thru the oop.
CPKlassSlot kslot = klass_slot_at(which);
assert(tag_at(kslot.name_index()).is_symbol(), "sanity");
Klass** adr = resolved_klasses()->adr_at(kslot.resolved_klass_index());
return OrderAccess::load_acquire(adr);
}
Klass* resolved_klass_at(int which) const; // Used by Compiler
// RedefineClasses() API support:
Symbol* klass_at_noresolve(int which) { return klass_name_at(which); }
@ -475,23 +459,11 @@ class ConstantPool : public Metadata {
// Method oops internally created for method handles may also
// use pseudo-strings to link themselves to related metaobjects.
bool is_pseudo_string_at(int which) {
assert(tag_at(which).is_string(), "Corrupted constant pool");
return slot_at(which).is_pseudo_string();
}
bool is_pseudo_string_at(int which);
oop pseudo_string_at(int which, int obj_index) {
assert(is_pseudo_string_at(which), "must be a pseudo-string");
oop s = resolved_references()->obj_at(obj_index);
return s;
}
oop pseudo_string_at(int which, int obj_index);
oop pseudo_string_at(int which) {
assert(is_pseudo_string_at(which), "must be a pseudo-string");
int obj_index = cp_to_object_index(which);
oop s = resolved_references()->obj_at(obj_index);
return s;
}
oop pseudo_string_at(int which);
void pseudo_string_at_put(int which, int obj_index, oop x) {
assert(tag_at(which).is_string(), "Corrupted constant pool");

View file

@ -0,0 +1,69 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OOPS_CONSTANTPOOL_INLINE_HPP
#define SHARE_VM_OOPS_CONSTANTPOOL_INLINE_HPP
#include "oops/constantPool.hpp"
#include "runtime/orderAccess.inline.hpp"
inline CPSlot ConstantPool::slot_at(int which) const {
assert(is_within_bounds(which), "index out of bounds");
assert(!tag_at(which).is_unresolved_klass() && !tag_at(which).is_unresolved_klass_in_error(), "Corrupted constant pool");
// Uses volatile because the klass slot changes without a lock.
intptr_t adr = OrderAccess::load_acquire(obj_at_addr(which));
assert(adr != 0 || which == 0, "cp entry for klass should not be zero");
return CPSlot(adr);
}
inline Klass* ConstantPool::resolved_klass_at(int which) const { // Used by Compiler
guarantee(tag_at(which).is_klass(), "Corrupted constant pool");
// Must do an acquire here in case another thread resolved the klass
// behind our back, lest we later load stale values thru the oop.
CPKlassSlot kslot = klass_slot_at(which);
assert(tag_at(kslot.name_index()).is_symbol(), "sanity");
Klass** adr = resolved_klasses()->adr_at(kslot.resolved_klass_index());
return OrderAccess::load_acquire(adr);
}
inline bool ConstantPool::is_pseudo_string_at(int which) {
assert(tag_at(which).is_string(), "Corrupted constant pool");
return slot_at(which).is_pseudo_string();
}
inline oop ConstantPool::pseudo_string_at(int which, int obj_index) {
assert(is_pseudo_string_at(which), "must be a pseudo-string");
oop s = resolved_references()->obj_at(obj_index);
return s;
}
inline oop ConstantPool::pseudo_string_at(int which) {
assert(is_pseudo_string_at(which), "must be a pseudo-string");
int obj_index = cp_to_object_index(which);
oop s = resolved_references()->obj_at(obj_index);
return s;
}
#endif // SHARE_VM_OOPS_CONSTANTPOOL_INLINE_HPP

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, 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,7 +34,8 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/access.inline.hpp"
#include "oops/cpCache.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/methodHandles.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, 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
@ -29,7 +29,6 @@
#include "memory/allocation.hpp"
#include "oops/array.hpp"
#include "oops/oopHandle.hpp"
#include "runtime/orderAccess.hpp"
#include "utilities/align.hpp"
#include "utilities/constantTag.hpp"
@ -328,42 +327,36 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
}
// Has this bytecode been resolved? Only valid for invokes and get/put field/static.
bool is_resolved(Bytecodes::Code code) const {
switch (bytecode_number(code)) {
case 1: return (bytecode_1() == code);
case 2: return (bytecode_2() == code);
}
return false; // default: not resolved
}
bool is_resolved(Bytecodes::Code code) const;
// Accessors
int indices() const { return _indices; }
int indices_ord() const { return OrderAccess::load_acquire(&_indices); }
int indices_ord() const;
int constant_pool_index() const { return (indices() & cp_index_mask); }
Bytecodes::Code bytecode_1() const { return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask); }
Bytecodes::Code bytecode_2() const { return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask); }
Metadata* f1_ord() const { return (Metadata *)OrderAccess::load_acquire(&_f1); }
Method* f1_as_method() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), ""); return (Method*)f1; }
Klass* f1_as_klass() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), ""); return (Klass*)f1; }
Bytecodes::Code bytecode_1() const;
Bytecodes::Code bytecode_2() const;
Metadata* f1_ord() const;
Method* f1_as_method() const;
Klass* f1_as_klass() const;
// Use the accessor f1() to acquire _f1's value. This is needed for
// example in BytecodeInterpreter::run(), where is_f1_null() is
// called to check if an invokedynamic call is resolved. This load
// of _f1 must be ordered with the loads performed by
// cache->main_entry_index().
bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound
bool is_f1_null() const; // classifies a CPC entry as unbound
int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; }
Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; }
Method* f2_as_interface_method() const { assert(bytecode_1() == Bytecodes::_invokeinterface, ""); return (Method*)_f2; }
intx flags_ord() const { return (intx)OrderAccess::load_acquire(&_flags); }
Method* f2_as_interface_method() const;
intx flags_ord() const;
int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); }
int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); }
bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
bool indy_resolution_failed() const { intx flags = flags_ord(); return (flags & (1 << indy_resolution_failed_shift)) != 0; }
bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; }
bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
bool indy_resolution_failed() const;
bool has_appendix() const;
bool has_method_type() const;
bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
bool is_long() const { return flag_state() == ltos; }
@ -440,16 +433,7 @@ class ConstantPoolCache: public MetaspaceObj {
ConstantPoolCache(int length,
const intStack& inverse_index_map,
const intStack& invokedynamic_inverse_index_map,
const intStack& invokedynamic_references_map) :
_length(length),
_constant_pool(NULL) {
CDS_JAVA_HEAP_ONLY(_archived_references = 0;)
initialize(inverse_index_map, invokedynamic_inverse_index_map,
invokedynamic_references_map);
for (int i = 0; i < length; i++) {
assert(entry_at(i)->is_f1_null(), "Failed to clear?");
}
}
const intStack& invokedynamic_references_map);
// Initialization
void initialize(const intArray& inverse_index_map,

View file

@ -0,0 +1,99 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OOPS_CPCACHEOOP_INLINE_HPP
#define SHARE_VM_OOPS_CPCACHEOOP_INLINE_HPP
#include "oops/cpCache.hpp"
#include "runtime/orderAccess.inline.hpp"
inline int ConstantPoolCacheEntry::indices_ord() const { return OrderAccess::load_acquire(&_indices); }
inline Bytecodes::Code ConstantPoolCacheEntry::bytecode_1() const {
return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask);
}
inline Bytecodes::Code ConstantPoolCacheEntry::bytecode_2() const {
return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask);
}
// Has this bytecode been resolved? Only valid for invokes and get/put field/static.
inline bool ConstantPoolCacheEntry::is_resolved(Bytecodes::Code code) const {
switch (bytecode_number(code)) {
case 1: return (bytecode_1() == code);
case 2: return (bytecode_2() == code);
}
return false; // default: not resolved
}
inline Method* ConstantPoolCacheEntry::f2_as_interface_method() const {
assert(bytecode_1() == Bytecodes::_invokeinterface, "");
return (Method*)_f2;
}
inline Metadata* ConstantPoolCacheEntry::f1_ord() const { return (Metadata *)OrderAccess::load_acquire(&_f1); }
inline Method* ConstantPoolCacheEntry::f1_as_method() const {
Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), "");
return (Method*)f1;
}
inline Klass* ConstantPoolCacheEntry::f1_as_klass() const {
Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), "");
return (Klass*)f1;
}
inline bool ConstantPoolCacheEntry::is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; }
inline bool ConstantPoolCacheEntry::has_appendix() const {
return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0;
}
inline bool ConstantPoolCacheEntry::has_method_type() const {
return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0;
}
inline intx ConstantPoolCacheEntry::flags_ord() const { return (intx)OrderAccess::load_acquire(&_flags); }
inline bool ConstantPoolCacheEntry::indy_resolution_failed() const {
intx flags = flags_ord();
return (flags & (1 << indy_resolution_failed_shift)) != 0;
}
// Constructor
inline ConstantPoolCache::ConstantPoolCache(int length,
const intStack& inverse_index_map,
const intStack& invokedynamic_inverse_index_map,
const intStack& invokedynamic_references_map) :
_length(length),
_constant_pool(NULL) {
CDS_JAVA_HEAP_ONLY(_archived_references = 0;)
initialize(inverse_index_map, invokedynamic_inverse_index_map,
invokedynamic_references_map);
for (int i = 0; i < length; i++) {
assert(entry_at(i)->is_f1_null(), "Failed to clear?");
}
}
#endif // SHARE_VM_OOPS_CPCACHEOOP_INLINE_HPP

View file

@ -42,7 +42,7 @@
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/constMethod.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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,9 +136,9 @@ class Method : public Metadata {
static address make_adapters(const methodHandle& mh, TRAPS);
address from_compiled_entry() const { return OrderAccess::load_acquire(&_from_compiled_entry); }
address from_compiled_entry() const;
address from_compiled_entry_no_trampoline() const;
address from_interpreted_entry() const{ return OrderAccess::load_acquire(&_from_interpreted_entry); }
address from_interpreted_entry() const;
// access flag
AccessFlags access_flags() const { return _access_flags; }
@ -333,12 +333,7 @@ class Method : public Metadata {
return _method_data;
}
void set_method_data(MethodData* data) {
// The store into method must be released. On platforms without
// total store order (TSO) the reference may become visible before
// the initialization of data otherwise.
OrderAccess::release_store(&_method_data, data);
}
void set_method_data(MethodData* data);
MethodCounters* method_counters() const {
return _method_counters;
@ -449,7 +444,7 @@ class Method : public Metadata {
// nmethod/verified compiler entry
address verified_code_entry();
bool check_code() const; // Not inline to avoid circular ref
CompiledMethod* volatile code() const { assert( check_code(), "" ); return OrderAccess::load_acquire(&_code); }
CompiledMethod* volatile code() const;
void clear_code(bool acquire_lock = true); // Clear out any compiled code
static void set_code(const methodHandle& mh, CompiledMethod* code);
void set_adapter_entry(AdapterHandlerEntry* adapter) {
@ -662,7 +657,7 @@ class Method : public Metadata {
// compiled code support
// NOTE: code() is inherently racy as deopt can be clearing code
// simultaneously. Use with caution.
bool has_compiled_code() const { return code() != NULL; }
bool has_compiled_code() const;
#ifdef TIERED
bool has_aot_code() const { return aot_code() != NULL; }

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OOPS_METHOD_INLINE_HPP
#define SHARE_VM_OOPS_METHOD_INLINE_HPP
#include "oops/method.hpp"
#include "runtime/orderAccess.hpp"
inline address Method::from_compiled_entry() const {
return OrderAccess::load_acquire(&_from_compiled_entry);
}
inline address Method::from_interpreted_entry() const {
return OrderAccess::load_acquire(&_from_interpreted_entry);
}
inline void Method::set_method_data(MethodData* data) {
// The store into method must be released. On platforms without
// total store order (TSO) the reference may become visible before
// the initialization of data otherwise.
OrderAccess::release_store(&_method_data, data);
}
inline CompiledMethod* volatile Method::code() const {
assert( check_code(), "" );
return OrderAccess::load_acquire(&_code);
}
inline bool Method::has_compiled_code() const { return code() != NULL; }
#endif // SHARE_VM_OOPS_METHOD_INLINE_HPP

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
@ -31,7 +31,7 @@
#include "memory/heapInspection.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/resourceArea.hpp"
#include "oops/methodData.hpp"
#include "oops/methodData.inline.hpp"
#include "prims/jvmtiRedefineClasses.hpp"
#include "runtime/arguments.hpp"
#include "runtime/compilationPolicy.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
@ -29,7 +29,6 @@
#include "memory/universe.hpp"
#include "oops/method.hpp"
#include "oops/oop.hpp"
#include "runtime/orderAccess.hpp"
#include "utilities/align.hpp"
#if INCLUDE_JVMCI
#include "jvmci/jvmci_globals.hpp"
@ -201,9 +200,7 @@ public:
void set_cell_at(int index, intptr_t value) {
_cells[index] = value;
}
void release_set_cell_at(int index, intptr_t value) {
OrderAccess::release_store(&_cells[index], value);
}
void release_set_cell_at(int index, intptr_t value);
intptr_t cell_at(int index) const {
return _cells[index];
}
@ -325,10 +322,7 @@ protected:
assert(0 <= index && index < cell_count(), "oob");
data()->set_cell_at(index, value);
}
void release_set_intptr_at(int index, intptr_t value) {
assert(0 <= index && index < cell_count(), "oob");
data()->release_set_cell_at(index, value);
}
void release_set_intptr_at(int index, intptr_t value);
intptr_t intptr_at(int index) const {
assert(0 <= index && index < cell_count(), "oob");
return data()->cell_at(index);
@ -336,18 +330,14 @@ protected:
void set_uint_at(int index, uint value) {
set_intptr_at(index, (intptr_t) value);
}
void release_set_uint_at(int index, uint value) {
release_set_intptr_at(index, (intptr_t) value);
}
void release_set_uint_at(int index, uint value);
uint uint_at(int index) const {
return (uint)intptr_at(index);
}
void set_int_at(int index, int value) {
set_intptr_at(index, (intptr_t) value);
}
void release_set_int_at(int index, int value) {
release_set_intptr_at(index, (intptr_t) value);
}
void release_set_int_at(int index, int value);
int int_at(int index) const {
return (int)intptr_at(index);
}
@ -1603,12 +1593,7 @@ protected:
assert((uint)row < row_limit(), "oob");
set_int_at(bci0_offset + row * ret_row_cell_count, bci);
}
void release_set_bci(uint row, int bci) {
assert((uint)row < row_limit(), "oob");
// 'release' when setting the bci acts as a valid flag for other
// threads wrt bci_count and bci_displacement.
release_set_int_at(bci0_offset + row * ret_row_cell_count, bci);
}
void release_set_bci(uint row, int bci);
void set_bci_count(uint row, uint count) {
assert((uint)row < row_limit(), "oob");
set_uint_at(count0_offset + row * ret_row_cell_count, count);

View file

@ -0,0 +1,55 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OOPS_METHODDATA_INLINE_HPP
#define SHARE_VM_OOPS_METHODDATA_INLINE_HPP
#include "oops/methodData.hpp"
#include "runtime/orderAccess.inline.hpp"
inline void DataLayout::release_set_cell_at(int index, intptr_t value) {
OrderAccess::release_store(&_cells[index], value);
}
inline void ProfileData::release_set_intptr_at(int index, intptr_t value) {
assert(0 <= index && index < cell_count(), "oob");
data()->release_set_cell_at(index, value);
}
inline void ProfileData::release_set_uint_at(int index, uint value) {
release_set_intptr_at(index, (intptr_t) value);
}
inline void ProfileData::release_set_int_at(int index, int value) {
release_set_intptr_at(index, (intptr_t) value);
}
inline void RetData::release_set_bci(uint row, int bci) {
assert((uint)row < row_limit(), "oob");
// 'release' when setting the bci acts as a valid flag for other
// threads wrt bci_count and bci_displacement.
release_set_int_at(bci0_offset + row * ret_row_cell_count, bci);
}
#endif // SHARE_VM_OOPS_METHODDATA_INLINE_HPP

View file

@ -32,6 +32,7 @@
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/arrayOop.inline.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/instanceMirrorKlass.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "prims/methodComparator.hpp"

View file

@ -40,7 +40,8 @@
#include "memory/universe.hpp"
#include "memory/oopFactory.hpp"
#include "oops/array.hpp"
#include "oops/constantPool.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/method.inline.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"

View file

@ -30,7 +30,7 @@
#include "interpreter/interpreter.hpp"
#include "memory/resourceArea.hpp"
#include "oops/methodData.hpp"
#include "oops/method.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/nativeLookup.hpp"
#include "runtime/advancedThresholdPolicy.hpp"

View file

@ -30,6 +30,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/linkResolver.hpp"
#include "memory/universe.inline.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jniCheck.hpp"
#include "runtime/compilationPolicy.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "interpreter/interpreter.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "runtime/frame.inline.hpp"

View file

@ -43,6 +43,7 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/klass.hpp"
#include "oops/method.inline.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/forte.hpp"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, 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
@ -82,13 +82,7 @@ protected:
template<CompLevel level> static inline bool loop_predicate_helper(int i, int b, double scale, Method* method);
// Get a compilation level for a given method.
static CompLevel comp_level(Method* method) {
CompiledMethod *nm = method->code();
if (nm != NULL && nm->is_in_use()) {
return (CompLevel)nm->comp_level();
}
return CompLevel_none;
}
static CompLevel comp_level(Method* method);
virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee,
CompLevel level, CompiledMethod* nm, JavaThread* thread);
virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, 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
@ -26,6 +26,7 @@
#define SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_INLINE_HPP
#include "compiler/compilerOracle.hpp"
#include "oops/method.inline.hpp"
#ifdef TIERED
@ -94,6 +95,14 @@ bool SimpleThresholdPolicy::is_trivial(Method* method) {
return false;
}
inline CompLevel SimpleThresholdPolicy::comp_level(Method* method) {
CompiledMethod *nm = method->code();
if (nm != NULL && nm->is_in_use()) {
return (CompLevel)nm->comp_level();
}
return CompLevel_none;
}
#endif // TIERED
#endif // SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_INLINE_HPP