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

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

[dotgnu-pnet-commits] cscctest ChangeLog csharp/expr/Makefile.am csha...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] cscctest ChangeLog csharp/expr/Makefile.am csha...
Date: Fri, 02 Jan 2009 16:03:55 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    cscctest
Changes by:     Klaus Treichel <ktreichel>      09/01/02 16:03:55

Modified files:
        .              : ChangeLog 
        csharp/expr    : Makefile.am binary3.il new1.cs new1.il new1.jl 
Added files:
        csharp/expr    : new3.cs new3.err new3.il new3.jerr 

Log message:
        Add more tests for value type creation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cscctest/ChangeLog?cvsroot=dotgnu-pnet&r1=1.182&r2=1.183
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/Makefile.am?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/binary3.il?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/new1.cs?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/new1.il?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/new1.jl?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/new3.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/new3.err?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/new3.il?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/cscctest/csharp/expr/new3.jerr?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/ChangeLog,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -b -r1.182 -r1.183
--- ChangeLog   30 Dec 2008 17:05:27 -0000      1.182
+++ ChangeLog   2 Jan 2009 16:03:51 -0000       1.183
@@ -1,3 +1,16 @@
+2009-01-02  Klaus Treichel  <address@hidden>
+
+       * csharp/expr/binary3.il: Update to reflect latest compiler changes.
+
+       * csharp/expr/Makefile.am: Add new3.cs to the tests.
+
+       * csharp/expr/new1.cs, csharp/expr/new1.il, csharp/expr/new1.jl: Add 
more
+       tests for value type creation.
+
+       * csharp/expr/new3.cs, csharp/expr/new3.err, csharp/expr/new3.il,
+       csharp/expr/new3.jerr: Add tests for value type creation involving 
unsafe
+       constructs.
+
 2008-12-30  Klaus Treichel  <address@hidden>
 
        * csharp/expr/addressof1.cs, csharp/expr/addressof1.err,

Index: csharp/expr/Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/csharp/expr/Makefile.am,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- csharp/expr/Makefile.am     30 Dec 2008 17:05:28 -0000      1.28
+++ csharp/expr/Makefile.am     2 Jan 2009 16:03:52 -0000       1.29
@@ -39,6 +39,7 @@
                is2.cs \
                new1.cs \
                new2.cs \
+               new3.cs \
                newarray1.cs \
                newarray2.cs \
                newarray3.cs \

Index: csharp/expr/binary3.il
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/csharp/expr/binary3.il,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- csharp/expr/binary3.il      21 Dec 2002 14:02:40 -0000      1.4
+++ csharp/expr/binary3.il      2 Jan 2009 16:03:52 -0000       1.5
@@ -58,12 +58,12 @@
 .method private hidebysig instance void 'm1'() cil managed 
 {
        .locals init    (valuetype 'Y', valuetype 'Y', valuetype 'X', valuetype 
'Y')
+       ldloca.s        0
        ldc.i4.1
-       newobj  instance void 'Y'::'.ctor'(int32)
-       stloc.0
+       call    instance void 'Y'::'.ctor'(int32)
+       ldloca.s        1
        ldc.i4.2
-       newobj  instance void 'Y'::'.ctor'(int32)
-       stloc.1
+       call    instance void 'Y'::'.ctor'(int32)
        ldloc.0
        ldloc.1
        call    valuetype 'X' 'Y'::'op_Subtraction'(valuetype 'Y', valuetype 
'Y')

Index: csharp/expr/new1.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/csharp/expr/new1.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- csharp/expr/new1.cs 29 May 2007 08:38:52 -0000      1.2
+++ csharp/expr/new1.cs 2 Jan 2009 16:03:53 -0000       1.3
@@ -1,7 +1,7 @@
 /*
  * new1.cs - Test the valid cases of the "new" operator.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2009  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +27,23 @@
        public X(int _x) { x = _x; }
 }
 
+struct Y
+{
+       public X x;
+
+       public X X
+       {
+               get
+               {
+                       return x;
+               }
+               set
+               {
+                       x = value;
+               }
+       }
+}
+
 enum Color
 {
        Red,
@@ -58,6 +75,29 @@
                t2 = new Test2(3L);
                o1 = new Object();
        }
+
+       void m2(Y y)
+       {
+               y.x = new X(1);
+       }
+
+       void m3(Y y)
+       {
+               y.X = new X(1);
+       }
+
+       X m4(Y y)
+       {
+               return y.x = new X(1);
+       }
+
+       void m4()
+       {
+               X[] x = new X[2];
+
+               x[0] = new X(0);
+               x[1] = new X();
+       }
 }
 
 class Test2

Index: csharp/expr/new1.il
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/csharp/expr/new1.il,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- csharp/expr/new1.il 21 Dec 2002 14:02:40 -0000      1.4
+++ csharp/expr/new1.il 2 Jan 2009 16:03:53 -0000       1.5
@@ -19,6 +19,30 @@
        .maxstack 2
 } // method .ctor
 } // class X
+.class private sequential sealed serializable ansi 'Y' extends 
['.library']'System'.'ValueType'
+{
+.field public valuetype 'X' 'x'
+.method public hidebysig specialname instance valuetype 'X' 'get_X'() cil 
managed 
+{
+       ldarg.0
+       ldfld   valuetype 'X' 'Y'::'x'
+       ret
+       .maxstack 1
+} // method get_X
+.method public hidebysig specialname instance void 'set_X'(valuetype 'X' 
'value') cil managed 
+{
+       ldarg.0
+       ldarg.1
+       stfld   valuetype 'X' 'Y'::'x'
+       ret
+       .maxstack 2
+} // method set_X
+.property valuetype 'X' 'X'()
+{
+       .get instance valuetype 'X' 'Y'::'get_X'()
+       .set instance void 'Y'::'set_X'(valuetype 'X')
+} // property X
+} // class Y
 .class private auto sealed serializable ansi 'Color' extends 
['.library']'System'.'Enum'
 {
 .field public static literal valuetype 'Color' 'Red' = int32(0x00000000)
@@ -33,16 +57,13 @@
        .locals init    (int32, valuetype 'X', valuetype 'Color', class 
'Test2', class ['.library']'System'.'Object')
        ldc.i4.0
        stloc.0
-       .locals init    (valuetype 'X')
-       ldloca.s        5
+       ldloca.s        1
        initobj 'X'
-       ldloc.s 5
-       stloc.1
        ldc.i4.0
        stloc.2
+       ldloca.s        1
        ldc.i4.3
-       newobj  instance void 'X'::'.ctor'(int32)
-       stloc.1
+       call    instance void 'X'::'.ctor'(int32)
        newobj  instance void 'Test2'::'.ctor'()
        stloc.3
        ldc.i4.3
@@ -55,8 +76,55 @@
        newobj  instance void ['.library']'System'.'Object'::'.ctor'()
        stloc.s 4
        ret
-       .maxstack 1
+       .maxstack 2
 } // method m1
+.method private hidebysig instance void 'm2'(valuetype 'Y' 'y') cil managed 
+{
+       ldarga.s        1
+       ldflda  valuetype 'X' 'Y'::'x'
+       ldc.i4.1
+       call    instance void 'X'::'.ctor'(int32)
+       ret
+       .maxstack 2
+} // method m2
+.method private hidebysig instance void 'm3'(valuetype 'Y' 'y') cil managed 
+{
+       ldarga.s        1
+       ldc.i4.1
+       newobj  instance void 'X'::'.ctor'(int32)
+       call    instance void 'Y'::'set_X'(valuetype 'X')
+       ret
+       .maxstack 2
+} // method m3
+.method private hidebysig instance valuetype 'X' 'm4'(valuetype 'Y' 'y') cil 
managed 
+{
+       ldarga.s        1
+       ldflda  valuetype 'X' 'Y'::'x'
+       dup
+       ldc.i4.1
+       call    instance void 'X'::'.ctor'(int32)
+       ldobj   'X'
+       ret
+       .maxstack 3
+} // method m4
+.method private hidebysig instance void 'm4'() cil managed 
+{
+       .locals init    (valuetype 'X'[])
+       ldc.i4.2
+       newarr  'X'
+       stloc.0
+       ldloc.0
+       ldc.i4.0
+       ldelema 'X'
+       ldc.i4.0
+       call    instance void 'X'::'.ctor'(int32)
+       ldloc.0
+       ldc.i4.1
+       ldelema 'X'
+       initobj 'X'
+       ret
+       .maxstack 2
+} // method m4
 .method public hidebysig specialname rtspecialname instance void '.ctor'() cil 
managed 
 {
        ldarg.0

Index: csharp/expr/new1.jl
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/csharp/expr/new1.jl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- csharp/expr/new1.jl 21 Nov 2002 00:06:54 -0000      1.3
+++ csharp/expr/new1.jl 2 Jan 2009 16:03:53 -0000       1.4
@@ -20,6 +20,39 @@
        .maxstack 2
 } // method .ctor
 } // class X
+.class private sequential sealed serializable ansi 'Y' extends 
['.library']'System'.'ValueType'
+{
+.field public valuetype 'X' 'x'
+.method public hidebysig specialname instance valuetype 'X' 'get_X'() cil 
managed java 
+{
+       aload_0
+       getfield        valuetype 'X' 'Y'::'x'
+       dup
+       ifnonnull       ?L1
+       pop
+       new     "X"
+       dup
+       invokespecial   "X" "<init>" "()V"
+?L1:
+       areturn
+       .locals 1
+       .maxstack 2
+} // method get_X
+.method public hidebysig specialname instance void 'set_X'(valuetype 'X' 
'value') cil managed java 
+{
+       aload_0
+       aload_1
+       putfield        valuetype 'X' 'Y'::'x'
+       return
+       .locals 2
+       .maxstack 2
+} // method set_X
+.property valuetype 'X' 'X'()
+{
+       .get instance valuetype 'X' 'Y'::'get_X'()
+       .set instance void 'Y'::'set_X'(valuetype 'X')
+} // property X
+} // class Y
 .class private auto sealed serializable ansi 'Color' extends 
['.library']'System'.'Enum'
 {
 .field public static literal valuetype 'Color' 'Red' = int32(0x00000000)
@@ -71,6 +104,68 @@
        .locals 6
        .maxstack 4
 } // method m1
+.method private hidebysig instance void 'm2'(valuetype 'Y' 'y') cil managed 
java 
+{
+       aload_1
+       invokestatic    "Y" "copyIn__" "(LY;)LY;"
+       new     'X'
+       dup
+       iconst_1
+       invokespecial   instance void 'X'::'.ctor'(int32)
+       putfield        valuetype 'X' 'Y'::'x'
+       return
+       .locals 2
+       .maxstack 4
+} // method m2
+.method private hidebysig instance void 'm3'(valuetype 'Y' 'y') cil managed 
java 
+{
+       aload_1
+       invokestatic    "Y" "copyIn__" "(LY;)LY;"
+       new     'X'
+       dup
+       iconst_1
+       invokespecial   instance void 'X'::'.ctor'(int32)
+       invokespecial   instance void 'Y'::'set_X'(valuetype 'X')
+       return
+       .locals 2
+       .maxstack 4
+} // method m3
+.method private hidebysig instance valuetype 'X' 'm4'(valuetype 'Y' 'y') cil 
managed java 
+{
+       aload_1
+       invokestatic    "Y" "copyIn__" "(LY;)LY;"
+       new     'X'
+       dup
+       iconst_1
+       invokespecial   instance void 'X'::'.ctor'(int32)
+       dup_x1
+       putfield        valuetype 'X' 'Y'::'x'
+       areturn
+       .locals 2
+       .maxstack 4
+} // method m4
+.method private hidebysig instance void 'm4'() cil managed java 
+{
+       iconst_2
+       anewarray valuetype 'X'
+       astore_1
+       aload_1
+       iconst_0
+       new     'X'
+       dup
+       iconst_0
+       invokespecial   instance void 'X'::'.ctor'(int32)
+       aastore
+       aload_1
+       iconst_1
+       new     'X'
+       dup
+       invokespecial   "X" "<init>" "()V"
+       aastore
+       return
+       .locals 2
+       .maxstack 5
+} // method m4
 .method public hidebysig specialname rtspecialname instance void '.ctor'() cil 
managed java 
 {
        aload_0

Index: csharp/expr/new3.cs
===================================================================
RCS file: csharp/expr/new3.cs
diff -N csharp/expr/new3.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ csharp/expr/new3.cs 2 Jan 2009 16:03:53 -0000       1.1
@@ -0,0 +1,42 @@
+/*
+ * new3.cs - Test the valid cases of the "new" operator with unsafe constructs.
+ *
+ * Copyright (C) 2009  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+struct X
+{
+       public int i;
+
+       public X(int i)
+       {
+               this.i = i;
+       }
+}
+
+class Test
+{
+       unsafe void t1(X x)
+       {
+               X *xPtr;
+
+               xPtr = &x;
+
+               *xPtr = new X();
+               *xPtr = new X(1);
+       }
+}

Index: csharp/expr/new3.err
===================================================================
RCS file: csharp/expr/new3.err
diff -N csharp/expr/new3.err
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ csharp/expr/new3.err        2 Jan 2009 16:03:54 -0000       1.1
@@ -0,0 +1,4 @@
+./new3.cs:33: warning: unsafe method declaration
+./new3.cs:37: warning: unsafe address operator
+./new3.cs:39: warning: unsafe pointer dereference
+./new3.cs:40: warning: unsafe pointer dereference

Index: csharp/expr/new3.il
===================================================================
RCS file: csharp/expr/new3.il
diff -N csharp/expr/new3.il
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ csharp/expr/new3.il 2 Jan 2009 16:03:54 -0000       1.1
@@ -0,0 +1,48 @@
+.assembly extern '.library'
+{
+       .ver 0:0:0:0
+}
+.assembly '<Assembly>'
+{
+       .ver 0:0:0:0
+       .custom instance void 
[.library]System.Security.Permissions.SecurityPermissionAttribute::.ctor(valuetype
 [.library]System.Security.Permissions.SecurityAction) =
+               (01 00 08 00 00 00 01 00 54 02 10 53 6B 69 70 56
+                65 72 69 66 69 63 61 74 69 6F 6E 01)
+}
+.module '<Module>'
+.custom instance void 
[.library]System.Security.UnverifiableCodeAttribute::.ctor() = (01 00 00 00)
+.class private sequential sealed serializable ansi 'X' extends 
['.library']'System'.'ValueType'
+{
+.field public int32 'i'
+.method public hidebysig specialname rtspecialname instance void '.ctor'(int32 
'i') cil managed 
+{
+       ldarg.0
+       ldarg.1
+       stfld   int32 'X'::'i'
+       ret
+       .maxstack 2
+} // method .ctor
+} // class X
+.class private auto ansi 'Test' extends ['.library']'System'.'Object'
+{
+.method private hidebysig instance void 't1'(valuetype 'X' 'x') cil managed 
+{
+       .locals init    (valuetype 'X' *)
+       ldarga.s        1
+       stloc.0
+       ldloc.0
+       initobj 'X'
+       ldloc.0
+       ldc.i4.1
+       call    instance void 'X'::'.ctor'(int32)
+       ret
+       .maxstack 2
+} // method t1
+.method public hidebysig specialname rtspecialname instance void '.ctor'() cil 
managed 
+{
+       ldarg.0
+       call    instance void ['.library']'System'.'Object'::'.ctor'()
+       ret
+       .maxstack 1
+} // method .ctor
+} // class Test

Index: csharp/expr/new3.jerr
===================================================================
RCS file: csharp/expr/new3.jerr
diff -N csharp/expr/new3.jerr
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ csharp/expr/new3.jerr       2 Jan 2009 16:03:54 -0000       1.1
@@ -0,0 +1,4 @@
+./new3.cs:33: unsafe method declaration not permitted with Java output
+./new3.cs:37: unsafe address operator not permitted with Java output
+./new3.cs:39: unsafe pointer dereference not permitted with Java output
+./new3.cs:40: unsafe pointer dereference not permitted with Java output




reply via email to

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