577 ++_size;
578
579 // Mark the method as being in the compile queue.
580 task->method()->set_queued_for_compilation();
581
582 if (CIPrintCompileQueue) {
583 print();
584 }
585
586 if (LogCompilation && xtty != NULL) {
587 task->log_task_queued();
588 }
589
590 // Notify CompilerThreads that a task is available.
591 lock()->notify_all();
592 }
593
594 void CompileQueue::delete_all() {
595 assert(lock()->owned_by_self(), "must own lock");
596 if (_first != NULL) {
597 for (CompileTask* task = _first; task != NULL; task = task->next()) {
598 delete task;
599 }
600 _first = NULL;
601 }
602 }
603
604 // ------------------------------------------------------------------
605 // CompileQueue::get
606 //
607 // Get the next CompileTask from a CompileQueue
608 CompileTask* CompileQueue::get() {
609 NMethodSweeper::possibly_sweep();
610
611 MutexLocker locker(lock());
612 // If _first is NULL we have no more compile jobs. There are two reasons for
613 // having no compile jobs: First, we compiled everything we wanted. Second,
614 // we ran out of code cache so compilation has been disabled. In the latter
615 // case we perform code cache sweeps to free memory such that we can re-enable
616 // compilation.
617 while (_first == NULL) {
618 // Exit loop if compilation is disabled forever
619 if (CompileBroker::is_compilation_disabled_forever()) {
|
577 ++_size;
578
579 // Mark the method as being in the compile queue.
580 task->method()->set_queued_for_compilation();
581
582 if (CIPrintCompileQueue) {
583 print();
584 }
585
586 if (LogCompilation && xtty != NULL) {
587 task->log_task_queued();
588 }
589
590 // Notify CompilerThreads that a task is available.
591 lock()->notify_all();
592 }
593
594 void CompileQueue::delete_all() {
595 assert(lock()->owned_by_self(), "must own lock");
596 if (_first != NULL) {
597 CompileTask* task = _first;
598 do {
599 CompileTask* delete_task = task;
600 task = task->next();
601 delete delete_task;
602 } while (task != NULL);
603 _first = NULL;
604 }
605 }
606
607 // ------------------------------------------------------------------
608 // CompileQueue::get
609 //
610 // Get the next CompileTask from a CompileQueue
611 CompileTask* CompileQueue::get() {
612 NMethodSweeper::possibly_sweep();
613
614 MutexLocker locker(lock());
615 // If _first is NULL we have no more compile jobs. There are two reasons for
616 // having no compile jobs: First, we compiled everything we wanted. Second,
617 // we ran out of code cache so compilation has been disabled. In the latter
618 // case we perform code cache sweeps to free memory such that we can re-enable
619 // compilation.
620 while (_first == NULL) {
621 // Exit loop if compilation is disabled forever
622 if (CompileBroker::is_compilation_disabled_forever()) {
|