hotspot/src/share/vm/runtime/deoptimization.cpp
changeset 46271 979ebd346ecf
parent 42040 70ec5a09a0d5
child 46289 1904e7ec236e
equal deleted inserted replaced
46270:2e7898927798 46271:979ebd346ecf
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2017, 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.
   449   }
   449   }
   450 
   450 
   451   // Compute whether the root vframe returns a float or double value.
   451   // Compute whether the root vframe returns a float or double value.
   452   BasicType return_type;
   452   BasicType return_type;
   453   {
   453   {
   454     HandleMark hm;
       
   455     methodHandle method(thread, array->element(0)->method());
   454     methodHandle method(thread, array->element(0)->method());
   456     Bytecode_invoke invoke = Bytecode_invoke_check(method, array->element(0)->bci());
   455     Bytecode_invoke invoke = Bytecode_invoke_check(method, array->element(0)->bci());
   457     return_type = invoke.is_valid() ? invoke.result_type() : T_ILLEGAL;
   456     return_type = invoke.is_valid() ? invoke.result_type() : T_ILLEGAL;
   458   }
   457   }
   459 
   458 
   797 Deoptimization::DeoptAction Deoptimization::_unloaded_action
   796 Deoptimization::DeoptAction Deoptimization::_unloaded_action
   798   = Deoptimization::Action_reinterpret;
   797   = Deoptimization::Action_reinterpret;
   799 
   798 
   800 #if defined(COMPILER2) || INCLUDE_JVMCI
   799 #if defined(COMPILER2) || INCLUDE_JVMCI
   801 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) {
   800 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) {
   802   Handle pending_exception(thread->pending_exception());
   801   Handle pending_exception(THREAD, thread->pending_exception());
   803   const char* exception_file = thread->exception_file();
   802   const char* exception_file = thread->exception_file();
   804   int exception_line = thread->exception_line();
   803   int exception_line = thread->exception_line();
   805   thread->clear_pending_exception();
   804   thread->clear_pending_exception();
   806 
   805 
   807   bool failures = false;
   806   bool failures = false;
  1107   for (int i = 0; i < monitors->length(); i++) {
  1106   for (int i = 0; i < monitors->length(); i++) {
  1108     MonitorInfo* mon_info = monitors->at(i);
  1107     MonitorInfo* mon_info = monitors->at(i);
  1109     if (mon_info->eliminated()) {
  1108     if (mon_info->eliminated()) {
  1110       assert(!mon_info->owner_is_scalar_replaced() || realloc_failures, "reallocation was missed");
  1109       assert(!mon_info->owner_is_scalar_replaced() || realloc_failures, "reallocation was missed");
  1111       if (!mon_info->owner_is_scalar_replaced()) {
  1110       if (!mon_info->owner_is_scalar_replaced()) {
  1112         Handle obj = Handle(mon_info->owner());
  1111         Handle obj(thread, mon_info->owner());
  1113         markOop mark = obj->mark();
  1112         markOop mark = obj->mark();
  1114         if (UseBiasedLocking && mark->has_bias_pattern()) {
  1113         if (UseBiasedLocking && mark->has_bias_pattern()) {
  1115           // New allocated objects may have the mark set to anonymously biased.
  1114           // New allocated objects may have the mark set to anonymously biased.
  1116           // Also the deoptimized method may called methods with synchronization
  1115           // Also the deoptimized method may called methods with synchronization
  1117           // where the thread-local object is bias locked to the current thread.
  1116           // where the thread-local object is bias locked to the current thread.
  1244 }
  1243 }
  1245 #endif
  1244 #endif
  1246 
  1245 
  1247 static void collect_monitors(compiledVFrame* cvf, GrowableArray<Handle>* objects_to_revoke) {
  1246 static void collect_monitors(compiledVFrame* cvf, GrowableArray<Handle>* objects_to_revoke) {
  1248   GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
  1247   GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
       
  1248   Thread* thread = Thread::current();
  1249   for (int i = 0; i < monitors->length(); i++) {
  1249   for (int i = 0; i < monitors->length(); i++) {
  1250     MonitorInfo* mon_info = monitors->at(i);
  1250     MonitorInfo* mon_info = monitors->at(i);
  1251     if (!mon_info->eliminated() && mon_info->owner() != NULL) {
  1251     if (!mon_info->eliminated() && mon_info->owner() != NULL) {
  1252       objects_to_revoke->append(Handle(mon_info->owner()));
  1252       objects_to_revoke->append(Handle(thread, mon_info->owner()));
  1253     }
  1253     }
  1254   }
  1254   }
  1255 }
  1255 }
  1256 
  1256 
  1257 
  1257