rev |
line source |
slaxemulator@9289
|
1 diff -Naur otp_src_R12B-5/erts/emulator/beam/erl_gc.c otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_gc.c
|
slaxemulator@9289
|
2 --- otp_src_R12B-5/erts/emulator/beam/erl_gc.c 2008-11-04 11:51:44.000000000 +0100
|
slaxemulator@9289
|
3 +++ otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_gc.c 2009-01-14 10:03:47.000000000 +0100
|
slaxemulator@9289
|
4 @@ -341,7 +341,6 @@
|
slaxemulator@9289
|
5 {
|
slaxemulator@9289
|
6 Uint reclaimed_now = 0;
|
slaxemulator@9289
|
7 int done = 0;
|
slaxemulator@9289
|
8 - Uint saved_status = p->status;
|
slaxemulator@9289
|
9 Uint ms1, s1, us1;
|
slaxemulator@9289
|
10
|
slaxemulator@9289
|
11 if (IS_TRACED_FL(p, F_TRACE_GC)) {
|
slaxemulator@9289
|
12 @@ -349,6 +348,7 @@
|
slaxemulator@9289
|
13 }
|
slaxemulator@9289
|
14
|
slaxemulator@9289
|
15 erts_smp_proc_lock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
16 + p->gcstatus = p->status;
|
slaxemulator@9289
|
17 p->status = P_GARBING;
|
slaxemulator@9289
|
18 if (erts_system_monitor_long_gc != 0) {
|
slaxemulator@9289
|
19 get_now(&ms1, &s1, &us1);
|
slaxemulator@9289
|
20 @@ -384,7 +384,7 @@
|
slaxemulator@9289
|
21 ErtsGcQuickSanityCheck(p);
|
slaxemulator@9289
|
22
|
slaxemulator@9289
|
23 erts_smp_proc_lock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
24 - p->status = saved_status;
|
slaxemulator@9289
|
25 + p->status = p->gcstatus;
|
slaxemulator@9289
|
26 erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
27 if (IS_TRACED_FL(p, F_TRACE_GC)) {
|
slaxemulator@9289
|
28 trace_gc(p, am_gc_end);
|
slaxemulator@9289
|
29 @@ -449,7 +449,6 @@
|
slaxemulator@9289
|
30 void
|
slaxemulator@9289
|
31 erts_garbage_collect_hibernate(Process* p)
|
slaxemulator@9289
|
32 {
|
slaxemulator@9289
|
33 - Uint saved_status = p->status;
|
slaxemulator@9289
|
34 Uint heap_size;
|
slaxemulator@9289
|
35 Eterm* heap;
|
slaxemulator@9289
|
36 Eterm* htop;
|
slaxemulator@9289
|
37 @@ -466,6 +465,7 @@
|
slaxemulator@9289
|
38 * Preliminaries.
|
slaxemulator@9289
|
39 */
|
slaxemulator@9289
|
40 erts_smp_proc_lock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
41 + p->gcstatus = p->status;
|
slaxemulator@9289
|
42 p->status = P_GARBING;
|
slaxemulator@9289
|
43 erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
44 erts_smp_locked_activity_begin(ERTS_ACTIVITY_GC);
|
slaxemulator@9289
|
45 @@ -580,7 +580,7 @@
|
slaxemulator@9289
|
46 ErtsGcQuickSanityCheck(p);
|
slaxemulator@9289
|
47
|
slaxemulator@9289
|
48 erts_smp_proc_lock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
49 - p->status = saved_status;
|
slaxemulator@9289
|
50 + p->status = p->gcstatus;
|
slaxemulator@9289
|
51 erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
52 erts_smp_locked_activity_end(ERTS_ACTIVITY_GC);
|
slaxemulator@9289
|
53 }
|
slaxemulator@9289
|
54 @@ -589,7 +589,6 @@
|
slaxemulator@9289
|
55 void
|
slaxemulator@9289
|
56 erts_garbage_collect_literals(Process* p, Eterm* literals, Uint lit_size)
|
slaxemulator@9289
|
57 {
|
slaxemulator@9289
|
58 - Uint saved_status = p->status;
|
slaxemulator@9289
|
59 Uint byte_lit_size = sizeof(Eterm)*lit_size;
|
slaxemulator@9289
|
60 Uint old_heap_size;
|
slaxemulator@9289
|
61 Eterm* temp_lit;
|
slaxemulator@9289
|
62 @@ -605,6 +604,7 @@
|
slaxemulator@9289
|
63 * Set GC state.
|
slaxemulator@9289
|
64 */
|
slaxemulator@9289
|
65 erts_smp_proc_lock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
66 + p->gcstatus = p->status;
|
slaxemulator@9289
|
67 p->status = P_GARBING;
|
slaxemulator@9289
|
68 erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
69 erts_smp_locked_activity_begin(ERTS_ACTIVITY_GC);
|
slaxemulator@9289
|
70 @@ -708,7 +708,7 @@
|
slaxemulator@9289
|
71 * Restore status.
|
slaxemulator@9289
|
72 */
|
slaxemulator@9289
|
73 erts_smp_proc_lock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
74 - p->status = saved_status;
|
slaxemulator@9289
|
75 + p->status = p->gcstatus;
|
slaxemulator@9289
|
76 erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS);
|
slaxemulator@9289
|
77 erts_smp_locked_activity_end(ERTS_ACTIVITY_GC);
|
slaxemulator@9289
|
78 }
|
slaxemulator@9289
|
79 diff -Naur otp_src_R12B-5/erts/emulator/beam/erl_message.c otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_message.c
|
slaxemulator@9289
|
80 --- otp_src_R12B-5/erts/emulator/beam/erl_message.c 2008-09-01 14:51:20.000000000 +0200
|
slaxemulator@9289
|
81 +++ otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_message.c 2009-01-14 10:03:47.000000000 +0100
|
slaxemulator@9289
|
82 @@ -295,10 +295,27 @@
|
slaxemulator@9289
|
83
|
slaxemulator@9289
|
84 ACTIVATE(receiver);
|
slaxemulator@9289
|
85
|
slaxemulator@9289
|
86 - if (receiver->status == P_WAITING) {
|
slaxemulator@9289
|
87 - add_to_schedule_q(receiver);
|
slaxemulator@9289
|
88 - } else if (receiver->status == P_SUSPENDED) {
|
slaxemulator@9289
|
89 + switch (receiver->status) {
|
slaxemulator@9289
|
90 + case P_GARBING:
|
slaxemulator@9289
|
91 + switch (receiver->gcstatus) {
|
slaxemulator@9289
|
92 + case P_SUSPENDED:
|
slaxemulator@9289
|
93 + goto suspended;
|
slaxemulator@9289
|
94 + case P_WAITING:
|
slaxemulator@9289
|
95 + goto waiting;
|
slaxemulator@9289
|
96 + default:
|
slaxemulator@9289
|
97 + break;
|
slaxemulator@9289
|
98 + }
|
slaxemulator@9289
|
99 + break;
|
slaxemulator@9289
|
100 + case P_SUSPENDED:
|
slaxemulator@9289
|
101 + suspended:
|
slaxemulator@9289
|
102 receiver->rstatus = P_RUNABLE;
|
slaxemulator@9289
|
103 + break;
|
slaxemulator@9289
|
104 + case P_WAITING:
|
slaxemulator@9289
|
105 + waiting:
|
slaxemulator@9289
|
106 + add_to_schedule_q(receiver);
|
slaxemulator@9289
|
107 + break;
|
slaxemulator@9289
|
108 + default:
|
slaxemulator@9289
|
109 + break;
|
slaxemulator@9289
|
110 }
|
slaxemulator@9289
|
111
|
slaxemulator@9289
|
112 if (IS_TRACED_FL(receiver, F_TRACE_RECEIVE)) {
|
slaxemulator@9289
|
113 diff -Naur otp_src_R12B-5/erts/emulator/beam/erl_process.c otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_process.c
|
slaxemulator@9289
|
114 --- otp_src_R12B-5/erts/emulator/beam/erl_process.c 2008-11-04 11:51:10.000000000 +0100
|
slaxemulator@9289
|
115 +++ otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_process.c 2009-01-14 10:03:47.000000000 +0100
|
slaxemulator@9289
|
116 @@ -473,21 +473,33 @@
|
slaxemulator@9289
|
117 static ERTS_INLINE void
|
slaxemulator@9289
|
118 resume_process(Process *p)
|
slaxemulator@9289
|
119 {
|
slaxemulator@9289
|
120 + Uint32 *statusp;
|
slaxemulator@9289
|
121 ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_STATUS & erts_proc_lc_my_proc_locks(p));
|
slaxemulator@9289
|
122 - /* We may get called from trace([suspend], false) */
|
slaxemulator@9289
|
123 - if (p->status != P_SUSPENDED)
|
slaxemulator@9289
|
124 + switch (p->status) {
|
slaxemulator@9289
|
125 + case P_SUSPENDED:
|
slaxemulator@9289
|
126 + statusp = &p->status;
|
slaxemulator@9289
|
127 + break;
|
slaxemulator@9289
|
128 + case P_GARBING:
|
slaxemulator@9289
|
129 + if (p->gcstatus == P_SUSPENDED) {
|
slaxemulator@9289
|
130 + statusp = &p->gcstatus;
|
slaxemulator@9289
|
131 + break;
|
slaxemulator@9289
|
132 + }
|
slaxemulator@9289
|
133 + /* Fall through */
|
slaxemulator@9289
|
134 + default:
|
slaxemulator@9289
|
135 return;
|
slaxemulator@9289
|
136 + }
|
slaxemulator@9289
|
137 +
|
slaxemulator@9289
|
138 ASSERT(p->rcount > 0);
|
slaxemulator@9289
|
139
|
slaxemulator@9289
|
140 if (--p->rcount > 0) /* multiple suspend i.e trace and busy port */
|
slaxemulator@9289
|
141 return;
|
slaxemulator@9289
|
142 switch(p->rstatus) {
|
slaxemulator@9289
|
143 case P_RUNABLE:
|
slaxemulator@9289
|
144 - p->status = P_WAITING; /* make add_to_schedule_q work */
|
slaxemulator@9289
|
145 + *statusp = P_WAITING; /* make add_to_schedule_q work */
|
slaxemulator@9289
|
146 add_to_schedule_q(p);
|
slaxemulator@9289
|
147 break;
|
slaxemulator@9289
|
148 case P_WAITING:
|
slaxemulator@9289
|
149 - p->status = P_WAITING;
|
slaxemulator@9289
|
150 + *statusp = P_WAITING;
|
slaxemulator@9289
|
151 break;
|
slaxemulator@9289
|
152 default:
|
slaxemulator@9289
|
153 erl_exit(1, "bad state in resume_process()\n");
|
slaxemulator@9289
|
154 @@ -1548,8 +1560,16 @@
|
slaxemulator@9289
|
155 else
|
slaxemulator@9289
|
156 sq->last->next = p;
|
slaxemulator@9289
|
157 sq->last = p;
|
slaxemulator@9289
|
158 - if (p->status != P_EXITING) {
|
slaxemulator@9289
|
159 +
|
slaxemulator@9289
|
160 + switch (p->status) {
|
slaxemulator@9289
|
161 + case P_EXITING:
|
slaxemulator@9289
|
162 + break;
|
slaxemulator@9289
|
163 + case P_GARBING:
|
slaxemulator@9289
|
164 + p->gcstatus = P_RUNABLE;
|
slaxemulator@9289
|
165 + break;
|
slaxemulator@9289
|
166 + default:
|
slaxemulator@9289
|
167 p->status = P_RUNABLE;
|
slaxemulator@9289
|
168 + break;
|
slaxemulator@9289
|
169 }
|
slaxemulator@9289
|
170
|
slaxemulator@9289
|
171 runq_len++;
|
slaxemulator@9289
|
172 @@ -2925,6 +2945,7 @@
|
slaxemulator@9289
|
173 p->max_gen_gcs = 0;
|
slaxemulator@9289
|
174 p->min_heap_size = 0;
|
slaxemulator@9289
|
175 p->status = P_RUNABLE;
|
slaxemulator@9289
|
176 + p->gcstatus = P_RUNABLE;
|
slaxemulator@9289
|
177 p->rstatus = P_RUNABLE;
|
slaxemulator@9289
|
178 p->rcount = 0;
|
slaxemulator@9289
|
179 p->id = ERTS_INVALID_PID;
|
slaxemulator@9289
|
180 diff -Naur otp_src_R12B-5/erts/emulator/beam/erl_process.h otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_process.h
|
slaxemulator@9289
|
181 --- otp_src_R12B-5/erts/emulator/beam/erl_process.h 2008-11-04 11:51:11.000000000 +0100
|
slaxemulator@9289
|
182 +++ otp_src_R12B-5_OTP-7738/erts/emulator/beam/erl_process.h 2009-01-14 10:03:47.000000000 +0100
|
slaxemulator@9289
|
183 @@ -207,6 +207,7 @@
|
slaxemulator@9289
|
184 * Only valid for the current process.
|
slaxemulator@9289
|
185 */
|
slaxemulator@9289
|
186 Uint32 status; /* process STATE */
|
slaxemulator@9289
|
187 + Uint32 gcstatus; /* process gc STATE */
|
slaxemulator@9289
|
188 Uint32 rstatus; /* process resume STATE */
|
slaxemulator@9289
|
189 Uint32 rcount; /* suspend count */
|
slaxemulator@9289
|
190 Eterm id; /* The pid of this process */
|