107
108 const int WordAlignmentMask = (1 << LogBytesPerWord) - 1;
109 const int LongAlignmentMask = (1 << LogBytesPerLong) - 1;
110
111 const int WordsPerLong = 2; // Number of stack entries for longs
112
113 const int oopSize = sizeof(char*); // Full-width oop
114 extern int heapOopSize; // Oop within a java object
115 const int wordSize = sizeof(char*);
116 const int longSize = sizeof(jlong);
117 const int jintSize = sizeof(jint);
118 const int size_tSize = sizeof(size_t);
119
120 const int BytesPerOop = BytesPerWord; // Full-width oop
121
122 extern int LogBytesPerHeapOop; // Oop within a java object
123 extern int LogBitsPerHeapOop;
124 extern int BytesPerHeapOop;
125 extern int BitsPerHeapOop;
126
127 // Oop encoding heap max
128 extern uint64_t OopEncodingHeapMax;
129
130 const int BitsPerJavaInteger = 32;
131 const int BitsPerJavaLong = 64;
132 const int BitsPerSize_t = size_tSize * BitsPerByte;
133
134 // Size of a char[] needed to represent a jint as a string in decimal.
135 const int jintAsStringSize = 12;
136
137 // In fact this should be
138 // log2_intptr(sizeof(class JavaThread)) - log2_intptr(64);
139 // see os::set_memory_serialize_page()
140 #ifdef _LP64
141 const int SerializePageShiftCount = 4;
142 #else
143 const int SerializePageShiftCount = 3;
144 #endif
145
146 // An opaque struct of heap-word width, so that HeapWord* can be a generic
147 // pointer into the heap. We require that object sizes be measured in
148 // units of heap words, so that that
149 // HeapWord* hw;
178 const int HeapWordsPerLong = BytesPerLong / HeapWordSize;
179 const int LogHeapWordsPerLong = LogBytesPerLong - LogHeapWordSize;
180
181 // The larger HeapWordSize for 64bit requires larger heaps
182 // for the same application running in 64bit. See bug 4967770.
183 // The minimum alignment to a heap word size is done. Other
184 // parts of the memory system may require additional alignment
185 // and are responsible for those alignments.
186 #ifdef _LP64
187 #define ScaleForWordSize(x) align_size_down_((x) * 13 / 10, HeapWordSize)
188 #else
189 #define ScaleForWordSize(x) (x)
190 #endif
191
192 // The minimum number of native machine words necessary to contain "byte_size"
193 // bytes.
194 inline size_t heap_word_size(size_t byte_size) {
195 return (byte_size + (HeapWordSize-1)) >> LogHeapWordSize;
196 }
197
198
199 const size_t K = 1024;
200 const size_t M = K*K;
201 const size_t G = M*K;
202 const size_t HWperKB = K / sizeof(HeapWord);
203
204 const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint
205 const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint
206
207 // Constants for converting from a base unit to milli-base units. For
208 // example from seconds to milliseconds and microseconds
209
210 const int MILLIUNITS = 1000; // milli units per base unit
211 const int MICROUNITS = 1000000; // micro units per base unit
212 const int NANOUNITS = 1000000000; // nano units per base unit
213
214 const jlong NANOSECS_PER_SEC = CONST64(1000000000);
215 const jint NANOSECS_PER_MILLISEC = 1000000;
216
217 inline const char* proper_unit_for_byte_size(size_t s) {
218 #ifdef _LP64
380 #define HOTSWAP
381
382 //----------------------------------------------------------------------------------------------------
383 // Object alignment, in units of HeapWords.
384 //
385 // Minimum is max(BytesPerLong, BytesPerDouble, BytesPerOop) / HeapWordSize, so jlong, jdouble and
386 // reference fields can be naturally aligned.
387
388 extern int MinObjAlignment;
389 extern int MinObjAlignmentInBytes;
390 extern int MinObjAlignmentInBytesMask;
391
392 extern int LogMinObjAlignment;
393 extern int LogMinObjAlignmentInBytes;
394
395 const int LogKlassAlignmentInBytes = 3;
396 const int LogKlassAlignment = LogKlassAlignmentInBytes - LogHeapWordSize;
397 const int KlassAlignmentInBytes = 1 << LogKlassAlignmentInBytes;
398 const int KlassAlignment = KlassAlignmentInBytes / HeapWordSize;
399
400 // Klass encoding metaspace max size
401 const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
402
403 // Machine dependent stuff
404
405 #if defined(X86) && defined(COMPILER2) && !defined(JAVASE_EMBEDDED)
406 // Include Restricted Transactional Memory lock eliding optimization
407 #define INCLUDE_RTM_OPT 1
408 #define RTM_OPT_ONLY(code) code
409 #else
410 #define INCLUDE_RTM_OPT 0
411 #define RTM_OPT_ONLY(code)
412 #endif
413 // States of Restricted Transactional Memory usage.
414 enum RTMState {
415 NoRTM = 0x2, // Don't use RTM
416 UseRTM = 0x1, // Use RTM
417 ProfileRTM = 0x0 // Use RTM with abort ratio calculation
418 };
419
420 #ifdef TARGET_ARCH_x86
|
107
108 const int WordAlignmentMask = (1 << LogBytesPerWord) - 1;
109 const int LongAlignmentMask = (1 << LogBytesPerLong) - 1;
110
111 const int WordsPerLong = 2; // Number of stack entries for longs
112
113 const int oopSize = sizeof(char*); // Full-width oop
114 extern int heapOopSize; // Oop within a java object
115 const int wordSize = sizeof(char*);
116 const int longSize = sizeof(jlong);
117 const int jintSize = sizeof(jint);
118 const int size_tSize = sizeof(size_t);
119
120 const int BytesPerOop = BytesPerWord; // Full-width oop
121
122 extern int LogBytesPerHeapOop; // Oop within a java object
123 extern int LogBitsPerHeapOop;
124 extern int BytesPerHeapOop;
125 extern int BitsPerHeapOop;
126
127 const int BitsPerJavaInteger = 32;
128 const int BitsPerJavaLong = 64;
129 const int BitsPerSize_t = size_tSize * BitsPerByte;
130
131 // Size of a char[] needed to represent a jint as a string in decimal.
132 const int jintAsStringSize = 12;
133
134 // In fact this should be
135 // log2_intptr(sizeof(class JavaThread)) - log2_intptr(64);
136 // see os::set_memory_serialize_page()
137 #ifdef _LP64
138 const int SerializePageShiftCount = 4;
139 #else
140 const int SerializePageShiftCount = 3;
141 #endif
142
143 // An opaque struct of heap-word width, so that HeapWord* can be a generic
144 // pointer into the heap. We require that object sizes be measured in
145 // units of heap words, so that that
146 // HeapWord* hw;
175 const int HeapWordsPerLong = BytesPerLong / HeapWordSize;
176 const int LogHeapWordsPerLong = LogBytesPerLong - LogHeapWordSize;
177
178 // The larger HeapWordSize for 64bit requires larger heaps
179 // for the same application running in 64bit. See bug 4967770.
180 // The minimum alignment to a heap word size is done. Other
181 // parts of the memory system may require additional alignment
182 // and are responsible for those alignments.
183 #ifdef _LP64
184 #define ScaleForWordSize(x) align_size_down_((x) * 13 / 10, HeapWordSize)
185 #else
186 #define ScaleForWordSize(x) (x)
187 #endif
188
189 // The minimum number of native machine words necessary to contain "byte_size"
190 // bytes.
191 inline size_t heap_word_size(size_t byte_size) {
192 return (byte_size + (HeapWordSize-1)) >> LogHeapWordSize;
193 }
194
195 const size_t K = 1024;
196 const size_t M = K*K;
197 const size_t G = M*K;
198 const size_t HWperKB = K / sizeof(HeapWord);
199
200 const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint
201 const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint
202
203 // Constants for converting from a base unit to milli-base units. For
204 // example from seconds to milliseconds and microseconds
205
206 const int MILLIUNITS = 1000; // milli units per base unit
207 const int MICROUNITS = 1000000; // micro units per base unit
208 const int NANOUNITS = 1000000000; // nano units per base unit
209
210 const jlong NANOSECS_PER_SEC = CONST64(1000000000);
211 const jint NANOSECS_PER_MILLISEC = 1000000;
212
213 inline const char* proper_unit_for_byte_size(size_t s) {
214 #ifdef _LP64
376 #define HOTSWAP
377
378 //----------------------------------------------------------------------------------------------------
379 // Object alignment, in units of HeapWords.
380 //
381 // Minimum is max(BytesPerLong, BytesPerDouble, BytesPerOop) / HeapWordSize, so jlong, jdouble and
382 // reference fields can be naturally aligned.
383
384 extern int MinObjAlignment;
385 extern int MinObjAlignmentInBytes;
386 extern int MinObjAlignmentInBytesMask;
387
388 extern int LogMinObjAlignment;
389 extern int LogMinObjAlignmentInBytes;
390
391 const int LogKlassAlignmentInBytes = 3;
392 const int LogKlassAlignment = LogKlassAlignmentInBytes - LogHeapWordSize;
393 const int KlassAlignmentInBytes = 1 << LogKlassAlignmentInBytes;
394 const int KlassAlignment = KlassAlignmentInBytes / HeapWordSize;
395
396 // Maximal size of heap where unscaled compression can be used. Also upper bound
397 // for heap placement: 4GB.
398 const uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1);
399 // Maximal size of heap where compressed oops can be used. Also upper bound for heap
400 // placement for zero based compression algorithm: UnscaledOopHeapMax << LogMinObjAlignmentInBytes.
401 extern uint64_t OopEncodingHeapMax;
402
403 // Maximal size of compressed class space. Above this limit compression is not possible.
404 // Also upper bound for placement of zero based class space. (Class space is further limited
405 // to be < 3G, see arguments.cpp.)
406 const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
407
408 // Machine dependent stuff
409
410 #if defined(X86) && defined(COMPILER2) && !defined(JAVASE_EMBEDDED)
411 // Include Restricted Transactional Memory lock eliding optimization
412 #define INCLUDE_RTM_OPT 1
413 #define RTM_OPT_ONLY(code) code
414 #else
415 #define INCLUDE_RTM_OPT 0
416 #define RTM_OPT_ONLY(code)
417 #endif
418 // States of Restricted Transactional Memory usage.
419 enum RTMState {
420 NoRTM = 0x2, // Don't use RTM
421 UseRTM = 0x1, // Use RTM
422 ProfileRTM = 0x0 // Use RTM with abort ratio calculation
423 };
424
425 #ifdef TARGET_ARCH_x86
|