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

Side by Side Diff: runtime/vm/isolate.h

Issue 1344993002: Refactor isolate interrupts to use OOB messages instead of interrupt bits. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_ISOLATE_H_ 5 #ifndef VM_ISOLATE_H_
6 #define VM_ISOLATE_H_ 6 #define VM_ISOLATE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/atomic.h" 10 #include "vm/atomic.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 V(Instance) \ 107 V(Instance) \
108 V(Library) \ 108 V(Library) \
109 V(Object) \ 109 V(Object) \
110 V(PcDescriptors) \ 110 V(PcDescriptors) \
111 V(String) \ 111 V(String) \
112 V(TypeArguments) \ 112 V(TypeArguments) \
113 V(TypeParameter) \ 113 V(TypeParameter) \
114 114
115 class Isolate : public BaseIsolate { 115 class Isolate : public BaseIsolate {
116 public: 116 public:
117 // Keep both these enums in sync with isolate_patch.dart.
118 // The different Isolate API message types.
119 enum LibMsgId {
120 kPauseMsg = 1,
121 kResumeMsg = 2,
122 kPingMsg = 3,
123 kKillMsg = 4,
124 kAddExitMsg = 5,
125 kDelExitMsg = 6,
126 kAddErrorMsg = 7,
127 kDelErrorMsg = 8,
128 kErrorFatalMsg = 9,
129 kInterruptMsg = 10,
130 };
131 // The different Isolate API message priorities for ping and kill messages.
132 enum LibMsgPriority {
133 kImmediateAction = 0,
134 kBeforeNextEventAction = 1,
135 kAsEventAction = 2
136 };
137
117 ~Isolate(); 138 ~Isolate();
118 139
119 static inline Isolate* Current() { 140 static inline Isolate* Current() {
120 Thread* thread = Thread::Current(); 141 Thread* thread = Thread::Current();
121 return thread == NULL ? NULL : thread->isolate(); 142 return thread == NULL ? NULL : thread->isolate();
122 } 143 }
123 144
124 // Register a newly introduced class. 145 // Register a newly introduced class.
125 void RegisterClass(const Class& cls); 146 void RegisterClass(const Class& cls);
126 void RegisterClassAt(intptr_t index, const Class& cls); 147 void RegisterClassAt(intptr_t index, const Class& cls);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 (origin_id_ == main_port_)); 200 (origin_id_ == main_port_));
180 origin_id_ = id; 201 origin_id_ = id;
181 } 202 }
182 void set_pause_capability(uint64_t value) { pause_capability_ = value; } 203 void set_pause_capability(uint64_t value) { pause_capability_ = value; }
183 uint64_t pause_capability() const { return pause_capability_; } 204 uint64_t pause_capability() const { return pause_capability_; }
184 void set_terminate_capability(uint64_t value) { 205 void set_terminate_capability(uint64_t value) {
185 terminate_capability_ = value; 206 terminate_capability_ = value;
186 } 207 }
187 uint64_t terminate_capability() const { return terminate_capability_; } 208 uint64_t terminate_capability() const { return terminate_capability_; }
188 209
210 void SendInternalLibMessage(LibMsgId msg_id, uint64_t capability);
211
189 Heap* heap() const { return heap_; } 212 Heap* heap() const { return heap_; }
190 void set_heap(Heap* value) { heap_ = value; } 213 void set_heap(Heap* value) { heap_ = value; }
191 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } 214 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); }
192 215
193 ObjectStore* object_store() const { return object_store_; } 216 ObjectStore* object_store() const { return object_store_; }
194 void set_object_store(ObjectStore* value) { object_store_ = value; } 217 void set_object_store(ObjectStore* value) { object_store_ = value; }
195 static intptr_t object_store_offset() { 218 static intptr_t object_store_offset() {
196 return OFFSET_OF(Isolate, object_store_); 219 return OFFSET_OF(Isolate, object_store_);
197 } 220 }
198 221
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 333
311 // Retrieve the stack address bounds for profiler. 334 // Retrieve the stack address bounds for profiler.
312 bool GetProfilerStackBounds(uword* lower, uword* upper) const; 335 bool GetProfilerStackBounds(uword* lower, uword* upper) const;
313 336
314 static uword GetSpecifiedStackSize(); 337 static uword GetSpecifiedStackSize();
315 338
316 static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize); 339 static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize);
317 340
318 // Interrupt bits. 341 // Interrupt bits.
319 enum { 342 enum {
320 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate. 343 kVMInterrupt = 0x1, // Internal VM checks: safepoints, store buffers, etc.
321 kMessageInterrupt = 0x2, // An interrupt to process an out of band message. 344 kMessageInterrupt = 0x2, // An interrupt to process an out of band message.
322 kVMInterrupt = 0x4, // Internal VM checks: safepoints, store buffers, etc.
323 345
324 kInterruptsMask = 346 kInterruptsMask = (kVMInterrupt | kMessageInterrupt),
325 kApiInterrupt |
326 kMessageInterrupt |
327 kVMInterrupt,
328 }; 347 };
329 348
330 void ScheduleInterrupts(uword interrupt_bits); 349 void ScheduleInterrupts(uword interrupt_bits);
350 RawError* HandleInterrupts();
331 uword GetAndClearInterrupts(); 351 uword GetAndClearInterrupts();
332 352
333 // Marks all libraries as loaded. 353 // Marks all libraries as loaded.
334 void DoneLoading(); 354 void DoneLoading();
335 355
336 bool MakeRunnable(); 356 bool MakeRunnable();
337 void Run(); 357 void Run();
338 358
339 MessageHandler* message_handler() const { return message_handler_; } 359 MessageHandler* message_handler() const { return message_handler_; }
340 void set_message_handler(MessageHandler* value) { message_handler_ = value; } 360 void set_message_handler(MessageHandler* value) { message_handler_ = value; }
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 uint8_t* serialized_message_; 1149 uint8_t* serialized_message_;
1130 intptr_t serialized_message_len_; 1150 intptr_t serialized_message_len_;
1131 Isolate::Flags isolate_flags_; 1151 Isolate::Flags isolate_flags_;
1132 bool paused_; 1152 bool paused_;
1133 bool errors_are_fatal_; 1153 bool errors_are_fatal_;
1134 }; 1154 };
1135 1155
1136 } // namespace dart 1156 } // namespace dart
1137 1157
1138 #endif // VM_ISOLATE_H_ 1158 #endif // VM_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698