hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 7913 dd096a83bdbb
parent 7397 5b173b4ca846
child 8076 96d498ec7ae1
equal deleted inserted replaced
7901:ea3d83447861 7913:dd096a83bdbb
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   942   // Find caller and bci from vframe
   942   // Find caller and bci from vframe
   943   methodHandle caller (THREAD, vfst.method());
   943   methodHandle caller (THREAD, vfst.method());
   944   int          bci    = vfst.bci();
   944   int          bci    = vfst.bci();
   945 
   945 
   946   // Find bytecode
   946   // Find bytecode
   947   Bytecode_invoke* bytecode = Bytecode_invoke_at(caller, bci);
   947   Bytecode_invoke bytecode(caller, bci);
   948   bc = bytecode->java_code();
   948   bc = bytecode.java_code();
   949   int bytecode_index = bytecode->index();
   949   int bytecode_index = bytecode.index();
   950 
   950 
   951   // Find receiver for non-static call
   951   // Find receiver for non-static call
   952   if (bc != Bytecodes::_invokestatic) {
   952   if (bc != Bytecodes::_invokestatic) {
   953     // This register map must be update since we need to find the receiver for
   953     // This register map must be update since we need to find the receiver for
   954     // compiled frames. The receiver might be in a register.
   954     // compiled frames. The receiver might be in a register.
   955     RegisterMap reg_map2(thread);
   955     RegisterMap reg_map2(thread);
   956     frame stubFrame   = thread->last_frame();
   956     frame stubFrame   = thread->last_frame();
   957     // Caller-frame is a compiled frame
   957     // Caller-frame is a compiled frame
   958     frame callerFrame = stubFrame.sender(&reg_map2);
   958     frame callerFrame = stubFrame.sender(&reg_map2);
   959 
   959 
   960     methodHandle callee = bytecode->static_target(CHECK_(nullHandle));
   960     methodHandle callee = bytecode.static_target(CHECK_(nullHandle));
   961     if (callee.is_null()) {
   961     if (callee.is_null()) {
   962       THROW_(vmSymbols::java_lang_NoSuchMethodException(), nullHandle);
   962       THROW_(vmSymbols::java_lang_NoSuchMethodException(), nullHandle);
   963     }
   963     }
   964     // Retrieve from a compiled argument list
   964     // Retrieve from a compiled argument list
   965     receiver = Handle(THREAD, callerFrame.retrieve_receiver(&reg_map2));
   965     receiver = Handle(THREAD, callerFrame.retrieve_receiver(&reg_map2));
  1672     JavaThread* thread, const char* objName) {
  1672     JavaThread* thread, const char* objName) {
  1673 
  1673 
  1674   // Get target class name from the checkcast instruction
  1674   // Get target class name from the checkcast instruction
  1675   vframeStream vfst(thread, true);
  1675   vframeStream vfst(thread, true);
  1676   assert(!vfst.at_end(), "Java frame must exist");
  1676   assert(!vfst.at_end(), "Java frame must exist");
  1677   Bytecode_checkcast* cc = Bytecode_checkcast_at(
  1677   Bytecode_checkcast cc(vfst.method(), vfst.method()->bcp_from(vfst.bci()));
  1678     vfst.method()->bcp_from(vfst.bci()));
       
  1679   Klass* targetKlass = Klass::cast(vfst.method()->constants()->klass_at(
  1678   Klass* targetKlass = Klass::cast(vfst.method()->constants()->klass_at(
  1680     cc->index(), thread));
  1679     cc.index(), thread));
  1681   return generate_class_cast_message(objName, targetKlass->external_name());
  1680   return generate_class_cast_message(objName, targetKlass->external_name());
  1682 }
  1681 }
  1683 
  1682 
  1684 char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
  1683 char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
  1685                                                         oopDesc* required,
  1684                                                         oopDesc* required,
  1709     // Get a signature from the invoke instruction
  1708     // Get a signature from the invoke instruction
  1710     const char* mhName = "method handle";
  1709     const char* mhName = "method handle";
  1711     const char* targetType = "the required signature";
  1710     const char* targetType = "the required signature";
  1712     vframeStream vfst(thread, true);
  1711     vframeStream vfst(thread, true);
  1713     if (!vfst.at_end()) {
  1712     if (!vfst.at_end()) {
  1714       Bytecode_invoke* call = Bytecode_invoke_at(vfst.method(), vfst.bci());
  1713       Bytecode_invoke call(vfst.method(), vfst.bci());
  1715       methodHandle target;
  1714       methodHandle target;
  1716       {
  1715       {
  1717         EXCEPTION_MARK;
  1716         EXCEPTION_MARK;
  1718         target = call->static_target(THREAD);
  1717         target = call.static_target(THREAD);
  1719         if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; }
  1718         if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; }
  1720       }
  1719       }
  1721       if (target.not_null()
  1720       if (target.not_null()
  1722           && target->is_method_handle_invoke()
  1721           && target->is_method_handle_invoke()
  1723           && required == target->method_handle_type()) {
  1722           && required == target->method_handle_type()) {