equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
121 |
121 |
122 CompilerDirectives* CompilerDirectives::next() { |
122 CompilerDirectives* CompilerDirectives::next() { |
123 return _next; |
123 return _next; |
124 } |
124 } |
125 |
125 |
126 bool CompilerDirectives::match(methodHandle method) { |
126 bool CompilerDirectives::match(const methodHandle& method) { |
127 if (is_default_directive()) { |
127 if (is_default_directive()) { |
128 return true; |
128 return true; |
129 } |
129 } |
130 if (method == NULL) { |
130 if (method == NULL) { |
131 return false; |
131 return false; |
230 // Breaks the abstraction and causes lots of extra complexity |
230 // Breaks the abstraction and causes lots of extra complexity |
231 // - if some option is changed we need to copy directiveset since it no longer can be shared |
231 // - if some option is changed we need to copy directiveset since it no longer can be shared |
232 // - Need to free copy after use |
232 // - Need to free copy after use |
233 // - Requires a modified bit so we don't overwrite options that is set by directives |
233 // - Requires a modified bit so we don't overwrite options that is set by directives |
234 |
234 |
235 DirectiveSet* DirectiveSet::compilecommand_compatibility_init(methodHandle method) { |
235 DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle& method) { |
236 // Early bail out - checking all options is expensive - we rely on them not being used |
236 // Early bail out - checking all options is expensive - we rely on them not being used |
237 // Only set a flag if it has not been modified and value changes. |
237 // Only set a flag if it has not been modified and value changes. |
238 // Only copy set if a flag needs to be set |
238 // Only copy set if a flag needs to be set |
239 if (!CompilerDirectivesIgnoreCompileCommandsOption && CompilerOracle::has_any_option()) { |
239 if (!CompilerDirectivesIgnoreCompileCommandsOption && CompilerOracle::has_any_option()) { |
240 DirectiveSet* set = DirectiveSet::clone(this); |
240 DirectiveSet* set = DirectiveSet::clone(this); |
305 CompilerDirectives* DirectiveSet::directive() { |
305 CompilerDirectives* DirectiveSet::directive() { |
306 assert(_directive != NULL, "Must have been initialized"); |
306 assert(_directive != NULL, "Must have been initialized"); |
307 return _directive; |
307 return _directive; |
308 } |
308 } |
309 |
309 |
310 bool DirectiveSet::matches_inline(methodHandle method, int inline_action) { |
310 bool DirectiveSet::matches_inline(const methodHandle& method, int inline_action) { |
311 if (_inlinematchers != NULL) { |
311 if (_inlinematchers != NULL) { |
312 if (_inlinematchers->match(method, inline_action)) { |
312 if (_inlinematchers->match(method, inline_action)) { |
313 return true; |
313 return true; |
314 } |
314 } |
315 } |
315 } |
382 } |
382 } |
383 st->cr(); |
383 st->cr(); |
384 } |
384 } |
385 } |
385 } |
386 |
386 |
387 bool DirectiveSet::is_intrinsic_disabled(methodHandle method) { |
387 bool DirectiveSet::is_intrinsic_disabled(const methodHandle& method) { |
388 vmIntrinsics::ID id = method->intrinsic_id(); |
388 vmIntrinsics::ID id = method->intrinsic_id(); |
389 assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); |
389 assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); |
390 |
390 |
391 ResourceMark rm; |
391 ResourceMark rm; |
392 |
392 |
541 if (dir->refcount() == 0) { |
541 if (dir->refcount() == 0) { |
542 delete dir; |
542 delete dir; |
543 } |
543 } |
544 } |
544 } |
545 |
545 |
546 DirectiveSet* DirectivesStack::getMatchingDirective(methodHandle method, AbstractCompiler *comp) { |
546 DirectiveSet* DirectivesStack::getMatchingDirective(const methodHandle& method, AbstractCompiler *comp) { |
547 assert(_depth > 0, "Must never be empty"); |
547 assert(_depth > 0, "Must never be empty"); |
548 |
548 |
549 DirectiveSet* match = NULL; |
549 DirectiveSet* match = NULL; |
550 { |
550 { |
551 MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag); |
551 MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag); |