57 void G1StringDedupThread::run() {
58 G1StringDedupStat total_stat;
59
60 initialize_in_thread();
61 wait_for_universe_init();
62
63 // Main loop
64 for (;;) {
65 G1StringDedupStat stat;
66
67 stat.mark_idle();
68
69 // Wait for the queue to become non-empty
70 G1StringDedupQueue::wait();
71 if (_should_terminate) {
72 break;
73 }
74
75 {
76 // Include thread in safepoints
77 SuspendibleThreadSetJoiner sts;
78
79 stat.mark_exec();
80
81 // Process the queue
82 for (;;) {
83 oop java_string = G1StringDedupQueue::pop();
84 if (java_string == NULL) {
85 break;
86 }
87
88 G1StringDedupTable::deduplicate(java_string, stat);
89
90 // Safepoint this thread if needed
91 if (sts.should_yield()) {
92 stat.mark_block();
93 sts.yield();
94 stat.mark_unblock();
95 }
96 }
97
98 G1StringDedupTable::trim_entry_cache();
99
100 stat.mark_done();
101
102 // Print statistics
103 total_stat.add(stat);
104 print(gclog_or_tty, stat, total_stat);
105 }
106 }
107
108 terminate();
109 }
110
111 void G1StringDedupThread::stop() {
112 {
113 MonitorLockerEx ml(Terminator_lock);
|
57 void G1StringDedupThread::run() {
58 G1StringDedupStat total_stat;
59
60 initialize_in_thread();
61 wait_for_universe_init();
62
63 // Main loop
64 for (;;) {
65 G1StringDedupStat stat;
66
67 stat.mark_idle();
68
69 // Wait for the queue to become non-empty
70 G1StringDedupQueue::wait();
71 if (_should_terminate) {
72 break;
73 }
74
75 {
76 // Include thread in safepoints
77 SuspendibleThreadSetJoiner sts_join;
78
79 stat.mark_exec();
80
81 // Process the queue
82 for (;;) {
83 oop java_string = G1StringDedupQueue::pop();
84 if (java_string == NULL) {
85 break;
86 }
87
88 G1StringDedupTable::deduplicate(java_string, stat);
89
90 // Safepoint this thread if needed
91 if (sts_join.should_yield()) {
92 stat.mark_block();
93 sts_join.yield();
94 stat.mark_unblock();
95 }
96 }
97
98 G1StringDedupTable::trim_entry_cache();
99
100 stat.mark_done();
101
102 // Print statistics
103 total_stat.add(stat);
104 print(gclog_or_tty, stat, total_stat);
105 }
106 }
107
108 terminate();
109 }
110
111 void G1StringDedupThread::stop() {
112 {
113 MonitorLockerEx ml(Terminator_lock);
|