mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
Merge
This commit is contained in:
commit
9288ff53e7
1316 changed files with 58581 additions and 14455 deletions
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/symbolTable.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
#include "code/codeCache.hpp"
|
||||
|
@ -56,6 +57,7 @@
|
|||
#if INCLUDE_JVMCI
|
||||
#include "jvmci/jvmciCompiler.hpp"
|
||||
#include "jvmci/jvmciRuntime.hpp"
|
||||
#include "jvmci/jvmciJavaClasses.hpp"
|
||||
#include "runtime/vframe.hpp"
|
||||
#endif
|
||||
#ifdef COMPILER2
|
||||
|
@ -214,7 +216,7 @@ bool compileBroker_init() {
|
|||
|
||||
if (DirectivesParser::has_file()) {
|
||||
return DirectivesParser::parse_from_flag();
|
||||
} else if (PrintCompilerDirectives) {
|
||||
} else if (CompilerDirectivesPrint) {
|
||||
// Print default directive even when no other was added
|
||||
DirectivesStack::print(tty);
|
||||
}
|
||||
|
@ -498,7 +500,7 @@ CompilerCounters::CompilerCounters() {
|
|||
// CompileBroker::compilation_init
|
||||
//
|
||||
// Initialize the Compilation object
|
||||
void CompileBroker::compilation_init() {
|
||||
void CompileBroker::compilation_init(TRAPS) {
|
||||
_last_method_compiled[0] = '\0';
|
||||
|
||||
// No need to initialize compilation system if we do not use it.
|
||||
|
@ -529,6 +531,17 @@ void CompileBroker::compilation_init() {
|
|||
} else {
|
||||
c1_count = JVMCIHostThreads;
|
||||
}
|
||||
|
||||
if (!UseInterpreter) {
|
||||
// Force initialization of JVMCI compiler otherwise JVMCI
|
||||
// compilations will not block until JVMCI is initialized
|
||||
ResourceMark rm;
|
||||
TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
|
||||
TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
|
||||
Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
|
||||
JavaValue result(T_OBJECT);
|
||||
JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // INCLUDE_JVMCI
|
||||
|
|
|
@ -276,7 +276,7 @@ public:
|
|||
CompileQueue *q = compile_queue(comp_level);
|
||||
return q != NULL ? q->size() : 0;
|
||||
}
|
||||
static void compilation_init();
|
||||
static void compilation_init(TRAPS);
|
||||
static void init_compiler_thread_log();
|
||||
static nmethod* compile_method(const methodHandle& method,
|
||||
int osr_bci,
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
class CompileTask : public CHeapObj<mtCompiler> {
|
||||
friend class VMStructs;
|
||||
friend class JVMCIVMStructs;
|
||||
|
||||
private:
|
||||
static CompileTask* _task_free_list;
|
||||
|
|
|
@ -86,16 +86,21 @@ void CompilerDirectives::print(outputStream* st) {
|
|||
//---
|
||||
}
|
||||
|
||||
void CompilerDirectives::finalize() {
|
||||
void CompilerDirectives::finalize(outputStream* st) {
|
||||
if (_c1_store != NULL) {
|
||||
_c1_store->finalize();
|
||||
_c1_store->finalize(st);
|
||||
}
|
||||
if (_c2_store != NULL) {
|
||||
_c2_store->finalize();
|
||||
_c2_store->finalize(st);
|
||||
}
|
||||
}
|
||||
|
||||
void DirectiveSet::finalize() {
|
||||
void DirectiveSet::finalize(outputStream* st) {
|
||||
// Check LogOption and warn
|
||||
if (LogOption && !LogCompilation) {
|
||||
st->print_cr("Warning: +LogCompilation must be set to enable compilation logging from directives");
|
||||
}
|
||||
|
||||
// if any flag has been modified - set directive as enabled
|
||||
// unless it already has been explicitly set.
|
||||
if (!_modified[EnableIndex]) {
|
||||
|
@ -252,12 +257,14 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(methodHandle metho
|
|||
changed = true;
|
||||
}
|
||||
}
|
||||
if (CompilerOracle::should_log(method)) {
|
||||
if (!_modified[LogIndex]) {
|
||||
set->LogOption = true;
|
||||
if (!_modified[LogIndex]) {
|
||||
bool log = CompilerOracle::should_log(method);
|
||||
if (log != set->LogOption) {
|
||||
set->LogOption = log;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (CompilerOracle::should_print(method)) {
|
||||
if (!_modified[PrintAssemblyIndex]) {
|
||||
set->PrintAssemblyOption = true;
|
||||
|
@ -306,7 +313,7 @@ CompilerDirectives* DirectiveSet::directive() {
|
|||
|
||||
bool DirectiveSet::matches_inline(methodHandle method, int inline_action) {
|
||||
if (_inlinematchers != NULL) {
|
||||
if (_inlinematchers->match(method, InlineMatcher::force_inline)) {
|
||||
if (_inlinematchers->match(method, inline_action)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -318,11 +325,11 @@ bool DirectiveSet::should_inline(ciMethod* inlinee) {
|
|||
VM_ENTRY_MARK;
|
||||
methodHandle mh(THREAD, inlinee->get_Method());
|
||||
|
||||
if (matches_inline(mh, InlineMatcher::force_inline)) {
|
||||
return true;
|
||||
if (_inlinematchers != NULL) {
|
||||
return matches_inline(mh, InlineMatcher::force_inline);
|
||||
}
|
||||
if (!CompilerDirectivesIgnoreCompileCommandsOption && CompilerOracle::should_inline(mh)) {
|
||||
return true;
|
||||
if (!CompilerDirectivesIgnoreCompileCommandsOption) {
|
||||
return CompilerOracle::should_inline(mh);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -332,11 +339,11 @@ bool DirectiveSet::should_not_inline(ciMethod* inlinee) {
|
|||
VM_ENTRY_MARK;
|
||||
methodHandle mh(THREAD, inlinee->get_Method());
|
||||
|
||||
if (matches_inline(mh, InlineMatcher::dont_inline)) {
|
||||
return true;
|
||||
if (_inlinematchers != NULL) {
|
||||
return matches_inline(mh, InlineMatcher::dont_inline);
|
||||
}
|
||||
if (!CompilerDirectivesIgnoreCompileCommandsOption && CompilerOracle::should_not_inline(mh)) {
|
||||
return true;
|
||||
if (!CompilerDirectivesIgnoreCompileCommandsOption) {
|
||||
return CompilerOracle::should_not_inline(mh);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -487,6 +494,14 @@ void DirectivesStack::pop_inner() {
|
|||
DirectivesStack::release(tmp);
|
||||
}
|
||||
|
||||
bool DirectivesStack::check_capacity(int request_size, outputStream* st) {
|
||||
if ((request_size + _depth) > CompilerDirectivesLimit) {
|
||||
st->print_cr("Could not add %i more directives. Currently %i/%i directives.", request_size, _depth, CompilerDirectivesLimit);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DirectivesStack::clear() {
|
||||
// holding the lock during the whole operation ensuring consistent result
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
@ -546,10 +561,11 @@ DirectiveSet* DirectivesStack::getMatchingDirective(methodHandle method, Abstrac
|
|||
match = dir->_c1_store;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match->EnableOption) {
|
||||
// The directiveSet for this compile is also enabled -> success
|
||||
break;
|
||||
} else {
|
||||
if (match->EnableOption) {
|
||||
// The directiveSet for this compile is also enabled -> success
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dir = dir->next();
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
cflags(Exclude, bool, false, X) \
|
||||
cflags(BreakAtExecute, bool, false, X) \
|
||||
cflags(BreakAtCompile, bool, false, X) \
|
||||
cflags(Log, bool, false, X) \
|
||||
cflags(Log, bool, LogCompilation, X) \
|
||||
cflags(PrintAssembly, bool, PrintAssembly, PrintAssembly) \
|
||||
cflags(PrintInlining, bool, PrintInlining, PrintInlining) \
|
||||
cflags(PrintNMethods, bool, PrintNMethods, PrintNMethods) \
|
||||
|
@ -88,6 +88,7 @@ public:
|
|||
static DirectiveSet* getDefaultDirective(AbstractCompiler* comp);
|
||||
static void push(CompilerDirectives* directive);
|
||||
static void pop();
|
||||
static bool check_capacity(int request_size, outputStream* st);
|
||||
static void clear();
|
||||
static void print(outputStream* st);
|
||||
static void release(DirectiveSet* set);
|
||||
|
@ -115,7 +116,7 @@ public:
|
|||
bool matches_inline(methodHandle method, int inline_action);
|
||||
static DirectiveSet* clone(DirectiveSet const* src);
|
||||
bool is_intrinsic_disabled(methodHandle method);
|
||||
void finalize();
|
||||
void finalize(outputStream* st);
|
||||
|
||||
typedef enum {
|
||||
#define enum_of_flags(name, type, dvalue, cc_flag) name##Index,
|
||||
|
@ -175,7 +176,7 @@ public:
|
|||
DirectiveSet* get_for(AbstractCompiler *comp);
|
||||
void print(outputStream* st);
|
||||
bool is_default_directive() { return _next == NULL; }
|
||||
void finalize();
|
||||
void finalize(outputStream* st);
|
||||
|
||||
void inc_refcount();
|
||||
void dec_refcount();
|
||||
|
|
|
@ -247,15 +247,6 @@ TypedMethodOptionMatcher::~TypedMethodOptionMatcher() {
|
|||
if (_option != NULL) {
|
||||
os::free((void*)_option);
|
||||
}
|
||||
if (_class_name != NULL) {
|
||||
_class_name->decrement_refcount();
|
||||
}
|
||||
if (_method_name != NULL) {
|
||||
_method_name->decrement_refcount();
|
||||
}
|
||||
if (_signature != NULL) {
|
||||
_signature->decrement_refcount();
|
||||
}
|
||||
}
|
||||
|
||||
TypedMethodOptionMatcher* TypedMethodOptionMatcher::parse_method_pattern(char*& line, const char*& error_msg) {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <string.h>
|
||||
|
||||
void DirectivesParser::push_tmp(CompilerDirectives* dir) {
|
||||
_tmp_depth++;
|
||||
dir->set_next(_tmp_top);
|
||||
_tmp_top = dir;
|
||||
}
|
||||
|
@ -41,17 +42,29 @@ CompilerDirectives* DirectivesParser::pop_tmp() {
|
|||
CompilerDirectives* tmp = _tmp_top;
|
||||
_tmp_top = _tmp_top->next();
|
||||
tmp->set_next(NULL);
|
||||
_tmp_depth--;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void DirectivesParser::clean_tmp() {
|
||||
CompilerDirectives* tmp = pop_tmp();
|
||||
while (tmp != NULL) {
|
||||
delete tmp;
|
||||
tmp = pop_tmp();
|
||||
}
|
||||
assert(_tmp_depth == 0, "Consistency");
|
||||
}
|
||||
|
||||
bool DirectivesParser::parse_string(const char* text, outputStream* st) {
|
||||
DirectivesParser cd(text, st);
|
||||
if (cd.valid()) {
|
||||
return cd.install_directives();
|
||||
} else {
|
||||
cd.clean_tmp();
|
||||
st->flush();
|
||||
st->print_cr("Parsing of compiler directives failed");
|
||||
return false;
|
||||
}
|
||||
st->flush();
|
||||
st->print_cr("Parsing of compiler directives failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DirectivesParser::has_file() {
|
||||
|
@ -91,6 +104,12 @@ bool DirectivesParser::parse_from_file_inner(const char* filename, outputStream*
|
|||
}
|
||||
|
||||
bool DirectivesParser::install_directives() {
|
||||
// Check limit
|
||||
if (!DirectivesStack::check_capacity(_tmp_depth, _st)) {
|
||||
clean_tmp();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Pop from internal temporary stack and push to compileBroker.
|
||||
CompilerDirectives* tmp = pop_tmp();
|
||||
int i = 0;
|
||||
|
@ -104,7 +123,7 @@ bool DirectivesParser::install_directives() {
|
|||
return false;
|
||||
} else {
|
||||
_st->print_cr("%i compiler directives added", i);
|
||||
if (PrintCompilerDirectives) {
|
||||
if (CompilerDirectivesPrint) {
|
||||
// Print entire directives stack after new has been pushed.
|
||||
DirectivesStack::print(_st);
|
||||
}
|
||||
|
@ -113,7 +132,7 @@ bool DirectivesParser::install_directives() {
|
|||
}
|
||||
|
||||
DirectivesParser::DirectivesParser(const char* text, outputStream* st)
|
||||
: JSON(text, false, st), depth(0), current_directive(NULL), current_directiveset(NULL), _tmp_top(NULL) {
|
||||
: JSON(text, false, st), depth(0), current_directive(NULL), current_directiveset(NULL), _tmp_top(NULL), _tmp_depth(0) {
|
||||
#ifndef PRODUCT
|
||||
memset(stack, 0, MAX_DEPTH * sizeof(stack[0]));
|
||||
#endif
|
||||
|
@ -121,6 +140,8 @@ DirectivesParser::DirectivesParser(const char* text, outputStream* st)
|
|||
}
|
||||
|
||||
DirectivesParser::~DirectivesParser() {
|
||||
assert(_tmp_top == NULL, "Consistency");
|
||||
assert(_tmp_depth == 0, "Consistency");
|
||||
}
|
||||
|
||||
const DirectivesParser::key DirectivesParser::keys[] = {
|
||||
|
@ -379,11 +400,12 @@ bool DirectivesParser::set_option(JSON_TYPE t, JSON_VAL* v) {
|
|||
|
||||
const char* error_msg = NULL;
|
||||
if (current_directiveset == NULL) {
|
||||
if (!current_directive->_c1_store->parse_and_add_inline(s, error_msg)) {
|
||||
assert (error_msg != NULL, "Must have valid error message");
|
||||
error(VALUE_ERROR, "Method pattern error: %s", error_msg);
|
||||
}
|
||||
if (!current_directive->_c2_store->parse_and_add_inline(s, error_msg)) {
|
||||
if (current_directive->_c1_store->parse_and_add_inline(s, error_msg)) {
|
||||
if (!current_directive->_c2_store->parse_and_add_inline(s, error_msg)) {
|
||||
assert (error_msg != NULL, "Must have valid error message");
|
||||
error(VALUE_ERROR, "Method pattern error: %s", error_msg);
|
||||
}
|
||||
} else {
|
||||
assert (error_msg != NULL, "Must have valid error message");
|
||||
error(VALUE_ERROR, "Method pattern error: %s", error_msg);
|
||||
}
|
||||
|
@ -520,7 +542,7 @@ bool DirectivesParser::callback(JSON_TYPE t, JSON_VAL* v, uint rlimit) {
|
|||
error(INTERNAL_ERROR, "Directive missing required match.");
|
||||
return false;
|
||||
}
|
||||
current_directive->finalize();
|
||||
current_directive->finalize(_st);
|
||||
push_tmp(current_directive);
|
||||
current_directive = NULL;
|
||||
break;
|
||||
|
@ -583,6 +605,7 @@ void DirectivesParser::test(const char* text, bool should_pass) {
|
|||
tty->print("-- DirectivesParser test failed as expected --\n");
|
||||
}
|
||||
}
|
||||
cd.clean_tmp();
|
||||
}
|
||||
|
||||
bool DirectivesParser::test() {
|
||||
|
|
|
@ -126,8 +126,10 @@ private:
|
|||
DirectiveSet* current_directiveset;
|
||||
|
||||
void push_tmp(CompilerDirectives* dir);
|
||||
void clean_tmp();
|
||||
CompilerDirectives* pop_tmp();
|
||||
CompilerDirectives* _tmp_top; // temporary storage for dirs while parsing
|
||||
int _tmp_depth; // Number of directives that has been parsed but not installed.
|
||||
|
||||
static uint mask(keytype kt);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue