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