| OLD | NEW |
| 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/os.h" | 5 #include "vm/os.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const int kMinimumAlignment = 16; | 94 const int kMinimumAlignment = 16; |
| 95 #else | 95 #else |
| 96 #error Unsupported architecture. | 96 #error Unsupported architecture. |
| 97 #endif | 97 #endif |
| 98 word alignment = kMinimumAlignment; | 98 word alignment = kMinimumAlignment; |
| 99 // TODO(5411554): Allow overriding default code alignment for | 99 // TODO(5411554): Allow overriding default code alignment for |
| 100 // testing purposes. | 100 // testing purposes. |
| 101 // Flags::DebugIsInt("codealign", &alignment); | 101 // Flags::DebugIsInt("codealign", &alignment); |
| 102 ASSERT(Utils::IsPowerOfTwo(alignment)); | 102 ASSERT(Utils::IsPowerOfTwo(alignment)); |
| 103 ASSERT(alignment >= kMinimumAlignment); | 103 ASSERT(alignment >= kMinimumAlignment); |
| 104 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); |
| 104 return alignment; | 105 return alignment; |
| 105 } | 106 } |
| 106 | 107 |
| 107 | 108 |
| 108 uword OS::GetStackSizeLimit() { | 109 uword OS::GetStackSizeLimit() { |
| 109 struct rlimit stack_limit; | 110 struct rlimit stack_limit; |
| 110 int retval = getrlimit(RLIMIT_STACK, &stack_limit); | 111 int retval = getrlimit(RLIMIT_STACK, &stack_limit); |
| 111 ASSERT(retval == 0); | 112 ASSERT(retval == 0); |
| 112 if (stack_limit.rlim_cur > INT_MAX) { | 113 if (stack_limit.rlim_cur > INT_MAX) { |
| 113 retval = INT_MAX; | 114 retval = INT_MAX; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 void OS::Abort() { | 206 void OS::Abort() { |
| 206 abort(); | 207 abort(); |
| 207 } | 208 } |
| 208 | 209 |
| 209 | 210 |
| 210 void OS::Exit(int code) { | 211 void OS::Exit(int code) { |
| 211 exit(code); | 212 exit(code); |
| 212 } | 213 } |
| 213 | 214 |
| 214 } // namespace dart | 215 } // namespace dart |
| OLD | NEW |