зеркало из https://github.com/mono/ikvm-fork.git
Cache ReflectiveModifiers in CompiledTypeWrapper. AttributeHelper.GetInnerClass() is expensive and this property is called directly in response to Class.getModifiers(), so caching the modifiers results in a significant speedup of Class.getModifiers() which in turns speeds up Constructor.newInstance().
This commit is contained in:
Родитель
220166a19e
Коммит
69aada9320
|
@ -7837,6 +7837,7 @@ namespace IKVM.Internal
|
||||||
private TypeWrapper[] interfaces;
|
private TypeWrapper[] interfaces;
|
||||||
private TypeWrapper[] innerclasses;
|
private TypeWrapper[] innerclasses;
|
||||||
private MethodInfo clinitMethod;
|
private MethodInfo clinitMethod;
|
||||||
|
private Modifiers reflectiveModifiers;
|
||||||
|
|
||||||
internal static CompiledTypeWrapper newInstance(string name, Type type)
|
internal static CompiledTypeWrapper newInstance(string name, Type type)
|
||||||
{
|
{
|
||||||
|
@ -8213,12 +8214,19 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
InnerClassAttribute attr = AttributeHelper.GetInnerClass(type);
|
if (reflectiveModifiers == 0)
|
||||||
if(attr != null)
|
|
||||||
{
|
{
|
||||||
return attr.Modifiers;
|
InnerClassAttribute attr = AttributeHelper.GetInnerClass(type);
|
||||||
|
if (attr != null)
|
||||||
|
{
|
||||||
|
reflectiveModifiers = attr.Modifiers;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reflectiveModifiers = Modifiers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Modifiers;
|
return reflectiveModifiers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче