Esempio n. 1
0
MVMint32 MVM_6model_find_method_spesh(MVMThreadContext *tc, MVMObject *obj, MVMString *name,
                                      MVMint32 ss_idx, MVMRegister *res) {
    /* Missed mono-morph; try cache-only lookup. */
    MVMObject *meth = MVM_6model_find_method_cache_only(tc, obj, name);
    if (!MVM_is_null(tc, meth)) {
        /* Got it; cache. Must be careful due to threads
         * reading, races, etc. */
        MVMStaticFrame *sf = tc->cur_frame->static_info;
        uv_mutex_lock(&tc->instance->mutex_spesh_install);
        if (!tc->cur_frame->effective_spesh_slots[ss_idx + 1]) {
            MVM_ASSIGN_REF(tc, &(sf->common.header),
                           tc->cur_frame->effective_spesh_slots[ss_idx + 1],
                           (MVMCollectable *)meth);
            MVM_barrier();
            MVM_ASSIGN_REF(tc, &(sf->common.header),
                           tc->cur_frame->effective_spesh_slots[ss_idx],
                           (MVMCollectable *)STABLE(obj));
        }
        uv_mutex_unlock(&tc->instance->mutex_spesh_install);
        res->o = meth;
        return 0;
    }
    else {
        /* Fully late-bound. */
        MVM_6model_find_method(tc, obj, name, res);
        return 1;
    }
}
Esempio n. 2
0
MVMObject * Kiji_bootstrap_Pair(MVMCompUnit* cu, MVMThreadContext*tc) {
  MVMObject * type = MVM_6model_find_method(
    tc,
    STABLE(tc->instance->KnowHOW)->HOW,
    MVM_string_ascii_decode_nt(tc, tc->instance->VMString, (char*)"new_type")
  );
  MVMObject * how = STABLE(type)->HOW;

  CLASS_INIT();
  /* CLASS_ADD_METHOD("elems",   Hash_elems); */
  CLASS_REGISTER(type);

  return type;
}