mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
Initial load
This commit is contained in:
parent
686d76f772
commit
8153779ad3
2894 changed files with 911801 additions and 0 deletions
215
hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
Normal file
215
hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
Normal file
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
*/
|
||||
|
||||
// This file holds compiler-dependent includes,
|
||||
// globally used constants & types, class (forward)
|
||||
// declarations and a few frequently used utility functions.
|
||||
|
||||
|
||||
# include <ctype.h>
|
||||
# include <dirent.h>
|
||||
# include <string.h>
|
||||
# include <strings.h> // for bsd'isms
|
||||
# include <stdarg.h>
|
||||
# include <stddef.h> // for offsetof
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <wchar.h>
|
||||
# include <stdarg.h>
|
||||
# include <ieeefp.h>
|
||||
# include <math.h>
|
||||
# include <time.h>
|
||||
# include <fcntl.h>
|
||||
# include <dlfcn.h>
|
||||
# include <pthread.h>
|
||||
# include <thread.h>
|
||||
# include <limits.h>
|
||||
# include <errno.h>
|
||||
# include <sys/trap.h>
|
||||
# include <sys/regset.h>
|
||||
# include <sys/procset.h>
|
||||
# include <ucontext.h>
|
||||
# include <setjmp.h>
|
||||
# ifdef SOLARIS_MUTATOR_LIBTHREAD
|
||||
# include <sys/procfs.h>
|
||||
# endif
|
||||
|
||||
// 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
|
||||
// When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
|
||||
// system header files. On 32-bit architectures, there is no problem.
|
||||
// On 64-bit architectures, defining NULL as a 32-bit constant can cause
|
||||
// problems with varargs functions: C++ integral promotion rules say for
|
||||
// varargs, we pass the argument 0 as an int. So, if NULL was passed to a
|
||||
// varargs function it will remain 32-bits. Depending on the calling
|
||||
// convention of the machine, if the argument is passed on the stack then
|
||||
// only 32-bits of the "NULL" pointer may be initialized to zero. The
|
||||
// other 32-bits will be garbage. If the varargs function is expecting a
|
||||
// pointer when it extracts the argument, then we have a problem.
|
||||
//
|
||||
// Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
|
||||
#ifdef _LP64
|
||||
#undef NULL
|
||||
#define NULL 0L
|
||||
#else
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// NULL vs NULL_WORD:
|
||||
// On Linux NULL is defined as a special type '__null'. Assigning __null to
|
||||
// integer variable will cause gcc warning. Use NULL_WORD in places where a
|
||||
// pointer is stored as integer value.
|
||||
#define NULL_WORD NULL
|
||||
|
||||
// Compiler-specific primitive types
|
||||
typedef unsigned short uint16_t;
|
||||
#ifndef _UINT32_T
|
||||
#define _UINT32_T
|
||||
typedef unsigned int uint32_t;
|
||||
#endif
|
||||
#if !defined(_SYS_INT_TYPES_H)
|
||||
#ifndef _UINT64_T
|
||||
#define _UINT64_T
|
||||
typedef unsigned long long uint64_t;
|
||||
#endif
|
||||
// %%%% how to access definition of intptr_t portably in 5.5 onward?
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
// If this gets an error, figure out a symbol XXX that implies the
|
||||
// prior definition of intptr_t, and add "&& !defined(XXX)" above.
|
||||
#endif
|
||||
|
||||
// Additional Java basic types
|
||||
|
||||
typedef unsigned char jubyte;
|
||||
typedef unsigned short jushort;
|
||||
typedef unsigned int juint;
|
||||
typedef unsigned long long julong;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Special (possibly not-portable) casts
|
||||
// Cast floats into same-size integers and vice-versa w/o changing bit-pattern
|
||||
|
||||
inline jint jint_cast (jfloat x) { return *(jint* )&x; }
|
||||
inline jlong jlong_cast (jdouble x) { return *(jlong* )&x; }
|
||||
|
||||
inline jfloat jfloat_cast (jint x) { return *(jfloat* )&x; }
|
||||
inline jdouble jdouble_cast(jlong x) { return *(jdouble*)&x; }
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Constant for jlong (specifying an long long constant is C++ compiler specific)
|
||||
|
||||
// Build a 64bit integer constant
|
||||
#define CONST64(x) (x ## LL)
|
||||
#define UCONST64(x) (x ## ULL)
|
||||
|
||||
const jlong min_jlong = CONST64(0x8000000000000000);
|
||||
const jlong max_jlong = CONST64(0x7fffffffffffffff);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// ANSI C++ fixes
|
||||
// NOTE:In the ANSI committee's continuing attempt to make each version
|
||||
// of C++ incompatible with the previous version, you can no longer cast
|
||||
// pointers to functions without specifying linkage unless you want to get
|
||||
// warnings.
|
||||
//
|
||||
// This also means that pointers to functions can no longer be "hidden"
|
||||
// in opaque types like void * because at the invokation point warnings
|
||||
// will be generated. While this makes perfect sense from a type safety
|
||||
// point of view it causes a lot of warnings on old code using C header
|
||||
// files. Here are some typedefs to make the job of silencing warnings
|
||||
// a bit easier.
|
||||
//
|
||||
// The final kick in the teeth is that you can only have extern "C" linkage
|
||||
// specified at file scope. So these typedefs are here rather than in the
|
||||
// .hpp for the class (os:Solaris usually) that needs them.
|
||||
|
||||
extern "C" {
|
||||
typedef int (*int_fnP_thread_t_iP_uP_stack_tP_gregset_t)(thread_t, int*, unsigned *, stack_t*, gregset_t);
|
||||
typedef int (*int_fnP_thread_t_i_gregset_t)(thread_t, int, gregset_t);
|
||||
typedef int (*int_fnP_thread_t_i)(thread_t, int);
|
||||
typedef int (*int_fnP_thread_t)(thread_t);
|
||||
|
||||
typedef int (*int_fnP_cond_tP_mutex_tP_timestruc_tP)(cond_t *cv, mutex_t *mx, timestruc_t *abst);
|
||||
typedef int (*int_fnP_cond_tP_mutex_tP)(cond_t *cv, mutex_t *mx);
|
||||
|
||||
// typedef for missing API in libc
|
||||
typedef int (*int_fnP_mutex_tP_i_vP)(mutex_t *, int, void *);
|
||||
typedef int (*int_fnP_mutex_tP)(mutex_t *);
|
||||
typedef int (*int_fnP_cond_tP_i_vP)(cond_t *cv, int scope, void *arg);
|
||||
typedef int (*int_fnP_cond_tP)(cond_t *cv);
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Debugging
|
||||
|
||||
#define DEBUG_EXCEPTION ::abort();
|
||||
|
||||
extern "C" void breakpoint();
|
||||
#define BREAKPOINT ::breakpoint()
|
||||
|
||||
// checking for nanness
|
||||
|
||||
#ifdef SPARC
|
||||
inline int g_isnan(float f) { return isnanf(f); }
|
||||
#else
|
||||
// isnanf() broken on Intel Solaris use isnand()
|
||||
inline int g_isnan(float f) { return isnand(f); }
|
||||
#endif
|
||||
|
||||
inline int g_isnan(double f) { return isnand(f); }
|
||||
|
||||
// Checking for finiteness
|
||||
|
||||
inline int g_isfinite(jfloat f) { return finite(f); }
|
||||
inline int g_isfinite(jdouble f) { return finite(f); }
|
||||
|
||||
|
||||
// Wide characters
|
||||
|
||||
inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
|
||||
|
||||
|
||||
// Misc
|
||||
int local_vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr);
|
||||
#define vsnprintf local_vsnprintf
|
||||
|
||||
|
||||
// Portability macros
|
||||
#define PRAGMA_INTERFACE
|
||||
#define PRAGMA_IMPLEMENTATION
|
||||
#define PRAGMA_IMPLEMENTATION_(arg)
|
||||
#define VALUE_OBJ_CLASS_SPEC : public _ValueObj
|
||||
|
||||
// Formatting.
|
||||
#ifdef _LP64
|
||||
#define FORMAT64_MODIFIER "l"
|
||||
#else // !_LP64
|
||||
#define FORMAT64_MODIFIER "ll"
|
||||
#endif // _LP64
|
||||
|
||||
#define offset_of(klass,field) offsetof(klass,field)
|
Loading…
Add table
Add a link
Reference in a new issue