470
471 void DirectivesStack::release(CompilerDirectives* dir) {
472 assert(DirectivesStack_lock->owned_by_self(), "");
473 dir->dec_refcount();
474 if (dir->refcount() == 0) {
475 delete dir;
476 }
477 }
478
479 DirectiveSet* DirectivesStack::getMatchingDirective(methodHandle method, AbstractCompiler *comp) {
480 assert(_depth > 0, "Must never be empty");
481 CompilerDirectives* dir = _top;
482 assert(dir != NULL, "Must be initialized");
483
484 DirectiveSet* match = NULL;
485 {
486 MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
487 while (dir != NULL) {
488 if (dir->is_default_directive() || dir->match(method)) {
489 match = dir->get_for(comp);
490 if (match->EnableOption) {
491 // The directiveSet for this compile is also enabled -> success
492 break;
493 }
494 }
495 dir = dir->next();
496 }
497 }
498
499 guarantee(match != NULL, "There should always be a default directive that matches");
500 // Check for legacy compile commands update, without DirectivesStack_lock
501 return match->compilecommand_compatibility_init(method);
502 }
|
470
471 void DirectivesStack::release(CompilerDirectives* dir) {
472 assert(DirectivesStack_lock->owned_by_self(), "");
473 dir->dec_refcount();
474 if (dir->refcount() == 0) {
475 delete dir;
476 }
477 }
478
479 DirectiveSet* DirectivesStack::getMatchingDirective(methodHandle method, AbstractCompiler *comp) {
480 assert(_depth > 0, "Must never be empty");
481 CompilerDirectives* dir = _top;
482 assert(dir != NULL, "Must be initialized");
483
484 DirectiveSet* match = NULL;
485 {
486 MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
487 while (dir != NULL) {
488 if (dir->is_default_directive() || dir->match(method)) {
489 match = dir->get_for(comp);
490 if (match == NULL) {
491 // temporary workaround for compilers without directives.
492 if (dir->is_default_directive()) {
493 // default dir is always enabled
494 // match c1 store - it contains all common flags even if C1 is unavailable
495 match = dir->_c1_store;
496 break;
497 }
498 }
499 if (match->EnableOption) {
500 // The directiveSet for this compile is also enabled -> success
501 break;
502 }
503 }
504 dir = dir->next();
505 }
506 }
507
508 guarantee(match != NULL, "There should always be a default directive that matches");
509 // Check for legacy compile commands update, without DirectivesStack_lock
510 return match->compilecommand_compatibility_init(method);
511 }
|