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

Side by Side Diff: runtime/vm/os_linux.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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/os_fuchsia.cc ('k') | runtime/vm/os_macos.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(HOST_OS_LINUX) 6 #if defined(HOST_OS_LINUX)
7 7
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
11 #include <fcntl.h> // NOLINT
11 #include <limits.h> // NOLINT 12 #include <limits.h> // NOLINT
12 #include <malloc.h> // NOLINT 13 #include <malloc.h> // NOLINT
13 #include <time.h> // NOLINT
14 #include <sys/resource.h> // NOLINT 14 #include <sys/resource.h> // NOLINT
15 #include <sys/stat.h> // NOLINT
16 #include <sys/syscall.h> // NOLINT
15 #include <sys/time.h> // NOLINT 17 #include <sys/time.h> // NOLINT
16 #include <sys/types.h> // NOLINT 18 #include <sys/types.h> // NOLINT
17 #include <sys/syscall.h> // NOLINT 19 #include <time.h> // NOLINT
18 #include <sys/stat.h> // NOLINT
19 #include <fcntl.h> // NOLINT
20 #include <unistd.h> // NOLINT 20 #include <unistd.h> // NOLINT
21 21
22 #include "platform/memory_sanitizer.h" 22 #include "platform/memory_sanitizer.h"
23 #include "platform/utils.h" 23 #include "platform/utils.h"
24 #include "vm/code_observers.h" 24 #include "vm/code_observers.h"
25 #include "vm/dart.h" 25 #include "vm/dart.h"
26 #include "vm/flags.h" 26 #include "vm/flags.h"
27 #include "vm/isolate.h" 27 #include "vm/isolate.h"
28 #include "vm/lockers.h" 28 #include "vm/lockers.h"
29 #include "vm/os_thread.h" 29 #include "vm/os_thread.h"
30 #include "vm/zone.h" 30 #include "vm/zone.h"
31 31
32
33 namespace dart { 32 namespace dart {
34 33
35 #ifndef PRODUCT 34 #ifndef PRODUCT
36 35
37 DEFINE_FLAG(bool, 36 DEFINE_FLAG(bool,
38 generate_perf_events_symbols, 37 generate_perf_events_symbols,
39 false, 38 false,
40 "Generate events symbols for profiling with perf"); 39 "Generate events symbols for profiling with perf");
41 40
42 // Linux CodeObservers. 41 // Linux CodeObservers.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 (*file_write)(buffer, strlen(buffer), out_file_); 82 (*file_write)(buffer, strlen(buffer), out_file_);
84 } 83 }
85 } 84 }
86 85
87 private: 86 private:
88 void* out_file_; 87 void* out_file_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(PerfCodeObserver); 89 DISALLOW_COPY_AND_ASSIGN(PerfCodeObserver);
91 }; 90 };
92 91
93
94 #endif // !PRODUCT 92 #endif // !PRODUCT
95 93
96 const char* OS::Name() { 94 const char* OS::Name() {
97 return "linux"; 95 return "linux";
98 } 96 }
99 97
100
101 intptr_t OS::ProcessId() { 98 intptr_t OS::ProcessId() {
102 return static_cast<intptr_t>(getpid()); 99 return static_cast<intptr_t>(getpid());
103 } 100 }
104 101
105
106 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { 102 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
107 time_t seconds = static_cast<time_t>(seconds_since_epoch); 103 time_t seconds = static_cast<time_t>(seconds_since_epoch);
108 if (seconds != seconds_since_epoch) return false; 104 if (seconds != seconds_since_epoch) return false;
109 struct tm* error_code = localtime_r(&seconds, tm_result); 105 struct tm* error_code = localtime_r(&seconds, tm_result);
110 return error_code != NULL; 106 return error_code != NULL;
111 } 107 }
112 108
113
114 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { 109 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
115 tm decomposed; 110 tm decomposed;
116 bool succeeded = LocalTime(seconds_since_epoch, &decomposed); 111 bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
117 // If unsuccessful, return an empty string like V8 does. 112 // If unsuccessful, return an empty string like V8 does.
118 return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : ""; 113 return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : "";
119 } 114 }
120 115
121
122 int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { 116 int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) {
123 tm decomposed; 117 tm decomposed;
124 bool succeeded = LocalTime(seconds_since_epoch, &decomposed); 118 bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
125 // Even if the offset was 24 hours it would still easily fit into 32 bits. 119 // Even if the offset was 24 hours it would still easily fit into 32 bits.
126 // If unsuccessful, return zero like V8 does. 120 // If unsuccessful, return zero like V8 does.
127 return succeeded ? static_cast<int>(decomposed.tm_gmtoff) : 0; 121 return succeeded ? static_cast<int>(decomposed.tm_gmtoff) : 0;
128 } 122 }
129 123
130
131 int OS::GetLocalTimeZoneAdjustmentInSeconds() { 124 int OS::GetLocalTimeZoneAdjustmentInSeconds() {
132 // TODO(floitsch): avoid excessive calls to tzset? 125 // TODO(floitsch): avoid excessive calls to tzset?
133 tzset(); 126 tzset();
134 // Even if the offset was 24 hours it would still easily fit into 32 bits. 127 // Even if the offset was 24 hours it would still easily fit into 32 bits.
135 // Note that Unix and Dart disagree on the sign. 128 // Note that Unix and Dart disagree on the sign.
136 return static_cast<int>(-timezone); 129 return static_cast<int>(-timezone);
137 } 130 }
138 131
139
140 int64_t OS::GetCurrentTimeMillis() { 132 int64_t OS::GetCurrentTimeMillis() {
141 return GetCurrentTimeMicros() / 1000; 133 return GetCurrentTimeMicros() / 1000;
142 } 134 }
143 135
144
145 int64_t OS::GetCurrentTimeMicros() { 136 int64_t OS::GetCurrentTimeMicros() {
146 // gettimeofday has microsecond resolution. 137 // gettimeofday has microsecond resolution.
147 struct timeval tv; 138 struct timeval tv;
148 if (gettimeofday(&tv, NULL) < 0) { 139 if (gettimeofday(&tv, NULL) < 0) {
149 UNREACHABLE(); 140 UNREACHABLE();
150 return 0; 141 return 0;
151 } 142 }
152 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; 143 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
153 } 144 }
154 145
155
156 int64_t OS::GetCurrentMonotonicTicks() { 146 int64_t OS::GetCurrentMonotonicTicks() {
157 struct timespec ts; 147 struct timespec ts;
158 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { 148 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
159 UNREACHABLE(); 149 UNREACHABLE();
160 return 0; 150 return 0;
161 } 151 }
162 // Convert to nanoseconds. 152 // Convert to nanoseconds.
163 int64_t result = ts.tv_sec; 153 int64_t result = ts.tv_sec;
164 result *= kNanosecondsPerSecond; 154 result *= kNanosecondsPerSecond;
165 result += ts.tv_nsec; 155 result += ts.tv_nsec;
166 return result; 156 return result;
167 } 157 }
168 158
169
170 int64_t OS::GetCurrentMonotonicFrequency() { 159 int64_t OS::GetCurrentMonotonicFrequency() {
171 return kNanosecondsPerSecond; 160 return kNanosecondsPerSecond;
172 } 161 }
173 162
174
175 int64_t OS::GetCurrentMonotonicMicros() { 163 int64_t OS::GetCurrentMonotonicMicros() {
176 int64_t ticks = GetCurrentMonotonicTicks(); 164 int64_t ticks = GetCurrentMonotonicTicks();
177 ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond); 165 ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond);
178 return ticks / kNanosecondsPerMicrosecond; 166 return ticks / kNanosecondsPerMicrosecond;
179 } 167 }
180 168
181
182 int64_t OS::GetCurrentThreadCPUMicros() { 169 int64_t OS::GetCurrentThreadCPUMicros() {
183 struct timespec ts; 170 struct timespec ts;
184 if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) { 171 if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) {
185 UNREACHABLE(); 172 UNREACHABLE();
186 return -1; 173 return -1;
187 } 174 }
188 int64_t result = ts.tv_sec; 175 int64_t result = ts.tv_sec;
189 result *= kMicrosecondsPerSecond; 176 result *= kMicrosecondsPerSecond;
190 result += (ts.tv_nsec / kNanosecondsPerMicrosecond); 177 result += (ts.tv_nsec / kNanosecondsPerMicrosecond);
191 return result; 178 return result;
192 } 179 }
193 180
194
195 // TODO(5411554): May need to hoist these architecture dependent code 181 // TODO(5411554): May need to hoist these architecture dependent code
196 // into a architecture specific file e.g: os_ia32_linux.cc 182 // into a architecture specific file e.g: os_ia32_linux.cc
197 intptr_t OS::ActivationFrameAlignment() { 183 intptr_t OS::ActivationFrameAlignment() {
198 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ 184 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
199 defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC) 185 defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC)
200 const int kMinimumAlignment = 16; 186 const int kMinimumAlignment = 16;
201 #elif defined(TARGET_ARCH_ARM) 187 #elif defined(TARGET_ARCH_ARM)
202 const int kMinimumAlignment = 8; 188 const int kMinimumAlignment = 8;
203 #else 189 #else
204 #error Unsupported architecture. 190 #error Unsupported architecture.
205 #endif 191 #endif
206 intptr_t alignment = kMinimumAlignment; 192 intptr_t alignment = kMinimumAlignment;
207 // TODO(5411554): Allow overriding default stack alignment for 193 // TODO(5411554): Allow overriding default stack alignment for
208 // testing purposes. 194 // testing purposes.
209 // Flags::DebugIsInt("stackalign", &alignment); 195 // Flags::DebugIsInt("stackalign", &alignment);
210 ASSERT(Utils::IsPowerOfTwo(alignment)); 196 ASSERT(Utils::IsPowerOfTwo(alignment));
211 ASSERT(alignment >= kMinimumAlignment); 197 ASSERT(alignment >= kMinimumAlignment);
212 return alignment; 198 return alignment;
213 } 199 }
214 200
215
216 intptr_t OS::PreferredCodeAlignment() { 201 intptr_t OS::PreferredCodeAlignment() {
217 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ 202 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
218 defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC) 203 defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC)
219 const int kMinimumAlignment = 32; 204 const int kMinimumAlignment = 32;
220 #elif defined(TARGET_ARCH_ARM) 205 #elif defined(TARGET_ARCH_ARM)
221 const int kMinimumAlignment = 16; 206 const int kMinimumAlignment = 16;
222 #else 207 #else
223 #error Unsupported architecture. 208 #error Unsupported architecture.
224 #endif 209 #endif
225 intptr_t alignment = kMinimumAlignment; 210 intptr_t alignment = kMinimumAlignment;
226 // TODO(5411554): Allow overriding default code alignment for 211 // TODO(5411554): Allow overriding default code alignment for
227 // testing purposes. 212 // testing purposes.
228 // Flags::DebugIsInt("codealign", &alignment); 213 // Flags::DebugIsInt("codealign", &alignment);
229 ASSERT(Utils::IsPowerOfTwo(alignment)); 214 ASSERT(Utils::IsPowerOfTwo(alignment));
230 ASSERT(alignment >= kMinimumAlignment); 215 ASSERT(alignment >= kMinimumAlignment);
231 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); 216 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment);
232 return alignment; 217 return alignment;
233 } 218 }
234 219
235
236 int OS::NumberOfAvailableProcessors() { 220 int OS::NumberOfAvailableProcessors() {
237 return sysconf(_SC_NPROCESSORS_ONLN); 221 return sysconf(_SC_NPROCESSORS_ONLN);
238 } 222 }
239 223
240
241 uintptr_t OS::MaxRSS() { 224 uintptr_t OS::MaxRSS() {
242 struct rusage usage; 225 struct rusage usage;
243 usage.ru_maxrss = 0; 226 usage.ru_maxrss = 0;
244 int r = getrusage(RUSAGE_SELF, &usage); 227 int r = getrusage(RUSAGE_SELF, &usage);
245 ASSERT(r == 0); 228 ASSERT(r == 0);
246 return usage.ru_maxrss * KB; 229 return usage.ru_maxrss * KB;
247 } 230 }
248 231
249
250 void OS::Sleep(int64_t millis) { 232 void OS::Sleep(int64_t millis) {
251 int64_t micros = millis * kMicrosecondsPerMillisecond; 233 int64_t micros = millis * kMicrosecondsPerMillisecond;
252 SleepMicros(micros); 234 SleepMicros(micros);
253 } 235 }
254 236
255
256 void OS::SleepMicros(int64_t micros) { 237 void OS::SleepMicros(int64_t micros) {
257 struct timespec req; // requested. 238 struct timespec req; // requested.
258 struct timespec rem; // remainder. 239 struct timespec rem; // remainder.
259 int64_t seconds = micros / kMicrosecondsPerSecond; 240 int64_t seconds = micros / kMicrosecondsPerSecond;
260 micros = micros - seconds * kMicrosecondsPerSecond; 241 micros = micros - seconds * kMicrosecondsPerSecond;
261 int64_t nanos = micros * kNanosecondsPerMicrosecond; 242 int64_t nanos = micros * kNanosecondsPerMicrosecond;
262 req.tv_sec = seconds; 243 req.tv_sec = seconds;
263 req.tv_nsec = nanos; 244 req.tv_nsec = nanos;
264 while (true) { 245 while (true) {
265 int r = nanosleep(&req, &rem); 246 int r = nanosleep(&req, &rem);
266 if (r == 0) { 247 if (r == 0) {
267 break; 248 break;
268 } 249 }
269 // We should only ever see an interrupt error. 250 // We should only ever see an interrupt error.
270 ASSERT(errno == EINTR); 251 ASSERT(errno == EINTR);
271 // Copy remainder into requested and repeat. 252 // Copy remainder into requested and repeat.
272 req = rem; 253 req = rem;
273 } 254 }
274 } 255 }
275 256
276
277 // TODO(regis, iposva): When this function is no longer called from the 257 // TODO(regis, iposva): When this function is no longer called from the
278 // CodeImmutability test in object_test.cc, it will be called only from the 258 // CodeImmutability test in object_test.cc, it will be called only from the
279 // simulator, which means that only the Intel implementation is needed. 259 // simulator, which means that only the Intel implementation is needed.
280 void OS::DebugBreak() { 260 void OS::DebugBreak() {
281 __builtin_trap(); 261 __builtin_trap();
282 } 262 }
283 263
284
285 uintptr_t DART_NOINLINE OS::GetProgramCounter() { 264 uintptr_t DART_NOINLINE OS::GetProgramCounter() {
286 return reinterpret_cast<uintptr_t>( 265 return reinterpret_cast<uintptr_t>(
287 __builtin_extract_return_addr(__builtin_return_address(0))); 266 __builtin_extract_return_addr(__builtin_return_address(0)));
288 } 267 }
289 268
290
291 char* OS::StrNDup(const char* s, intptr_t n) { 269 char* OS::StrNDup(const char* s, intptr_t n) {
292 return strndup(s, n); 270 return strndup(s, n);
293 } 271 }
294 272
295
296 intptr_t OS::StrNLen(const char* s, intptr_t n) { 273 intptr_t OS::StrNLen(const char* s, intptr_t n) {
297 return strnlen(s, n); 274 return strnlen(s, n);
298 } 275 }
299 276
300
301 void OS::Print(const char* format, ...) { 277 void OS::Print(const char* format, ...) {
302 va_list args; 278 va_list args;
303 va_start(args, format); 279 va_start(args, format);
304 VFPrint(stdout, format, args); 280 VFPrint(stdout, format, args);
305 va_end(args); 281 va_end(args);
306 } 282 }
307 283
308
309 void OS::VFPrint(FILE* stream, const char* format, va_list args) { 284 void OS::VFPrint(FILE* stream, const char* format, va_list args) {
310 vfprintf(stream, format, args); 285 vfprintf(stream, format, args);
311 fflush(stream); 286 fflush(stream);
312 } 287 }
313 288
314
315 int OS::SNPrint(char* str, size_t size, const char* format, ...) { 289 int OS::SNPrint(char* str, size_t size, const char* format, ...) {
316 va_list args; 290 va_list args;
317 va_start(args, format); 291 va_start(args, format);
318 int retval = VSNPrint(str, size, format, args); 292 int retval = VSNPrint(str, size, format, args);
319 va_end(args); 293 va_end(args);
320 return retval; 294 return retval;
321 } 295 }
322 296
323
324 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { 297 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
325 MSAN_UNPOISON(str, size); 298 MSAN_UNPOISON(str, size);
326 int retval = vsnprintf(str, size, format, args); 299 int retval = vsnprintf(str, size, format, args);
327 if (retval < 0) { 300 if (retval < 0) {
328 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format); 301 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format);
329 } 302 }
330 return retval; 303 return retval;
331 } 304 }
332 305
333
334 char* OS::SCreate(Zone* zone, const char* format, ...) { 306 char* OS::SCreate(Zone* zone, const char* format, ...) {
335 va_list args; 307 va_list args;
336 va_start(args, format); 308 va_start(args, format);
337 char* buffer = VSCreate(zone, format, args); 309 char* buffer = VSCreate(zone, format, args);
338 va_end(args); 310 va_end(args);
339 return buffer; 311 return buffer;
340 } 312 }
341 313
342
343 char* OS::VSCreate(Zone* zone, const char* format, va_list args) { 314 char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
344 // Measure. 315 // Measure.
345 va_list measure_args; 316 va_list measure_args;
346 va_copy(measure_args, args); 317 va_copy(measure_args, args);
347 intptr_t len = VSNPrint(NULL, 0, format, measure_args); 318 intptr_t len = VSNPrint(NULL, 0, format, measure_args);
348 va_end(measure_args); 319 va_end(measure_args);
349 320
350 char* buffer; 321 char* buffer;
351 if (zone) { 322 if (zone) {
352 buffer = zone->Alloc<char>(len + 1); 323 buffer = zone->Alloc<char>(len + 1);
353 } else { 324 } else {
354 buffer = reinterpret_cast<char*>(malloc(len + 1)); 325 buffer = reinterpret_cast<char*>(malloc(len + 1));
355 } 326 }
356 ASSERT(buffer != NULL); 327 ASSERT(buffer != NULL);
357 328
358 // Print. 329 // Print.
359 va_list print_args; 330 va_list print_args;
360 va_copy(print_args, args); 331 va_copy(print_args, args);
361 VSNPrint(buffer, len + 1, format, print_args); 332 VSNPrint(buffer, len + 1, format, print_args);
362 va_end(print_args); 333 va_end(print_args);
363 return buffer; 334 return buffer;
364 } 335 }
365 336
366
367 bool OS::StringToInt64(const char* str, int64_t* value) { 337 bool OS::StringToInt64(const char* str, int64_t* value) {
368 ASSERT(str != NULL && strlen(str) > 0 && value != NULL); 338 ASSERT(str != NULL && strlen(str) > 0 && value != NULL);
369 int32_t base = 10; 339 int32_t base = 10;
370 char* endptr; 340 char* endptr;
371 int i = 0; 341 int i = 0;
372 if (str[0] == '-') { 342 if (str[0] == '-') {
373 i = 1; 343 i = 1;
374 } 344 }
375 if ((str[i] == '0') && (str[i + 1] == 'x' || str[i + 1] == 'X') && 345 if ((str[i] == '0') && (str[i + 1] == 'x' || str[i + 1] == 'X') &&
376 (str[i + 2] != '\0')) { 346 (str[i + 2] != '\0')) {
377 base = 16; 347 base = 16;
378 } 348 }
379 errno = 0; 349 errno = 0;
380 *value = strtoll(str, &endptr, base); 350 *value = strtoll(str, &endptr, base);
381 return ((errno == 0) && (endptr != str) && (*endptr == 0)); 351 return ((errno == 0) && (endptr != str) && (*endptr == 0));
382 } 352 }
383 353
384
385 void OS::RegisterCodeObservers() { 354 void OS::RegisterCodeObservers() {
386 #ifndef PRODUCT 355 #ifndef PRODUCT
387 if (FLAG_generate_perf_events_symbols) { 356 if (FLAG_generate_perf_events_symbols) {
388 CodeObservers::Register(new PerfCodeObserver); 357 CodeObservers::Register(new PerfCodeObserver);
389 } 358 }
390 #endif // !PRODUCT 359 #endif // !PRODUCT
391 } 360 }
392 361
393
394 void OS::PrintErr(const char* format, ...) { 362 void OS::PrintErr(const char* format, ...) {
395 va_list args; 363 va_list args;
396 va_start(args, format); 364 va_start(args, format);
397 VFPrint(stderr, format, args); 365 VFPrint(stderr, format, args);
398 va_end(args); 366 va_end(args);
399 } 367 }
400 368
401
402 void OS::InitOnce() { 369 void OS::InitOnce() {
403 // TODO(5411554): For now we check that initonce is called only once, 370 // TODO(5411554): For now we check that initonce is called only once,
404 // Once there is more formal mechanism to call InitOnce we can move 371 // Once there is more formal mechanism to call InitOnce we can move
405 // this check there. 372 // this check there.
406 static bool init_once_called = false; 373 static bool init_once_called = false;
407 ASSERT(init_once_called == false); 374 ASSERT(init_once_called == false);
408 init_once_called = true; 375 init_once_called = true;
409 } 376 }
410 377
411
412 void OS::Shutdown() {} 378 void OS::Shutdown() {}
413 379
414
415 void OS::Abort() { 380 void OS::Abort() {
416 abort(); 381 abort();
417 } 382 }
418 383
419
420 void OS::Exit(int code) { 384 void OS::Exit(int code) {
421 exit(code); 385 exit(code);
422 } 386 }
423 387
424 } // namespace dart 388 } // namespace dart
425 389
426 #endif // defined(HOST_OS_LINUX) 390 #endif // defined(HOST_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/vm/os_fuchsia.cc ('k') | runtime/vm/os_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698