blob: e5b007548677272e143e3d72498ceff002c9f421 [file] [log] [blame]
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#ifndef ART_SRC_GLOBALS_H_
4#define ART_SRC_GLOBALS_H_
5
Carl Shapiro1fb86202011-06-27 17:43:13 -07006#include <stddef.h>
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -07007#include <stdint.h>
8
Carl Shapiro6b6b5f02011-06-21 15:05:09 -07009namespace art {
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -070010
11typedef uint8_t byte;
12typedef intptr_t word;
13typedef uintptr_t uword;
14
Carl Shapiro69759ea2011-07-21 18:13:35 -070015const size_t KB = 1024;
16const size_t MB = KB * KB;
17const size_t GB = KB * KB * KB;
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -070018
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -070019const int kWordSize = sizeof(word);
20const int kPointerSize = sizeof(void*);
21
22const int kBitsPerByte = 8;
23const int kBitsPerByteLog2 = 3;
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070024const int kBitsPerWord = kWordSize * kBitsPerByte;
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -070025
Ian Rogers0d666d82011-08-14 16:03:46 -070026// Required stack alignment
27const int kStackAlignment = 16;
Brian Carlstrom0024d6c2011-08-09 08:26:12 -070028
Ian Rogers408f79a2011-08-23 18:22:33 -070029// Required object alignment
30const int kObjectAlignment = 8;
31
Brian Carlstrome24fa612011-09-29 00:53:55 -070032// Required ARM instruction alignment
33const int kArmAlignment = 4;
34
Brian Carlstrom0024d6c2011-08-09 08:26:12 -070035// System page size. Normally you're expected to get this from
36// sysconf(_SC_PAGESIZE) or some system-specific define (usually
37// PAGESIZE or PAGE_SIZE). If we use a simple compile-time constant
38// the compiler can generate appropriate masks directly, so we define
39// it here and verify it as the runtime is starting up.
40//
41// Must be a power of 2.
Brian Carlstromb0460ea2011-07-29 10:08:05 -070042const int kPageSize = 4096;
43
Carl Shapiro6b6b5f02011-06-21 15:05:09 -070044} // namespace art
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -070045
46#endif // ART_SRC_GLOBALS_H_