bool intrp_patcher_get_putstatic(u1 *sp) { ptrint *ip; unresolved_field *uf; fieldinfo *fi; ip = (ptrint *) sp; uf = (unresolved_field *) ip[2]; /* get the fieldinfo */ if (!(fi = resolve_field_eager(uf))) return false; /* check if the field's class is initialized */ if (!(fi->clazz->state & CLASS_INITIALIZED)) if (!initialize_class(fi->clazz)) return false; /* patch the field's address */ ip[1] = (ptrint) &(fi->value); return true; }
void objc_initialize_class(Class cls) { if (cls->info & OBJC_CLASS_INFO_INITIALIZED) return; objc_global_mutex_lock(); /* * It's possible that two threads try to initialize a class at the same * time. Make sure that the thread which held the lock did not already * initialize it. */ if (cls->info & OBJC_CLASS_INFO_INITIALIZED) { objc_global_mutex_unlock(); return; } setup_class(cls); if (!(cls->info & OBJC_CLASS_INFO_SETUP)) { objc_global_mutex_unlock(); return; } initialize_class(cls); objc_global_mutex_unlock(); }
bool patcher_get_putstatic(patchref_t *pr) { unresolved_field* uf = (unresolved_field*) pr->ref; uintptr_t* datap = (uintptr_t*) pr->datap; uint8_t* ra = (uint8_t*) pr->mpc; // Resolve the field. fieldinfo* fi = resolve_field_eager(uf); if (fi == NULL) return false; ra += PATCHER_CALL_SIZE; // Check if the field's class is initialized/ if (!(fi->clazz->state & CLASS_INITIALIZED)) if (!initialize_class(fi->clazz)) return false; // Patch the field value's address. *datap = (uintptr_t) fi->value; if (pr->disp_mb && !(fi->flags & ACC_VOLATILE)) patch_out_mfence(ra + pr->disp_mb - 2); // Synchronize data cache. md_dcacheflush((void*) pr->datap, SIZEOF_VOID_P); // Patch back the original code. patcher_patch_code(pr); return true; }
OBJCRT_EXPORT void objc_registerClassPair(Class cls) { objc_global_mutex_lock(); // metaclass super is set up by setup_class. setup_class(cls); objc_hashtable_set(classes, cls->name, cls); initialize_class(cls); objc_global_mutex_unlock(); }
void initialize_library_module() { initialize_attribute_manager(); initialize_trace(); initialize_constants(); initialize_fingerprint(); initialize_print(); initialize_placeholder(); initialize_idx_metavar(); initialize_io_state(); initialize_unifier(); initialize_kernel_serializer(); initialize_let(); initialize_typed_expr(); initialize_choice(); initialize_string(); initialize_resolve_macro(); initialize_annotation(); initialize_explicit(); initialize_module(); initialize_protected(); initialize_private(); initialize_scoped_ext(); initialize_reducible(); initialize_aliases(); initialize_coercion(); initialize_unifier_plugin(); initialize_sorry(); initialize_class(); initialize_library_util(); initialize_pp_options(); initialize_projection(); initialize_normalize(); initialize_abbreviation(); initialize_relation_manager(); initialize_user_recursors(); initialize_composition_manager(); initialize_noncomputable(); initialize_aux_recursors(); initialize_class_instance_resolution(); initialize_type_context(); initialize_light_rule_set(); initialize_congr_lemma_manager(); initialize_app_builder(); initialize_fun_info_manager(); initialize_unification_hint(); }
bool patcher_initialize_class(patchref_t *pr) { classinfo *c; /* get stuff from the patcher reference */ c = (classinfo *) pr->ref; /* check if the class is initialized */ if (!(c->state & CLASS_INITIALIZED)) if (!initialize_class(c)) return false; /* patch back original code */ patcher_patch_code(pr); return true; }
static void initialize_class(Class cls) { if (cls->info & OBJC_CLASS_INFO_INITIALIZED) return; if (cls->superclass) initialize_class(cls->superclass); cls->info |= OBJC_CLASS_INFO_DTABLE; object_getClass((id)cls)->info |= OBJC_CLASS_INFO_DTABLE; objc_update_dtable(cls); objc_update_dtable(object_getClass((id)cls)); /* * Set it first to prevent calling it recursively due to message sends * in the initialize method */ cls->info |= OBJC_CLASS_INFO_INITIALIZED; object_getClass((id)cls)->info |= OBJC_CLASS_INFO_INITIALIZED; call_method(cls, "initialize"); }
bool intrp_patcher_get_putstatic_clinit(u1 *sp) { ptrint *ip; fieldinfo *fi; /* get the fieldinfo */ ip = (ptrint *) sp; fi = (fieldinfo *) ip[2]; /* check if the field's class is initialized */ if (!(fi->clazz->state & CLASS_INITIALIZED)) if (!initialize_class(fi->clazz)) return false; /* patch the field's address */ ip[1] = (ptrint) &(fi->value); return true; }
void initialize_library_module() { initialize_constants(); initialize_fingerprint(); initialize_print(); initialize_placeholder(); initialize_idx_metavar(); initialize_kernel_bindings(); initialize_io_state(); initialize_unifier(); initialize_kernel_serializer(); initialize_let(); initialize_typed_expr(); initialize_choice(); initialize_num(); initialize_string(); initialize_resolve_macro(); initialize_annotation(); initialize_explicit(); initialize_module(); initialize_protected(); initialize_private(); initialize_scoped_ext(); initialize_reducible(); initialize_aliases(); initialize_coercion(); initialize_unifier_plugin(); initialize_sorry(); initialize_class(); initialize_library_util(); initialize_pp_options(); initialize_projection(); initialize_normalize(); initialize_abbreviation(); initialize_relation_manager(); initialize_user_recursors(); initialize_class_instance_elaborator(); initialize_composition_manager(); }