Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: src/vm/process.cc

Issue 1405293007: Bugfix in process handle: Do detaching from owner process separately from derefing. (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/vm/process_handle.h » ('j') | src/vm/process_handle.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 #include "src/vm/process.h" 5 #include "src/vm/process.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "src/shared/assert.h" 10 #include "src/shared/assert.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 #ifdef DEBUG 102 #ifdef DEBUG
103 true_then_false_ = true; 103 true_then_false_ = true;
104 #endif 104 #endif
105 } 105 }
106 106
107 Process::~Process() { 107 Process::~Process() {
108 // [Cleanup] should've been called at this point. So we ASSERT the post 108 // [Cleanup] should've been called at this point. So we ASSERT the post
109 // conditions here. 109 // conditions here.
110 ASSERT(ports_ == NULL); 110 ASSERT(ports_ == NULL);
111 111
112 ProcessHandle::DecrementRef(process_handle_);
113
112 #ifdef FLETCH_ENABLE_MULTIPLE_PROCESS_HEAPS 114 #ifdef FLETCH_ENABLE_MULTIPLE_PROCESS_HEAPS
113 heap_.ProcessWeakPointers(); 115 heap_.ProcessWeakPointers();
114 #endif // #ifdef FLETCH_ENABLE_MULTIPLE_PROCESS_HEAPS 116 #endif // #ifdef FLETCH_ENABLE_MULTIPLE_PROCESS_HEAPS
115 117
116 delete debug_info_; 118 delete debug_info_;
117 119
118 ASSERT(next_ == NULL); 120 ASSERT(next_ == NULL);
119 ASSERT(cooked_stack_deltas_.is_empty()); 121 ASSERT(cooked_stack_deltas_.is_empty());
120 } 122 }
121 123
122 void Process::Cleanup(Signal::Kind kind) { 124 void Process::Cleanup(Signal::Kind kind) {
123 // Clear out the process pointer from all the ports. 125 // Clear out the process pointer from all the ports.
124 ASSERT(immutable_heap_ == NULL); 126 ASSERT(immutable_heap_ == NULL);
125 while (ports_ != NULL) { 127 while (ports_ != NULL) {
126 Port* next = ports_->next(); 128 Port* next = ports_->next();
127 ports_->OwnerProcessTerminating(); 129 ports_->OwnerProcessTerminating();
128 ports_ = next; 130 ports_ = next;
129 } 131 }
130 132
131 // We are going down at this point. If anything else is starting to 133 // We are going down at this point. If anything else is starting to
132 // link/monitor with this [ProcessHandle], it will fail after this line. 134 // link/monitor with this [ProcessHandle], it will fail after this line.
133 ProcessHandle::OwnerProcessTerminating(process_handle_); 135 process_handle_->OwnerProcessTerminating();
134 136
135 // Since nobody can send us messages (or signals) at this point, we can 137 // Since nobody can send us messages (or signals) at this point, we can
136 // propagate the exit signal. 138 // propagate the exit signal.
137 links()->CleanupWithSignal(process_handle(), kind); 139 links()->CleanupWithSignal(process_handle(), kind);
138 } 140 }
139 141
140 void Process::SetupExecutionStack() { 142 void Process::SetupExecutionStack() {
141 ASSERT(coroutine_ == NULL); 143 ASSERT(coroutine_ == NULL);
142 Stack* stack = Stack::cast(NewStack(256)); 144 Stack* stack = Stack::cast(NewStack(256));
143 stack->set(0, NULL); 145 stack->set(0, NULL);
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 while (queue != NULL) { 858 while (queue != NULL) {
857 Instance* channel = queue->port()->channel(); 859 Instance* channel = queue->port()->channel();
858 if (channel != NULL) return channel; 860 if (channel != NULL) return channel;
859 mailbox->AdvanceCurrentMessage(); 861 mailbox->AdvanceCurrentMessage();
860 queue = mailbox->CurrentMessage(); 862 queue = mailbox->CurrentMessage();
861 } 863 }
862 return process->program()->null_object(); 864 return process->program()->null_object();
863 } 865 }
864 866
865 } // namespace fletch 867 } // namespace fletch
OLDNEW
« no previous file with comments | « no previous file | src/vm/process_handle.h » ('j') | src/vm/process_handle.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698