[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/image image.h,1.17,1.18 meta_build.c,1.
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/image image.h,1.17,1.18 meta_build.c,1.14,1.15 meta_index.c,1.3,1.4 |
Date: |
Fri, 07 Feb 2003 06:31:32 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv17219/image
Modified Files:
image.h meta_build.c meta_index.c
Log Message:
Put some of the infrastructure in place to support on-demand
loading of tokens from "ILImageTokenInfo" (temporarily disabled).
Index: image.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/image.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** image.h 6 Nov 2002 00:53:13 -0000 1.17
--- image.h 7 Feb 2003 11:31:30 -0000 1.18
***************
*** 410,413 ****
--- 410,423 ----
/*
+ * Load a token information block on demand.
+ */
+ void *_ILImageLoadOnDemand(ILImage *image, ILToken token);
+
+ /*
+ * Determine if a token has already been loaded.
+ */
+ int _ILImageTokenAlreadyLoaded(ILImage *image, ILToken token);
+
+ /*
* Perform dynamic linking on an image to resolve all
* assemblies that it refers to. Returns a load error.
Index: meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** meta_build.c 28 Jan 2003 07:08:24 -0000 1.14
--- meta_build.c 7 Feb 2003 11:31:30 -0000 1.15
***************
*** 900,905 ****
/* If we have already loaded this type, then bail out */
! info = ILClass_FromToken(image, token);
! if(info)
{
return 0;
--- 900,904 ----
/* If we have already loaded this type, then bail out */
! if(_ILImageTokenAlreadyLoaded(image, token))
{
return 0;
***************
*** 2424,2427 ****
--- 2423,2559 ----
return 0;
}
+
+ #if 0
+
+ /*
+ * Table of all token loading functions.
+ */
+ static TokenLoadFunc const TokenLoadFunctions[] = {
+ Load_Module, /* 00 */
+ 0, /*Load_TypeRef,*/
+ Load_TypeDef,
+ 0,
+ Load_FieldDef,
+ 0,
+ Load_MethodDef,
+ 0,
+ Load_ParamDef, /* 08 */
+ Load_InterfaceImpl,
+ Load_MemberRef,
+ Load_Constant,
+ Load_CustomAttr,
+ Load_FieldMarshal,
+ Load_DeclSecurity,
+ Load_ClassLayout,
+ Load_FieldLayout, /* 10 */
+ Load_StandAloneSig,
+ 0, /*Load_EventMap,*/
+ 0,
+ Load_Event,
+ 0, /*Load_PropertyMap,*/
+ 0,
+ Load_Property,
+ 0, /*Load_MethodSemantics,*/ /* 18 */
+ 0, /*Load_MethodImpl,*/
+ Load_ModuleRef,
+ Load_TypeSpec,
+ 0, /*Load_ImplMap,*/
+ Load_FieldRVA,
+ 0,
+ 0,
+ Load_Assembly, /* 20 */
+ Load_ProcessorDef,
+ Load_OSDef,
+ Load_AssemblyRef,
+ Load_ProcessorRef,
+ Load_OSRef,
+ Load_File,
+ Load_ExportedType,
+ 0, /*Load_ManifestResource,*/ /* 28 */
+ 0, /*Load_NestedClass,*/
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* 30 */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* 38 */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ };
+
+ void *_ILImageLoadOnDemand(ILImage *image, ILToken token)
+ {
+ ILUInt32 values[IL_IMAGE_TOKEN_COLUMNS];
+ ILUInt32 valuesNext[IL_IMAGE_TOKEN_COLUMNS];
+ ILUInt32 *pvaluesNext;
+ TokenLoadFunc func;
+ void **data;
+
+ /* Load the values for the token */
+ if(!_ILImageRawTokenData(image, token, values))
+ {
+ return 0;
+ }
+
+ /* Load the values for the following token, in case it is a range */
+ if((token + 1) <= ((token & IL_META_TOKEN_MASK) |
+ image->tokenCount[token >> 24]))
+ {
+ if(!_ILImageRawTokenData(image, token + 1, valuesNext))
+ {
+ return 0;
+ }
+ pvaluesNext = valuesNext;
+ }
+ else
+ {
+ pvaluesNext = 0;
+ }
+
+ /* Find the loading function for this token type */
+ func = TokenLoadFunctions[token >> 24];
+ if(!func)
+ {
+ return 0;
+ }
+
+ /* Load the token information */
+ if((*func)(image, values, pvaluesNext, token, 0) != 0)
+ {
+ /* A metadata error was detected */
+ return 0;
+ }
+
+ /* Retrieve the program item from the token table */
+ data = image->tokenData[token >> 24];
+ if(data)
+ {
+ return data[(token & ~IL_META_TOKEN_MASK) - 1];
+ }
+ return 0;
+ }
+
+ #else
+
+ void *_ILImageLoadOnDemand(ILImage *image, ILToken token)
+ {
+ return 0;
+ }
+
+ #endif
#ifdef __cplusplus
Index: meta_index.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_index.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** meta_index.c 1 Jul 2002 13:43:24 -0000 1.3
--- meta_index.c 7 Feb 2003 11:31:30 -0000 1.4
***************
*** 1225,1228 ****
--- 1225,1229 ----
{
void **data;
+ void *item;
if(token < (unsigned long)0x40000000)
{
***************
*** 1234,1238 ****
if(data)
{
! return data[tokenId - 1];
}
}
--- 1235,1270 ----
if(data)
{
! item = data[tokenId - 1];
! if(item)
! {
! return item;
! }
! }
! if(image->type != IL_IMAGETYPE_BUILDING)
! {
! /* Perform on-demand loading of the token */
! return _ILImageLoadOnDemand(image, token);
! }
! }
! }
! return 0;
! }
!
! int _ILImageTokenAlreadyLoaded(ILImage *image, ILToken token)
! {
! void **data;
! if(token < (unsigned long)0x40000000)
! {
! ILToken tokenId = (token & (unsigned long)0x00FFFFFF);
! ILToken tokenType = (token >> 24);
! if(tokenId >= 1 && tokenId <= image->tokenCount[tokenType])
! {
! data = image->tokenData[tokenType];
! if(data)
! {
! if(data[tokenId - 1])
! {
! return 1;
! }
}
}
***************
*** 1255,1259 ****
ILToken token;
ILToken left, right;
- void **data;
void *item;
int cmp;
--- 1287,1290 ----
***************
*** 1261,1265 ****
/* Find the table in question */
maxToken = (tokenType | image->tokenCount[tokenType >> 24]);
- data = image->tokenData[tokenType >> 24];
/* Is the table sorted? */
--- 1292,1295 ----
***************
*** 1272,1276 ****
{
token = ((left + right) / 2);
! item = data[(token & ~IL_META_TOKEN_MASK) - 1];
if(!item)
{
--- 1302,1306 ----
{
token = ((left + right) / 2);
! item = ILImageTokenInfo(image, token);
if(!item)
{
***************
*** 1299,1303 ****
for(token = (tokenType | 1); token <= maxToken; ++token)
{
! item = data[(token & ~IL_META_TOKEN_MASK) - 1];
if(item && (*compareFunc)(item, userData) == 0)
{
--- 1329,1333 ----
for(token = (tokenType | 1); token <= maxToken; ++token)
{
! item = ILImageTokenInfo(image, token);
if(item && (*compareFunc)(item, userData) == 0)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/image image.h,1.17,1.18 meta_build.c,1.14,1.15 meta_index.c,1.3,1.4,
Rhys Weatherley <address@hidden> <=