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

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

Issue 1315893004: Load runtime entries from the Thread instead of the ObjectPool. (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
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_THREAD_H_ 5 #ifndef VM_THREAD_H_
6 #define VM_THREAD_H_ 6 #define VM_THREAD_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/os_thread.h" 9 #include "vm/os_thread.h"
10 #include "vm/store_buffer.h" 10 #include "vm/store_buffer.h"
11 #include "vm/runtime_entry_list.h"
11 12
12 namespace dart { 13 namespace dart {
13 14
14 class CHA; 15 class CHA;
15 class HandleScope; 16 class HandleScope;
16 class Heap; 17 class Heap;
17 class Isolate; 18 class Isolate;
18 class LongJumpScope; 19 class LongJumpScope;
19 class Object; 20 class Object;
20 class RawBool; 21 class RawBool;
21 class RawObject; 22 class RawObject;
23 class RuntimeEntry;
22 class StackResource; 24 class StackResource;
23 class TimelineEventBlock; 25 class TimelineEventBlock;
24 class Zone; 26 class Zone;
25 27
26
27 // List of VM-global objects/addresses cached in each Thread object. 28 // List of VM-global objects/addresses cached in each Thread object.
28 #define CACHED_VM_OBJECTS_LIST(V) \ 29 #define CACHED_VM_OBJECTS_LIST(V) \
29 V(RawObject*, object_null_, Object::null(), NULL) \ 30 V(RawObject*, object_null_, Object::null(), NULL) \
30 V(RawBool*, bool_true_, Object::bool_true().raw(), NULL) \ 31 V(RawBool*, bool_true_, Object::bool_true().raw(), NULL) \
31 V(RawBool*, bool_false_, Object::bool_false().raw(), NULL) \ 32 V(RawBool*, bool_false_, Object::bool_false().raw(), NULL) \
32 33
33 #define CACHED_ADDRESSES_LIST(V) \ 34 #define CACHED_ADDRESSES_LIST(V) \
34 V(uword, update_store_buffer_entry_point_, \ 35 V(uword, update_store_buffer_entry_point_, \
35 StubCode::UpdateStoreBuffer_entry()->EntryPoint(), 0) 36 StubCode::UpdateStoreBuffer_entry()->EntryPoint(), 0) \
36 37
37 #define CACHED_CONSTANTS_LIST(V) \ 38 #define CACHED_CONSTANTS_LIST(V) \
38 CACHED_VM_OBJECTS_LIST(V) \ 39 CACHED_VM_OBJECTS_LIST(V) \
39 CACHED_ADDRESSES_LIST(V) 40 CACHED_ADDRESSES_LIST(V) \
40 41
41 struct InterruptedThreadState { 42 struct InterruptedThreadState {
42 ThreadId tid; 43 ThreadId tid;
43 uintptr_t pc; 44 uintptr_t pc;
44 uintptr_t csp; 45 uintptr_t csp;
45 uintptr_t dsp; 46 uintptr_t dsp;
46 uintptr_t fp; 47 uintptr_t fp;
47 uintptr_t lr; 48 uintptr_t lr;
48 }; 49 };
49 50
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 #endif 220 #endif
220 }; 221 };
221 222
222 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ 223 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \
223 static intptr_t member_name##offset() { \ 224 static intptr_t member_name##offset() { \
224 return OFFSET_OF(Thread, member_name); \ 225 return OFFSET_OF(Thread, member_name); \
225 } 226 }
226 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD) 227 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD)
227 #undef DEFINE_OFFSET_METHOD 228 #undef DEFINE_OFFSET_METHOD
228 229
230 #define DEFINE_OFFSET_METHOD(name) \
231 static intptr_t name##_entry_point_offset() { \
232 return OFFSET_OF(Thread, name##_entry_point_); \
233 }
234 RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD)
235 #undef DEFINE_OFFSET_METHOD
236
237 #define DEFINE_OFFSET_METHOD(returntype, name, ...) \
238 static intptr_t name##_entry_point_offset() { \
239 return OFFSET_OF(Thread, name##_entry_point_); \
240 }
241 LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD)
242 #undef DEFINE_OFFSET_METHOD
243
229 static bool CanLoadFromThread(const Object& object); 244 static bool CanLoadFromThread(const Object& object);
230 static intptr_t OffsetFromThread(const Object& object); 245 static intptr_t OffsetFromThread(const Object& object);
246 static intptr_t OffsetFromThread(const RuntimeEntry* runtime_entry);
231 247
232 TimelineEventBlock* timeline_block() const { 248 TimelineEventBlock* timeline_block() const {
233 return state_.timeline_block; 249 return state_.timeline_block;
234 } 250 }
235 251
236 void set_timeline_block(TimelineEventBlock* block) { 252 void set_timeline_block(TimelineEventBlock* block) {
237 state_.timeline_block = block; 253 state_.timeline_block = block;
238 } 254 }
239 255
240 LongJumpScope* long_jump_base() const { return state_.long_jump_base; } 256 LongJumpScope* long_jump_base() const { return state_.long_jump_base; }
(...skipping 19 matching lines...) Expand all
260 void* thread_interrupt_data_; 276 void* thread_interrupt_data_;
261 Isolate* isolate_; 277 Isolate* isolate_;
262 Heap* heap_; 278 Heap* heap_;
263 State state_; 279 State state_;
264 StoreBufferBlock* store_buffer_block_; 280 StoreBufferBlock* store_buffer_block_;
265 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ 281 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \
266 type_name member_name; 282 type_name member_name;
267 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) 283 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS)
268 #undef DECLARE_MEMBERS 284 #undef DECLARE_MEMBERS
269 285
286 #define DECLARE_MEMBERS(name) \
287 uword name##_entry_point_;
288 RUNTIME_ENTRY_LIST(DECLARE_MEMBERS)
289 #undef DECLARE_MEMBERS
290
291 #define DECLARE_MEMBERS(returntype, name, ...) \
292 uword name##_entry_point_;
293 LEAF_RUNTIME_ENTRY_LIST(DECLARE_MEMBERS)
294 #undef DECLARE_MEMBERS
295
270 explicit Thread(bool init_vm_constants = true); 296 explicit Thread(bool init_vm_constants = true);
271 297
272 void InitVMConstants(); 298 void InitVMConstants();
273 299
274 void ClearState() { 300 void ClearState() {
275 memset(&state_, 0, sizeof(state_)); 301 memset(&state_, 0, sizeof(state_));
276 } 302 }
277 303
278 void StoreBufferRelease(bool check_threshold = true); 304 void StoreBufferRelease(bool check_threshold = true);
279 void StoreBufferAcquire(); 305 void StoreBufferAcquire();
(...skipping 14 matching lines...) Expand all
294 friend class ApiZone; 320 friend class ApiZone;
295 friend class Isolate; 321 friend class Isolate;
296 friend class StackZone; 322 friend class StackZone;
297 friend class ThreadRegistry; 323 friend class ThreadRegistry;
298 DISALLOW_COPY_AND_ASSIGN(Thread); 324 DISALLOW_COPY_AND_ASSIGN(Thread);
299 }; 325 };
300 326
301 } // namespace dart 327 } // namespace dart
302 328
303 #endif // VM_THREAD_H_ 329 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698