hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp

Print this page




  60 #ifdef SOLARIS
  61 #include <thread.h>
  62 #endif // SOLARIS
  63 
  64 #include <limits.h>
  65 #include <errno.h>
  66 
  67 #ifdef SOLARIS
  68 #include <sys/trap.h>
  69 #include <sys/regset.h>
  70 #include <sys/procset.h>
  71 #include <ucontext.h>
  72 #include <setjmp.h>
  73 #endif // SOLARIS
  74 
  75 # ifdef SOLARIS_MUTATOR_LIBTHREAD
  76 # include <sys/procfs.h>
  77 # endif
  78 
  79 #ifdef LINUX

  80 #define __STDC_LIMIT_MACROS

  81 #include <inttypes.h>
  82 #include <signal.h>
  83 #include <ucontext.h>
  84 #include <sys/time.h>
  85 #endif // LINUX
  86 
  87 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
  88 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
  89 // system header files.  On 32-bit architectures, there is no problem.
  90 // On 64-bit architectures, defining NULL as a 32-bit constant can cause
  91 // problems with varargs functions: C++ integral promotion rules say for
  92 // varargs, we pass the argument 0 as an int.  So, if NULL was passed to a
  93 // varargs function it will remain 32-bits.  Depending on the calling
  94 // convention of the machine, if the argument is passed on the stack then
  95 // only 32-bits of the "NULL" pointer may be initialized to zero.  The
  96 // other 32-bits will be garbage.  If the varargs function is expecting a
  97 // pointer when it extracts the argument, then we have a problem.
  98 //
  99 // Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
 100 //




  60 #ifdef SOLARIS
  61 #include <thread.h>
  62 #endif // SOLARIS
  63 
  64 #include <limits.h>
  65 #include <errno.h>
  66 
  67 #ifdef SOLARIS
  68 #include <sys/trap.h>
  69 #include <sys/regset.h>
  70 #include <sys/procset.h>
  71 #include <ucontext.h>
  72 #include <setjmp.h>
  73 #endif // SOLARIS
  74 
  75 # ifdef SOLARIS_MUTATOR_LIBTHREAD
  76 # include <sys/procfs.h>
  77 # endif
  78 
  79 #ifdef LINUX
  80 #ifndef __STDC_LIMIT_MACROS
  81 #define __STDC_LIMIT_MACROS
  82 #endif // __STDC_LIMIT_MACROS
  83 #include <inttypes.h>
  84 #include <signal.h>
  85 #include <ucontext.h>
  86 #include <sys/time.h>
  87 #endif // LINUX
  88 
  89 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
  90 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
  91 // system header files.  On 32-bit architectures, there is no problem.
  92 // On 64-bit architectures, defining NULL as a 32-bit constant can cause
  93 // problems with varargs functions: C++ integral promotion rules say for
  94 // varargs, we pass the argument 0 as an int.  So, if NULL was passed to a
  95 // varargs function it will remain 32-bits.  Depending on the calling
  96 // convention of the machine, if the argument is passed on the stack then
  97 // only 32-bits of the "NULL" pointer may be initialized to zero.  The
  98 // other 32-bits will be garbage.  If the varargs function is expecting a
  99 // pointer when it extracts the argument, then we have a problem.
 100 //
 101 // Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
 102 //