提交 07ee1913 编写于 作者: Z Zoltan Varga 提交者: Mantas Puida

[aot] fixing up cherrypicked of AOT class allocation leak fix

上级 9cb60d09
......@@ -168,6 +168,7 @@ typedef struct MonoAotCompile {
GHashTable *method_label_hash;
const char *temp_prefix;
guint32 label_generator;
MonoClass **typespec_classes;
} MonoAotCompile;
typedef struct {
......@@ -1334,16 +1335,21 @@ static guint32
find_typespec_for_class (MonoAotCompile *acfg, MonoClass *klass)
{
int i;
MonoClass *k = NULL;
int len = acfg->image->tables [MONO_TABLE_TYPESPEC].rows;
/* FIXME: Search referenced images as well */
for (i = 0; i < acfg->image->tables [MONO_TABLE_TYPESPEC].rows; ++i) {
k = mono_class_get_full (acfg->image, MONO_TOKEN_TYPE_SPEC | (i + 1), NULL);
if (k == klass)
if (!acfg->typespec_classes) {
acfg->typespec_classes = mono_mempool_alloc0 (acfg->mempool, sizeof (MonoClass*) * len);
for (i = 0; i < len; ++i) {
acfg->typespec_classes [i] = mono_class_get_full (acfg->image, MONO_TOKEN_TYPE_SPEC | (i + 1), NULL);
}
}
for (i = 0; i < len; ++i) {
if (acfg->typespec_classes [i] == klass)
break;
}
if (i < acfg->image->tables [MONO_TABLE_TYPESPEC].rows)
if (i < len)
return MONO_TOKEN_TYPE_SPEC | (i + 1);
else
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册