src/share/vm/interpreter/interpreterRuntime.cpp

Print this page




1176           }
1177           // add handler to library
1178           _fingerprints->append(fingerprint);
1179           _handlers->append(handler);
1180           // set handler index
1181           assert(_fingerprints->length() == _handlers->length(), "sanity check");
1182           handler_index = _fingerprints->length() - 1;
1183         }
1184       }
1185     } else {
1186       CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
1187     }
1188     if (handler_index < 0) {
1189       // use generic signature handler
1190       method->set_signature_handler(Interpreter::slow_signature_handler());
1191     } else {
1192       // set handler
1193       method->set_signature_handler(_handlers->at(handler_index));
1194     }
1195   }











1196   assert(method->signature_handler() == Interpreter::slow_signature_handler() ||
1197          _handlers->find(method->signature_handler()) == _fingerprints->find(Fingerprinter(method).fingerprint()),
1198          "sanity check");
1199 }
1200 
1201 
1202 BufferBlob*              SignatureHandlerLibrary::_handler_blob = NULL;
1203 address                  SignatureHandlerLibrary::_handler      = NULL;
1204 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL;
1205 GrowableArray<address>*  SignatureHandlerLibrary::_handlers     = NULL;
1206 address                  SignatureHandlerLibrary::_buffer       = NULL;
1207 
1208 
1209 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, methodOopDesc* method))
1210   methodHandle m(thread, method);
1211   assert(m->is_native(), "sanity check");
1212   // lookup native function entry point if it doesn't exist
1213   bool in_base_library;
1214   if (!m->has_native_function()) {
1215     NativeLookup::lookup(m, in_base_library, CHECK);
1216   }
1217   // make sure signature handler is installed
1218   SignatureHandlerLibrary::add(m);




1176           }
1177           // add handler to library
1178           _fingerprints->append(fingerprint);
1179           _handlers->append(handler);
1180           // set handler index
1181           assert(_fingerprints->length() == _handlers->length(), "sanity check");
1182           handler_index = _fingerprints->length() - 1;
1183         }
1184       }
1185     } else {
1186       CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
1187     }
1188     if (handler_index < 0) {
1189       // use generic signature handler
1190       method->set_signature_handler(Interpreter::slow_signature_handler());
1191     } else {
1192       // set handler
1193       method->set_signature_handler(_handlers->at(handler_index));
1194     }
1195   }
1196 #ifdef ASSERT
1197   int handler_index, fingerprint_index;
1198   {
1199     // '_handlers' and '_fingerprints' are 'GrowableArray's and are NOT synchronized
1200     // in any way if accessed from multiple threads. To avoid races with another
1201     // thread which may change the arrays in the above, mutex protected block, we
1202     // have to protect this read access here with the same mutex as well!
1203     MutexLocker mu(SignatureHandlerLibrary_lock);
1204     handler_index = _handlers->find(method->signature_handler());
1205     fingerprint_index = _fingerprints->find(Fingerprinter(method).fingerprint());
1206   }
1207   assert(method->signature_handler() == Interpreter::slow_signature_handler() ||
1208          handler_index == fingerprint_index, "sanity check");
1209 #endif
1210 }
1211 
1212 
1213 BufferBlob*              SignatureHandlerLibrary::_handler_blob = NULL;
1214 address                  SignatureHandlerLibrary::_handler      = NULL;
1215 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL;
1216 GrowableArray<address>*  SignatureHandlerLibrary::_handlers     = NULL;
1217 address                  SignatureHandlerLibrary::_buffer       = NULL;
1218 
1219 
1220 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, methodOopDesc* method))
1221   methodHandle m(thread, method);
1222   assert(m->is_native(), "sanity check");
1223   // lookup native function entry point if it doesn't exist
1224   bool in_base_library;
1225   if (!m->has_native_function()) {
1226     NativeLookup::lookup(m, in_base_library, CHECK);
1227   }
1228   // make sure signature handler is installed
1229   SignatureHandlerLibrary::add(m);