< prev index next >

src/hotspot/share/runtime/javaCalls.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2018, 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 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "code/nmethod.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "interpreter/linkResolver.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/method.inline.hpp"
  34 #include "oops/oop.inline.hpp"

  35 #include "prims/jniCheck.hpp"
  36 #include "runtime/compilationPolicy.hpp"
  37 #include "runtime/handles.inline.hpp"
  38 #include "runtime/interfaceSupport.inline.hpp"
  39 #include "runtime/javaCalls.hpp"
  40 #include "runtime/jniHandles.inline.hpp"
  41 #include "runtime/mutexLocker.hpp"
  42 #include "runtime/os.inline.hpp"
  43 #include "runtime/sharedRuntime.hpp"
  44 #include "runtime/signature.hpp"
  45 #include "runtime/stubRoutines.hpp"
  46 #include "runtime/thread.inline.hpp"
  47 
  48 // -----------------------------------------------------
  49 // Implementation of JavaCallWrapper
  50 
  51 JavaCallWrapper::JavaCallWrapper(const methodHandle& callee_method, Handle receiver, JavaValue* result, TRAPS) {
  52   JavaThread* thread = (JavaThread *)THREAD;
  53   bool clear_pending_exception = true;
  54 


 137   // on sparc/ia64 which will catch violations of the reseting of last_Java_frame
 138   // invariants (i.e. _flags always cleared on return to Java)
 139 
 140   _thread->frame_anchor()->copy(&_anchor);
 141 
 142   // Release handles after we are marked as being inside the VM again, since this
 143   // operation might block
 144   JNIHandleBlock::release_block(_old_handles, _thread);
 145 }
 146 
 147 
 148 void JavaCallWrapper::oops_do(OopClosure* f) {
 149   f->do_oop((oop*)&_receiver);
 150   handles()->oops_do(f);
 151 }
 152 
 153 
 154 // Helper methods
 155 static BasicType runtime_type_from(JavaValue* result) {
 156   switch (result->get_type()) {
 157     case T_BOOLEAN: // fall through
 158     case T_CHAR   : // fall through
 159     case T_SHORT  : // fall through
 160     case T_INT    : // fall through
 161 #ifndef _LP64
 162     case T_OBJECT : // fall through
 163     case T_ARRAY  : // fall through

 164 #endif
 165     case T_BYTE   : // fall through
 166     case T_VOID   : return T_INT;
 167     case T_LONG   : return T_LONG;
 168     case T_FLOAT  : return T_FLOAT;
 169     case T_DOUBLE : return T_DOUBLE;
 170 #ifdef _LP64
 171     case T_ARRAY  : // fall through
 172     case T_OBJECT:  return T_OBJECT;

 173 #endif
 174     default:
 175       ShouldNotReachHere();
 176       return T_ILLEGAL;
 177   }
 178 }
 179 
 180 // ============ Virtual calls ============
 181 
 182 void JavaCalls::call_virtual(JavaValue* result, Klass* spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
 183   CallInfo callinfo;
 184   Handle receiver = args->receiver();
 185   Klass* recvrKlass = receiver.is_null() ? (Klass*)NULL : receiver->klass();
 186   LinkInfo link_info(spec_klass, name, signature);
 187   LinkResolver::resolve_virtual_call(
 188           callinfo, receiver, recvrKlass, link_info, true, CHECK);
 189   methodHandle method = callinfo.selected_method();
 190   assert(method.not_null(), "should have thrown exception");
 191 
 192   // Invoke the method


 280 void JavaCalls::call_static(JavaValue* result, Klass* klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, TRAPS) {
 281   JavaCallArguments args;
 282   args.push_oop(arg1);
 283   args.push_oop(arg2);
 284   call_static(result, klass, name, signature, &args, CHECK);
 285 }
 286 
 287 
 288 void JavaCalls::call_static(JavaValue* result, Klass* klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, Handle arg3, TRAPS) {
 289   JavaCallArguments args;
 290   args.push_oop(arg1);
 291   args.push_oop(arg2);
 292   args.push_oop(arg3);
 293   call_static(result, klass, name, signature, &args, CHECK);
 294 }
 295 
 296 // ============ allocate and initialize new object instance ============
 297 
 298 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, JavaCallArguments* args, TRAPS) {
 299   klass->initialize(CHECK_NH); // Quick no-op if already initialized.













 300   Handle obj = klass->allocate_instance_handle(CHECK_NH);
 301   JavaValue void_result(T_VOID);
 302   args->set_receiver(obj); // inserts <obj> as the first argument.
 303   JavaCalls::call_special(&void_result, klass,
 304                           vmSymbols::object_initializer_name(),
 305                           constructor_signature, args, CHECK_NH);
 306   // Already returned a Null Handle if any exception is pending.
 307   return obj;
 308 }
 309 
 310 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, TRAPS) {
 311   JavaCallArguments args;
 312   return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
 313 }
 314 
 315 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, Handle arg1, TRAPS) {
 316   JavaCallArguments args;
 317   args.push_oop(arg1);
 318   return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
 319 }


 376     // A klass might not be initialized since JavaCall's might be used during the executing of
 377     // the <clinit>. For example, a Thread.start might start executing on an object that is
 378     // not fully initialized! (bad Java programming style)
 379     assert(holder->is_linked(), "rewriting must have taken place");
 380   }
 381 #endif
 382 
 383   CompilationPolicy::compile_if_required(method, CHECK);
 384 
 385   // Since the call stub sets up like the interpreter we call the from_interpreted_entry
 386   // so we can go compiled via a i2c. Otherwise initial entry method will always
 387   // run interpreted.
 388   address entry_point = method->from_interpreted_entry();
 389   if (JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) {
 390     entry_point = method->interpreter_entry();
 391   }
 392 
 393   // Figure out if the result value is an oop or not (Note: This is a different value
 394   // than result_type. result_type will be T_INT of oops. (it is about size)
 395   BasicType result_type = runtime_type_from(result);
 396   bool oop_result_flag = (result->get_type() == T_OBJECT || result->get_type() == T_ARRAY);

 397 
 398   // NOTE: if we move the computation of the result_val_address inside
 399   // the call to call_stub, the optimizer produces wrong code.
 400   intptr_t* result_val_address = (intptr_t*)(result->get_value_addr());
 401 
 402   // Find receiver
 403   Handle receiver = (!method->is_static()) ? args->receiver() : Handle();
 404 
 405   // When we reenter Java, we need to reenable the reserved/yellow zone which
 406   // might already be disabled when we are in VM.
 407   if (!thread->stack_guards_enabled()) {
 408     thread->reguard_stack();
 409   }
 410 
 411   // Check that there are shadow pages available before changing thread state
 412   // to Java. Calculate current_stack_pointer here to make sure
 413   // stack_shadow_pages_available() and bang_stack_shadow_pages() use the same sp.
 414   address sp = os::current_stack_pointer();
 415   if (!os::stack_shadow_pages_available(THREAD, method, sp)) {
 416     // Throw stack overflow exception with preinitialized exception.
 417     Exceptions::throw_stack_overflow_exception(THREAD, __FILE__, __LINE__, method);
 418     return;
 419   } else {
 420     // Touch pages checked if the OS needs them to be touched to be mapped.
 421     os::map_stack_shadow_pages(sp);
 422   }
 423 
 424 #if INCLUDE_JVMCI
 425   if (alternative_target != NULL) {
 426     if (alternative_target->is_alive() && !alternative_target->is_unloading()) {
 427       thread->set_jvmci_alternate_call_target(alternative_target->verified_entry_point());
 428       entry_point = method->adapter()->get_i2c_entry();
 429     } else {
 430       THROW(vmSymbols::jdk_vm_ci_code_InvalidInstalledCodeException());
 431     }
 432   }
 433 #endif
 434 








 435   // do call
 436   { JavaCallWrapper link(method, receiver, result, CHECK);
 437     { HandleMark hm(thread);  // HandleMark used by HandleMarkCleaner
 438 
 439       StubRoutines::call_stub()(




 440         (address)&link,
 441         // (intptr_t*)&(result->_value), // see NOTE above (compiler problem)
 442         result_val_address,          // see NOTE above (compiler problem)
 443         result_type,
 444         method(),
 445         entry_point,
 446         args->parameters(),
 447         args->size_of_parameters(),
 448         CHECK
 449       );
 450 
 451       result = link.result();  // circumvent MS C++ 5.0 compiler bug (result is clobbered across call)
 452       // Preserve oop return value across possible gc points
 453       if (oop_result_flag) {
 454         thread->set_vm_result((oop) result->get_jobject());
 455       }
 456     }
 457   } // Exit JavaCallWrapper (can block - potential return oop must be preserved)
 458 
 459   // Check if a thread stop or suspend should be executed


 596       // Verify the pointee.
 597       oop vv = resolve_indirect_oop(v, _value_state[_pos]);
 598       guarantee(oopDesc::is_oop_or_null(vv, true),
 599                 "Bad JNI oop argument %d: " PTR_FORMAT " -> " PTR_FORMAT,
 600                 _pos, v, p2i(vv));
 601     }
 602 
 603     check_value(true);          // Verify value state.
 604   }
 605 
 606   void do_bool()                       { check_int(T_BOOLEAN);       }
 607   void do_char()                       { check_int(T_CHAR);          }
 608   void do_float()                      { check_int(T_FLOAT);         }
 609   void do_double()                     { check_double(T_DOUBLE);     }
 610   void do_byte()                       { check_int(T_BYTE);          }
 611   void do_short()                      { check_int(T_SHORT);         }
 612   void do_int()                        { check_int(T_INT);           }
 613   void do_long()                       { check_long(T_LONG);         }
 614   void do_void()                       { check_return_type(T_VOID);  }
 615   void do_object(int begin, int end)   { check_obj(T_OBJECT);        }

 616   void do_array(int begin, int end)    { check_obj(T_OBJECT);        }
 617 };
 618 
 619 
 620 void JavaCallArguments::verify(const methodHandle& method, BasicType return_type) {
 621   guarantee(method->size_of_parameters() == size_of_parameters(), "wrong no. of arguments pushed");
 622 
 623   // Treat T_OBJECT and T_ARRAY as the same
 624   if (return_type == T_ARRAY) return_type = T_OBJECT;
 625 
 626   // Check that oop information is correct
 627   Symbol* signature = method->signature();
 628 
 629   SignatureChekker sc(signature,
 630                       return_type,
 631                       method->is_static(),
 632                       _value_state,
 633                       _value);
 634   sc.iterate_parameters();
 635   sc.check_doing_return(true);
   1 /*
   2  * Copyright (c) 1997, 2019, 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 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "code/nmethod.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "interpreter/linkResolver.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/method.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "oops/valueKlass.hpp"
  36 #include "prims/jniCheck.hpp"
  37 #include "runtime/compilationPolicy.hpp"
  38 #include "runtime/handles.inline.hpp"
  39 #include "runtime/interfaceSupport.inline.hpp"
  40 #include "runtime/javaCalls.hpp"
  41 #include "runtime/jniHandles.inline.hpp"
  42 #include "runtime/mutexLocker.hpp"
  43 #include "runtime/os.inline.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/signature.hpp"
  46 #include "runtime/stubRoutines.hpp"
  47 #include "runtime/thread.inline.hpp"
  48 
  49 // -----------------------------------------------------
  50 // Implementation of JavaCallWrapper
  51 
  52 JavaCallWrapper::JavaCallWrapper(const methodHandle& callee_method, Handle receiver, JavaValue* result, TRAPS) {
  53   JavaThread* thread = (JavaThread *)THREAD;
  54   bool clear_pending_exception = true;
  55 


 138   // on sparc/ia64 which will catch violations of the reseting of last_Java_frame
 139   // invariants (i.e. _flags always cleared on return to Java)
 140 
 141   _thread->frame_anchor()->copy(&_anchor);
 142 
 143   // Release handles after we are marked as being inside the VM again, since this
 144   // operation might block
 145   JNIHandleBlock::release_block(_old_handles, _thread);
 146 }
 147 
 148 
 149 void JavaCallWrapper::oops_do(OopClosure* f) {
 150   f->do_oop((oop*)&_receiver);
 151   handles()->oops_do(f);
 152 }
 153 
 154 
 155 // Helper methods
 156 static BasicType runtime_type_from(JavaValue* result) {
 157   switch (result->get_type()) {
 158     case T_BOOLEAN  : // fall through
 159     case T_CHAR     : // fall through
 160     case T_SHORT    : // fall through
 161     case T_INT      : // fall through
 162 #ifndef _LP64
 163     case T_OBJECT   : // fall through
 164     case T_ARRAY    : // fall through
 165     case T_VALUETYPE: // fall through
 166 #endif
 167     case T_BYTE     : // fall through
 168     case T_VOID     : return T_INT;
 169     case T_LONG     : return T_LONG;
 170     case T_FLOAT    : return T_FLOAT;
 171     case T_DOUBLE   : return T_DOUBLE;
 172 #ifdef _LP64
 173     case T_ARRAY    : // fall through
 174     case T_OBJECT   : return T_OBJECT;
 175     case T_VALUETYPE: return T_VALUETYPE;
 176 #endif
 177     default:
 178       ShouldNotReachHere();
 179       return T_ILLEGAL;
 180   }
 181 }
 182 
 183 // ============ Virtual calls ============
 184 
 185 void JavaCalls::call_virtual(JavaValue* result, Klass* spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
 186   CallInfo callinfo;
 187   Handle receiver = args->receiver();
 188   Klass* recvrKlass = receiver.is_null() ? (Klass*)NULL : receiver->klass();
 189   LinkInfo link_info(spec_klass, name, signature);
 190   LinkResolver::resolve_virtual_call(
 191           callinfo, receiver, recvrKlass, link_info, true, CHECK);
 192   methodHandle method = callinfo.selected_method();
 193   assert(method.not_null(), "should have thrown exception");
 194 
 195   // Invoke the method


 283 void JavaCalls::call_static(JavaValue* result, Klass* klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, TRAPS) {
 284   JavaCallArguments args;
 285   args.push_oop(arg1);
 286   args.push_oop(arg2);
 287   call_static(result, klass, name, signature, &args, CHECK);
 288 }
 289 
 290 
 291 void JavaCalls::call_static(JavaValue* result, Klass* klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, Handle arg3, TRAPS) {
 292   JavaCallArguments args;
 293   args.push_oop(arg1);
 294   args.push_oop(arg2);
 295   args.push_oop(arg3);
 296   call_static(result, klass, name, signature, &args, CHECK);
 297 }
 298 
 299 // ============ allocate and initialize new object instance ============
 300 
 301 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, JavaCallArguments* args, TRAPS) {
 302   klass->initialize(CHECK_NH); // Quick no-op if already initialized.
 303 
 304   // Special case for factory methods
 305   if (!constructor_signature->is_void_method_signature()) {
 306     assert(klass->is_value(), "inline classes must use factory methods");
 307     JavaValue factory_result(T_OBJECT);
 308     JavaCalls::call_static(&factory_result, klass,
 309                            vmSymbols::object_initializer_name(),
 310                            constructor_signature, args, CHECK_NH);
 311     return Handle(THREAD, (oop)factory_result.get_jobject());
 312   }
 313 
 314   // main branch of code creates a non-inline object:
 315   assert(!klass->is_value(), "classic constructors are only for non-inline classes");
 316   Handle obj = klass->allocate_instance_handle(CHECK_NH);
 317   JavaValue void_result(T_VOID);
 318   args->set_receiver(obj); // inserts <obj> as the first argument.
 319   JavaCalls::call_special(&void_result, klass,
 320                           vmSymbols::object_initializer_name(),
 321                           constructor_signature, args, CHECK_NH);
 322   // Already returned a Null Handle if any exception is pending.
 323   return obj;
 324 }
 325 
 326 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, TRAPS) {
 327   JavaCallArguments args;
 328   return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
 329 }
 330 
 331 Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, Handle arg1, TRAPS) {
 332   JavaCallArguments args;
 333   args.push_oop(arg1);
 334   return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
 335 }


 392     // A klass might not be initialized since JavaCall's might be used during the executing of
 393     // the <clinit>. For example, a Thread.start might start executing on an object that is
 394     // not fully initialized! (bad Java programming style)
 395     assert(holder->is_linked(), "rewriting must have taken place");
 396   }
 397 #endif
 398 
 399   CompilationPolicy::compile_if_required(method, CHECK);
 400 
 401   // Since the call stub sets up like the interpreter we call the from_interpreted_entry
 402   // so we can go compiled via a i2c. Otherwise initial entry method will always
 403   // run interpreted.
 404   address entry_point = method->from_interpreted_entry();
 405   if (JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) {
 406     entry_point = method->interpreter_entry();
 407   }
 408 
 409   // Figure out if the result value is an oop or not (Note: This is a different value
 410   // than result_type. result_type will be T_INT of oops. (it is about size)
 411   BasicType result_type = runtime_type_from(result);
 412   bool oop_result_flag = (result->get_type() == T_OBJECT || result->get_type() == T_ARRAY
 413                           || result->get_type() == T_VALUETYPE);
 414 
 415   // NOTE: if we move the computation of the result_val_address inside
 416   // the call to call_stub, the optimizer produces wrong code.
 417   intptr_t* result_val_address = (intptr_t*)(result->get_value_addr());
 418 
 419   // Find receiver
 420   Handle receiver = (!method->is_static()) ? args->receiver() : Handle();
 421 
 422   // When we reenter Java, we need to reenable the reserved/yellow zone which
 423   // might already be disabled when we are in VM.
 424   if (!thread->stack_guards_enabled()) {
 425     thread->reguard_stack();
 426   }
 427 
 428   // Check that there are shadow pages available before changing thread state
 429   // to Java. Calculate current_stack_pointer here to make sure
 430   // stack_shadow_pages_available() and bang_stack_shadow_pages() use the same sp.
 431   address sp = os::current_stack_pointer();
 432   if (!os::stack_shadow_pages_available(THREAD, method, sp)) {
 433     // Throw stack overflow exception with preinitialized exception.
 434     Exceptions::throw_stack_overflow_exception(THREAD, __FILE__, __LINE__, method);
 435     return;
 436   } else {
 437     // Touch pages checked if the OS needs them to be touched to be mapped.
 438     os::map_stack_shadow_pages(sp);
 439   }
 440 
 441 #if INCLUDE_JVMCI
 442   if (alternative_target != NULL) {
 443     if (alternative_target->is_alive() && !alternative_target->is_unloading()) {
 444       thread->set_jvmci_alternate_call_target(alternative_target->verified_entry_point());
 445       entry_point = method->adapter()->get_i2c_entry();
 446     } else {
 447       THROW(vmSymbols::jdk_vm_ci_code_InvalidInstalledCodeException());
 448     }
 449   }
 450 #endif
 451 
 452   Handle vt;
 453   if (ValueTypeReturnedAsFields && result->get_type() == T_VALUETYPE) {
 454     // Pre allocate buffered value in case the result is returned
 455     // flattened by compiled code
 456     ValueKlass* vk = method->returned_value_type(thread);
 457     vt = vk->allocate_instance_handle(CHECK);
 458   }
 459 
 460   // do call
 461   { JavaCallWrapper link(method, receiver, result, CHECK);
 462     { HandleMark hm(thread);  // HandleMark used by HandleMarkCleaner
 463 
 464     if (vt() != NULL) {
 465       result->set_jobject((jobject)vt());
 466     }
 467 
 468     StubRoutines::call_stub()(
 469         (address)&link,
 470         // (intptr_t*)&(result->_value), // see NOTE above (compiler problem)
 471         result_val_address,          // see NOTE above (compiler problem)
 472         result_type,
 473         method(),
 474         entry_point,
 475         args->parameters(),
 476         args->size_of_parameters(),
 477         CHECK
 478       );
 479 
 480       result = link.result();  // circumvent MS C++ 5.0 compiler bug (result is clobbered across call)
 481       // Preserve oop return value across possible gc points
 482       if (oop_result_flag) {
 483         thread->set_vm_result((oop) result->get_jobject());
 484       }
 485     }
 486   } // Exit JavaCallWrapper (can block - potential return oop must be preserved)
 487 
 488   // Check if a thread stop or suspend should be executed


 625       // Verify the pointee.
 626       oop vv = resolve_indirect_oop(v, _value_state[_pos]);
 627       guarantee(oopDesc::is_oop_or_null(vv, true),
 628                 "Bad JNI oop argument %d: " PTR_FORMAT " -> " PTR_FORMAT,
 629                 _pos, v, p2i(vv));
 630     }
 631 
 632     check_value(true);          // Verify value state.
 633   }
 634 
 635   void do_bool()                       { check_int(T_BOOLEAN);       }
 636   void do_char()                       { check_int(T_CHAR);          }
 637   void do_float()                      { check_int(T_FLOAT);         }
 638   void do_double()                     { check_double(T_DOUBLE);     }
 639   void do_byte()                       { check_int(T_BYTE);          }
 640   void do_short()                      { check_int(T_SHORT);         }
 641   void do_int()                        { check_int(T_INT);           }
 642   void do_long()                       { check_long(T_LONG);         }
 643   void do_void()                       { check_return_type(T_VOID);  }
 644   void do_object(int begin, int end)   { check_obj(T_OBJECT);        }
 645   void do_valuetype(int begin, int end){ check_obj(T_VALUETYPE);     }
 646   void do_array(int begin, int end)    { check_obj(T_OBJECT);        }
 647 };
 648 
 649 
 650 void JavaCallArguments::verify(const methodHandle& method, BasicType return_type) {
 651   guarantee(method->size_of_parameters() == size_of_parameters(), "wrong no. of arguments pushed");
 652 
 653   // Treat T_OBJECT and T_ARRAY as the same
 654   if (return_type == T_ARRAY) return_type = T_OBJECT;
 655 
 656   // Check that oop information is correct
 657   Symbol* signature = method->signature();
 658 
 659   SignatureChekker sc(signature,
 660                       return_type,
 661                       method->is_static(),
 662                       _value_state,
 663                       _value);
 664   sc.iterate_parameters();
 665   sc.check_doing_return(true);
< prev index next >