510 if (set->is_exclusive_copy()) {
511 // Old CompilecCmmands forced us to create an exclusive copy
512 delete set;
513 } else {
514 assert(set->directive() != NULL, "");
515 release(set->directive());
516 }
517 }
518
519
520 void DirectivesStack::release(CompilerDirectives* dir) {
521 assert(DirectivesStack_lock->owned_by_self(), "");
522 dir->dec_refcount();
523 if (dir->refcount() == 0) {
524 delete dir;
525 }
526 }
527
528 DirectiveSet* DirectivesStack::getMatchingDirective(methodHandle method, AbstractCompiler *comp) {
529 assert(_depth > 0, "Must never be empty");
530 CompilerDirectives* dir = _top;
531 assert(dir != NULL, "Must be initialized");
532
533 DirectiveSet* match = NULL;
534 {
535 MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
536 while (dir != NULL) {
537 if (dir->is_default_directive() || dir->match(method)) {
538 match = dir->get_for(comp);
539 if (match == NULL) {
540 // temporary workaround for compilers without directives.
541 if (dir->is_default_directive()) {
542 // default dir is always enabled
543 // match c1 store - it contains all common flags even if C1 is unavailable
544 match = dir->_c1_store;
545 break;
546 }
547 }
548 if (match->EnableOption) {
549 // The directiveSet for this compile is also enabled -> success
550 break;
551 }
552 }
553 dir = dir->next();
554 }
555 }
|
510 if (set->is_exclusive_copy()) {
511 // Old CompilecCmmands forced us to create an exclusive copy
512 delete set;
513 } else {
514 assert(set->directive() != NULL, "");
515 release(set->directive());
516 }
517 }
518
519
520 void DirectivesStack::release(CompilerDirectives* dir) {
521 assert(DirectivesStack_lock->owned_by_self(), "");
522 dir->dec_refcount();
523 if (dir->refcount() == 0) {
524 delete dir;
525 }
526 }
527
528 DirectiveSet* DirectivesStack::getMatchingDirective(methodHandle method, AbstractCompiler *comp) {
529 assert(_depth > 0, "Must never be empty");
530
531 DirectiveSet* match = NULL;
532 {
533 MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
534
535 CompilerDirectives* dir = _top;
536 assert(dir != NULL, "Must be initialized");
537
538 while (dir != NULL) {
539 if (dir->is_default_directive() || dir->match(method)) {
540 match = dir->get_for(comp);
541 if (match == NULL) {
542 // temporary workaround for compilers without directives.
543 if (dir->is_default_directive()) {
544 // default dir is always enabled
545 // match c1 store - it contains all common flags even if C1 is unavailable
546 match = dir->_c1_store;
547 break;
548 }
549 }
550 if (match->EnableOption) {
551 // The directiveSet for this compile is also enabled -> success
552 break;
553 }
554 }
555 dir = dir->next();
556 }
557 }
|