hotspot/src/share/vm/runtime/jniHandles.hpp
author twisti
Thu, 08 Apr 2010 10:55:40 +0200
changeset 5252 58f23871a5b6
parent 4013 b154310845de
child 5531 8c0269fb855b
permissions -rw-r--r--
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag Summary: During testing a bug was hit when an exception returned to the interpreter and the SP was wrong. Reviewed-by: kvn, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
3672
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
     2
 * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
1
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
class JNIHandleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// Interface for creating and resolving local/global JNI handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
class JNIHandles : AllStatic {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  static JNIHandleBlock* _global_handles;             // First global handle block
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  static JNIHandleBlock* _weak_global_handles;        // First weak global handle block
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  static oop _deleted_handle;                         // Sentinel marking deleted handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  // Resolve handle into oop
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  inline static oop resolve(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  // Resolve externally provided handle into oop with some guards
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  inline static oop resolve_external_guard(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  // Resolve handle into oop, result guaranteed not to be null
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  inline static oop resolve_non_null(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  // Local handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  static jobject make_local(oop obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  static jobject make_local(JNIEnv* env, oop obj);    // Fast version when env is known
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  static jobject make_local(Thread* thread, oop obj); // Even faster version when current thread is known
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  inline static void destroy_local(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  // Global handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  static jobject make_global(Handle  obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  static void destroy_global(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  // Weak global handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  static jobject make_weak_global(Handle obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  static void destroy_weak_global(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  // jmethodID handling (as Weak global handles).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // Because the useful life-span of a jmethodID cannot be determined, once created they are
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // never reclaimed.  The methods to which they refer, however, can be GC'ed away if the class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // is unloaded or if the method is made obsolete or deleted -- in these cases, the jmethodID
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  // refers to NULL (as is the case for any weak reference).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  static jmethodID make_jmethod_id(methodHandle mh);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static void destroy_jmethod_id(jmethodID mid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  inline static methodOop resolve_jmethod_id(jmethodID mid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  inline static methodOop checked_resolve_jmethod_id(jmethodID mid); // NULL on invalid jmethodID
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  static void change_method_associated_with_jmethod_id(jmethodID jmid, methodHandle mh);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  // Sentinel marking deleted handles in block. Note that we cannot store NULL as
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  // the sentinel, since clearing weak global JNI refs are done by storing NULL in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  // the handle. The handle may not be reused before destroy_weak_global is called.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  static oop deleted_handle()   { return _deleted_handle; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  // Initialization
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  static void initialize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // Debugging
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  static void print_on(outputStream* st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  static void print()           { print_on(tty); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  static void verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  static bool is_local_handle(Thread* thread, jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  static bool is_frame_handle(JavaThread* thr, jobject obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  static bool is_global_handle(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  static bool is_weak_global_handle(jobject handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  static long global_handle_memory_usage();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  static long weak_global_handle_memory_usage();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  // Garbage collection support(global handles only, local handles are traversed from thread)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  // Traversal of regular global handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  static void oops_do(OopClosure* f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  // Traversal of weak global handles. Unreachable oops are cleared.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
// JNI handle blocks holding local/global JNI handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
class JNIHandleBlock : public CHeapObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  friend class VMStructs;
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents: 3672
diff changeset
   102
  friend class CppInterpreter;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents: 3672
diff changeset
   103
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  enum SomeConstants {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    block_size_in_oops  = 32                    // Number of handles per handle block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  oop             _handles[block_size_in_oops]; // The handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  int             _top;                         // Index of next unused handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  JNIHandleBlock* _next;                        // Link to next block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // The following instance variables are only used by the first block in a chain.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // Having two types of blocks complicates the code and the space overhead in negligble.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  JNIHandleBlock* _last;                        // Last block in use
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  JNIHandleBlock* _pop_frame_link;              // Block to restore on PopLocalFrame call
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  oop*            _free_list;                   // Handle free list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  int             _allocate_before_rebuild;     // Number of blocks to allocate before rebuilding free list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  #ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  JNIHandleBlock* _block_list_link;             // Link for list below
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  static JNIHandleBlock* _block_list;           // List of all allocated blocks (for debugging only)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  #endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  static JNIHandleBlock* _block_free_list;      // Free list of currently unused blocks
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  static int      _blocks_allocated;            // For debugging/printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // Fill block with bad_handle values
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  void zap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents: 3672
diff changeset
   131
 protected:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // No more handles in the both the current and following blocks
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  void clear() { _top = 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents: 3672
diff changeset
   135
 private:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  // Free list computation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  void rebuild_free_list();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // Handle allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  jobject allocate_handle(oop obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  // Block allocation and block free list management
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  static JNIHandleBlock* allocate_block(Thread* thread = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  static void release_block(JNIHandleBlock* block, Thread* thread = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  // JNI PushLocalFrame/PopLocalFrame support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  JNIHandleBlock* pop_frame_link() const          { return _pop_frame_link; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  void set_pop_frame_link(JNIHandleBlock* block)  { _pop_frame_link = block; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  // Stub generator support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  static int top_offset_in_bytes()                { return offset_of(JNIHandleBlock, _top); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  // Garbage collection support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  // Traversal of regular handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  void oops_do(OopClosure* f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  // Traversal of weak handles. Unreachable oops are cleared.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  // Debugging
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  bool chain_contains(jobject handle) const;    // Does this block or following blocks contain handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  bool contains(jobject handle) const;          // Does this block contain handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  int length() const;                           // Length of chain starting with this block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  long memory_usage() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  #ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  static bool any_contains(jobject handle);     // Does any block currently in use contain handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  static void print_statistics();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  #endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
inline oop JNIHandles::resolve(jobject handle) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  oop result = (handle == NULL ? (oop)NULL : *(oop*)handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  assert(result != NULL || (handle == NULL || !CheckJNICalls || is_weak_global_handle(handle)), "Invalid value read from jni handle");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  assert(result != badJNIHandle, "Pointing to zapped jni handle area");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
inline oop JNIHandles::resolve_external_guard(jobject handle) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  if (handle == NULL) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  oop result = *(oop*)handle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  if (result == NULL || result == badJNIHandle) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
inline oop JNIHandles::resolve_non_null(jobject handle) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  assert(handle != NULL, "JNI handle should not be null");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  oop result = *(oop*)handle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  assert(result != NULL, "Invalid value read from jni handle");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  assert(result != badJNIHandle, "Pointing to zapped jni handle area");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  // Don't let that private _deleted_handle object escape into the wild.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  assert(result != deleted_handle(), "Used a deleted global handle.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
inline methodOop JNIHandles::resolve_jmethod_id(jmethodID mid) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  return (methodOop) resolve_non_null((jobject)mid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
inline methodOop JNIHandles::checked_resolve_jmethod_id(jmethodID mid) {
3672
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   203
  if (mid == NULL) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    return (methodOop) NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  }
3672
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   206
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   207
  oop o = resolve_non_null((jobject) mid);
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   208
  if (!o->is_method()) {
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   209
    return (methodOop) NULL;
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   210
  }
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   211
65e946046d1e 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 1
diff changeset
   212
  return (methodOop) o;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
inline void JNIHandles::destroy_local(jobject handle) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  if (handle != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    *((oop*)handle) = deleted_handle(); // Mark the handle as deleted, allocate will reuse it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
}