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