dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/image meta_build.c,1.18,1.19 misc_token


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/image meta_build.c,1.18,1.19 misc_token.c,1.1,1.2
Date: Fri, 14 Feb 2003 18:55:51 -0500

Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv3216/image

Modified Files:
        meta_build.c misc_token.c 
Log Message:


Reduce the number of times that ILImageSearchForToken is called in
IL???GetFromOwner, by filtering out tokens that obviously won't
have an attached information block.


Index: meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** meta_build.c        14 Feb 2003 04:03:28 -0000      1.18
--- meta_build.c        14 Feb 2003 23:55:49 -0000      1.19
***************
*** 986,991 ****
  
        /* Set the attributes for the class */
!       ILClassSetAttrs(info, ~0, values[IL_OFFSET_TYPEDEF_ATTRS] &
!                                                               
~(IL_META_TYPEDEF_HAS_SECURITY));
  
        /* Done: we'll get the members later */
--- 986,990 ----
  
        /* Set the attributes for the class */
!       ILClassSetAttrs(info, ~0, values[IL_OFFSET_TYPEDEF_ATTRS]);
  
        /* Done: we'll get the members later */
***************
*** 1039,1047 ****
        field = ILFieldCreate((ILClass *)userData, token,
                                  ILImageGetString(image, 
values[IL_OFFSET_FIELDDEF_NAME]),
!                                 values[IL_OFFSET_FIELDDEF_ATTRS] &
!                                       ~(IL_META_FIELDDEF_HAS_FIELD_MARSHAL |
!                                         IL_META_FIELDDEF_HAS_SECURITY |
!                                         IL_META_FIELDDEF_HAS_DEFAULT |
!                                         IL_META_FIELDDEF_HAS_FIELD_RVA));
        if(!field)
        {
--- 1038,1042 ----
        field = ILFieldCreate((ILClass *)userData, token,
                                  ILImageGetString(image, 
values[IL_OFFSET_FIELDDEF_NAME]),
!                                 values[IL_OFFSET_FIELDDEF_ATTRS]);
        if(!field)
        {
***************
*** 1081,1087 ****
        const char *name = ILImageGetString(image, 
values[IL_OFFSET_PARAMDEF_NAME]);
        if(!ILParameterCreate((ILMethod *)userData, token, name,
!                                                 
values[IL_OFFSET_PARAMDEF_ATTRS] &
!                                                       
~(IL_META_PARAMDEF_HAS_DEFAULT |
!                                                         
IL_META_PARAMDEF_HAS_FIELD_MARSHAL),
                                                  
values[IL_OFFSET_PARAMDEF_NUMBER]))
        {
--- 1076,1080 ----
        const char *name = ILImageGetString(image, 
values[IL_OFFSET_PARAMDEF_NAME]);
        if(!ILParameterCreate((ILMethod *)userData, token, name,
!                                                 
values[IL_OFFSET_PARAMDEF_ATTRS],
                                                  
values[IL_OFFSET_PARAMDEF_NUMBER]))
        {
***************
*** 1138,1143 ****
        method = ILMethodCreate((ILClass *)userData, token,
                                  ILImageGetString(image, 
values[IL_OFFSET_METHODDEF_NAME]),
!                                 values[IL_OFFSET_METHODDEF_ATTRS] &
!                                       ~(IL_META_METHODDEF_HAS_SECURITY));
        if(!method)
        {
--- 1131,1135 ----
        method = ILMethodCreate((ILClass *)userData, token,
                                  ILImageGetString(image, 
values[IL_OFFSET_METHODDEF_NAME]),
!                                 values[IL_OFFSET_METHODDEF_ATTRS]);
        if(!method)
        {
***************
*** 1490,1495 ****
                                             ILImageGetString
                                                        (image, 
values[IL_OFFSET_PROPERTY_NAME]),
!                                            values[IL_OFFSET_PROPERTY_ATTRS] &
!                                                       
~(IL_META_PROPDEF_HAS_DEFAULT),
                                                 signature);
        if(!signature)
--- 1482,1486 ----
                                             ILImageGetString
                                                        (image, 
values[IL_OFFSET_PROPERTY_NAME]),
!                                            values[IL_OFFSET_PROPERTY_ATTRS],
                                                 signature);
        if(!signature)

Index: misc_token.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/misc_token.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** misc_token.c        24 Apr 2002 05:36:36 -0000      1.1
--- misc_token.c        14 Feb 2003 23:55:49 -0000      1.2
***************
*** 268,271 ****
--- 268,300 ----
  ILConstant *ILConstantGetFromOwner(ILProgramItem *owner)
  {
+       ILField *field;
+       ILParameter *param;
+       ILProperty *property;
+ 
+       /* Filter out program items that obviously don't have a value,
+          to avoid searching the constant table unnecessarily */
+       if((field = ILProgramItemToField(owner)) != 0)
+       {
+               if((field->member.attributes & IL_META_FIELDDEF_HAS_DEFAULT) == 
0)
+               {
+                       return 0;
+               }
+       }
+       else if((param = ILProgramItemToParameter(owner)) != 0)
+       {
+               if((param->attributes & IL_META_PARAMDEF_HAS_DEFAULT) == 0)
+               {
+                       return 0;
+               }
+       }
+       else if((property = ILProgramItemToProperty(owner)) != 0)
+       {
+               if((property->member.attributes & IL_META_PROPDEF_HAS_DEFAULT) 
== 0)
+               {
+                       return 0;
+               }
+       }
+ 
+       /* Search for the constant token */
        return (ILConstant *)ILImageSearchForToken
                                (owner->image, IL_META_TOKEN_CONSTANT,
***************
*** 318,321 ****
--- 347,354 ----
  ILFieldRVA *ILFieldRVAGetFromOwner(ILField *owner)
  {
+       if((owner->member.attributes & IL_META_FIELDDEF_HAS_FIELD_RVA) == 0)
+       {
+               return 0;
+       }
        return (ILFieldRVA *)ILImageSearchForToken
                                (owner->member.programItem.image,
***************
*** 364,367 ****
--- 397,408 ----
  ILFieldLayout *ILFieldLayoutGetFromOwner(ILField *owner)
  {
+       /* Field layout information can only exist on explicit-layout classes,
+          so bail out early if we have some other kind of class */
+       if(!ILClass_IsExplicitLayout(owner->member.owner))
+       {
+               return 0;
+       }
+ 
+       /* Search for the layout token */
        return (ILFieldLayout *)ILImageSearchForToken
                                (owner->member.programItem.image,
***************
*** 447,450 ****
--- 488,511 ----
  ILFieldMarshal *ILFieldMarshalGetFromOwner(ILProgramItem *owner)
  {
+       ILField *field;
+       ILParameter *param;
+ 
+       /* Filter out members that obviously don't have marshal information */
+       if((field = ILProgramItemToField(owner)) != 0)
+       {
+               if((field->member.attributes & 
IL_META_FIELDDEF_HAS_FIELD_MARSHAL) == 0)
+               {
+                       return 0;
+               }
+       }
+       else if((param = ILProgramItemToParameter(owner)) != 0)
+       {
+               if((param->attributes & IL_META_PARAMDEF_HAS_FIELD_MARSHAL) == 
0)
+               {
+                       return 0;
+               }
+       }
+ 
+       /* Search for the token */
        return (ILFieldMarshal *)ILImageSearchForToken
                                (owner->image, IL_META_TOKEN_FIELD_MARSHAL,
***************
*** 510,513 ****
--- 571,581 ----
  ILClassLayout *ILClassLayoutGetFromOwner(ILClass *owner)
  {
+       /* Class layout information cannot exist on auto-layout classes */
+       if(ILClass_IsAutoLayout(owner))
+       {
+               return 0;
+       }
+ 
+       /* Search for the layout token */
        return (ILClassLayout *)ILImageSearchForToken
                                (owner->programItem.image, 
IL_META_TOKEN_CLASS_LAYOUT,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]