projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2efa78
)
[runtime] Optimize mono_class_field_is_special_static () a bit.
author
Alex Rønne Petersen
<alexrp@xamarin.com>
Thu, 3 Sep 2015 22:30:46 +0000
(
00:30
+0200)
committer
Alex Rønne Petersen
<alexrp@xamarin.com>
Thu, 3 Sep 2015 22:34:38 +0000
(
00:34
+0200)
We can avoid loading custom attributes by checking field->offset == -1. This
won't always be the case for a special static field at all stages during class
loading but it'll speed up the most frequent cases.
mono/metadata/object.c
patch
|
blob
|
history
diff --git
a/mono/metadata/object.c
b/mono/metadata/object.c
index 7604585dcadebda52d74e5f561295e6373758d6e..31746e2308d5456ba833573d8af534c65edf838d 100644
(file)
--- a/
mono/metadata/object.c
+++ b/
mono/metadata/object.c
@@
-2419,6
+2419,8
@@
mono_class_field_is_special_static (MonoClassField *field)
if (mono_field_is_deleted (field))
return FALSE;
if (!(field->type->attrs & FIELD_ATTRIBUTE_LITERAL)) {
+ if (field->offset == -1)
+ return TRUE;
if (field_is_special_static (field->parent, field) != SPECIAL_STATIC_NONE)
return TRUE;
}