< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.hpp

Print this page




   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 #ifndef SHARE_JVMCI_JVMCICOMPILERTOVM_HPP
  25 #define SHARE_JVMCI_JVMCICOMPILERTOVM_HPP
  26 
  27 #include "gc/shared/cardTable.hpp"
  28 #include "jvmci/jvmciExceptions.hpp"

  29 #include "runtime/javaCalls.hpp"
  30 #include "runtime/signature.hpp"
  31 
  32 class JVMCIObjectArray;
  33 
  34 class CompilerToVM {
  35  public:
  36   class Data {
  37     friend class JVMCIVMStructs;
  38 
  39    private:
  40     static int Klass_vtable_start_offset;
  41     static int Klass_vtable_length_offset;
  42 
  43     static int Method_extra_stack_entries;
  44 
  45     static address SharedRuntime_ic_miss_stub;
  46     static address SharedRuntime_handle_wrong_method_stub;
  47     static address SharedRuntime_deopt_blob_unpack;
  48     static address SharedRuntime_deopt_blob_unpack_with_exception_in_tls;


 115 
 116   static JNINativeMethod methods[];
 117   static JNINativeMethod jni_methods[];
 118 
 119   static JVMCIObjectArray initialize_intrinsics(JVMCI_TRAPS);
 120  public:
 121   static int methods_count();
 122 
 123 };
 124 
 125 
 126 class JavaArgumentUnboxer : public SignatureIterator {
 127  protected:
 128   JavaCallArguments*  _jca;
 129   arrayOop _args;
 130   int _index;
 131 
 132   Handle next_arg(BasicType expectedType);
 133 
 134  public:
 135   JavaArgumentUnboxer(Symbol* signature, JavaCallArguments*  jca, arrayOop args, bool is_static) : SignatureIterator(signature) {





 136     this->_return_type = T_ILLEGAL;
 137     _jca = jca;
 138     _index = 0;
 139     _args = args;
 140     if (!is_static) {
 141       _jca->push_oop(next_arg(T_OBJECT));
 142     }
 143     iterate();
 144     assert(_index == args->length(), "arg count mismatch with signature");
 145   }
 146 
 147   inline void do_bool()   { if (!is_return_type()) _jca->push_int(next_arg(T_BOOLEAN)->bool_field(java_lang_boxing_object::value_offset_in_bytes(T_BOOLEAN))); }
 148   inline void do_char()   { if (!is_return_type()) _jca->push_int(next_arg(T_CHAR)->char_field(java_lang_boxing_object::value_offset_in_bytes(T_CHAR))); }
 149   inline void do_short()  { if (!is_return_type()) _jca->push_int(next_arg(T_SHORT)->short_field(java_lang_boxing_object::value_offset_in_bytes(T_SHORT))); }
 150   inline void do_byte()   { if (!is_return_type()) _jca->push_int(next_arg(T_BYTE)->byte_field(java_lang_boxing_object::value_offset_in_bytes(T_BYTE))); }
 151   inline void do_int()    { if (!is_return_type()) _jca->push_int(next_arg(T_INT)->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT))); }
 152 
 153   inline void do_long()   { if (!is_return_type()) _jca->push_long(next_arg(T_LONG)->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG))); }
 154   inline void do_float()  { if (!is_return_type()) _jca->push_float(next_arg(T_FLOAT)->float_field(java_lang_boxing_object::value_offset_in_bytes(T_FLOAT))); }
 155   inline void do_double() { if (!is_return_type()) _jca->push_double(next_arg(T_DOUBLE)->double_field(java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE))); }
 156 
 157   inline void do_object() { _jca->push_oop(next_arg(T_OBJECT)); }
 158   inline void do_object(int begin, int end) { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
 159   inline void do_array(int begin, int end)  { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
 160   inline void do_void()                     { }








 161 };
 162 
 163 class JNIHandleMark : public StackObj {
 164   JavaThread* _thread;
 165   public:
 166     JNIHandleMark(JavaThread* thread) : _thread(thread) { push_jni_handle_block(thread); }
 167     ~JNIHandleMark() { pop_jni_handle_block(_thread); }
 168 
 169   private:
 170     static void push_jni_handle_block(JavaThread* thread);
 171     static void pop_jni_handle_block(JavaThread* thread);
 172 };
 173 
 174 #endif // SHARE_JVMCI_JVMCICOMPILERTOVM_HPP


   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 #ifndef SHARE_JVMCI_JVMCICOMPILERTOVM_HPP
  25 #define SHARE_JVMCI_JVMCICOMPILERTOVM_HPP
  26 
  27 #include "gc/shared/cardTable.hpp"
  28 #include "jvmci/jvmciExceptions.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/javaCalls.hpp"
  31 #include "runtime/signature.hpp"
  32 
  33 class JVMCIObjectArray;
  34 
  35 class CompilerToVM {
  36  public:
  37   class Data {
  38     friend class JVMCIVMStructs;
  39 
  40    private:
  41     static int Klass_vtable_start_offset;
  42     static int Klass_vtable_length_offset;
  43 
  44     static int Method_extra_stack_entries;
  45 
  46     static address SharedRuntime_ic_miss_stub;
  47     static address SharedRuntime_handle_wrong_method_stub;
  48     static address SharedRuntime_deopt_blob_unpack;
  49     static address SharedRuntime_deopt_blob_unpack_with_exception_in_tls;


 116 
 117   static JNINativeMethod methods[];
 118   static JNINativeMethod jni_methods[];
 119 
 120   static JVMCIObjectArray initialize_intrinsics(JVMCI_TRAPS);
 121  public:
 122   static int methods_count();
 123 
 124 };
 125 
 126 
 127 class JavaArgumentUnboxer : public SignatureIterator {
 128  protected:
 129   JavaCallArguments*  _jca;
 130   arrayOop _args;
 131   int _index;
 132 
 133   Handle next_arg(BasicType expectedType);
 134 
 135  public:
 136   JavaArgumentUnboxer(Symbol* signature,
 137                       JavaCallArguments* jca,
 138                       arrayOop args,
 139                       bool is_static)
 140     : SignatureIterator(signature)
 141   {
 142     this->_return_type = T_ILLEGAL;
 143     _jca = jca;
 144     _index = 0;
 145     _args = args;
 146     if (!is_static) {
 147       _jca->push_oop(next_arg(T_OBJECT));
 148     }
 149     do_parameters_on(this);
 150     assert(_index == args->length(), "arg count mismatch with signature");
 151   }
 152 
 153  private:
 154   friend class SignatureIterator;  // so do_parameters_on can call do_type
 155   void do_type(BasicType type) {
 156     if (is_reference_type(type)) {
 157       _jca->push_oop(next_arg(T_OBJECT));
 158       return;
 159     }
 160     Handle arg = next_arg(type);
 161     assert(arg->klass() == SystemDictionary::box_klass(type), "already checked");
 162     int box_offset = java_lang_boxing_object::value_offset_in_bytes(type);
 163     switch (type) {
 164     case T_BOOLEAN:     _jca->push_int(arg->bool_field(box_offset));    break;
 165     case T_CHAR:        _jca->push_int(arg->char_field(box_offset));    break;
 166     case T_SHORT:       _jca->push_int(arg->short_field(box_offset));   break;
 167     case T_BYTE:        _jca->push_int(arg->byte_field(box_offset));    break;
 168     case T_INT:         _jca->push_int(arg->int_field(box_offset));     break;
 169     case T_LONG:        _jca->push_long(arg->long_field(box_offset));   break;
 170     case T_FLOAT:       _jca->push_float(arg->float_field(box_offset));    break;
 171     case T_DOUBLE:      _jca->push_double(arg->double_field(box_offset));  break;
 172     default:            ShouldNotReachHere();
 173     }
 174   }
 175 };
 176 
 177 class JNIHandleMark : public StackObj {
 178   JavaThread* _thread;
 179   public:
 180     JNIHandleMark(JavaThread* thread) : _thread(thread) { push_jni_handle_block(thread); }
 181     ~JNIHandleMark() { pop_jni_handle_block(_thread); }
 182 
 183   private:
 184     static void push_jni_handle_block(JavaThread* thread);
 185     static void pop_jni_handle_block(JavaThread* thread);
 186 };
 187 
 188 #endif // SHARE_JVMCI_JVMCICOMPILERTOVM_HPP
< prev index next >