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

Side by Side Diff: runtime/vm/os_linux.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_android.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(TARGET_OS_LINUX) 6 #if defined(TARGET_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
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 417 }
418 418
419 419
420 void OS::AlignedFree(void* ptr) { 420 void OS::AlignedFree(void* ptr) {
421 free(ptr); 421 free(ptr);
422 } 422 }
423 423
424 424
425 // TODO(5411554): May need to hoist these architecture dependent code 425 // TODO(5411554): May need to hoist these architecture dependent code
426 // into a architecture specific file e.g: os_ia32_linux.cc 426 // into a architecture specific file e.g: os_ia32_linux.cc
427 word OS::ActivationFrameAlignment() { 427 intptr_t OS::ActivationFrameAlignment() {
428 #if defined(TARGET_ARCH_IA32) || \ 428 #if defined(TARGET_ARCH_IA32) || \
429 defined(TARGET_ARCH_X64) || \ 429 defined(TARGET_ARCH_X64) || \
430 defined(TARGET_ARCH_ARM64) 430 defined(TARGET_ARCH_ARM64)
431 const int kMinimumAlignment = 16; 431 const int kMinimumAlignment = 16;
432 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) 432 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS)
433 const int kMinimumAlignment = 8; 433 const int kMinimumAlignment = 8;
434 #else 434 #else
435 #error Unsupported architecture. 435 #error Unsupported architecture.
436 #endif 436 #endif
437 word alignment = kMinimumAlignment; 437 intptr_t alignment = kMinimumAlignment;
438 // TODO(5411554): Allow overriding default stack alignment for 438 // TODO(5411554): Allow overriding default stack alignment for
439 // testing purposes. 439 // testing purposes.
440 // Flags::DebugIsInt("stackalign", &alignment); 440 // Flags::DebugIsInt("stackalign", &alignment);
441 ASSERT(Utils::IsPowerOfTwo(alignment)); 441 ASSERT(Utils::IsPowerOfTwo(alignment));
442 ASSERT(alignment >= kMinimumAlignment); 442 ASSERT(alignment >= kMinimumAlignment);
443 return alignment; 443 return alignment;
444 } 444 }
445 445
446 446
447 word OS::PreferredCodeAlignment() { 447 intptr_t OS::PreferredCodeAlignment() {
448 #if defined(TARGET_ARCH_IA32) || \ 448 #if defined(TARGET_ARCH_IA32) || \
449 defined(TARGET_ARCH_X64) || \ 449 defined(TARGET_ARCH_X64) || \
450 defined(TARGET_ARCH_ARM64) 450 defined(TARGET_ARCH_ARM64)
451 const int kMinimumAlignment = 32; 451 const int kMinimumAlignment = 32;
452 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) 452 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS)
453 const int kMinimumAlignment = 16; 453 const int kMinimumAlignment = 16;
454 #else 454 #else
455 #error Unsupported architecture. 455 #error Unsupported architecture.
456 #endif 456 #endif
457 word alignment = kMinimumAlignment; 457 intptr_t alignment = kMinimumAlignment;
458 // TODO(5411554): Allow overriding default code alignment for 458 // TODO(5411554): Allow overriding default code alignment for
459 // testing purposes. 459 // testing purposes.
460 // Flags::DebugIsInt("codealign", &alignment); 460 // Flags::DebugIsInt("codealign", &alignment);
461 ASSERT(Utils::IsPowerOfTwo(alignment)); 461 ASSERT(Utils::IsPowerOfTwo(alignment));
462 ASSERT(alignment >= kMinimumAlignment); 462 ASSERT(alignment >= kMinimumAlignment);
463 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); 463 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment);
464 return alignment; 464 return alignment;
465 } 465 }
466 466
467 467
468 uword OS::GetStackSizeLimit() {
469 struct rlimit stack_limit;
470 int retval = getrlimit(RLIMIT_STACK, &stack_limit);
471 ASSERT(retval == 0);
472 if (stack_limit.rlim_cur > INT_MAX) {
473 retval = INT_MAX;
474 } else {
475 retval = stack_limit.rlim_cur;
476 }
477 return retval;
478 }
479
480
481 bool OS::AllowStackFrameIteratorFromAnotherThread() { 468 bool OS::AllowStackFrameIteratorFromAnotherThread() {
482 return false; 469 return false;
483 } 470 }
484 471
485 472
486 int OS::NumberOfAvailableProcessors() { 473 int OS::NumberOfAvailableProcessors() {
487 return sysconf(_SC_NPROCESSORS_ONLN); 474 return sysconf(_SC_NPROCESSORS_ONLN);
488 } 475 }
489 476
490 477
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 } 614 }
628 615
629 616
630 void OS::Exit(int code) { 617 void OS::Exit(int code) {
631 exit(code); 618 exit(code);
632 } 619 }
633 620
634 } // namespace dart 621 } // namespace dart
635 622
636 #endif // defined(TARGET_OS_LINUX) 623 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/vm/os_android.cc ('k') | runtime/vm/os_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698