hotspot/src/share/vm/prims/jniCheck.cpp
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1 489c9b5090e2
child 1618 2d86b9b84aa5
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
# include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# include "incls/_jniCheck.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// Heap objects are allowed to be directly referenced only in VM code,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// not in native code.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
#define ASSERT_OOPS_ALLOWED                                          \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
    assert(JavaThread::current()->thread_state() == _thread_in_vm,   \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
           "jniCheck examining oops in bad state.")
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// Execute the given block of source code with the thread in VM state.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// To do this, transition from the NATIVE state to the VM state, execute
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// the code, and transtition back.  The ThreadInVMfromNative constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// performs the transition to VM state, its destructor restores the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// NATIVE state.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
#define IN_VM(source_code)   {                                         \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    {                                                                  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
      ThreadInVMfromNative __tiv(thr);                                 \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
      source_code                                                      \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    }                                                                  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
 * DECLARATIONS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
static struct JNINativeInterface_ * unchecked_jni_NativeInterface;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
 * MACRO DEFINITIONS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
// All JNI checked functions here use JNI_ENTRY_CHECKED() instead of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// QUICK_ENTRY or LEAF variants found in jni.cpp.  This allows handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
// to be created if a fatal error should occur.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
// Check for thread not attached to VM;  need to catch this before
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
// assertions in the wrapper routines might fire
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// Check for env being the one value appropriate for this thread.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
#define JNI_ENTRY_CHECKED(result_type, header)                           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
extern "C" {                                                             \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  result_type JNICALL header {                                           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    if (thr == NULL || !thr->is_Java_thread()) {                         \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      tty->print_cr(fatal_using_jnienv_in_nonjava);                      \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
      os::abort(true);                                                   \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    }                                                                    \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    JNIEnv* xenv = thr->jni_environment();                               \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    if (env != xenv) {                                                   \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
      NativeReportJNIFatalError(thr, warn_wrong_jnienv);                 \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    }                                                                    \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    __ENTRY(result_type, header, thr)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#define UNCHECKED() (unchecked_jni_NativeInterface)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
static const char * warn_wrong_jnienv = "Using JNIEnv in the wrong thread";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
static const char * warn_bad_class_descriptor = "JNI FindClass received a bad class descriptor \"%s\".  A correct class descriptor " \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  "has no leading \"L\" or trailing \";\".  Incorrect descriptors will not be accepted in future releases.";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
static const char * fatal_using_jnienv_in_nonjava = "FATAL ERROR in native method: Using JNIEnv in non-Java thread";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
static const char * warn_other_function_in_critical = "Warning: Calling other JNI functions in the scope of " \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  "Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
static const char * fatal_bad_ref_to_jni = "Bad global or local ref passed to JNI";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
static const char * fatal_received_null_class = "JNI received a null class";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
static const char * fatal_class_not_a_class = "JNI received a class argument that is not a class";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
static const char * fatal_class_not_a_throwable_class = "JNI Throw or ThrowNew received a class argument that is not a Throwable or Throwable subclass";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
static const char * fatal_wrong_class_or_method = "Wrong object class or methodID passed to JNI call";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
static const char * fatal_unknown_array_object = "Unknown array object passed to JNI array operations";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
static const char * fatal_object_array_expected = "Object array expected but not received for JNI array operation";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
static const char * fatal_non_array  = "Non-array passed to JNI array operations";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
static const char * fatal_element_type_mismatch = "Array element type mismatch in JNI";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
static const char * fatal_should_be_static = "Non-static field ID passed to JNI";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
static const char * fatal_wrong_static_field = "Wrong static field ID passed to JNI";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
static const char * fatal_static_field_not_found = "Static field not found in JNI get/set field operations";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
static const char * fatal_static_field_mismatch = "Field type (static) mismatch in JNI get/set field operations";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
static const char * fatal_should_be_nonstatic = "Static field ID passed to JNI";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
static const char * fatal_null_object = "Null object passed to JNI";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
static const char * fatal_wrong_field = "Wrong field ID passed to JNI";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
static const char * fatal_instance_field_not_found = "Instance field not found in JNI get/set field operations";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
static const char * fatal_instance_field_mismatch = "Field type (instance) mismatch in JNI get/set field operations";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
static const char * fatal_non_string = "JNI string operation received a non-string";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
// Report a JNI failure caught by -Xcheck:jni.  Perform a core dump.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
// Note: two variations -- one to be called when in VM state (e.g. when
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
// within IN_VM macro), one to be called when in NATIVE state.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
// When in VM state:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
static void ReportJNIFatalError(JavaThread* thr, const char *msg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  tty->print_cr("FATAL ERROR in native method: %s", msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  thr->print_stack();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  os::abort(true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
// When in VM state:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
static void ReportJNIWarning(JavaThread* thr, const char *msg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  tty->print_cr("WARNING in native method: %s", msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  thr->print_stack();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
// When in NATIVE state:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
static void NativeReportJNIFatalError(JavaThread* thr, const char *msg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    ReportJNIFatalError(thr, msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
static void NativeReportJNIWarning(JavaThread* thr, const char *msg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    ReportJNIWarning(thr, msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
 * SUPPORT FUNCTIONS
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
functionEnterCritical(JavaThread* thr)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  if (thr->has_pending_exception()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    NativeReportJNIWarning(thr, "JNI call made with exception pending");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
functionEnterCriticalExceptionAllowed(JavaThread* thr)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
functionEnter(JavaThread* thr)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  if (thr->in_critical()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    tty->print_cr(warn_other_function_in_critical);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  if (thr->has_pending_exception()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    NativeReportJNIWarning(thr, "JNI call made with exception pending");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
functionEnterExceptionAllowed(JavaThread* thr)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  if (thr->in_critical()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    tty->print_cr(warn_other_function_in_critical);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
functionExit(JNIEnv *env)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  /* nothing to do at this time */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
checkStaticFieldID(JavaThread* thr, jfieldID fid, jclass cls, int ftype)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  fieldDescriptor fd;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  /* make sure it is a static field */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  if (!jfieldIDWorkaround::is_static_jfieldID(fid))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    ReportJNIFatalError(thr, fatal_should_be_static);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  /* validate the class being passed */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  klassOop k_oop = jniCheck::validate_class(thr, cls, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  /* check for proper subclass hierarchy */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  klassOop f_oop = id->holder();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  if (!instanceKlass::cast(k_oop)->is_subtype_of(f_oop))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    ReportJNIFatalError(thr, fatal_wrong_static_field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  /* check for proper field type */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  if (!instanceKlass::cast(f_oop)->find_local_field_from_offset(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
          id->offset(), true, &fd))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    ReportJNIFatalError(thr, fatal_static_field_not_found);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  if ((fd.field_type() != ftype) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
      !(fd.field_type() == T_ARRAY && ftype == T_OBJECT)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    ReportJNIFatalError(thr, fatal_static_field_mismatch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
checkInstanceFieldID(JavaThread* thr, jfieldID fid, jobject obj, int ftype)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  fieldDescriptor fd;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  /* make sure it is an instance field */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  if (jfieldIDWorkaround::is_static_jfieldID(fid))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    ReportJNIFatalError(thr, fatal_should_be_nonstatic);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  /* validate the object being passed and then get its class */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  oop oopObj = jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  if (!oopObj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    ReportJNIFatalError(thr, fatal_null_object);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  klassOop k_oop = oopObj->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  if (!jfieldIDWorkaround::is_valid_jfieldID(k_oop, fid)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    ReportJNIFatalError(thr, fatal_wrong_field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  /* make sure the field exists */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  int offset = jfieldIDWorkaround::from_instance_jfieldID(k_oop, fid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  if (!instanceKlass::cast(k_oop)->contains_field_offset(offset))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
    ReportJNIFatalError(thr, fatal_wrong_field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  /* check for proper field type */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  if (!instanceKlass::cast(k_oop)->find_field_from_offset(offset,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
                                                              false, &fd))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    ReportJNIFatalError(thr, fatal_instance_field_not_found);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  if ((fd.field_type() != ftype) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
      !(fd.field_type() == T_ARRAY && ftype == T_OBJECT)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    ReportJNIFatalError(thr, fatal_instance_field_mismatch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
checkString(JavaThread* thr, jstring js)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  oop s = jniCheck::validate_object(thr, js);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  if (!s || !java_lang_String::is_instance(s))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
    ReportJNIFatalError(thr, fatal_non_string);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
static inline void
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
checkArray(JavaThread* thr, jarray jArray, int elementType)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  arrayOop aOop;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  aOop = (arrayOop)jniCheck::validate_object(thr, jArray);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  if (aOop == NULL || !aOop->is_array())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
    ReportJNIFatalError(thr, fatal_non_array);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  if (elementType != -1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
    if (aOop->is_typeArray()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
      BasicType array_type = typeArrayKlass::cast(aOop->klass())->element_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
      if (array_type != elementType)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
        ReportJNIFatalError(thr, fatal_element_type_mismatch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
      } else if (aOop->is_objArray()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
        if ( T_OBJECT != elementType)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
          ReportJNIFatalError(thr, fatal_object_array_expected);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
        ReportJNIFatalError(thr, fatal_unknown_array_object);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
oop jniCheck::validate_handle(JavaThread* thr, jobject obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  if (JNIHandles::is_frame_handle(thr, obj) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
      JNIHandles::is_local_handle(thr, obj) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
      JNIHandles::is_global_handle(obj) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
      JNIHandles::is_weak_global_handle(obj)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    return JNIHandles::resolve_external_guard(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  ReportJNIFatalError(thr, fatal_bad_ref_to_jni);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
methodOop jniCheck::validate_jmethod_id(JavaThread* thr, jmethodID method_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  methodOop moop = JNIHandles::checked_resolve_jmethod_id(method_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  if (moop == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
    ReportJNIFatalError(thr, fatal_wrong_class_or_method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  return moop;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
oop jniCheck::validate_object(JavaThread* thr, jobject obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
    if (!obj)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
        return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
    oop oopObj = jniCheck::validate_handle(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
    if (!oopObj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
      ReportJNIFatalError(thr, fatal_bad_ref_to_jni);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
    return oopObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
// Warn if a class descriptor is in decorated form; class descriptors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
// passed to JNI findClass should not be decorated unless they are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
// array descriptors.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
void jniCheck::validate_class_descriptor(JavaThread* thr, const char* name) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  if (name == NULL) return;  // implementation accepts NULL so just return
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  size_t len = strlen(name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  if (len >= 2 &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
      name[0] == JVM_SIGNATURE_CLASS &&            // 'L'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
      name[len-1] == JVM_SIGNATURE_ENDCLASS ) {    // ';'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    char msg[JVM_MAXPATHLEN];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    jio_snprintf(msg, JVM_MAXPATHLEN, warn_bad_class_descriptor, name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
    ReportJNIWarning(thr, msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
klassOop jniCheck::validate_class(JavaThread* thr, jclass clazz, bool allow_primitive) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  oop mirror = jniCheck::validate_handle(thr, clazz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  if (!mirror) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
    ReportJNIFatalError(thr, fatal_received_null_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  if (mirror->klass() != SystemDictionary::class_klass()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
    ReportJNIFatalError(thr, fatal_class_not_a_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  klassOop k = java_lang_Class::as_klassOop(mirror);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  // Make allowances for primitive classes ...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  if (!(k != NULL || allow_primitive && java_lang_Class::is_primitive(mirror))) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
    ReportJNIFatalError(thr, fatal_class_not_a_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  return k;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
void jniCheck::validate_throwable_klass(JavaThread* thr, klassOop klass) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  assert(klass != NULL, "klass argument must have a value");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  if (!Klass::cast(klass)->oop_is_instance() ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
      !instanceKlass::cast(klass)->is_subclass_of(SystemDictionary::throwable_klass())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
    ReportJNIFatalError(thr, fatal_class_not_a_throwable_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
void jniCheck::validate_call_object(JavaThread* thr, jobject obj, jmethodID method_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  /* validate the object being passed */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  jniCheck::validate_jmethod_id(thr, method_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
void jniCheck::validate_call_class(JavaThread* thr, jclass clazz, jmethodID method_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  /* validate the class being passed */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  ASSERT_OOPS_ALLOWED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  jniCheck::validate_jmethod_id(thr, method_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
 * IMPLEMENTATION OF FUNCTIONS IN CHECKED TABLE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
JNI_ENTRY_CHECKED(jclass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  checked_jni_DefineClass(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
                          const char *name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
                          jobject loader,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
                          const jbyte *buf,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
                          jsize len))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
      jniCheck::validate_object(thr, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
    jclass result = UNCHECKED()->DefineClass(env, name, loader, buf, len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
JNI_ENTRY_CHECKED(jclass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  checked_jni_FindClass(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
                        const char *name))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
      jniCheck::validate_class_descriptor(thr, name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
    jclass result = UNCHECKED()->FindClass(env, name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
JNI_ENTRY_CHECKED(jmethodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  checked_jni_FromReflectedMethod(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
                                  jobject method))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
      jniCheck::validate_object(thr, method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
    jmethodID result = UNCHECKED()->FromReflectedMethod(env, method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
JNI_ENTRY_CHECKED(jfieldID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
  checked_jni_FromReflectedField(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
                                 jobject field))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
      jniCheck::validate_object(thr, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
    jfieldID result = UNCHECKED()->FromReflectedField(env, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
  checked_jni_ToReflectedMethod(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
                                jclass cls,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
                                jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
                                jboolean isStatic))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
      jniCheck::validate_class(thr, cls, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
      jniCheck::validate_jmethod_id(thr, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
    jobject result = UNCHECKED()->ToReflectedMethod(env, cls, methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
                                                    isStatic);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
JNI_ENTRY_CHECKED(jclass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
  checked_jni_GetSuperclass(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
                            jclass sub))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
      jniCheck::validate_class(thr, sub, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
    jclass result = UNCHECKED()->GetSuperclass(env, sub);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
JNI_ENTRY_CHECKED(jboolean,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  checked_jni_IsAssignableFrom(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
                               jclass sub,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
                               jclass sup))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
      jniCheck::validate_class(thr, sub, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
      jniCheck::validate_class(thr, sup, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
    jboolean result = UNCHECKED()->IsAssignableFrom(env, sub, sup);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
  checked_jni_ToReflectedField(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
                               jclass cls,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
                               jfieldID fieldID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
                               jboolean isStatic))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
      jniCheck::validate_class(thr, cls, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
    jobject result = UNCHECKED()->ToReflectedField(env, cls, fieldID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
                                                   isStatic);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  checked_jni_Throw(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
                    jthrowable obj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
      oop oopObj = jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
      if (oopObj == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
        // Unchecked Throw tolerates a NULL obj, so just warn
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
        ReportJNIWarning(thr, "JNI Throw called with NULL throwable");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
        jniCheck::validate_throwable_klass(thr, oopObj->klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
    jint result = UNCHECKED()->Throw(env, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
  checked_jni_ThrowNew(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
                       jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
                       const char *msg))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
      klassOop k = jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
      assert(k != NULL, "validate_class shouldn't return NULL klassOop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
      jniCheck::validate_throwable_klass(thr, k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
    jint result = UNCHECKED()->ThrowNew(env, clazz, msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
JNI_ENTRY_CHECKED(jthrowable,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
  checked_jni_ExceptionOccurred(JNIEnv *env))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
    jthrowable result = UNCHECKED()->ExceptionOccurred(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
  checked_jni_ExceptionDescribe(JNIEnv *env))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
    UNCHECKED()->ExceptionDescribe(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
  checked_jni_ExceptionClear(JNIEnv *env))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
    UNCHECKED()->ExceptionClear(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
  checked_jni_FatalError(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
                         const char *msg))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
    UNCHECKED()->FatalError(env, msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  checked_jni_PushLocalFrame(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
                             jint capacity))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
    if (capacity < 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
      NativeReportJNIFatalError(thr, "negative capacity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
    jint result = UNCHECKED()->PushLocalFrame(env, capacity);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
  checked_jni_PopLocalFrame(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
                            jobject result))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
    jobject res = UNCHECKED()->PopLocalFrame(env, result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
    return res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
  checked_jni_NewGlobalRef(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
                           jobject lobj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
      if (lobj != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
        jniCheck::validate_handle(thr, lobj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
    jobject result = UNCHECKED()->NewGlobalRef(env,lobj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
  checked_jni_DeleteGlobalRef(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
                              jobject gref))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
      jniCheck::validate_object(thr, gref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
      if (gref && !JNIHandles::is_global_handle(gref)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
        ReportJNIFatalError(thr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
            "Invalid global JNI handle passed to DeleteGlobalRef");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
    UNCHECKED()->DeleteGlobalRef(env,gref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
  checked_jni_DeleteLocalRef(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
                             jobject obj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
      jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
      if (obj && !(JNIHandles::is_local_handle(thr, obj) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
                   JNIHandles::is_frame_handle(thr, obj)))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
        ReportJNIFatalError(thr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
            "Invalid local JNI handle passed to DeleteLocalRef");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
    UNCHECKED()->DeleteLocalRef(env, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
JNI_ENTRY_CHECKED(jboolean,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
  checked_jni_IsSameObject(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
                           jobject obj1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
                           jobject obj2))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
      /* This JNI function can be used to compare weak global references
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
       * to NULL objects. If the handles are valid, but contain NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
       * then don't attempt to validate the object.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
       */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
      if (obj1 != NULL && jniCheck::validate_handle(thr, obj1) != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
        jniCheck::validate_object(thr, obj1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
      if (obj2 != NULL && jniCheck::validate_handle(thr, obj2) != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
        jniCheck::validate_object(thr, obj2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
    jboolean result = UNCHECKED()->IsSameObject(env,obj1,obj2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
  checked_jni_NewLocalRef(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
                          jobject ref))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
      if (ref != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
        jniCheck::validate_handle(thr, ref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
    jobject result = UNCHECKED()->NewLocalRef(env, ref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
  checked_jni_EnsureLocalCapacity(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
                                  jint capacity))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
    if (capacity < 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
      NativeReportJNIFatalError(thr, "negative capacity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
    jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
  checked_jni_AllocObject(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
                          jclass clazz))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
    jobject result = UNCHECKED()->AllocObject(env,clazz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
  checked_jni_NewObject(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
                        jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
                        jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
                        ...))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
    va_list args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
      jniCheck::validate_jmethod_id(thr, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
    va_start(args, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
    jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
    va_end(args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
  checked_jni_NewObjectV(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
                         jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
                         jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
                         va_list args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
      jniCheck::validate_jmethod_id(thr, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
    jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
  checked_jni_NewObjectA(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
                         jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
                         jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
                         const jvalue *args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
      jniCheck::validate_jmethod_id(thr, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
    jobject result = UNCHECKED()->NewObjectA(env,clazz,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
JNI_ENTRY_CHECKED(jclass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
  checked_jni_GetObjectClass(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
                             jobject obj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
      jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
    jclass result = UNCHECKED()->GetObjectClass(env,obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
JNI_ENTRY_CHECKED(jboolean,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
  checked_jni_IsInstanceOf(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
                           jobject obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
                           jclass clazz))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
      jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
      jniCheck::validate_class(thr, clazz, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
    jboolean result = UNCHECKED()->IsInstanceOf(env,obj,clazz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
JNI_ENTRY_CHECKED(jmethodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
  checked_jni_GetMethodID(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
                          jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
                          const char *name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
                          const char *sig))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
    jmethodID result = UNCHECKED()->GetMethodID(env,clazz,name,sig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
#define WRAPPER_CallMethod(ResultType, Result) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
JNI_ENTRY_CHECKED(ResultType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
  checked_jni_Call##Result##Method(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
                                   jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
                                   jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
                                   ...)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
    va_list args; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
      jniCheck::validate_call_object(thr, obj, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
    va_start(args,methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
    ResultType result =UNCHECKED()->Call##Result##MethodV(env, obj, methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
                                                          args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
    va_end(args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
JNI_END \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
JNI_ENTRY_CHECKED(ResultType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
  checked_jni_Call##Result##MethodV(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
                                    jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
                                    jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
                                    va_list args)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
    IN_VM(\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
      jniCheck::validate_call_object(thr, obj, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
    ResultType result = UNCHECKED()->Call##Result##MethodV(env, obj, methodID,\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
                                                           args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
JNI_END \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
JNI_ENTRY_CHECKED(ResultType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
  checked_jni_Call##Result##MethodA(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
                                    jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
                                    jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
                                    const jvalue * args)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
      jniCheck::validate_call_object(thr, obj, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
    ResultType result = UNCHECKED()->Call##Result##MethodA(env, obj, methodID,\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
                                                           args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
WRAPPER_CallMethod(jobject,Object)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
WRAPPER_CallMethod(jboolean,Boolean)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
WRAPPER_CallMethod(jbyte,Byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
WRAPPER_CallMethod(jshort,Short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
WRAPPER_CallMethod(jchar,Char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
WRAPPER_CallMethod(jint,Int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
WRAPPER_CallMethod(jlong,Long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
WRAPPER_CallMethod(jfloat,Float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
WRAPPER_CallMethod(jdouble,Double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
  checked_jni_CallVoidMethod(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
                             jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
                             jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
                             ...))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
    va_list args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   840
      jniCheck::validate_call_object(thr, obj, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   842
    va_start(args,methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   843
    UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
    va_end(args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   847
489c9b5090e2 Initial load
duke
parents:
diff changeset
   848
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   849
  checked_jni_CallVoidMethodV(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   850
                              jobject obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   851
                              jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   852
                              va_list args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   853
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   854
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   855
      jniCheck::validate_call_object(thr, obj, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   856
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   857
    UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   858
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   859
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   860
489c9b5090e2 Initial load
duke
parents:
diff changeset
   861
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   862
  checked_jni_CallVoidMethodA(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   863
                              jobject obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   864
                              jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   865
                              const jvalue * args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   866
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   867
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   868
      jniCheck::validate_call_object(thr, obj, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   869
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   870
    UNCHECKED()->CallVoidMethodA(env,obj,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   871
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   872
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   873
489c9b5090e2 Initial load
duke
parents:
diff changeset
   874
#define WRAPPER_CallNonvirtualMethod(ResultType, Result) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   875
JNI_ENTRY_CHECKED(ResultType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   876
  checked_jni_CallNonvirtual##Result##Method(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   877
                                             jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   878
                                             jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   879
                                             jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   880
                                             ...)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   881
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   882
    va_list args; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   883
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   884
      jniCheck::validate_call_object(thr, obj, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   885
      jniCheck::validate_call_class(thr, clazz, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   886
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   887
    va_start(args,methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   888
    ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodV(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   889
                                                                     obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   890
                                                                     clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   891
                                                                     methodID,\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   892
                                                                     args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   893
    va_end(args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   894
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   895
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   896
JNI_END \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   897
\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   898
JNI_ENTRY_CHECKED(ResultType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   899
  checked_jni_CallNonvirtual##Result##MethodV(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   900
                                              jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   901
                                              jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   902
                                              jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   903
                                              va_list args)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   904
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   905
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   906
      jniCheck::validate_call_object(thr, obj, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   907
      jniCheck::validate_call_class(thr, clazz, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   908
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   909
    ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodV(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   910
                                                                     obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   911
                                                                     clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   912
                                                                     methodID,\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   913
                                                                     args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   914
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   915
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   916
JNI_END \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   917
\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   918
JNI_ENTRY_CHECKED(ResultType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   919
  checked_jni_CallNonvirtual##Result##MethodA(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   920
                                              jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   921
                                              jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   922
                                              jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   923
                                              const jvalue * args)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   924
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   925
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   926
      jniCheck::validate_call_object(thr, obj, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   927
      jniCheck::validate_call_class(thr, clazz, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   928
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   929
    ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodA(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   930
                                                                     obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   931
                                                                     clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   932
                                                                     methodID,\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   933
                                                                     args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   934
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   935
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   936
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   937
489c9b5090e2 Initial load
duke
parents:
diff changeset
   938
WRAPPER_CallNonvirtualMethod(jobject,Object)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   939
WRAPPER_CallNonvirtualMethod(jboolean,Boolean)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   940
WRAPPER_CallNonvirtualMethod(jbyte,Byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   941
WRAPPER_CallNonvirtualMethod(jshort,Short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   942
WRAPPER_CallNonvirtualMethod(jchar,Char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   943
WRAPPER_CallNonvirtualMethod(jint,Int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   944
WRAPPER_CallNonvirtualMethod(jlong,Long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   945
WRAPPER_CallNonvirtualMethod(jfloat,Float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   946
WRAPPER_CallNonvirtualMethod(jdouble,Double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   947
489c9b5090e2 Initial load
duke
parents:
diff changeset
   948
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   949
  checked_jni_CallNonvirtualVoidMethod(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   950
                                       jobject obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   951
                                       jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   952
                                       jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   953
                                       ...))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   954
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   955
    va_list args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   956
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   957
      jniCheck::validate_call_object(thr, obj, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   958
      jniCheck::validate_call_class(thr, clazz, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   959
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   960
    va_start(args,methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   961
    UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   962
    va_end(args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   963
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   964
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   965
489c9b5090e2 Initial load
duke
parents:
diff changeset
   966
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   967
  checked_jni_CallNonvirtualVoidMethodV(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   968
                                        jobject obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   969
                                        jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   970
                                        jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   971
                                        va_list args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   972
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   973
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   974
      jniCheck::validate_call_object(thr, obj, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   975
      jniCheck::validate_call_class(thr, clazz, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   976
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   977
    UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   978
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   979
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   980
489c9b5090e2 Initial load
duke
parents:
diff changeset
   981
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   982
  checked_jni_CallNonvirtualVoidMethodA(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   983
                                        jobject obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   984
                                        jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   985
                                        jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   986
                                        const jvalue * args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   987
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   988
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   989
      jniCheck::validate_call_object(thr, obj, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   990
      jniCheck::validate_call_class(thr, clazz, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   991
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   992
    UNCHECKED()->CallNonvirtualVoidMethodA(env,obj,clazz,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   993
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   994
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
   995
489c9b5090e2 Initial load
duke
parents:
diff changeset
   996
JNI_ENTRY_CHECKED(jfieldID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   997
  checked_jni_GetFieldID(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   998
                         jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   999
                         const char *name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1000
                         const char *sig))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1001
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1002
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1003
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1004
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1005
    jfieldID result = UNCHECKED()->GetFieldID(env,clazz,name,sig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1006
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1007
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1008
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1009
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1010
#define WRAPPER_GetField(ReturnType,Result,FieldType) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1011
JNI_ENTRY_CHECKED(ReturnType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1012
  checked_jni_Get##Result##Field(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1013
                                 jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1014
                                 jfieldID fieldID)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1015
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1016
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1017
      checkInstanceFieldID(thr, fieldID, obj, FieldType); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1018
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1019
    ReturnType result = UNCHECKED()->Get##Result##Field(env,obj,fieldID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1020
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1021
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1022
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1023
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1024
WRAPPER_GetField(jobject,  Object,  T_OBJECT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1025
WRAPPER_GetField(jboolean, Boolean, T_BOOLEAN)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1026
WRAPPER_GetField(jbyte,    Byte,    T_BYTE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1027
WRAPPER_GetField(jshort,   Short,   T_SHORT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1028
WRAPPER_GetField(jchar,    Char,    T_CHAR)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1029
WRAPPER_GetField(jint,     Int,     T_INT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1030
WRAPPER_GetField(jlong,    Long,    T_LONG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1031
WRAPPER_GetField(jfloat,   Float,   T_FLOAT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1032
WRAPPER_GetField(jdouble,  Double,  T_DOUBLE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1033
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1034
#define WRAPPER_SetField(ValueType,Result,FieldType) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1035
JNI_ENTRY_CHECKED(void,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1036
  checked_jni_Set##Result##Field(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1037
                                 jobject obj, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1038
                                 jfieldID fieldID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1039
                                 ValueType val)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1040
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1041
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1042
      checkInstanceFieldID(thr, fieldID, obj, FieldType); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1043
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1044
    UNCHECKED()->Set##Result##Field(env,obj,fieldID,val); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1045
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1046
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1047
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1048
WRAPPER_SetField(jobject,  Object,  T_OBJECT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1049
WRAPPER_SetField(jboolean, Boolean, T_BOOLEAN)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1050
WRAPPER_SetField(jbyte,    Byte,    T_BYTE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1051
WRAPPER_SetField(jshort,   Short,   T_SHORT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1052
WRAPPER_SetField(jchar,    Char,    T_CHAR)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1053
WRAPPER_SetField(jint,     Int,     T_INT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1054
WRAPPER_SetField(jlong,    Long,    T_LONG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1055
WRAPPER_SetField(jfloat,   Float,   T_FLOAT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1056
WRAPPER_SetField(jdouble,  Double,  T_DOUBLE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1057
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1058
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1059
JNI_ENTRY_CHECKED(jmethodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1060
  checked_jni_GetStaticMethodID(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1061
                                jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1062
                                const char *name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1063
                                const char *sig))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1064
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1065
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1066
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1067
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1068
    jmethodID result = UNCHECKED()->GetStaticMethodID(env,clazz,name,sig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1069
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1070
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1071
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1072
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1073
#define WRAPPER_CallStaticMethod(ReturnType,Result) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1074
JNI_ENTRY_CHECKED(ReturnType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1075
  checked_jni_CallStatic##Result##Method(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1076
                                         jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1077
                                         jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1078
                                         ...)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1079
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1080
    va_list args; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1081
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1082
      jniCheck::validate_jmethod_id(thr, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1083
      jniCheck::validate_class(thr, clazz, false); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1084
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1085
    va_start(args,methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1086
    ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1087
                                                                 clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1088
                                                                 methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1089
                                                                 args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1090
    va_end(args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1091
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1092
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1093
JNI_END \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1094
\
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1095
JNI_ENTRY_CHECKED(ReturnType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1096
  checked_jni_CallStatic##Result##MethodV(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1097
                                          jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1098
                                          jmethodID methodID,\
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1099
                                          va_list args)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1100
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1101
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1102
      jniCheck::validate_jmethod_id(thr, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1103
      jniCheck::validate_class(thr, clazz, false); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1104
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1105
    ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1106
                                                                 clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1107
                                                                 methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1108
                                                                 args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1109
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1110
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1111
JNI_END \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1112
\
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1113
JNI_ENTRY_CHECKED(ReturnType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1114
  checked_jni_CallStatic##Result##MethodA(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1115
                                          jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1116
                                          jmethodID methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1117
                                          const jvalue *args)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1118
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1119
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1120
      jniCheck::validate_jmethod_id(thr, methodID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1121
      jniCheck::validate_class(thr, clazz, false); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1122
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1123
    ReturnType result = UNCHECKED()->CallStatic##Result##MethodA(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1124
                                                                 clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1125
                                                                 methodID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1126
                                                                 args); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1127
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1128
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1129
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1130
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1131
WRAPPER_CallStaticMethod(jobject,Object)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1132
WRAPPER_CallStaticMethod(jboolean,Boolean)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1133
WRAPPER_CallStaticMethod(jbyte,Byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1134
WRAPPER_CallStaticMethod(jshort,Short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1135
WRAPPER_CallStaticMethod(jchar,Char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1136
WRAPPER_CallStaticMethod(jint,Int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1137
WRAPPER_CallStaticMethod(jlong,Long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1138
WRAPPER_CallStaticMethod(jfloat,Float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1139
WRAPPER_CallStaticMethod(jdouble,Double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1140
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1141
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1142
  checked_jni_CallStaticVoidMethod(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1143
                                   jclass cls,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1144
                                   jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1145
                                   ...))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1146
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1147
    va_list args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1148
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1149
      jniCheck::validate_jmethod_id(thr, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1150
      jniCheck::validate_class(thr, cls, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1151
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1152
    va_start(args,methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1153
    UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1154
    va_end(args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1155
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1156
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1157
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1158
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1159
  checked_jni_CallStaticVoidMethodV(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1160
                                    jclass cls,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1161
                                    jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1162
                                    va_list args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1163
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1164
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1165
      jniCheck::validate_jmethod_id(thr, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1166
      jniCheck::validate_class(thr, cls, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1167
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1168
    UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1169
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1170
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1171
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1172
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1173
  checked_jni_CallStaticVoidMethodA(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1174
                                    jclass cls,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1175
                                    jmethodID methodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1176
                                    const jvalue * args))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1177
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1178
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1179
      jniCheck::validate_jmethod_id(thr, methodID);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1180
      jniCheck::validate_class(thr, cls, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1181
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1182
    UNCHECKED()->CallStaticVoidMethodA(env,cls,methodID,args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1183
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1184
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1185
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1186
JNI_ENTRY_CHECKED(jfieldID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1187
  checked_jni_GetStaticFieldID(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1188
                               jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1189
                               const char *name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1190
                               const char *sig))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1191
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1192
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1193
      jniCheck::validate_class(thr, clazz, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1194
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1195
    jfieldID result = UNCHECKED()->GetStaticFieldID(env,clazz,name,sig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1196
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1197
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1198
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1199
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1200
#define WRAPPER_GetStaticField(ReturnType,Result,FieldType) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1201
JNI_ENTRY_CHECKED(ReturnType,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1202
  checked_jni_GetStatic##Result##Field(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1203
                                       jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1204
                                       jfieldID fieldID)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1205
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1206
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1207
      jniCheck::validate_class(thr, clazz, false); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1208
      checkStaticFieldID(thr, fieldID, clazz, FieldType); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1209
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1210
    ReturnType result = UNCHECKED()->GetStatic##Result##Field(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1211
                                                              clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1212
                                                              fieldID); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1213
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1214
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1215
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1216
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1217
WRAPPER_GetStaticField(jobject,  Object,  T_OBJECT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1218
WRAPPER_GetStaticField(jboolean, Boolean, T_BOOLEAN)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1219
WRAPPER_GetStaticField(jbyte,    Byte,    T_BYTE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1220
WRAPPER_GetStaticField(jshort,   Short,   T_SHORT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1221
WRAPPER_GetStaticField(jchar,    Char,    T_CHAR)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1222
WRAPPER_GetStaticField(jint,     Int,     T_INT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1223
WRAPPER_GetStaticField(jlong,    Long,    T_LONG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1224
WRAPPER_GetStaticField(jfloat,   Float,   T_FLOAT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1225
WRAPPER_GetStaticField(jdouble,  Double,  T_DOUBLE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1226
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1227
#define WRAPPER_SetStaticField(ValueType,Result,FieldType) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1228
JNI_ENTRY_CHECKED(void,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1229
  checked_jni_SetStatic##Result##Field(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1230
                                       jclass clazz, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1231
                                       jfieldID fieldID, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1232
                                       ValueType value)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1233
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1234
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1235
      jniCheck::validate_class(thr, clazz, false); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1236
      checkStaticFieldID(thr, fieldID, clazz, FieldType); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1237
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1238
    UNCHECKED()->SetStatic##Result##Field(env,clazz,fieldID,value); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1239
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1240
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1241
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1242
WRAPPER_SetStaticField(jobject,  Object,  T_OBJECT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1243
WRAPPER_SetStaticField(jboolean, Boolean, T_BOOLEAN)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1244
WRAPPER_SetStaticField(jbyte,    Byte,    T_BYTE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1245
WRAPPER_SetStaticField(jshort,   Short,   T_SHORT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1246
WRAPPER_SetStaticField(jchar,    Char,    T_CHAR)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1247
WRAPPER_SetStaticField(jint,     Int,     T_INT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1248
WRAPPER_SetStaticField(jlong,    Long,    T_LONG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1249
WRAPPER_SetStaticField(jfloat,   Float,   T_FLOAT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1250
WRAPPER_SetStaticField(jdouble,  Double,  T_DOUBLE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1251
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1252
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1253
JNI_ENTRY_CHECKED(jstring,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1254
  checked_jni_NewString(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1255
                        const jchar *unicode,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1256
                        jsize len))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1257
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1258
    jstring result = UNCHECKED()->NewString(env,unicode,len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1259
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1260
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1261
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1262
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1263
JNI_ENTRY_CHECKED(jsize,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1264
  checked_jni_GetStringLength(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1265
                              jstring str))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1266
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1267
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1268
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1269
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1270
    jsize result = UNCHECKED()->GetStringLength(env,str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1271
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1272
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1273
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1274
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1275
JNI_ENTRY_CHECKED(const jchar *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1276
  checked_jni_GetStringChars(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1277
                             jstring str,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1278
                             jboolean *isCopy))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1279
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1280
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1281
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1282
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1283
    const jchar *result = UNCHECKED()->GetStringChars(env,str,isCopy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1284
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1285
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1286
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1287
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1288
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1289
  checked_jni_ReleaseStringChars(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1290
                                 jstring str,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1291
                                 const jchar *chars))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1292
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1293
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1294
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1295
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1296
    /* cannot check validity of copy, unless every request is logged by
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1297
     * checking code.  Implementation of this check is deferred until a
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1298
     * subsequent release.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1299
     */
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1300
    UNCHECKED()->ReleaseStringChars(env,str,chars);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1301
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1302
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1303
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1304
JNI_ENTRY_CHECKED(jstring,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1305
  checked_jni_NewStringUTF(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1306
                           const char *utf))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1307
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1308
    jstring result = UNCHECKED()->NewStringUTF(env,utf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1309
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1310
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1311
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1312
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1313
JNI_ENTRY_CHECKED(jsize,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1314
  checked_jni_GetStringUTFLength(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1315
                                 jstring str))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1316
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1317
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1318
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1319
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1320
    jsize result = UNCHECKED()->GetStringUTFLength(env,str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1321
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1322
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1323
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1324
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1325
JNI_ENTRY_CHECKED(const char *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1326
  checked_jni_GetStringUTFChars(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1327
                                jstring str,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1328
                                jboolean *isCopy))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1329
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1330
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1331
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1332
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1333
    const char *result = UNCHECKED()->GetStringUTFChars(env,str,isCopy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1334
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1335
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1336
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1337
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1338
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1339
  checked_jni_ReleaseStringUTFChars(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1340
                                    jstring str,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1341
                                    const char* chars))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1342
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1343
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1344
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1345
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1346
    /* cannot check validity of copy, unless every request is logged by
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1347
     * checking code.  Implementation of this check is deferred until a
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1348
     * subsequent release.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1349
     */
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1350
    UNCHECKED()->ReleaseStringUTFChars(env,str,chars);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1351
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1352
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1353
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1354
JNI_ENTRY_CHECKED(jsize,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1355
  checked_jni_GetArrayLength(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1356
                             jarray array))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1357
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1358
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1359
      checkArray(thr, array, -1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1360
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1361
    jsize result = UNCHECKED()->GetArrayLength(env,array);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1362
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1363
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1364
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1365
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1366
JNI_ENTRY_CHECKED(jobjectArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1367
  checked_jni_NewObjectArray(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1368
                             jsize len,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1369
                             jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1370
                             jobject init))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1371
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1372
    jobjectArray result = UNCHECKED()->NewObjectArray(env,len,clazz,init);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1373
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1374
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1375
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1376
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1377
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1378
  checked_jni_GetObjectArrayElement(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1379
                                    jobjectArray array,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1380
                                    jsize index))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1381
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1382
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1383
      checkArray(thr, array, T_OBJECT);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1384
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1385
    jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1386
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1387
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1388
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1389
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1390
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1391
  checked_jni_SetObjectArrayElement(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1392
                                    jobjectArray array,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1393
                                    jsize index,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1394
                                    jobject val))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1395
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1396
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1397
      checkArray(thr, array, T_OBJECT);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1398
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1399
    UNCHECKED()->SetObjectArrayElement(env,array,index,val);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1400
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1401
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1402
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1403
#define WRAPPER_NewScalarArray(Return, Result) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1404
JNI_ENTRY_CHECKED(Return, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1405
  checked_jni_New##Result##Array(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1406
                                 jsize len)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1407
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1408
    Return result = UNCHECKED()->New##Result##Array(env,len); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1409
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1410
    return (Return) result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1411
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1412
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1413
WRAPPER_NewScalarArray(jbooleanArray, Boolean)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1414
WRAPPER_NewScalarArray(jbyteArray, Byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1415
WRAPPER_NewScalarArray(jshortArray, Short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1416
WRAPPER_NewScalarArray(jcharArray, Char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1417
WRAPPER_NewScalarArray(jintArray, Int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1418
WRAPPER_NewScalarArray(jlongArray, Long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1419
WRAPPER_NewScalarArray(jfloatArray, Float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1420
WRAPPER_NewScalarArray(jdoubleArray, Double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1421
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1422
#define WRAPPER_GetScalarArrayElements(ElementTag,ElementType,Result) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1423
JNI_ENTRY_CHECKED(ElementType *,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1424
  checked_jni_Get##Result##ArrayElements(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1425
                                         ElementType##Array array, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1426
                                         jboolean *isCopy)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1427
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1428
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1429
      checkArray(thr, array, ElementTag); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1430
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1431
    ElementType *result = UNCHECKED()->Get##Result##ArrayElements(env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1432
                                                                  array, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1433
                                                                  isCopy); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1434
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1435
    return result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1436
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1437
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1438
WRAPPER_GetScalarArrayElements(T_BOOLEAN, jboolean, Boolean)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1439
WRAPPER_GetScalarArrayElements(T_BYTE,    jbyte,    Byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1440
WRAPPER_GetScalarArrayElements(T_SHORT,   jshort,   Short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1441
WRAPPER_GetScalarArrayElements(T_CHAR,    jchar,    Char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1442
WRAPPER_GetScalarArrayElements(T_INT,     jint,     Int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1443
WRAPPER_GetScalarArrayElements(T_LONG,    jlong,    Long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1444
WRAPPER_GetScalarArrayElements(T_FLOAT,   jfloat,   Float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1445
WRAPPER_GetScalarArrayElements(T_DOUBLE,  jdouble,  Double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1446
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1447
#define WRAPPER_ReleaseScalarArrayElements(ElementTag,ElementType,Result,Tag) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1448
JNI_ENTRY_CHECKED(void,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1449
  checked_jni_Release##Result##ArrayElements(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1450
                                             ElementType##Array array, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1451
                                             ElementType *elems, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1452
                                             jint mode)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1453
    functionEnterExceptionAllowed(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1454
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1455
      checkArray(thr, array, ElementTag); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1456
      ASSERT_OOPS_ALLOWED; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1457
      typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(array)); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1458
      /* cannot check validity of copy, unless every request is logged by
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1459
       * checking code.  Implementation of this check is deferred until a
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1460
       * subsequent release.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1461
       */ \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1462
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1463
    UNCHECKED()->Release##Result##ArrayElements(env,array,elems,mode); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1464
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1465
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1466
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1467
WRAPPER_ReleaseScalarArrayElements(T_BOOLEAN,jboolean, Boolean, bool)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1468
WRAPPER_ReleaseScalarArrayElements(T_BYTE,   jbyte,    Byte,    byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1469
WRAPPER_ReleaseScalarArrayElements(T_SHORT,  jshort,   Short,   short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1470
WRAPPER_ReleaseScalarArrayElements(T_CHAR,   jchar,    Char,    char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1471
WRAPPER_ReleaseScalarArrayElements(T_INT,    jint,     Int,     int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1472
WRAPPER_ReleaseScalarArrayElements(T_LONG,   jlong,    Long,    long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1473
WRAPPER_ReleaseScalarArrayElements(T_FLOAT,  jfloat,   Float,   float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1474
WRAPPER_ReleaseScalarArrayElements(T_DOUBLE, jdouble,  Double,  double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1475
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1476
#define WRAPPER_GetScalarArrayRegion(ElementTag,ElementType,Result) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1477
JNI_ENTRY_CHECKED(void,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1478
  checked_jni_Get##Result##ArrayRegion(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1479
                                       ElementType##Array array, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1480
                                       jsize start, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1481
                                       jsize len, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1482
                                       ElementType *buf)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1483
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1484
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1485
      checkArray(thr, array, ElementTag); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1486
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1487
    UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1488
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1489
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1490
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1491
WRAPPER_GetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1492
WRAPPER_GetScalarArrayRegion(T_BYTE,    jbyte,    Byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1493
WRAPPER_GetScalarArrayRegion(T_SHORT,   jshort,   Short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1494
WRAPPER_GetScalarArrayRegion(T_CHAR,    jchar,    Char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1495
WRAPPER_GetScalarArrayRegion(T_INT,     jint,     Int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1496
WRAPPER_GetScalarArrayRegion(T_LONG,    jlong,    Long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1497
WRAPPER_GetScalarArrayRegion(T_FLOAT,   jfloat,   Float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1498
WRAPPER_GetScalarArrayRegion(T_DOUBLE,  jdouble,  Double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1499
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1500
#define WRAPPER_SetScalarArrayRegion(ElementTag,ElementType,Result) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1501
JNI_ENTRY_CHECKED(void,  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1502
  checked_jni_Set##Result##ArrayRegion(JNIEnv *env, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1503
                                       ElementType##Array array, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1504
                                       jsize start, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1505
                                       jsize len, \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1506
                                       const ElementType *buf)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1507
    functionEnter(thr); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1508
    IN_VM( \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1509
      checkArray(thr, array, ElementTag); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1510
    ) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1511
    UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1512
    functionExit(env); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1513
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1514
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1515
WRAPPER_SetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1516
WRAPPER_SetScalarArrayRegion(T_BYTE,    jbyte,    Byte)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1517
WRAPPER_SetScalarArrayRegion(T_SHORT,   jshort,   Short)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1518
WRAPPER_SetScalarArrayRegion(T_CHAR,    jchar,    Char)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1519
WRAPPER_SetScalarArrayRegion(T_INT,     jint,     Int)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1520
WRAPPER_SetScalarArrayRegion(T_LONG,    jlong,    Long)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1521
WRAPPER_SetScalarArrayRegion(T_FLOAT,   jfloat,   Float)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1522
WRAPPER_SetScalarArrayRegion(T_DOUBLE,  jdouble,  Double)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1523
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1524
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1525
  checked_jni_RegisterNatives(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1526
                              jclass clazz,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1527
                              const JNINativeMethod *methods,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1528
                              jint nMethods))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1529
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1530
    jint result = UNCHECKED()->RegisterNatives(env,clazz,methods,nMethods);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1531
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1532
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1533
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1534
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1535
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1536
  checked_jni_UnregisterNatives(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1537
                                jclass clazz))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1538
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1539
    jint result = UNCHECKED()->UnregisterNatives(env,clazz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1540
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1541
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1542
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1543
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1544
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1545
  checked_jni_MonitorEnter(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1546
                           jobject obj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1547
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1548
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1549
      jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1550
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1551
    jint result = UNCHECKED()->MonitorEnter(env,obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1552
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1553
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1554
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1555
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1556
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1557
  checked_jni_MonitorExit(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1558
                          jobject obj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1559
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1560
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1561
      jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1562
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1563
    jint result = UNCHECKED()->MonitorExit(env,obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1564
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1565
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1566
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1567
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1568
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1569
  checked_jni_GetJavaVM(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1570
                        JavaVM **vm))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1571
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1572
    jint result = UNCHECKED()->GetJavaVM(env,vm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1573
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1574
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1575
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1576
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1577
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1578
  checked_jni_GetStringRegion(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1579
                              jstring str,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1580
                              jsize start,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1581
                              jsize len,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1582
                              jchar *buf))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1583
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1584
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1585
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1586
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1587
    UNCHECKED()->GetStringRegion(env, str, start, len, buf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1588
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1589
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1590
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1591
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1592
  checked_jni_GetStringUTFRegion(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1593
                                 jstring str,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1594
                                 jsize start,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1595
                                 jsize len,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1596
                                 char *buf))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1597
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1598
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1599
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1600
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1601
    UNCHECKED()->GetStringUTFRegion(env, str, start, len, buf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1602
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1603
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1604
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1605
JNI_ENTRY_CHECKED(void *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1606
  checked_jni_GetPrimitiveArrayCritical(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1607
                                        jarray array,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1608
                                        jboolean *isCopy))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1609
    functionEnterCritical(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1610
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1611
      checkArray(thr, array, -1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1612
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1613
    void *result = UNCHECKED()->GetPrimitiveArrayCritical(env, array, isCopy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1614
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1615
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1616
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1617
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1618
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1619
  checked_jni_ReleasePrimitiveArrayCritical(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1620
                                            jarray array,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1621
                                            void *carray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1622
                                            jint mode))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1623
    functionEnterCriticalExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1624
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1625
      checkArray(thr, array, -1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1626
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1627
    /* The Hotspot JNI code does not use the parameters, so just check the
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1628
     * array parameter as a minor sanity check
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1629
     */
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1630
    UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, carray, mode);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1631
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1632
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1633
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1634
JNI_ENTRY_CHECKED(const jchar*,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1635
  checked_jni_GetStringCritical(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1636
                                jstring string,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1637
                                jboolean *isCopy))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1638
    functionEnterCritical(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1639
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1640
      checkString(thr, string);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1641
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1642
    const jchar *result = UNCHECKED()->GetStringCritical(env, string, isCopy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1643
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1644
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1645
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1646
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1647
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1648
  checked_jni_ReleaseStringCritical(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1649
                                    jstring str,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1650
                                    const jchar *chars))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1651
    functionEnterCriticalExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1652
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1653
      checkString(thr, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1654
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1655
    /* The Hotspot JNI code does not use the parameters, so just check the
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1656
     * string parameter as a minor sanity check
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1657
     */
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1658
    UNCHECKED()->ReleaseStringCritical(env, str, chars);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1659
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1660
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1661
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1662
JNI_ENTRY_CHECKED(jweak,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1663
  checked_jni_NewWeakGlobalRef(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1664
                               jobject obj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1665
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1666
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1667
      if (obj != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1668
        jniCheck::validate_handle(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1669
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1670
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1671
    jweak result = UNCHECKED()->NewWeakGlobalRef(env, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1672
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1673
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1674
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1675
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1676
JNI_ENTRY_CHECKED(void,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1677
  checked_jni_DeleteWeakGlobalRef(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1678
                                  jweak ref))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1679
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1680
    UNCHECKED()->DeleteWeakGlobalRef(env, ref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1681
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1682
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1683
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1684
JNI_ENTRY_CHECKED(jboolean,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1685
  checked_jni_ExceptionCheck(JNIEnv *env))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1686
    functionEnterExceptionAllowed(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1687
    jboolean result = UNCHECKED()->ExceptionCheck(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1688
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1689
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1690
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1691
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1692
JNI_ENTRY_CHECKED(jobject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1693
  checked_jni_NewDirectByteBuffer(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1694
                                  void *address,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1695
                                  jlong capacity))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1696
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1697
    jobject result = UNCHECKED()->NewDirectByteBuffer(env, address, capacity);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1698
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1699
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1700
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1701
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1702
JNI_ENTRY_CHECKED(void *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1703
  checked_jni_GetDirectBufferAddress(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1704
                                     jobject buf))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1705
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1706
    void* result = UNCHECKED()->GetDirectBufferAddress(env, buf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1707
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1708
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1709
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1710
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1711
JNI_ENTRY_CHECKED(jlong,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1712
  checked_jni_GetDirectBufferCapacity(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1713
                                      jobject buf))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1714
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1715
    jlong result = UNCHECKED()->GetDirectBufferCapacity(env, buf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1716
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1717
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1718
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1719
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1720
JNI_ENTRY_CHECKED(jobjectRefType,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1721
  checked_jni_GetObjectRefType(JNIEnv *env,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1722
                               jobject obj))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1723
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1724
    /* validate the object being passed */
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1725
    IN_VM(
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1726
      jniCheck::validate_object(thr, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1727
    )
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1728
    jobjectRefType result = UNCHECKED()->GetObjectRefType(env, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1729
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1730
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1731
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1732
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1733
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1734
JNI_ENTRY_CHECKED(jint,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1735
  checked_jni_GetVersion(JNIEnv *env))
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1736
    functionEnter(thr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1737
    jint result = UNCHECKED()->GetVersion(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1738
    functionExit(env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1739
    return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1740
JNI_END
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1741
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1742
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1743
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1744
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1745
 * Structure containing all checked jni functions
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1746
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1747
struct JNINativeInterface_  checked_jni_NativeInterface = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1748
    NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1749
    NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1750
    NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1751
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1752
    NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1753
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1754
    checked_jni_GetVersion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1755
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1756
    checked_jni_DefineClass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1757
    checked_jni_FindClass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1758
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1759
    checked_jni_FromReflectedMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1760
    checked_jni_FromReflectedField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1761
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1762
    checked_jni_ToReflectedMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1763
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1764
    checked_jni_GetSuperclass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1765
    checked_jni_IsAssignableFrom,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1766
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1767
    checked_jni_ToReflectedField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1768
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1769
    checked_jni_Throw,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1770
    checked_jni_ThrowNew,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1771
    checked_jni_ExceptionOccurred,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1772
    checked_jni_ExceptionDescribe,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1773
    checked_jni_ExceptionClear,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1774
    checked_jni_FatalError,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1775
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1776
    checked_jni_PushLocalFrame,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1777
    checked_jni_PopLocalFrame,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1778
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1779
    checked_jni_NewGlobalRef,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1780
    checked_jni_DeleteGlobalRef,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1781
    checked_jni_DeleteLocalRef,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1782
    checked_jni_IsSameObject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1783
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1784
    checked_jni_NewLocalRef,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1785
    checked_jni_EnsureLocalCapacity,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1786
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1787
    checked_jni_AllocObject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1788
    checked_jni_NewObject,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1789
    checked_jni_NewObjectV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1790
    checked_jni_NewObjectA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1791
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1792
    checked_jni_GetObjectClass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1793
    checked_jni_IsInstanceOf,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1794
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1795
    checked_jni_GetMethodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1796
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1797
    checked_jni_CallObjectMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1798
    checked_jni_CallObjectMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1799
    checked_jni_CallObjectMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1800
    checked_jni_CallBooleanMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1801
    checked_jni_CallBooleanMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1802
    checked_jni_CallBooleanMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1803
    checked_jni_CallByteMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1804
    checked_jni_CallByteMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1805
    checked_jni_CallByteMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1806
    checked_jni_CallCharMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1807
    checked_jni_CallCharMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1808
    checked_jni_CallCharMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1809
    checked_jni_CallShortMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1810
    checked_jni_CallShortMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1811
    checked_jni_CallShortMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1812
    checked_jni_CallIntMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1813
    checked_jni_CallIntMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1814
    checked_jni_CallIntMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1815
    checked_jni_CallLongMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1816
    checked_jni_CallLongMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1817
    checked_jni_CallLongMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1818
    checked_jni_CallFloatMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1819
    checked_jni_CallFloatMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1820
    checked_jni_CallFloatMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1821
    checked_jni_CallDoubleMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1822
    checked_jni_CallDoubleMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1823
    checked_jni_CallDoubleMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1824
    checked_jni_CallVoidMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1825
    checked_jni_CallVoidMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1826
    checked_jni_CallVoidMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1827
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1828
    checked_jni_CallNonvirtualObjectMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1829
    checked_jni_CallNonvirtualObjectMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1830
    checked_jni_CallNonvirtualObjectMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1831
    checked_jni_CallNonvirtualBooleanMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1832
    checked_jni_CallNonvirtualBooleanMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1833
    checked_jni_CallNonvirtualBooleanMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1834
    checked_jni_CallNonvirtualByteMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1835
    checked_jni_CallNonvirtualByteMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1836
    checked_jni_CallNonvirtualByteMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1837
    checked_jni_CallNonvirtualCharMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1838
    checked_jni_CallNonvirtualCharMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1839
    checked_jni_CallNonvirtualCharMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1840
    checked_jni_CallNonvirtualShortMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1841
    checked_jni_CallNonvirtualShortMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1842
    checked_jni_CallNonvirtualShortMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1843
    checked_jni_CallNonvirtualIntMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1844
    checked_jni_CallNonvirtualIntMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1845
    checked_jni_CallNonvirtualIntMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1846
    checked_jni_CallNonvirtualLongMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1847
    checked_jni_CallNonvirtualLongMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1848
    checked_jni_CallNonvirtualLongMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1849
    checked_jni_CallNonvirtualFloatMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1850
    checked_jni_CallNonvirtualFloatMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1851
    checked_jni_CallNonvirtualFloatMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1852
    checked_jni_CallNonvirtualDoubleMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1853
    checked_jni_CallNonvirtualDoubleMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1854
    checked_jni_CallNonvirtualDoubleMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1855
    checked_jni_CallNonvirtualVoidMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1856
    checked_jni_CallNonvirtualVoidMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1857
    checked_jni_CallNonvirtualVoidMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1858
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1859
    checked_jni_GetFieldID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1860
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1861
    checked_jni_GetObjectField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1862
    checked_jni_GetBooleanField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1863
    checked_jni_GetByteField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1864
    checked_jni_GetCharField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1865
    checked_jni_GetShortField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1866
    checked_jni_GetIntField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1867
    checked_jni_GetLongField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1868
    checked_jni_GetFloatField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1869
    checked_jni_GetDoubleField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1870
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1871
    checked_jni_SetObjectField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1872
    checked_jni_SetBooleanField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1873
    checked_jni_SetByteField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1874
    checked_jni_SetCharField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1875
    checked_jni_SetShortField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1876
    checked_jni_SetIntField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1877
    checked_jni_SetLongField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1878
    checked_jni_SetFloatField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1879
    checked_jni_SetDoubleField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1880
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1881
    checked_jni_GetStaticMethodID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1882
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1883
    checked_jni_CallStaticObjectMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1884
    checked_jni_CallStaticObjectMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1885
    checked_jni_CallStaticObjectMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1886
    checked_jni_CallStaticBooleanMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1887
    checked_jni_CallStaticBooleanMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1888
    checked_jni_CallStaticBooleanMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1889
    checked_jni_CallStaticByteMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1890
    checked_jni_CallStaticByteMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1891
    checked_jni_CallStaticByteMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1892
    checked_jni_CallStaticCharMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1893
    checked_jni_CallStaticCharMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1894
    checked_jni_CallStaticCharMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1895
    checked_jni_CallStaticShortMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1896
    checked_jni_CallStaticShortMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1897
    checked_jni_CallStaticShortMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1898
    checked_jni_CallStaticIntMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1899
    checked_jni_CallStaticIntMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1900
    checked_jni_CallStaticIntMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1901
    checked_jni_CallStaticLongMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1902
    checked_jni_CallStaticLongMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1903
    checked_jni_CallStaticLongMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1904
    checked_jni_CallStaticFloatMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1905
    checked_jni_CallStaticFloatMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1906
    checked_jni_CallStaticFloatMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1907
    checked_jni_CallStaticDoubleMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1908
    checked_jni_CallStaticDoubleMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1909
    checked_jni_CallStaticDoubleMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1910
    checked_jni_CallStaticVoidMethod,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1911
    checked_jni_CallStaticVoidMethodV,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1912
    checked_jni_CallStaticVoidMethodA,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1913
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1914
    checked_jni_GetStaticFieldID,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1915
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1916
    checked_jni_GetStaticObjectField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1917
    checked_jni_GetStaticBooleanField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1918
    checked_jni_GetStaticByteField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1919
    checked_jni_GetStaticCharField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1920
    checked_jni_GetStaticShortField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1921
    checked_jni_GetStaticIntField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1922
    checked_jni_GetStaticLongField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1923
    checked_jni_GetStaticFloatField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1924
    checked_jni_GetStaticDoubleField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1925
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1926
    checked_jni_SetStaticObjectField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1927
    checked_jni_SetStaticBooleanField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1928
    checked_jni_SetStaticByteField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1929
    checked_jni_SetStaticCharField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1930
    checked_jni_SetStaticShortField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1931
    checked_jni_SetStaticIntField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1932
    checked_jni_SetStaticLongField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1933
    checked_jni_SetStaticFloatField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1934
    checked_jni_SetStaticDoubleField,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1935
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1936
    checked_jni_NewString,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1937
    checked_jni_GetStringLength,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1938
    checked_jni_GetStringChars,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1939
    checked_jni_ReleaseStringChars,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1940
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1941
    checked_jni_NewStringUTF,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1942
    checked_jni_GetStringUTFLength,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1943
    checked_jni_GetStringUTFChars,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1944
    checked_jni_ReleaseStringUTFChars,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1945
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1946
    checked_jni_GetArrayLength,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1947
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1948
    checked_jni_NewObjectArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1949
    checked_jni_GetObjectArrayElement,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1950
    checked_jni_SetObjectArrayElement,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1951
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1952
    checked_jni_NewBooleanArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1953
    checked_jni_NewByteArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1954
    checked_jni_NewCharArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1955
    checked_jni_NewShortArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1956
    checked_jni_NewIntArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1957
    checked_jni_NewLongArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1958
    checked_jni_NewFloatArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1959
    checked_jni_NewDoubleArray,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1960
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1961
    checked_jni_GetBooleanArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1962
    checked_jni_GetByteArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1963
    checked_jni_GetCharArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1964
    checked_jni_GetShortArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1965
    checked_jni_GetIntArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1966
    checked_jni_GetLongArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1967
    checked_jni_GetFloatArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1968
    checked_jni_GetDoubleArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1969
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1970
    checked_jni_ReleaseBooleanArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1971
    checked_jni_ReleaseByteArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1972
    checked_jni_ReleaseCharArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1973
    checked_jni_ReleaseShortArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1974
    checked_jni_ReleaseIntArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1975
    checked_jni_ReleaseLongArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1976
    checked_jni_ReleaseFloatArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1977
    checked_jni_ReleaseDoubleArrayElements,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1978
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1979
    checked_jni_GetBooleanArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1980
    checked_jni_GetByteArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1981
    checked_jni_GetCharArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1982
    checked_jni_GetShortArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1983
    checked_jni_GetIntArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1984
    checked_jni_GetLongArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1985
    checked_jni_GetFloatArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1986
    checked_jni_GetDoubleArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1987
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1988
    checked_jni_SetBooleanArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1989
    checked_jni_SetByteArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1990
    checked_jni_SetCharArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1991
    checked_jni_SetShortArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1992
    checked_jni_SetIntArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1993
    checked_jni_SetLongArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1994
    checked_jni_SetFloatArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1995
    checked_jni_SetDoubleArrayRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1996
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1997
    checked_jni_RegisterNatives,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1998
    checked_jni_UnregisterNatives,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1999
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2000
    checked_jni_MonitorEnter,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2001
    checked_jni_MonitorExit,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2002
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2003
    checked_jni_GetJavaVM,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2004
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2005
    checked_jni_GetStringRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2006
    checked_jni_GetStringUTFRegion,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2007
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2008
    checked_jni_GetPrimitiveArrayCritical,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2009
    checked_jni_ReleasePrimitiveArrayCritical,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2010
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2011
    checked_jni_GetStringCritical,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2012
    checked_jni_ReleaseStringCritical,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2013
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2014
    checked_jni_NewWeakGlobalRef,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2015
    checked_jni_DeleteWeakGlobalRef,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2016
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2017
    checked_jni_ExceptionCheck,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2018
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2019
    checked_jni_NewDirectByteBuffer,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2020
    checked_jni_GetDirectBufferAddress,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2021
    checked_jni_GetDirectBufferCapacity,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2022
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2023
    // New 1.6 Features
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2024
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2025
    checked_jni_GetObjectRefType
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2026
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2027
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2028
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2029
// Returns the function structure
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2030
struct JNINativeInterface_* jni_functions_check() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2031
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2032
  unchecked_jni_NativeInterface = jni_functions_nocheck();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2033
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2034
  // make sure the last pointer in the checked table is not null, indicating
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2035
  // an addition to the JNINativeInterface_ structure without initializing
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2036
  // it in the checked table.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2037
  debug_only(int *lastPtr = (int *)((char *)&checked_jni_NativeInterface + \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2038
             sizeof(*unchecked_jni_NativeInterface) - sizeof(char *));)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2039
  assert(*lastPtr != 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2040
         "Mismatched JNINativeInterface tables, check for new entries");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2041
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2042
  // with -verbose:jni this message will print
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2043
  if (PrintJNIResolving) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2044
    tty->print_cr("Checked JNI functions are being used to " \
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2045
                  "validate JNI usage");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2046
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2047
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2048
  return &checked_jni_NativeInterface;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  2049
}