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 { 1198 // '_handlers' and '_fingerprints' are 'GrowableArray's and are NOT synchronized 1199 // in any way if accessed from multiple threads. To avoid races with another 1200 // thread which may change the arrays in the above, mutex protected block, we 1201 // have to protect this read access here with the same mutex as well! 1202 MutexLocker mu(SignatureHandlerLibrary_lock); 1203 assert(method->signature_handler() == Interpreter::slow_signature_handler() || 1204 _handlers->find(method->signature_handler()) == _fingerprints->find(Fingerprinter(method).fingerprint()), 1205 "sanity check"); 1206 } 1207 #endif 1208 } 1209 1210 1211 BufferBlob* SignatureHandlerLibrary::_handler_blob = NULL; 1212 address SignatureHandlerLibrary::_handler = NULL; 1213 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL; 1214 GrowableArray<address>* SignatureHandlerLibrary::_handlers = NULL; 1215 address SignatureHandlerLibrary::_buffer = NULL; 1216 1217 1218 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, methodOopDesc* method)) 1219 methodHandle m(thread, method); 1220 assert(m->is_native(), "sanity check"); 1221 // lookup native function entry point if it doesn't exist 1222 bool in_base_library; 1223 if (!m->has_native_function()) { 1224 NativeLookup::lookup(m, in_base_library, CHECK); 1225 } 1226 // make sure signature handler is installed 1227 SignatureHandlerLibrary::add(m); |