[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/codegen cg_misc.tc,1.43,1.44 cg_nodes.tc
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/codegen cg_misc.tc,1.43,1.44 cg_nodes.tc,1.72,1.73 jv_misc.tc,1.27,1.28 |
Date: |
Fri, 29 Nov 2002 16:58:14 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv13481/codegen
Modified Files:
cg_misc.tc cg_nodes.tc jv_misc.tc
Log Message:
Support the use of "this" as an l-value within struct's.
Index: cg_misc.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_misc.tc,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** cg_misc.tc 20 Nov 2002 21:08:49 -0000 1.43
--- cg_misc.tc 29 Nov 2002 21:58:12 -0000 1.44
***************
*** 804,807 ****
--- 804,914 ----
/*
+ * Prepare a "this" expression for a store.
+ */
+ ILNode_Prepare(ILNode_This)
+ {
+ ILMachineType type = ILNode_GetType((ILNode *)node, info);
+ ILGenSimple(info, IL_OP_LDARG_0);
+ ILGenAdjust(info, 1);
+ return type;
+ }
+
+ /*
+ * Prepare a "this" expression for a store and get the current value.
+ */
+ ILNode_GetAndPrepare(ILNode_This)
+ {
+ ILType *type;
+ ILMachineType machineType;
+ unsigned tempVar;
+
+ /* Determine the type of the class that we are in */
+ if(info->currentClass)
+ {
+ type = ILClassToType(((ILNode_ClassDefn *)(info->currentClass))
+ ->classInfo);
+ }
+ else
+ {
+ type = ILFindSystemType(info, "Object");
+ }
+ machineType = ILTypeToMachineType(type);
+
+ /* The code to be generated is different for leave and non-leave cases
*/
+ if(leave)
+ {
+ tempVar = ILGenTempTypedVar(info, type);
+ ILGenSimple(info, IL_OP_LDARG_0);
+ ILGenAdjust(info, 1);
+ ILGenLoadManaged(info, machineType, type);
+ ILGenStoreLocal(info, tempVar);
+ ILGenLoadLocal(info, tempVar);
+ ILGenSimple(info, IL_OP_LDARG_0);
+ ILGenLoadLocal(info, tempVar);
+ ILGenAdjust(info, 2);
+ ILGenReleaseTempVar(info, tempVar);
+ }
+ else
+ {
+ ILGenSimple(info, IL_OP_LDARG_0);
+ ILGenAdjust(info, 1);
+ ILGenSimple(info, IL_OP_LDARG_0);
+ ILGenAdjust(info, 1);
+ ILGenLoadManaged(info, machineType, type);
+ }
+ return machineType;
+ }
+
+ /*
+ * Store into a "this" expression.
+ */
+ ILNode_Store(ILNode_This)
+ {
+ ILType *type;
+ ILMachineType machineType;
+ unsigned tempVar;
+
+ /* Determine the type of the class that we are in */
+ if(info->currentClass)
+ {
+ type = ILClassToType(((ILNode_ClassDefn *)(info->currentClass))
+ ->classInfo);
+ }
+ else
+ {
+ type = ILFindSystemType(info, "Object");
+ }
+ machineType = ILTypeToMachineType(type);
+
+ /* The code to be generated is different for leave and non-leave cases
*/
+ if(leave)
+ {
+ tempVar = ILGenTempTypedVar(info, type);
+ ILGenSimple(info, IL_OP_DUP);
+ ILGenStoreLocal(info, tempVar);
+ ILGenExtend(info, 1);
+ ILGenStoreManaged(info, machineType, type);
+ ILGenAdjust(info, -2);
+ ILGenLoadLocal(info, tempVar);
+ ILGenAdjust(info, 1);
+ ILGenReleaseTempVar(info, tempVar);
+ }
+ else
+ {
+ ILGenStoreManaged(info, machineType, type);
+ ILGenAdjust(info, -2);
+ }
+ }
+
+ /*
+ * Generate reference code for a "this" expression.
+ */
+ ILNode_GenRef(ILNode_This)
+ {
+ ILGenSimple(info, IL_OP_LDARG_0);
+ ILGenAdjust(info, 1);
+ }
+
+ /*
* Generate value code for an argument list expression.
*/
Index: cg_nodes.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_nodes.tc,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -r1.72 -r1.73
*** cg_nodes.tc 27 Nov 2002 11:13:32 -0000 1.72
--- cg_nodes.tc 29 Nov 2002 21:58:12 -0000 1.73
***************
*** 413,417 ****
}
%node ILNode_ToConst ILNode_UnaryExpression
! %node ILNode_This ILNode_Expression
%node ILNode_ArgList ILNode_BinaryExpression
%node ILNode_VarArgList ILNode_Expression
--- 413,417 ----
}
%node ILNode_ToConst ILNode_UnaryExpression
! %node ILNode_This ILNode_LValue
%node ILNode_ArgList ILNode_BinaryExpression
%node ILNode_VarArgList ILNode_Expression
Index: jv_misc.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/jv_misc.tc,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** jv_misc.tc 20 Nov 2002 21:08:49 -0000 1.27
--- jv_misc.tc 29 Nov 2002 21:58:12 -0000 1.28
***************
*** 421,424 ****
--- 421,436 ----
/*
+ * L-value processing for "this", which isn't used under JVM.
+ */
+ JavaPrepare(ILNode_This),
+ JavaGetAndPrepare(ILNode_This)
+ {
+ return ILMachineType_Void;
+ }
+ JavaStore(ILNode_This)
+ {
+ }
+
+ /*
* Generate value code for an argument list expression.
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/codegen cg_misc.tc,1.43,1.44 cg_nodes.tc,1.72,1.73 jv_misc.tc,1.27,1.28,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet/cscc/c c_stubs.tc,1.12,1.13
- Next by Date:
[Dotgnu-pnet-commits] CVS: cscctest/csharp/expr this1.cs,NONE,1.1 this1.il,NONE,1.1 this1.jerr,NONE,1.1 Makefile.am,1.22,1.23
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet/cscc/c c_stubs.tc,1.12,1.13
- Next by thread:
[Dotgnu-pnet-commits] CVS: cscctest/csharp/expr this1.cs,NONE,1.1 this1.il,NONE,1.1 this1.jerr,NONE,1.1 Makefile.am,1.22,1.23
- Index(es):