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

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

Issue 415513002: - Fix a lot of warnings generated by -Wshorten-64-to-32 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/os.h ('k') | runtime/vm/os_linux.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(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 #include <android/log.h> // NOLINT 10 #include <android/log.h> // NOLINT
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 199
200 void OS::AlignedFree(void* ptr) { 200 void OS::AlignedFree(void* ptr) {
201 free(ptr); 201 free(ptr);
202 } 202 }
203 203
204 204
205 // TODO(5411554): May need to hoist these architecture dependent code 205 // TODO(5411554): May need to hoist these architecture dependent code
206 // into a architecture specific file e.g: os_ia32_linux.cc 206 // into a architecture specific file e.g: os_ia32_linux.cc
207 word OS::ActivationFrameAlignment() { 207 intptr_t OS::ActivationFrameAlignment() {
208 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 208 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
209 const int kMinimumAlignment = 16; 209 const int kMinimumAlignment = 16;
210 #elif defined(TARGET_ARCH_ARM) 210 #elif defined(TARGET_ARCH_ARM)
211 const int kMinimumAlignment = 8; 211 const int kMinimumAlignment = 8;
212 #else 212 #else
213 #error Unsupported architecture. 213 #error Unsupported architecture.
214 #endif 214 #endif
215 word alignment = kMinimumAlignment; 215 intptr_t alignment = kMinimumAlignment;
216 // TODO(5411554): Allow overriding default stack alignment for 216 // TODO(5411554): Allow overriding default stack alignment for
217 // testing purposes. 217 // testing purposes.
218 // Flags::DebugIsInt("stackalign", &alignment); 218 // Flags::DebugIsInt("stackalign", &alignment);
219 ASSERT(Utils::IsPowerOfTwo(alignment)); 219 ASSERT(Utils::IsPowerOfTwo(alignment));
220 ASSERT(alignment >= kMinimumAlignment); 220 ASSERT(alignment >= kMinimumAlignment);
221 return alignment; 221 return alignment;
222 } 222 }
223 223
224 224
225 word OS::PreferredCodeAlignment() { 225 intptr_t OS::PreferredCodeAlignment() {
226 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 226 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
227 const int kMinimumAlignment = 16; 227 const int kMinimumAlignment = 16;
228 #elif defined(TARGET_ARCH_ARM) 228 #elif defined(TARGET_ARCH_ARM)
229 const int kMinimumAlignment = 16; 229 const int kMinimumAlignment = 16;
230 #else 230 #else
231 #error Unsupported architecture. 231 #error Unsupported architecture.
232 #endif 232 #endif
233 word alignment = kMinimumAlignment; 233 intptr_t alignment = kMinimumAlignment;
234 // TODO(5411554): Allow overriding default code alignment for 234 // TODO(5411554): Allow overriding default code alignment for
235 // testing purposes. 235 // testing purposes.
236 // Flags::DebugIsInt("codealign", &alignment); 236 // Flags::DebugIsInt("codealign", &alignment);
237 ASSERT(Utils::IsPowerOfTwo(alignment)); 237 ASSERT(Utils::IsPowerOfTwo(alignment));
238 ASSERT(alignment >= kMinimumAlignment); 238 ASSERT(alignment >= kMinimumAlignment);
239 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); 239 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment);
240 return alignment; 240 return alignment;
241 } 241 }
242 242
243 243
244 uword OS::GetStackSizeLimit() {
245 struct rlimit stack_limit;
246 int retval = getrlimit(RLIMIT_STACK, &stack_limit);
247 ASSERT(retval == 0);
248 if (stack_limit.rlim_cur > INT_MAX) {
249 retval = INT_MAX;
250 } else {
251 retval = stack_limit.rlim_cur;
252 }
253 return retval;
254 }
255
256
257 bool OS::AllowStackFrameIteratorFromAnotherThread() { 244 bool OS::AllowStackFrameIteratorFromAnotherThread() {
258 return false; 245 return false;
259 } 246 }
260 247
261 248
262 int OS::NumberOfAvailableProcessors() { 249 int OS::NumberOfAvailableProcessors() {
263 return sysconf(_SC_NPROCESSORS_ONLN); 250 return sysconf(_SC_NPROCESSORS_ONLN);
264 } 251 }
265 252
266 253
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 413 }
427 414
428 415
429 void OS::Exit(int code) { 416 void OS::Exit(int code) {
430 exit(code); 417 exit(code);
431 } 418 }
432 419
433 } // namespace dart 420 } // namespace dart
434 421
435 #endif // defined(TARGET_OS_ANDROID) 422 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/vm/os.h ('k') | runtime/vm/os_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698