src/share/native/common/check_code.c

Print this page
rev 8725 : 8024854: Basic changes and files to build the class library on AIX
Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, thomas.stuefe@sap.com
Reviewed-by: alanb, prr, sla, chegar, michaelm, mullan


  73    JVM_GetCPMethodClassNameUTF
  74    JVM_GetCPFieldModifiers
  75    JVM_GetCPMethodModifiers
  76 
  77    JVM_ReleaseUTF
  78    JVM_IsSameClassPackage
  79 
  80  */
  81 
  82 #include <string.h>
  83 #include <setjmp.h>
  84 #include <assert.h>
  85 #include <limits.h>
  86 #include <stdlib.h>
  87 
  88 #include "jni.h"
  89 #include "jvm.h"
  90 #include "classfile_constants.h"
  91 #include "opcodes.in_out"
  92 



































  93 #ifdef __APPLE__
  94 /* use setjmp/longjmp versions that do not save/restore the signal mask */
  95 #define setjmp _setjmp
  96 #define longjmp _longjmp
  97 #endif
  98 
  99 #define MAX_ARRAY_DIMENSIONS 255
 100 /* align byte code */
 101 #ifndef ALIGN_UP
 102 #define ALIGN_UP(n,align_grain) (((n) + ((align_grain) - 1)) & ~((align_grain)-1))
 103 #endif /* ALIGN_UP */
 104 #define UCALIGN(n) ((unsigned char *)ALIGN_UP((uintptr_t)(n),sizeof(int)))
 105 
 106 #ifdef DEBUG
 107 
 108 int verify_verbose = 0;
 109 static struct context_type *GlobalContext;
 110 #endif
 111 
 112 enum {




  73    JVM_GetCPMethodClassNameUTF
  74    JVM_GetCPFieldModifiers
  75    JVM_GetCPMethodModifiers
  76 
  77    JVM_ReleaseUTF
  78    JVM_IsSameClassPackage
  79 
  80  */
  81 
  82 #include <string.h>
  83 #include <setjmp.h>
  84 #include <assert.h>
  85 #include <limits.h>
  86 #include <stdlib.h>
  87 
  88 #include "jni.h"
  89 #include "jvm.h"
  90 #include "classfile_constants.h"
  91 #include "opcodes.in_out"
  92 
  93 /* On AIX malloc(0) and calloc(0, ...) return a NULL pointer, which is legal,
  94  * but the code here does not handles it. So we wrap the methods and return non-NULL
  95  * pointers even if we allocate 0 bytes.
  96  */
  97 #ifdef _AIX
  98 static int aix_dummy;
  99 static void* aix_malloc(size_t len) {
 100   if (len == 0) {
 101     return &aix_dummy;
 102   }
 103   return malloc(len);
 104 }
 105 
 106 static void* aix_calloc(size_t n, size_t size) {
 107   if (n == 0) {
 108     return &aix_dummy;
 109   }
 110   return calloc(n, size);
 111 }
 112 
 113 static void aix_free(void* p) {
 114   if (p == &aix_dummy) {
 115     return;
 116   }
 117   free(p);
 118 }
 119 
 120 #undef malloc
 121 #undef calloc
 122 #undef free
 123 #define malloc aix_malloc
 124 #define calloc aix_calloc
 125 #define free aix_free
 126 #endif
 127 
 128 #ifdef __APPLE__
 129 /* use setjmp/longjmp versions that do not save/restore the signal mask */
 130 #define setjmp _setjmp
 131 #define longjmp _longjmp
 132 #endif
 133 
 134 #define MAX_ARRAY_DIMENSIONS 255
 135 /* align byte code */
 136 #ifndef ALIGN_UP
 137 #define ALIGN_UP(n,align_grain) (((n) + ((align_grain) - 1)) & ~((align_grain)-1))
 138 #endif /* ALIGN_UP */
 139 #define UCALIGN(n) ((unsigned char *)ALIGN_UP((uintptr_t)(n),sizeof(int)))
 140 
 141 #ifdef DEBUG
 142 
 143 int verify_verbose = 0;
 144 static struct context_type *GlobalContext;
 145 #endif
 146 
 147 enum {