globalDefinitions.hpp revision 13249:a2753984d2c1
1/* 2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25#ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP 26#define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP 27 28#include "utilities/compilerWarnings.hpp" 29#include "utilities/debug.hpp" 30#include "utilities/macros.hpp" 31 32#include COMPILER_HEADER(utilities/globalDefinitions) 33 34// Defaults for macros that might be defined per compiler. 35#ifndef NOINLINE 36#define NOINLINE 37#endif 38#ifndef ALWAYSINLINE 39#define ALWAYSINLINE inline 40#endif 41 42// This file holds all globally used constants & types, class (forward) 43// declarations and a few frequently used utility functions. 44 45//---------------------------------------------------------------------------------------------------- 46// Printf-style formatters for fixed- and variable-width types as pointers and 47// integers. These are derived from the definitions in inttypes.h. If the platform 48// doesn't provide appropriate definitions, they should be provided in 49// the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp) 50 51#define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false") 52 53// Format 32-bit quantities. 54#define INT32_FORMAT "%" PRId32 55#define UINT32_FORMAT "%" PRIu32 56#define INT32_FORMAT_W(width) "%" #width PRId32 57#define UINT32_FORMAT_W(width) "%" #width PRIu32 58 59#define PTR32_FORMAT "0x%08" PRIx32 60#define PTR32_FORMAT_W(width) "0x%" #width PRIx32 61 62// Format 64-bit quantities. 63#define INT64_FORMAT "%" PRId64 64#define UINT64_FORMAT "%" PRIu64 65#define UINT64_FORMAT_X "%" PRIx64 66#define INT64_FORMAT_W(width) "%" #width PRId64 67#define UINT64_FORMAT_W(width) "%" #width PRIu64 68 69#define PTR64_FORMAT "0x%016" PRIx64 70 71// Format jlong, if necessary 72#ifndef JLONG_FORMAT 73#define JLONG_FORMAT INT64_FORMAT 74#endif 75#ifndef JULONG_FORMAT 76#define JULONG_FORMAT UINT64_FORMAT 77#endif 78#ifndef JULONG_FORMAT_X 79#define JULONG_FORMAT_X UINT64_FORMAT_X 80#endif 81 82// Format pointers which change size between 32- and 64-bit. 83#ifdef _LP64 84#define INTPTR_FORMAT "0x%016" PRIxPTR 85#define PTR_FORMAT "0x%016" PRIxPTR 86#else // !_LP64 87#define INTPTR_FORMAT "0x%08" PRIxPTR 88#define PTR_FORMAT "0x%08" PRIxPTR 89#endif // _LP64 90 91#define INTPTR_FORMAT_W(width) "%" #width PRIxPTR 92 93#define SSIZE_FORMAT "%" PRIdPTR 94#define SIZE_FORMAT "%" PRIuPTR 95#define SIZE_FORMAT_HEX "0x%" PRIxPTR 96#define SSIZE_FORMAT_W(width) "%" #width PRIdPTR 97#define SIZE_FORMAT_W(width) "%" #width PRIuPTR 98#define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR 99 100#define INTX_FORMAT "%" PRIdPTR 101#define UINTX_FORMAT "%" PRIuPTR 102#define INTX_FORMAT_W(width) "%" #width PRIdPTR 103#define UINTX_FORMAT_W(width) "%" #width PRIuPTR 104 105//---------------------------------------------------------------------------------------------------- 106// Constants 107 108const int LogBytesPerShort = 1; 109const int LogBytesPerInt = 2; 110#ifdef _LP64 111const int LogBytesPerWord = 3; 112#else 113const int LogBytesPerWord = 2; 114#endif 115const int LogBytesPerLong = 3; 116 117const int BytesPerShort = 1 << LogBytesPerShort; 118const int BytesPerInt = 1 << LogBytesPerInt; 119const int BytesPerWord = 1 << LogBytesPerWord; 120const int BytesPerLong = 1 << LogBytesPerLong; 121 122const int LogBitsPerByte = 3; 123const int LogBitsPerShort = LogBitsPerByte + LogBytesPerShort; 124const int LogBitsPerInt = LogBitsPerByte + LogBytesPerInt; 125const int LogBitsPerWord = LogBitsPerByte + LogBytesPerWord; 126const int LogBitsPerLong = LogBitsPerByte + LogBytesPerLong; 127 128const int BitsPerByte = 1 << LogBitsPerByte; 129const int BitsPerShort = 1 << LogBitsPerShort; 130const int BitsPerInt = 1 << LogBitsPerInt; 131const int BitsPerWord = 1 << LogBitsPerWord; 132const int BitsPerLong = 1 << LogBitsPerLong; 133 134const int WordAlignmentMask = (1 << LogBytesPerWord) - 1; 135const int LongAlignmentMask = (1 << LogBytesPerLong) - 1; 136 137const int WordsPerLong = 2; // Number of stack entries for longs 138 139const int oopSize = sizeof(char*); // Full-width oop 140extern int heapOopSize; // Oop within a java object 141const int wordSize = sizeof(char*); 142const int longSize = sizeof(jlong); 143const int jintSize = sizeof(jint); 144const int size_tSize = sizeof(size_t); 145 146const int BytesPerOop = BytesPerWord; // Full-width oop 147 148extern int LogBytesPerHeapOop; // Oop within a java object 149extern int LogBitsPerHeapOop; 150extern int BytesPerHeapOop; 151extern int BitsPerHeapOop; 152 153const int BitsPerJavaInteger = 32; 154const int BitsPerJavaLong = 64; 155const int BitsPerSize_t = size_tSize * BitsPerByte; 156 157// Size of a char[] needed to represent a jint as a string in decimal. 158const int jintAsStringSize = 12; 159 160// In fact this should be 161// log2_intptr(sizeof(class JavaThread)) - log2_intptr(64); 162// see os::set_memory_serialize_page() 163#ifdef _LP64 164const int SerializePageShiftCount = 4; 165#else 166const int SerializePageShiftCount = 3; 167#endif 168 169// An opaque struct of heap-word width, so that HeapWord* can be a generic 170// pointer into the heap. We require that object sizes be measured in 171// units of heap words, so that that 172// HeapWord* hw; 173// hw += oop(hw)->foo(); 174// works, where foo is a method (like size or scavenge) that returns the 175// object size. 176class HeapWord { 177 friend class VMStructs; 178 private: 179 char* i; 180#ifndef PRODUCT 181 public: 182 char* value() { return i; } 183#endif 184}; 185 186// Analogous opaque struct for metadata allocated from 187// metaspaces. 188class MetaWord { 189 private: 190 char* i; 191}; 192 193// HeapWordSize must be 2^LogHeapWordSize. 194const int HeapWordSize = sizeof(HeapWord); 195#ifdef _LP64 196const int LogHeapWordSize = 3; 197#else 198const int LogHeapWordSize = 2; 199#endif 200const int HeapWordsPerLong = BytesPerLong / HeapWordSize; 201const int LogHeapWordsPerLong = LogBytesPerLong - LogHeapWordSize; 202 203// The minimum number of native machine words necessary to contain "byte_size" 204// bytes. 205inline size_t heap_word_size(size_t byte_size) { 206 return (byte_size + (HeapWordSize-1)) >> LogHeapWordSize; 207} 208 209//------------------------------------------- 210// Constant for jlong (standardized by C++11) 211 212// Build a 64bit integer constant 213#define CONST64(x) (x ## LL) 214#define UCONST64(x) (x ## ULL) 215 216const jlong min_jlong = CONST64(0x8000000000000000); 217const jlong max_jlong = CONST64(0x7fffffffffffffff); 218 219const size_t K = 1024; 220const size_t M = K*K; 221const size_t G = M*K; 222const size_t HWperKB = K / sizeof(HeapWord); 223 224// Constants for converting from a base unit to milli-base units. For 225// example from seconds to milliseconds and microseconds 226 227const int MILLIUNITS = 1000; // milli units per base unit 228const int MICROUNITS = 1000000; // micro units per base unit 229const int NANOUNITS = 1000000000; // nano units per base unit 230 231const jlong NANOSECS_PER_SEC = CONST64(1000000000); 232const jint NANOSECS_PER_MILLISEC = 1000000; 233 234inline const char* proper_unit_for_byte_size(size_t s) { 235#ifdef _LP64 236 if (s >= 10*G) { 237 return "G"; 238 } 239#endif 240 if (s >= 10*M) { 241 return "M"; 242 } else if (s >= 10*K) { 243 return "K"; 244 } else { 245 return "B"; 246 } 247} 248 249template <class T> 250inline T byte_size_in_proper_unit(T s) { 251#ifdef _LP64 252 if (s >= 10*G) { 253 return (T)(s/G); 254 } 255#endif 256 if (s >= 10*M) { 257 return (T)(s/M); 258 } else if (s >= 10*K) { 259 return (T)(s/K); 260 } else { 261 return s; 262 } 263} 264 265inline const char* exact_unit_for_byte_size(size_t s) { 266#ifdef _LP64 267 if (s >= G && (s % G) == 0) { 268 return "G"; 269 } 270#endif 271 if (s >= M && (s % M) == 0) { 272 return "M"; 273 } 274 if (s >= K && (s % K) == 0) { 275 return "K"; 276 } 277 return "B"; 278} 279 280inline size_t byte_size_in_exact_unit(size_t s) { 281#ifdef _LP64 282 if (s >= G && (s % G) == 0) { 283 return s / G; 284 } 285#endif 286 if (s >= M && (s % M) == 0) { 287 return s / M; 288 } 289 if (s >= K && (s % K) == 0) { 290 return s / K; 291 } 292 return s; 293} 294 295//---------------------------------------------------------------------------------------------------- 296// VM type definitions 297 298// intx and uintx are the 'extended' int and 'extended' unsigned int types; 299// they are 32bit wide on a 32-bit platform, and 64bit wide on a 64bit platform. 300 301typedef intptr_t intx; 302typedef uintptr_t uintx; 303 304const intx min_intx = (intx)1 << (sizeof(intx)*BitsPerByte-1); 305const intx max_intx = (uintx)min_intx - 1; 306const uintx max_uintx = (uintx)-1; 307 308// Table of values: 309// sizeof intx 4 8 310// min_intx 0x80000000 0x8000000000000000 311// max_intx 0x7FFFFFFF 0x7FFFFFFFFFFFFFFF 312// max_uintx 0xFFFFFFFF 0xFFFFFFFFFFFFFFFF 313 314typedef unsigned int uint; NEEDS_CLEANUP 315 316 317//---------------------------------------------------------------------------------------------------- 318// Java type definitions 319 320// All kinds of 'plain' byte addresses 321typedef signed char s_char; 322typedef unsigned char u_char; 323typedef u_char* address; 324typedef uintptr_t address_word; // unsigned integer which will hold a pointer 325 // except for some implementations of a C++ 326 // linkage pointer to function. Should never 327 // need one of those to be placed in this 328 // type anyway. 329 330// Utility functions to "portably" (?) bit twiddle pointers 331// Where portable means keep ANSI C++ compilers quiet 332 333inline address set_address_bits(address x, int m) { return address(intptr_t(x) | m); } 334inline address clear_address_bits(address x, int m) { return address(intptr_t(x) & ~m); } 335 336// Utility functions to "portably" make cast to/from function pointers. 337 338inline address_word mask_address_bits(address x, int m) { return address_word(x) & m; } 339inline address_word castable_address(address x) { return address_word(x) ; } 340inline address_word castable_address(void* x) { return address_word(x) ; } 341 342// Pointer subtraction. 343// The idea here is to avoid ptrdiff_t, which is signed and so doesn't have 344// the range we might need to find differences from one end of the heap 345// to the other. 346// A typical use might be: 347// if (pointer_delta(end(), top()) >= size) { 348// // enough room for an object of size 349// ... 350// and then additions like 351// ... top() + size ... 352// are safe because we know that top() is at least size below end(). 353inline size_t pointer_delta(const volatile void* left, 354 const volatile void* right, 355 size_t element_size) { 356 return (((uintptr_t) left) - ((uintptr_t) right)) / element_size; 357} 358 359// A version specialized for HeapWord*'s. 360inline size_t pointer_delta(const HeapWord* left, const HeapWord* right) { 361 return pointer_delta(left, right, sizeof(HeapWord)); 362} 363// A version specialized for MetaWord*'s. 364inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) { 365 return pointer_delta(left, right, sizeof(MetaWord)); 366} 367 368// 369// ANSI C++ does not allow casting from one pointer type to a function pointer 370// directly without at best a warning. This macro accomplishes it silently 371// In every case that is present at this point the value be cast is a pointer 372// to a C linkage function. In some case the type used for the cast reflects 373// that linkage and a picky compiler would not complain. In other cases because 374// there is no convenient place to place a typedef with extern C linkage (i.e 375// a platform dependent header file) it doesn't. At this point no compiler seems 376// picky enough to catch these instances (which are few). It is possible that 377// using templates could fix these for all cases. This use of templates is likely 378// so far from the middle of the road that it is likely to be problematic in 379// many C++ compilers. 380// 381#define CAST_TO_FN_PTR(func_type, value) (reinterpret_cast<func_type>(value)) 382#define CAST_FROM_FN_PTR(new_type, func_ptr) ((new_type)((address_word)(func_ptr))) 383 384// Unsigned byte types for os and stream.hpp 385 386// Unsigned one, two, four and eigth byte quantities used for describing 387// the .class file format. See JVM book chapter 4. 388 389typedef jubyte u1; 390typedef jushort u2; 391typedef juint u4; 392typedef julong u8; 393 394const jubyte max_jubyte = (jubyte)-1; // 0xFF largest jubyte 395const jushort max_jushort = (jushort)-1; // 0xFFFF largest jushort 396const juint max_juint = (juint)-1; // 0xFFFFFFFF largest juint 397const julong max_julong = (julong)-1; // 0xFF....FF largest julong 398 399typedef jbyte s1; 400typedef jshort s2; 401typedef jint s4; 402typedef jlong s8; 403 404const jbyte min_jbyte = -(1 << 7); // smallest jbyte 405const jbyte max_jbyte = (1 << 7) - 1; // largest jbyte 406const jshort min_jshort = -(1 << 15); // smallest jshort 407const jshort max_jshort = (1 << 15) - 1; // largest jshort 408 409const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint 410const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint 411 412//---------------------------------------------------------------------------------------------------- 413// JVM spec restrictions 414 415const int max_method_code_size = 64*K - 1; // JVM spec, 2nd ed. section 4.8.1 (p.134) 416 417// Default ProtectionDomainCacheSize values 418 419const int defaultProtectionDomainCacheSize = NOT_LP64(137) LP64_ONLY(2017); 420 421//---------------------------------------------------------------------------------------------------- 422// Default and minimum StringTableSize values 423 424const int defaultStringTableSize = NOT_LP64(1009) LP64_ONLY(60013); 425const int minimumStringTableSize = 1009; 426 427const int defaultSymbolTableSize = 20011; 428const int minimumSymbolTableSize = 1009; 429 430 431//---------------------------------------------------------------------------------------------------- 432// HotSwap - for JVMTI aka Class File Replacement and PopFrame 433// 434// Determines whether on-the-fly class replacement and frame popping are enabled. 435 436#define HOTSWAP 437 438//---------------------------------------------------------------------------------------------------- 439// Object alignment, in units of HeapWords. 440// 441// Minimum is max(BytesPerLong, BytesPerDouble, BytesPerOop) / HeapWordSize, so jlong, jdouble and 442// reference fields can be naturally aligned. 443 444extern int MinObjAlignment; 445extern int MinObjAlignmentInBytes; 446extern int MinObjAlignmentInBytesMask; 447 448extern int LogMinObjAlignment; 449extern int LogMinObjAlignmentInBytes; 450 451const int LogKlassAlignmentInBytes = 3; 452const int LogKlassAlignment = LogKlassAlignmentInBytes - LogHeapWordSize; 453const int KlassAlignmentInBytes = 1 << LogKlassAlignmentInBytes; 454const int KlassAlignment = KlassAlignmentInBytes / HeapWordSize; 455 456// Maximal size of heap where unscaled compression can be used. Also upper bound 457// for heap placement: 4GB. 458const uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1); 459// Maximal size of heap where compressed oops can be used. Also upper bound for heap 460// placement for zero based compression algorithm: UnscaledOopHeapMax << LogMinObjAlignmentInBytes. 461extern uint64_t OopEncodingHeapMax; 462 463// Maximal size of compressed class space. Above this limit compression is not possible. 464// Also upper bound for placement of zero based class space. (Class space is further limited 465// to be < 3G, see arguments.cpp.) 466const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes; 467 468// Machine dependent stuff 469 470// The maximum size of the code cache. Can be overridden by targets. 471#define CODE_CACHE_SIZE_LIMIT (2*G) 472// Allow targets to reduce the default size of the code cache. 473#define CODE_CACHE_DEFAULT_LIMIT CODE_CACHE_SIZE_LIMIT 474 475#include CPU_HEADER(globalDefinitions) 476 477// To assure the IRIW property on processors that are not multiple copy 478// atomic, sync instructions must be issued between volatile reads to 479// assure their ordering, instead of after volatile stores. 480// (See "A Tutorial Introduction to the ARM and POWER Relaxed Memory Models" 481// by Luc Maranget, Susmit Sarkar and Peter Sewell, INRIA/Cambridge) 482#ifdef CPU_NOT_MULTIPLE_COPY_ATOMIC 483const bool support_IRIW_for_not_multiple_copy_atomic_cpu = true; 484#else 485const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false; 486#endif 487 488// The expected size in bytes of a cache line, used to pad data structures. 489#ifndef DEFAULT_CACHE_LINE_SIZE 490 #define DEFAULT_CACHE_LINE_SIZE 64 491#endif 492 493 494//---------------------------------------------------------------------------------------------------- 495// Utility macros for compilers 496// used to silence compiler warnings 497 498#define Unused_Variable(var) var 499 500 501//---------------------------------------------------------------------------------------------------- 502// Miscellaneous 503 504// 6302670 Eliminate Hotspot __fabsf dependency 505// All fabs() callers should call this function instead, which will implicitly 506// convert the operand to double, avoiding a dependency on __fabsf which 507// doesn't exist in early versions of Solaris 8. 508inline double fabsd(double value) { 509 return fabs(value); 510} 511 512// Returns numerator/denominator as percentage value from 0 to 100. If denominator 513// is zero, return 0.0. 514template<typename T> 515inline double percent_of(T numerator, T denominator) { 516 return denominator != 0 ? (double)numerator / denominator * 100.0 : 0.0; 517} 518 519//---------------------------------------------------------------------------------------------------- 520// Special casts 521// Cast floats into same-size integers and vice-versa w/o changing bit-pattern 522typedef union { 523 jfloat f; 524 jint i; 525} FloatIntConv; 526 527typedef union { 528 jdouble d; 529 jlong l; 530 julong ul; 531} DoubleLongConv; 532 533inline jint jint_cast (jfloat x) { return ((FloatIntConv*)&x)->i; } 534inline jfloat jfloat_cast (jint x) { return ((FloatIntConv*)&x)->f; } 535 536inline jlong jlong_cast (jdouble x) { return ((DoubleLongConv*)&x)->l; } 537inline julong julong_cast (jdouble x) { return ((DoubleLongConv*)&x)->ul; } 538inline jdouble jdouble_cast (jlong x) { return ((DoubleLongConv*)&x)->d; } 539 540inline jint low (jlong value) { return jint(value); } 541inline jint high(jlong value) { return jint(value >> 32); } 542 543// the fancy casts are a hopefully portable way 544// to do unsigned 32 to 64 bit type conversion 545inline void set_low (jlong* value, jint low ) { *value &= (jlong)0xffffffff << 32; 546 *value |= (jlong)(julong)(juint)low; } 547 548inline void set_high(jlong* value, jint high) { *value &= (jlong)(julong)(juint)0xffffffff; 549 *value |= (jlong)high << 32; } 550 551inline jlong jlong_from(jint h, jint l) { 552 jlong result = 0; // initialization to avoid warning 553 set_high(&result, h); 554 set_low(&result, l); 555 return result; 556} 557 558union jlong_accessor { 559 jint words[2]; 560 jlong long_value; 561}; 562 563void basic_types_init(); // cannot define here; uses assert 564 565 566// NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java 567enum BasicType { 568 T_BOOLEAN = 4, 569 T_CHAR = 5, 570 T_FLOAT = 6, 571 T_DOUBLE = 7, 572 T_BYTE = 8, 573 T_SHORT = 9, 574 T_INT = 10, 575 T_LONG = 11, 576 T_OBJECT = 12, 577 T_ARRAY = 13, 578 T_VOID = 14, 579 T_ADDRESS = 15, 580 T_NARROWOOP = 16, 581 T_METADATA = 17, 582 T_NARROWKLASS = 18, 583 T_CONFLICT = 19, // for stack value type with conflicting contents 584 T_ILLEGAL = 99 585}; 586 587inline bool is_java_primitive(BasicType t) { 588 return T_BOOLEAN <= t && t <= T_LONG; 589} 590 591inline bool is_subword_type(BasicType t) { 592 // these guys are processed exactly like T_INT in calling sequences: 593 return (t == T_BOOLEAN || t == T_CHAR || t == T_BYTE || t == T_SHORT); 594} 595 596inline bool is_signed_subword_type(BasicType t) { 597 return (t == T_BYTE || t == T_SHORT); 598} 599 600// Convert a char from a classfile signature to a BasicType 601inline BasicType char2type(char c) { 602 switch( c ) { 603 case 'B': return T_BYTE; 604 case 'C': return T_CHAR; 605 case 'D': return T_DOUBLE; 606 case 'F': return T_FLOAT; 607 case 'I': return T_INT; 608 case 'J': return T_LONG; 609 case 'S': return T_SHORT; 610 case 'Z': return T_BOOLEAN; 611 case 'V': return T_VOID; 612 case 'L': return T_OBJECT; 613 case '[': return T_ARRAY; 614 } 615 return T_ILLEGAL; 616} 617 618extern char type2char_tab[T_CONFLICT+1]; // Map a BasicType to a jchar 619inline char type2char(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2char_tab[t] : 0; } 620extern int type2size[T_CONFLICT+1]; // Map BasicType to result stack elements 621extern const char* type2name_tab[T_CONFLICT+1]; // Map a BasicType to a jchar 622inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; } 623extern BasicType name2type(const char* name); 624 625// Auxiliary math routines 626// least common multiple 627extern size_t lcm(size_t a, size_t b); 628 629 630// NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java 631enum BasicTypeSize { 632 T_BOOLEAN_size = 1, 633 T_CHAR_size = 1, 634 T_FLOAT_size = 1, 635 T_DOUBLE_size = 2, 636 T_BYTE_size = 1, 637 T_SHORT_size = 1, 638 T_INT_size = 1, 639 T_LONG_size = 2, 640 T_OBJECT_size = 1, 641 T_ARRAY_size = 1, 642 T_NARROWOOP_size = 1, 643 T_NARROWKLASS_size = 1, 644 T_VOID_size = 0 645}; 646 647 648// maps a BasicType to its instance field storage type: 649// all sub-word integral types are widened to T_INT 650extern BasicType type2field[T_CONFLICT+1]; 651extern BasicType type2wfield[T_CONFLICT+1]; 652 653 654// size in bytes 655enum ArrayElementSize { 656 T_BOOLEAN_aelem_bytes = 1, 657 T_CHAR_aelem_bytes = 2, 658 T_FLOAT_aelem_bytes = 4, 659 T_DOUBLE_aelem_bytes = 8, 660 T_BYTE_aelem_bytes = 1, 661 T_SHORT_aelem_bytes = 2, 662 T_INT_aelem_bytes = 4, 663 T_LONG_aelem_bytes = 8, 664#ifdef _LP64 665 T_OBJECT_aelem_bytes = 8, 666 T_ARRAY_aelem_bytes = 8, 667#else 668 T_OBJECT_aelem_bytes = 4, 669 T_ARRAY_aelem_bytes = 4, 670#endif 671 T_NARROWOOP_aelem_bytes = 4, 672 T_NARROWKLASS_aelem_bytes = 4, 673 T_VOID_aelem_bytes = 0 674}; 675 676extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element 677#ifdef ASSERT 678extern int type2aelembytes(BasicType t, bool allow_address = false); // asserts 679#else 680inline int type2aelembytes(BasicType t, bool allow_address = false) { return _type2aelembytes[t]; } 681#endif 682 683 684// JavaValue serves as a container for arbitrary Java values. 685 686class JavaValue { 687 688 public: 689 typedef union JavaCallValue { 690 jfloat f; 691 jdouble d; 692 jint i; 693 jlong l; 694 jobject h; 695 } JavaCallValue; 696 697 private: 698 BasicType _type; 699 JavaCallValue _value; 700 701 public: 702 JavaValue(BasicType t = T_ILLEGAL) { _type = t; } 703 704 JavaValue(jfloat value) { 705 _type = T_FLOAT; 706 _value.f = value; 707 } 708 709 JavaValue(jdouble value) { 710 _type = T_DOUBLE; 711 _value.d = value; 712 } 713 714 jfloat get_jfloat() const { return _value.f; } 715 jdouble get_jdouble() const { return _value.d; } 716 jint get_jint() const { return _value.i; } 717 jlong get_jlong() const { return _value.l; } 718 jobject get_jobject() const { return _value.h; } 719 JavaCallValue* get_value_addr() { return &_value; } 720 BasicType get_type() const { return _type; } 721 722 void set_jfloat(jfloat f) { _value.f = f;} 723 void set_jdouble(jdouble d) { _value.d = d;} 724 void set_jint(jint i) { _value.i = i;} 725 void set_jlong(jlong l) { _value.l = l;} 726 void set_jobject(jobject h) { _value.h = h;} 727 void set_type(BasicType t) { _type = t; } 728 729 jboolean get_jboolean() const { return (jboolean) (_value.i);} 730 jbyte get_jbyte() const { return (jbyte) (_value.i);} 731 jchar get_jchar() const { return (jchar) (_value.i);} 732 jshort get_jshort() const { return (jshort) (_value.i);} 733 734}; 735 736 737#define STACK_BIAS 0 738// V9 Sparc CPU's running in 64 Bit mode use a stack bias of 7ff 739// in order to extend the reach of the stack pointer. 740#if defined(SPARC) && defined(_LP64) 741#undef STACK_BIAS 742#define STACK_BIAS 0x7ff 743#endif 744 745 746// TosState describes the top-of-stack state before and after the execution of 747// a bytecode or method. The top-of-stack value may be cached in one or more CPU 748// registers. The TosState corresponds to the 'machine representation' of this cached 749// value. There's 4 states corresponding to the JAVA types int, long, float & double 750// as well as a 5th state in case the top-of-stack value is actually on the top 751// of stack (in memory) and thus not cached. The atos state corresponds to the itos 752// state when it comes to machine representation but is used separately for (oop) 753// type specific operations (e.g. verification code). 754 755enum TosState { // describes the tos cache contents 756 btos = 0, // byte, bool tos cached 757 ztos = 1, // byte, bool tos cached 758 ctos = 2, // char tos cached 759 stos = 3, // short tos cached 760 itos = 4, // int tos cached 761 ltos = 5, // long tos cached 762 ftos = 6, // float tos cached 763 dtos = 7, // double tos cached 764 atos = 8, // object cached 765 vtos = 9, // tos not cached 766 number_of_states, 767 ilgl // illegal state: should not occur 768}; 769 770 771inline TosState as_TosState(BasicType type) { 772 switch (type) { 773 case T_BYTE : return btos; 774 case T_BOOLEAN: return ztos; 775 case T_CHAR : return ctos; 776 case T_SHORT : return stos; 777 case T_INT : return itos; 778 case T_LONG : return ltos; 779 case T_FLOAT : return ftos; 780 case T_DOUBLE : return dtos; 781 case T_VOID : return vtos; 782 case T_ARRAY : // fall through 783 case T_OBJECT : return atos; 784 } 785 return ilgl; 786} 787 788inline BasicType as_BasicType(TosState state) { 789 switch (state) { 790 case btos : return T_BYTE; 791 case ztos : return T_BOOLEAN; 792 case ctos : return T_CHAR; 793 case stos : return T_SHORT; 794 case itos : return T_INT; 795 case ltos : return T_LONG; 796 case ftos : return T_FLOAT; 797 case dtos : return T_DOUBLE; 798 case atos : return T_OBJECT; 799 case vtos : return T_VOID; 800 } 801 return T_ILLEGAL; 802} 803 804 805// Helper function to convert BasicType info into TosState 806// Note: Cannot define here as it uses global constant at the time being. 807TosState as_TosState(BasicType type); 808 809 810// JavaThreadState keeps track of which part of the code a thread is executing in. This 811// information is needed by the safepoint code. 812// 813// There are 4 essential states: 814// 815// _thread_new : Just started, but not executed init. code yet (most likely still in OS init code) 816// _thread_in_native : In native code. This is a safepoint region, since all oops will be in jobject handles 817// _thread_in_vm : Executing in the vm 818// _thread_in_Java : Executing either interpreted or compiled Java code (or could be in a stub) 819// 820// Each state has an associated xxxx_trans state, which is an intermediate state used when a thread is in 821// a transition from one state to another. These extra states makes it possible for the safepoint code to 822// handle certain thread_states without having to suspend the thread - making the safepoint code faster. 823// 824// Given a state, the xxxx_trans state can always be found by adding 1. 825// 826enum JavaThreadState { 827 _thread_uninitialized = 0, // should never happen (missing initialization) 828 _thread_new = 2, // just starting up, i.e., in process of being initialized 829 _thread_new_trans = 3, // corresponding transition state (not used, included for completness) 830 _thread_in_native = 4, // running in native code 831 _thread_in_native_trans = 5, // corresponding transition state 832 _thread_in_vm = 6, // running in VM 833 _thread_in_vm_trans = 7, // corresponding transition state 834 _thread_in_Java = 8, // running in Java or in stub code 835 _thread_in_Java_trans = 9, // corresponding transition state (not used, included for completness) 836 _thread_blocked = 10, // blocked in vm 837 _thread_blocked_trans = 11, // corresponding transition state 838 _thread_max_state = 12 // maximum thread state+1 - used for statistics allocation 839}; 840 841 842 843//---------------------------------------------------------------------------------------------------- 844// 'Forward' declarations of frequently used classes 845// (in order to reduce interface dependencies & reduce 846// number of unnecessary compilations after changes) 847 848class ClassFileStream; 849 850class Event; 851 852class Thread; 853class VMThread; 854class JavaThread; 855class Threads; 856 857class VM_Operation; 858class VMOperationQueue; 859 860class CodeBlob; 861class CompiledMethod; 862class nmethod; 863class RuntimeBlob; 864class OSRAdapter; 865class I2CAdapter; 866class C2IAdapter; 867class CompiledIC; 868class relocInfo; 869class ScopeDesc; 870class PcDesc; 871 872class Recompiler; 873class Recompilee; 874class RecompilationPolicy; 875class RFrame; 876class CompiledRFrame; 877class InterpretedRFrame; 878 879class vframe; 880class javaVFrame; 881class interpretedVFrame; 882class compiledVFrame; 883class deoptimizedVFrame; 884class externalVFrame; 885class entryVFrame; 886 887class RegisterMap; 888 889class Mutex; 890class Monitor; 891class BasicLock; 892class BasicObjectLock; 893 894class PeriodicTask; 895 896class JavaCallWrapper; 897 898class oopDesc; 899class metaDataOopDesc; 900 901class NativeCall; 902 903class zone; 904 905class StubQueue; 906 907class outputStream; 908 909class ResourceArea; 910 911class DebugInformationRecorder; 912class ScopeValue; 913class CompressedStream; 914class DebugInfoReadStream; 915class DebugInfoWriteStream; 916class LocationValue; 917class ConstantValue; 918class IllegalValue; 919 920class PrivilegedElement; 921class MonitorArray; 922 923class MonitorInfo; 924 925class OffsetClosure; 926class OopMapCache; 927class InterpreterOopMap; 928class OopMapCacheEntry; 929class OSThread; 930 931typedef int (*OSThreadStartFunc)(void*); 932 933class Space; 934 935class JavaValue; 936class methodHandle; 937class JavaCallArguments; 938 939// Basic support for errors. 940extern void basic_fatal(const char* msg); 941 942//---------------------------------------------------------------------------------------------------- 943// Special constants for debugging 944 945const jint badInt = -3; // generic "bad int" value 946const long badAddressVal = -2; // generic "bad address" value 947const long badOopVal = -1; // generic "bad oop" value 948const intptr_t badHeapOopVal = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC 949const int badHandleValue = 0xBC; // value used to zap vm handle area 950const int badResourceValue = 0xAB; // value used to zap resource area 951const int freeBlockPad = 0xBA; // value used to pad freed blocks. 952const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks. 953const juint uninitMetaWordVal= 0xf7f7f7f7; // value used to zap newly allocated metachunk 954const intptr_t badJNIHandleVal = (intptr_t) UCONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area 955const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC 956const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC 957const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation 958const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation 959 960 961// (These must be implemented as #defines because C++ compilers are 962// not obligated to inline non-integral constants!) 963#define badAddress ((address)::badAddressVal) 964#define badOop (cast_to_oop(::badOopVal)) 965#define badHeapWord (::badHeapWordVal) 966#define badJNIHandle (cast_to_oop(::badJNIHandleVal)) 967 968// Default TaskQueue size is 16K (32-bit) or 128K (64-bit) 969#define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17)) 970 971//---------------------------------------------------------------------------------------------------- 972// Utility functions for bitfield manipulations 973 974const intptr_t AllBits = ~0; // all bits set in a word 975const intptr_t NoBits = 0; // no bits set in a word 976const jlong NoLongBits = 0; // no bits set in a long 977const intptr_t OneBit = 1; // only right_most bit set in a word 978 979// get a word with the n.th or the right-most or left-most n bits set 980// (note: #define used only so that they can be used in enum constant definitions) 981#define nth_bit(n) (((n) >= BitsPerWord) ? 0 : (OneBit << (n))) 982#define right_n_bits(n) (nth_bit(n) - 1) 983#define left_n_bits(n) (right_n_bits(n) << (((n) >= BitsPerWord) ? 0 : (BitsPerWord - (n)))) 984 985// bit-operations using a mask m 986inline void set_bits (intptr_t& x, intptr_t m) { x |= m; } 987inline void clear_bits (intptr_t& x, intptr_t m) { x &= ~m; } 988inline intptr_t mask_bits (intptr_t x, intptr_t m) { return x & m; } 989inline jlong mask_long_bits (jlong x, jlong m) { return x & m; } 990inline bool mask_bits_are_true (intptr_t flags, intptr_t mask) { return (flags & mask) == mask; } 991 992// bit-operations using the n.th bit 993inline void set_nth_bit(intptr_t& x, int n) { set_bits (x, nth_bit(n)); } 994inline void clear_nth_bit(intptr_t& x, int n) { clear_bits(x, nth_bit(n)); } 995inline bool is_set_nth_bit(intptr_t x, int n) { return mask_bits (x, nth_bit(n)) != NoBits; } 996 997// returns the bitfield of x starting at start_bit_no with length field_length (no sign-extension!) 998inline intptr_t bitfield(intptr_t x, int start_bit_no, int field_length) { 999 return mask_bits(x >> start_bit_no, right_n_bits(field_length)); 1000} 1001 1002 1003//---------------------------------------------------------------------------------------------------- 1004// Utility functions for integers 1005 1006// Avoid use of global min/max macros which may cause unwanted double 1007// evaluation of arguments. 1008#ifdef max 1009#undef max 1010#endif 1011 1012#ifdef min 1013#undef min 1014#endif 1015 1016// The following defines serve the purpose of preventing use of accidentally 1017// included min max macros from compiling, while continuing to allow innocent 1018// min and max identifiers in the code to compile as intended. 1019#define max max 1020#define min min 1021 1022// It is necessary to use templates here. Having normal overloaded 1023// functions does not work because it is necessary to provide both 32- 1024// and 64-bit overloaded functions, which does not work, and having 1025// explicitly-typed versions of these routines (i.e., MAX2I, MAX2L) 1026// will be even more error-prone than macros. 1027template<class T> inline T MAX2(T a, T b) { return (a > b) ? a : b; } 1028template<class T> inline T MIN2(T a, T b) { return (a < b) ? a : b; } 1029template<class T> inline T MAX3(T a, T b, T c) { return MAX2(MAX2(a, b), c); } 1030template<class T> inline T MIN3(T a, T b, T c) { return MIN2(MIN2(a, b), c); } 1031template<class T> inline T MAX4(T a, T b, T c, T d) { return MAX2(MAX3(a, b, c), d); } 1032template<class T> inline T MIN4(T a, T b, T c, T d) { return MIN2(MIN3(a, b, c), d); } 1033 1034template<class T> inline T ABS(T x) { return (x > 0) ? x : -x; } 1035 1036// true if x is a power of 2, false otherwise 1037inline bool is_power_of_2(intptr_t x) { 1038 return ((x != NoBits) && (mask_bits(x, x - 1) == NoBits)); 1039} 1040 1041// long version of is_power_of_2 1042inline bool is_power_of_2_long(jlong x) { 1043 return ((x != NoLongBits) && (mask_long_bits(x, x - 1) == NoLongBits)); 1044} 1045 1046// Returns largest i such that 2^i <= x. 1047// If x < 0, the function returns 31 on a 32-bit machine and 63 on a 64-bit machine. 1048// If x == 0, the function returns -1. 1049inline int log2_intptr(intptr_t x) { 1050 int i = -1; 1051 uintptr_t p = 1; 1052 while (p != 0 && p <= (uintptr_t)x) { 1053 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x) 1054 i++; p *= 2; 1055 } 1056 // p = 2^(i+1) && x < p (i.e., 2^i <= x < 2^(i+1)) 1057 // If p = 0, overflow has occurred and i = 31 or i = 63 (depending on the machine word size). 1058 return i; 1059} 1060 1061//* largest i such that 2^i <= x 1062// A negative value of 'x' will return '63' 1063inline int log2_long(jlong x) { 1064 int i = -1; 1065 julong p = 1; 1066 while (p != 0 && p <= (julong)x) { 1067 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x) 1068 i++; p *= 2; 1069 } 1070 // p = 2^(i+1) && x < p (i.e., 2^i <= x < 2^(i+1)) 1071 // (if p = 0 then overflow occurred and i = 63) 1072 return i; 1073} 1074 1075//* the argument must be exactly a power of 2 1076inline int exact_log2(intptr_t x) { 1077 assert(is_power_of_2(x), "x must be a power of 2: " INTPTR_FORMAT, x); 1078 return log2_intptr(x); 1079} 1080 1081//* the argument must be exactly a power of 2 1082inline int exact_log2_long(jlong x) { 1083 assert(is_power_of_2_long(x), "x must be a power of 2: " JLONG_FORMAT, x); 1084 return log2_long(x); 1085} 1086 1087inline bool is_odd (intx x) { return x & 1; } 1088inline bool is_even(intx x) { return !is_odd(x); } 1089 1090// "to" should be greater than "from." 1091inline intx byte_size(void* from, void* to) { 1092 return (address)to - (address)from; 1093} 1094 1095//---------------------------------------------------------------------------------------------------- 1096// Avoid non-portable casts with these routines (DEPRECATED) 1097 1098// NOTE: USE Bytes class INSTEAD WHERE POSSIBLE 1099// Bytes is optimized machine-specifically and may be much faster then the portable routines below. 1100 1101// Given sequence of four bytes, build into a 32-bit word 1102// following the conventions used in class files. 1103// On the 386, this could be realized with a simple address cast. 1104// 1105 1106// This routine takes eight bytes: 1107inline u8 build_u8_from( u1 c1, u1 c2, u1 c3, u1 c4, u1 c5, u1 c6, u1 c7, u1 c8 ) { 1108 return (( u8(c1) << 56 ) & ( u8(0xff) << 56 )) 1109 | (( u8(c2) << 48 ) & ( u8(0xff) << 48 )) 1110 | (( u8(c3) << 40 ) & ( u8(0xff) << 40 )) 1111 | (( u8(c4) << 32 ) & ( u8(0xff) << 32 )) 1112 | (( u8(c5) << 24 ) & ( u8(0xff) << 24 )) 1113 | (( u8(c6) << 16 ) & ( u8(0xff) << 16 )) 1114 | (( u8(c7) << 8 ) & ( u8(0xff) << 8 )) 1115 | (( u8(c8) << 0 ) & ( u8(0xff) << 0 )); 1116} 1117 1118// This routine takes four bytes: 1119inline u4 build_u4_from( u1 c1, u1 c2, u1 c3, u1 c4 ) { 1120 return (( u4(c1) << 24 ) & 0xff000000) 1121 | (( u4(c2) << 16 ) & 0x00ff0000) 1122 | (( u4(c3) << 8 ) & 0x0000ff00) 1123 | (( u4(c4) << 0 ) & 0x000000ff); 1124} 1125 1126// And this one works if the four bytes are contiguous in memory: 1127inline u4 build_u4_from( u1* p ) { 1128 return build_u4_from( p[0], p[1], p[2], p[3] ); 1129} 1130 1131// Ditto for two-byte ints: 1132inline u2 build_u2_from( u1 c1, u1 c2 ) { 1133 return u2((( u2(c1) << 8 ) & 0xff00) 1134 | (( u2(c2) << 0 ) & 0x00ff)); 1135} 1136 1137// And this one works if the two bytes are contiguous in memory: 1138inline u2 build_u2_from( u1* p ) { 1139 return build_u2_from( p[0], p[1] ); 1140} 1141 1142// Ditto for floats: 1143inline jfloat build_float_from( u1 c1, u1 c2, u1 c3, u1 c4 ) { 1144 u4 u = build_u4_from( c1, c2, c3, c4 ); 1145 return *(jfloat*)&u; 1146} 1147 1148inline jfloat build_float_from( u1* p ) { 1149 u4 u = build_u4_from( p ); 1150 return *(jfloat*)&u; 1151} 1152 1153 1154// now (64-bit) longs 1155 1156inline jlong build_long_from( u1 c1, u1 c2, u1 c3, u1 c4, u1 c5, u1 c6, u1 c7, u1 c8 ) { 1157 return (( jlong(c1) << 56 ) & ( jlong(0xff) << 56 )) 1158 | (( jlong(c2) << 48 ) & ( jlong(0xff) << 48 )) 1159 | (( jlong(c3) << 40 ) & ( jlong(0xff) << 40 )) 1160 | (( jlong(c4) << 32 ) & ( jlong(0xff) << 32 )) 1161 | (( jlong(c5) << 24 ) & ( jlong(0xff) << 24 )) 1162 | (( jlong(c6) << 16 ) & ( jlong(0xff) << 16 )) 1163 | (( jlong(c7) << 8 ) & ( jlong(0xff) << 8 )) 1164 | (( jlong(c8) << 0 ) & ( jlong(0xff) << 0 )); 1165} 1166 1167inline jlong build_long_from( u1* p ) { 1168 return build_long_from( p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7] ); 1169} 1170 1171 1172// Doubles, too! 1173inline jdouble build_double_from( u1 c1, u1 c2, u1 c3, u1 c4, u1 c5, u1 c6, u1 c7, u1 c8 ) { 1174 jlong u = build_long_from( c1, c2, c3, c4, c5, c6, c7, c8 ); 1175 return *(jdouble*)&u; 1176} 1177 1178inline jdouble build_double_from( u1* p ) { 1179 jlong u = build_long_from( p ); 1180 return *(jdouble*)&u; 1181} 1182 1183 1184// Portable routines to go the other way: 1185 1186inline void explode_short_to( u2 x, u1& c1, u1& c2 ) { 1187 c1 = u1(x >> 8); 1188 c2 = u1(x); 1189} 1190 1191inline void explode_short_to( u2 x, u1* p ) { 1192 explode_short_to( x, p[0], p[1]); 1193} 1194 1195inline void explode_int_to( u4 x, u1& c1, u1& c2, u1& c3, u1& c4 ) { 1196 c1 = u1(x >> 24); 1197 c2 = u1(x >> 16); 1198 c3 = u1(x >> 8); 1199 c4 = u1(x); 1200} 1201 1202inline void explode_int_to( u4 x, u1* p ) { 1203 explode_int_to( x, p[0], p[1], p[2], p[3]); 1204} 1205 1206 1207// Pack and extract shorts to/from ints: 1208 1209inline int extract_low_short_from_int(jint x) { 1210 return x & 0xffff; 1211} 1212 1213inline int extract_high_short_from_int(jint x) { 1214 return (x >> 16) & 0xffff; 1215} 1216 1217inline int build_int_from_shorts( jushort low, jushort high ) { 1218 return ((int)((unsigned int)high << 16) | (unsigned int)low); 1219} 1220 1221// Convert pointer to intptr_t, for use in printing pointers. 1222inline intptr_t p2i(const void * p) { 1223 return (intptr_t) p; 1224} 1225 1226// swap a & b 1227template<class T> static void swap(T& a, T& b) { 1228 T tmp = a; 1229 a = b; 1230 b = tmp; 1231} 1232 1233#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0])) 1234 1235//---------------------------------------------------------------------------------------------------- 1236// Sum and product which can never overflow: they wrap, just like the 1237// Java operations. Note that we don't intend these to be used for 1238// general-purpose arithmetic: their purpose is to emulate Java 1239// operations. 1240 1241// The goal of this code to avoid undefined or implementation-defined 1242// behavior. The use of an lvalue to reference cast is explicitly 1243// permitted by Lvalues and rvalues [basic.lval]. [Section 3.10 Para 1244// 15 in C++03] 1245#define JAVA_INTEGER_OP(OP, NAME, TYPE, UNSIGNED_TYPE) \ 1246inline TYPE NAME (TYPE in1, TYPE in2) { \ 1247 UNSIGNED_TYPE ures = static_cast<UNSIGNED_TYPE>(in1); \ 1248 ures OP ## = static_cast<UNSIGNED_TYPE>(in2); \ 1249 return reinterpret_cast<TYPE&>(ures); \ 1250} 1251 1252JAVA_INTEGER_OP(+, java_add, jint, juint) 1253JAVA_INTEGER_OP(-, java_subtract, jint, juint) 1254JAVA_INTEGER_OP(*, java_multiply, jint, juint) 1255JAVA_INTEGER_OP(+, java_add, jlong, julong) 1256JAVA_INTEGER_OP(-, java_subtract, jlong, julong) 1257JAVA_INTEGER_OP(*, java_multiply, jlong, julong) 1258 1259#undef JAVA_INTEGER_OP 1260 1261// Dereference vptr 1262// All C++ compilers that we know of have the vtbl pointer in the first 1263// word. If there are exceptions, this function needs to be made compiler 1264// specific. 1265static inline void* dereference_vptr(const void* addr) { 1266 return *(void**)addr; 1267} 1268 1269#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP 1270