[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_lookup.c cscc/csh...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_lookup.c cscc/csh... |
Date: |
Fri, 15 Aug 2008 20:52:37 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 08/08/15 20:52:37
Modified files:
. : ChangeLog
cscc/csharp : cs_lookup.c cs_lvalue.tc
Log message:
Optimize calls to virtual functions on sealed types.
Fix base calls from value types.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3558&r2=1.3559
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_lookup.c?cvsroot=dotgnu-pnet&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.66&r2=1.67
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3558
retrieving revision 1.3559
diff -u -b -r1.3558 -r1.3559
--- ChangeLog 14 Aug 2008 08:51:25 -0000 1.3558
+++ ChangeLog 15 Aug 2008 20:52:35 -0000 1.3559
@@ -1,3 +1,21 @@
+2008-08-15 Klaus Treichel <address@hidden>
+
+ * cscc/csharp/cs_lookup.c (CheckForSealedImplementation): Add function
to
+ check if a virtual method is implemented by the type on which the method
+ is called and thy type is sealed. If that's the case replace the method
+ in the CSMemberLookupInfo with the sealed implementation.
+ This is done to avoid boxing of value types if they implement the method
+ to call. This can be done with a non virtual call then.
+ (TrimMemberList): Call CheckForSealedImplementation if the
+ resulting CSMemberLookupInfo consists of one or more methods.
+
+ * cscc/csharp/cs_lvalue.tc (SemToLRValue): Fix a bug with the this type
+ on a method invocation with base acces. The parent type was used as
+ this type instead of the actual type which caused wrong code to be
+ generated if the this type is a value type.
+ (ILNode_SemAnalysis(ILNode_BaseElement)): Fix two bugs with returning an
+ uninitialized value.
+
2008-08-14 Klaus Treichel <address@hidden>
* support/time.c (ILGetSinceRebootTime): Fix assignments to the members
Index: cscc/csharp/cs_lookup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lookup.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- cscc/csharp/cs_lookup.c 30 Oct 2007 17:35:23 -0000 1.39
+++ cscc/csharp/cs_lookup.c 15 Aug 2008 20:52:36 -0000 1.40
@@ -305,9 +305,63 @@
}
/*
+ * Check if the member is implemented by the sealed class and
+ * replace the member with the sealed implementation.
+ */
+static void CheckForSealedImplementation(CSMemberLookupInfo *results,
+
ILClass *classInfo,
+
ILClass *accessedFrom)
+{
+ CSMemberLookupIter iter;
+ CSMemberInfo *member;
+
+ /* Resolve the class to its actual image */
+ classInfo = ILClassResolve(classInfo);
+
+ if(!classInfo || !ILClass_IsSealed(classInfo))
+ {
+ /* The class is not sealed so we are done */
+ return;
+ }
+
+ /* If the list is empty, then we are done too */
+ if(!(results->num))
+ {
+ return;
+ }
+
+ MemberIterInit(&iter, results);
+ while((member = MemberIterNext(&iter)) != 0)
+ {
+ if((member->kind == IL_META_MEMBERKIND_METHOD) &&
+ (member->owner != classInfo) &&
+ (ILMethod_IsVirtual(member->member) ||
+ ILMethod_IsAbstract(member->member)))
+ {
+ ILMember *memberInfo;
+
+ memberInfo = ILClassNextMemberMatch(classInfo, 0,
+
IL_META_MEMBERKIND_METHOD,
+
ILMember_Name(member->member),
+
ILMember_Signature(member->member));
+
+ if(memberInfo)
+ {
+ if(ILMemberAccessible(memberInfo, accessedFrom))
+ {
+ member->owner = classInfo;
+ member->member =
ILToProgramItem(memberInfo);
+ }
+ }
+ }
+ }
+}
+
+/*
* Trim a list of members to remove unneeded elements.
*/
-static int TrimMemberList(CSMemberLookupInfo *results, int isIndexerList)
+static int TrimMemberList(CSMemberLookupInfo *results, int isIndexerList,
+ ILClass *info, ILClass
*accessedFrom)
{
CSMemberLookupIter iter;
CSMemberInfo *firstMember;
@@ -422,6 +476,7 @@
return CS_SEMKIND_AMBIGUOUS;
}
}
+ CheckForSealedImplementation(results, info, accessedFrom);
return CS_SEMKIND_METHOD_GROUP;
}
else if(results->num == 1)
@@ -431,6 +486,7 @@
{
case CS_MEMBERKIND_TYPE:
{
+ CheckForSealedImplementation(results, info,
accessedFrom);
return CS_SEMKIND_TYPE;
}
/* Not reached */
@@ -511,7 +567,7 @@
}
/* Trim the list and determine the kind for the result */
- return TrimMemberList(results, 0);
+ return TrimMemberList(results, 0, info, accessedFrom);
}
/*
@@ -605,7 +661,7 @@
}
/* Trim the list and determine the kind for the result */
- return TrimMemberList(results, 1);
+ return TrimMemberList(results, 1, info, accessedFrom);
}
/*
Index: cscc/csharp/cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- cscc/csharp/cs_lvalue.tc 7 Nov 2007 16:39:41 -0000 1.66
+++ cscc/csharp/cs_lvalue.tc 15 Aug 2008 20:52:36 -0000 1.67
@@ -642,7 +642,7 @@
}
/* Replace the node with either the object expression
or "this" */
- if(expr)
+ if(expr && !yyisa(expr, ILNode_This))
{
*parent = ILNode_MarkType_create(expr,
CSSemGetType(*exprSem));
}
@@ -651,9 +651,17 @@
thisType = CurrentClassType(info);
if(thisType)
{
+ if(expr && yyisa(expr, ILNode_This))
+ {
+ *parent = ILNode_MarkType_create
+ (expr, thisType);
+ }
+ else
+ {
*parent = ILNode_MarkType_create
(ILNode_This_create(),
thisType);
}
+ }
else
{
*parent = ILNode_This_create();
@@ -1500,6 +1508,7 @@
CSItemCandidateError((ILNode *)node, 0, 0,
CSSemGetGroup(indexers), args, numArgs);
CSEvalFreeArguments(args);
+ CSSemSetType(value, ILType_Int32);
return value;
}
@@ -1515,6 +1524,7 @@
CSSemGetGroup(indexers),
args,
numArgs);
CSEvalFreeArguments(args);
+ CSSemSetType(value, ILType_Int32);
return value;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_lookup.c cscc/csh...,
Klaus Treichel <=