lookupTarget* baseCompileTimeLookup::undirected_resend_lookup_target() { if (!methodHolder_or_map()->is_map()) { return simpleLookup::undirected_resend_lookup_target(); } else { // don't know actual value of lookup start location assert(methodHolder_or_map() == receiverMapOop(), "expecting receiver and sending method holder to be in same map"); return (new mapLookupTarget(methodHolder_map())) -> be_receiver(); } }
int32 MethodLookupKey::hash() { int32 i; // Coded for speed - called for every codeTable lookup // XOR the identity-hash values of the fields. For efficiency, just // xor the marks and extract hash bits at the end instead of doing // this for every field. // Also, don't need to check for no_hash: real keys are guaranteed // to have an id hash value because init_hash is called before a // key is added to the table. If a lookup key contains oops with // no_hash, we'll have a bogus hash value, but we won't find anything // anyway. i = (int32)receiverMapOop()->mark(); if (selector->is_mem()) i ^= (int32)memOop(selector)->mark(); // Can't do the optimization for the methodHolder - it might be // e.g. a smiOop in the lookupError glue method. // Not non-zero often enough to hash on // (an optimization for speed; Bay's idea) // i ^= (int32)delegatee ->mark(); return (lookupType & ~ImplicitSelfBit) ^ markOop(i)->hash() ^ methodHolder_or_map()->identity_hash(); }
bool NMethodLookupKey::verify() { bool flag = true; if (!oop(receiverMapOop())->verify_oop()) { lprintf("\tin receiverMap of NMethodLookupKey 0x%lx\n", this); flag = false; } else if (!receiverMapOop()->is_map()) { error1("receiverMapOop() 0x%lx isn't a map", receiverMapOop()); flag = false; } if ( methodHolder_or_map() != MH_TBD && !methodHolder_or_map()->verify_oop()) { lprintf("\tin methodHolder of NMethodLookupKey 0x%lx\n", this); flag = false; } if (selector) { if (!selector->verify_oop()) { lprintf("\tin selector of NMethodLookupKey 0x%lx\n", this); flag = false; /* uncommon but legal } else if (!selector->is_string()) { lprintf("warning: selector "); selector->print_oop(); lprintf(" isn't a string\n"); flag = false; */ } } if (delegatee) { if (!delegatee->verify_oop()) { lprintf("\tin delegatee of NMethodLookupKey 0x%lx\n", this); flag = false; } else { BaseLookupType l = baseLookupType(lookupType); if (l == DirectedResendBaseLookupType && ! delegatee->is_string()) { error1("delegatee 0x%lx isn't a string", delegatee); flag = false; } } } return flag; }
void MethodLookupKey::print() { printIndent(); lprintf("MethodLookupKey: rcvMap = 0x%lx, mh = ", (long unsigned)receiverMapOop()); if (methodHolder_or_map() == MH_TBD) { lprintf("<to be determined>"); } else { methodHolder_or_map()->print_real_oop(); } lprintf(",\n"); printIndent(); lprintf(" sel = "); selector->print_real_oop(); lprintf(", del = "); delegatee->print_real_oop(); lprintf(",\n"); printIndent(); lprintf(" type = "); printLookupType(lookupType); lprintf("\n"); }
void SICompiler::initTopScope() { recompileeScope = recompilee ? (RScope*)constructRScopes(recompilee) : (RScope*)new RNullScope(NULL); if (PrintPICScopes) recompileeScope->printTree(0, 0); nodeGen->haveStackFrame = true; MethodKind kind = method()->kind(); countID = Memory->code->nextNMethodID(); SCodeScope* s; SScope* parentScope = NULL; if (L->receiverMap()->is_block()) { blockOop block = (blockOop) L->receiver; assert_block(block, "expecting a block literal"); // caution: parentFrame could be on conversion stack, so use // sending frame as a starting point // I think this hint is bogus--dmu (see NIC) frame* sender = L->sendingVFrame ? L->sendingVFrame->fr : currentProcess->last_self_frame(false); parentVFrame = block->parentVFrame(sender, true)->as_compiled(); if (parentVFrame) parentScope = new_SVFrameScope(parentVFrame); } MethodLookupKey* k= new_MethodLookupKey(L->key); SendInfo* info = new SendInfo(k); switch (kind) { case OuterMethodType: s = new SMethodScope(method(), methodHolder_or_map(), NULL, recompileeScope, info); break; case BlockMethodType: // taken from NIC by dmu 7/1 assert(L->receiverMap()->is_block(), "was expecting block"); if (parentScope) { s = new SBlockScope(method(), parentScope, NULL, recompileeScope, info); } else { s = new SDeadBlockScope(method(), info); } break; default: fatal("unexpected byte code kind"); } needRegWindowFlushes = false; topScope = s; s->vscope = vscopes ? vscopes->top() : NULL; }
oop abstractSlotRef::interpret( oop receiver, oop sel, oop del, oop* argp, int32 nargs) { oop res = interpretData( receiver, sel, *argp ); if (res != badOop) return res; res = ::interpret( receiver, sel, del, contents(), methodHolder_or_map(receiver), argp, nargs); return res; }
void SICompiler::print() { print_short(); lprintf(":"); L->print(); if (L->result()) { L->result()->print(); if (method()) { lprintf("\tmethod: "); method()->print_real_oop(); lprintf("\n"); } } else { lprintf("\tmethod: "); method()->print_real_oop(); lprintf("; methodHolder: "); methodHolder_or_map()->print_real_oop(); lprintf("\n"); } lprintf("\treceiver: "); L->receiver->print_real_oop(); lprintf("\tnodeGen: %#lx\n", nodeGen); lprintf("\tp ((SICompiler*)%#lx)->print_code()\n", this); }
void MethodLookupKey::init_hash() { receiverMapOop() ->identity_hash(); methodHolder_or_map()->identity_hash(); selector ->identity_hash(); delegatee ->identity_hash(); }