Mercurial > hg > graal-jvmci-8
comparison src/share/vm/utilities/globalDefinitions.hpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 12706c5b39bc 5c8bd7c16119 |
children | e522a00b91aa |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
159 const size_t K = 1024; | 159 const size_t K = 1024; |
160 const size_t M = K*K; | 160 const size_t M = K*K; |
161 const size_t G = M*K; | 161 const size_t G = M*K; |
162 const size_t HWperKB = K / sizeof(HeapWord); | 162 const size_t HWperKB = K / sizeof(HeapWord); |
163 | 163 |
164 const size_t LOG_K = 10; | |
165 const size_t LOG_M = 2 * LOG_K; | |
166 const size_t LOG_G = 2 * LOG_M; | |
167 | |
168 const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint | 164 const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint |
169 const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint | 165 const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint |
170 | 166 |
171 // Constants for converting from a base unit to milli-base units. For | 167 // Constants for converting from a base unit to milli-base units. For |
172 // example from seconds to milliseconds and microseconds | 168 // example from seconds to milliseconds and microseconds |
177 | 173 |
178 const jlong NANOSECS_PER_SEC = CONST64(1000000000); | 174 const jlong NANOSECS_PER_SEC = CONST64(1000000000); |
179 const jint NANOSECS_PER_MILLISEC = 1000000; | 175 const jint NANOSECS_PER_MILLISEC = 1000000; |
180 | 176 |
181 inline const char* proper_unit_for_byte_size(size_t s) { | 177 inline const char* proper_unit_for_byte_size(size_t s) { |
178 #ifdef _LP64 | |
179 if (s >= 10*G) { | |
180 return "G"; | |
181 } | |
182 #endif | |
182 if (s >= 10*M) { | 183 if (s >= 10*M) { |
183 return "M"; | 184 return "M"; |
184 } else if (s >= 10*K) { | 185 } else if (s >= 10*K) { |
185 return "K"; | 186 return "K"; |
186 } else { | 187 } else { |
187 return "B"; | 188 return "B"; |
188 } | 189 } |
189 } | 190 } |
190 | 191 |
191 inline size_t byte_size_in_proper_unit(size_t s) { | 192 template <class T> |
193 inline T byte_size_in_proper_unit(T s) { | |
194 #ifdef _LP64 | |
195 if (s >= 10*G) { | |
196 return (T)(s/G); | |
197 } | |
198 #endif | |
192 if (s >= 10*M) { | 199 if (s >= 10*M) { |
193 return s/M; | 200 return (T)(s/M); |
194 } else if (s >= 10*K) { | 201 } else if (s >= 10*K) { |
195 return s/K; | 202 return (T)(s/K); |
196 } else { | 203 } else { |
197 return s; | 204 return s; |
198 } | 205 } |
199 } | 206 } |
200 | |
201 | 207 |
202 //---------------------------------------------------------------------------------------------------- | 208 //---------------------------------------------------------------------------------------------------- |
203 // VM type definitions | 209 // VM type definitions |
204 | 210 |
205 // intx and uintx are the 'extended' int and 'extended' unsigned int types; | 211 // intx and uintx are the 'extended' int and 'extended' unsigned int types; |