globalDefinitions.hpp revision 513
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * This code is free software; you can redistribute it and/or modify it
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * under the terms of the GNU General Public License version 2 only, as
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * published by the Free Software Foundation.
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * This code is distributed in the hope that it will be useful, but WITHOUT
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * version 2 for more details (a copy is included in the LICENSE file that
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * accompanied this code).
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * You should have received a copy of the GNU General Public License version
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * 2 along with this work; if not, write to the Free Software Foundation,
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * CA 95054 USA or visit www.sun.com if you need additional information or
edd884cac454202076ea91062c7e26723718936bneil_a_wilson * have any questions.
edd884cac454202076ea91062c7e26723718936bneil_a_wilson// This file holds all globally used constants & types, class (forward)
edd884cac454202076ea91062c7e26723718936bneil_a_wilson// declarations and a few frequently used utility functions.
edd884cac454202076ea91062c7e26723718936bneil_a_wilson//----------------------------------------------------------------------------------------------------
edd884cac454202076ea91062c7e26723718936bneil_a_wilsonconst int BytesPerShort = 1 << LogBytesPerShort;
const int wordSize = sizeof(char*);
extern int LogBitsPerHeapOop;
extern int BytesPerHeapOop;
extern int BitsPerHeapOop;
#ifdef _LP64
class HeapWord {
friend class VMStructs;
#ifndef PRODUCT
char* value() { return i; }
#ifdef _LP64
#ifdef _LP64
#define ScaleForWordSize(x) (x)
const size_t M = K*K;
const size_t G = M*K;
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
typedef signed char s_char;
typedef unsigned char u_char;
const void* right,
// Unsigned byte types for os and stream.hpp
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
#define HOTSWAP
//----------------------------------------------------------------------------------------------------
#include "incls/_globalDefinitions_pd.hpp.incl"
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
return result;
union jlong_accessor {
enum BasicType {
return T_ILLEGAL;
inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }
enum BasicTypeSize {
T_VOID_size = 0
enum ArrayElementSize {
#ifdef _LP64
extern int _type2aelembytes[T_CONFLICT+1]; // maps a BasicType to nof bytes used by its array element
#ifdef ASSERT
class JavaValue {
typedef union JavaCallValue {
jfloat f;
jdouble d;
jint i;
jlong l;
jobject h;
#define STACK_BIAS 0
switch (type) {
return ilgl;
enum ReferenceType {
// _thread_in_native : In native code. This is a safepoint region, since all oops will be in jobject handles
// Each state has an associated xxxx_trans state, which is an intermediate state used when a thread is in
// a transition from one state to another. These extra states makes it possible for the safepoint code to
// handle certain thread_states without having to suspend the thread - making the safepoint code faster.
enum JavaThreadState {
enum MethodCompilation {
enum CompLevel {
CompLevel_none = 0,
#ifdef TIERED
//----------------------------------------------------------------------------------------------------
class symbolTable;
class ClassFileStream;
class Event;
class Thread;
class VMThread;
class JavaThread;
class Threads;
class VM_Operation;
class VMOperationQueue;
class CodeBlob;
class nmethod;
class OSRAdapter;
class I2CAdapter;
class C2IAdapter;
class CompiledIC;
class relocInfo;
class ScopeDesc;
class PcDesc;
class Recompiler;
class Recompilee;
class RecompilationPolicy;
class RFrame;
class CompiledRFrame;
class InterpretedRFrame;
class frame;
class vframe;
class javaVFrame;
class interpretedVFrame;
class compiledVFrame;
class deoptimizedVFrame;
class externalVFrame;
class entryVFrame;
class RegisterMap;
class Mutex;
class Monitor;
class BasicLock;
class BasicObjectLock;
class PeriodicTask;
class JavaCallWrapper;
class oopDesc;
class NativeCall;
class zone;
class StubQueue;
class outputStream;
class ResourceArea;
class DebugInformationRecorder;
class ScopeValue;
class CompressedStream;
class DebugInfoReadStream;
class DebugInfoWriteStream;
class LocationValue;
class ConstantValue;
class IllegalValue;
class PrivilegedElement;
class MonitorArray;
class MonitorInfo;
class OffsetClosure;
class OopMapCache;
class InterpreterOopMap;
class OopMapCacheEntry;
class OSThread;
typedef int (*OSThreadStartFunc)(void*);
class Space;
class JavaValue;
class methodHandle;
class JavaCallArguments;
// Basic support for errors (general debug facilities not defined at this point fo the include phase)
//----------------------------------------------------------------------------------------------------
const intptr_t badHeapOopVal = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
const intptr_t badJNIHandleVal = (intptr_t) CONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area
//----------------------------------------------------------------------------------------------------
// get a word with the n.th or the right-most or left-most n bits set
// bit-operations using the n.th bit
//----------------------------------------------------------------------------------------------------
#ifdef max
#ifdef min
template<class T> inline T MAX2(T a, T b) { return (a > b) ? a : b; }
template<class T> inline T MIN2(T a, T b) { return (a < b) ? a : b; }
template<class T> inline T ABS(T x) { return (x > 0) ? x : -x; }
while (p != 0 && p <= (uintptr_t)x) {
while (p != 0 && p <= (julong)x) {
#ifdef ASSERT
return log2_intptr(x);
#ifdef ASSERT
return mask_bits(x + m, ~m);
#ifdef ASSERT
return mask_bits(x, ~m);
//----------------------------------------------------------------------------------------------------
return *(jfloat*)&u;
return *(jfloat*)&u;
return *(jdouble*)&u;
return *(jdouble*)&u;
// Each compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp)
#ifdef _LP64
#ifdef _LP64
# ifdef ASSERT
# ifdef COMPILER2
# define ENABLE_ZAP_DEAD_LOCALS