//------------------------------------------------------------------ // ciObjectFactory::get_unloaded_method // // Get the ciMethod representing an unloaded/unfound method. // // Implementation note: unloaded methods are currently stored in // an unordered array, requiring a linear-time lookup for each // unloaded method. This may need to change. ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature, ciInstanceKlass* accessor) { ciSignature* that = NULL; for (int i = 0; i < _unloaded_methods->length(); i++) { ciMethod* entry = _unloaded_methods->at(i); if (entry->holder()->equals(holder) && entry->name()->equals(name) && entry->signature()->as_symbol()->equals(signature)) { // Short-circuit slow resolve. if (entry->signature()->accessing_klass() == accessor) { // We've found a match. return entry; } else { // Lazily create ciSignature if (that == NULL) that = new (arena()) ciSignature(accessor, constantPoolHandle(), signature); if (entry->signature()->equals(that)) { // We've found a match. return entry; } } } } // This is a new unloaded method. Create it and stick it in // the cache. ciMethod* new_method = new (arena()) ciMethod(holder, name, signature, accessor); init_ident_of(new_method); _unloaded_methods->append(new_method); return new_method; }
// ------------------------------------------------------------------ // ciMethod::ciMethod // // Unloaded method. ciMethod::ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature, ciInstanceKlass* accessor) : ciMetadata((Metadata*)NULL), _name( name), _holder( holder), _intrinsic_id( vmIntrinsics::_none), _liveness( NULL), _can_be_statically_bound(false), _method_blocks( NULL), _method_data( NULL), _has_injected_profile( false) #if defined(COMPILER2) || defined(SHARK) , _flow( NULL), _bcea( NULL), _instructions_size(-1) #endif // COMPILER2 || SHARK { // Usually holder and accessor are the same type but in some cases // the holder has the wrong class loader (e.g. invokedynamic call // sites) so we pass the accessor. _signature = new (CURRENT_ENV->arena()) ciSignature(accessor, constantPoolHandle(), signature); }
// Constructor StackMapReader(ClassVerifier* v, StackMapStream* stream, char* code_data, int32_t code_len, TRAPS) : _verifier(v), _stream(stream), _code_data(code_data), _code_length(code_len) { methodHandle m = v->method(); if (m->has_stackmap_table()) { _cp = constantPoolHandle(THREAD, m->constants()); _frame_count = _stream->get_u2(CHECK); } else { // There's no stackmap table present. Frame count and size are 0. _frame_count = 0; } }
// Calls to this constructor must be proceeded by a ResourceMark // and a HandleMark JvmtiConstantPoolReconstituter(instanceKlassHandle ikh){ set_error(JVMTI_ERROR_NONE); _ikh = ikh; _cpool = constantPoolHandle(Thread::current(), ikh->constants()); _symmap = new SymbolHashMap(); _classmap = new SymbolHashMap(); _cpool_size = _cpool->hash_entries_to(_symmap, _classmap); if (_cpool_size == 0) { set_error(JVMTI_ERROR_OUT_OF_MEMORY); } else if (_cpool_size < 0) { set_error(JVMTI_ERROR_INTERNAL); } }
// ------------------------------------------------------------------ // ciMethod::ciMethod // // Unloaded method. ciMethod::ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature) : ciObject(ciMethodKlass::make()) { // These fields are always filled in. _name = name; _holder = holder; _signature = new (CURRENT_ENV->arena()) ciSignature(_holder, constantPoolHandle(), signature); _intrinsic_id = vmIntrinsics::_none; _liveness = NULL; _can_be_statically_bound = false; _method_blocks = NULL; _method_data = NULL; #if defined(COMPILER2) || defined(SHARK) _flow = NULL; _bcea = NULL; #endif // COMPILER2 || SHARK }