We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
objc_class 结构体中包含了方法缓存的存储信息cache_t类型的cache属性。
struct objc_class : objc_object { // Class ISA; Class superclass; cache_t cache; // formerly cache pointer and vtable class_data_bits_t bits; // class_rw_t * plus custom rr/alloc flags };
cache_t结构如下所示:
struct cache_t { struct bucket_t *_buckets; // 散列表 mask_t _mask; //散列表的长度 - 1 mask_t _occupied; // 已经缓存的方法数量 }
里面最关键的属性为_buckets它实际上是一个增量扩展的哈希表结构,哈希表内部存储的是一个个bucket_t:
struct bucket_t { private: MethodCacheIMP _imp; cache_key_t _key; }
每个bucket_t 包含了key以及对应的函数实体地址IMP.每次查找方法的时候会将_mask与传入的key进行&操作后,作为索引值,如果发生冲突cache_next方法将索引值减1继续搜索。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
objc_class 结构体中包含了方法缓存的存储信息cache_t类型的cache属性。
cache_t结构如下所示:
里面最关键的属性为_buckets它实际上是一个增量扩展的哈希表结构,哈希表内部存储的是一个个bucket_t:
每个bucket_t 包含了key以及对应的函数实体地址IMP.每次查找方法的时候会将_mask与传入的key进行&操作后,作为索引值,如果发生冲突cache_next方法将索引值减1继续搜索。
The text was updated successfully, but these errors were encountered: