src/share/vm/runtime/javaCalls.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 



























  25 // A JavaCallWrapper is constructed before each JavaCall and destructed after the call.
  26 // Its purpose is to allocate/deallocate a new handle block and to save/restore the last
  27 // Java fp/sp. A pointer to the JavaCallWrapper is stored on the stack.
  28 
  29 class JavaCallWrapper: StackObj {
  30   friend class VMStructs;
  31  private:
  32   JavaThread*      _thread;                 // the thread to which this call belongs
  33   JNIHandleBlock*  _handles;                // the saved handle block
  34   methodOop        _callee_method;          // to be able to collect arguments if entry frame is top frame
  35   oop              _receiver;               // the receiver of the call (if a non-static call)
  36 
  37   JavaFrameAnchor  _anchor;                 // last thread anchor state that we must restore
  38 
  39   JavaValue*       _result;                 // result value
  40 
  41  public:
  42   // Construction/destruction
  43    JavaCallWrapper(methodHandle callee_method, Handle receiver, JavaValue* result, TRAPS);
  44   ~JavaCallWrapper();


 172   // ------------
 173 
 174   // The receiver must be first oop in argument list
 175   static void call_virtual(JavaValue* result, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, JavaCallArguments* args, TRAPS);
 176 
 177   static void call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, TRAPS); // No args
 178   static void call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, Handle arg1, TRAPS);
 179   static void call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, Handle arg1, Handle arg2, TRAPS);
 180 
 181   // Static call
 182   // -----------
 183   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, JavaCallArguments* args, TRAPS);
 184 
 185   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, TRAPS);
 186   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, TRAPS);
 187   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, Handle arg2, TRAPS);
 188 
 189   // Low-level interface
 190   static void call(JavaValue* result, methodHandle method, JavaCallArguments* args, TRAPS);
 191 };


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_JAVACALLS_HPP
  26 #define SHARE_VM_RUNTIME_JAVACALLS_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "oops/methodOop.hpp"
  30 #include "runtime/handles.hpp"
  31 #include "runtime/javaFrameAnchor.hpp"
  32 #include "runtime/vmThread.hpp"
  33 #ifdef TARGET_ARCH_x86
  34 # include "jniTypes_x86.hpp"
  35 #endif
  36 #ifdef TARGET_ARCH_sparc
  37 # include "jniTypes_sparc.hpp"
  38 #endif
  39 #ifdef TARGET_ARCH_zero
  40 # include "jniTypes_zero.hpp"
  41 #endif
  42 #ifdef TARGET_OS_FAMILY_linux
  43 # include "thread_linux.inline.hpp"
  44 #endif
  45 #ifdef TARGET_OS_FAMILY_solaris
  46 # include "thread_solaris.inline.hpp"
  47 #endif
  48 #ifdef TARGET_OS_FAMILY_windows
  49 # include "thread_windows.inline.hpp"
  50 #endif
  51 
  52 // A JavaCallWrapper is constructed before each JavaCall and destructed after the call.
  53 // Its purpose is to allocate/deallocate a new handle block and to save/restore the last
  54 // Java fp/sp. A pointer to the JavaCallWrapper is stored on the stack.
  55 
  56 class JavaCallWrapper: StackObj {
  57   friend class VMStructs;
  58  private:
  59   JavaThread*      _thread;                 // the thread to which this call belongs
  60   JNIHandleBlock*  _handles;                // the saved handle block
  61   methodOop        _callee_method;          // to be able to collect arguments if entry frame is top frame
  62   oop              _receiver;               // the receiver of the call (if a non-static call)
  63 
  64   JavaFrameAnchor  _anchor;                 // last thread anchor state that we must restore
  65 
  66   JavaValue*       _result;                 // result value
  67 
  68  public:
  69   // Construction/destruction
  70    JavaCallWrapper(methodHandle callee_method, Handle receiver, JavaValue* result, TRAPS);
  71   ~JavaCallWrapper();


 199   // ------------
 200 
 201   // The receiver must be first oop in argument list
 202   static void call_virtual(JavaValue* result, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, JavaCallArguments* args, TRAPS);
 203 
 204   static void call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, TRAPS); // No args
 205   static void call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, Handle arg1, TRAPS);
 206   static void call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, Handle arg1, Handle arg2, TRAPS);
 207 
 208   // Static call
 209   // -----------
 210   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, JavaCallArguments* args, TRAPS);
 211 
 212   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, TRAPS);
 213   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, TRAPS);
 214   static void call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, Handle arg2, TRAPS);
 215 
 216   // Low-level interface
 217   static void call(JavaValue* result, methodHandle method, JavaCallArguments* args, TRAPS);
 218 };
 219 
 220 #endif // SHARE_VM_RUNTIME_JAVACALLS_HPP