[Mono-bugs] [Bug 52107][Nor] New - PPC: System.Reflection fails when JITted
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 26 May 2004 18:51:13 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by vargaz@freemail.hu.
http://bugzilla.ximian.com/show_bug.cgi?id=52107
--- shadow/52107 2004-05-26 18:51:13.000000000 -0400
+++ shadow/52107.tmp.20528 2004-05-26 18:51:13.000000000 -0400
@@ -0,0 +1,262 @@
+Bug#: 52107
+Product: Mono: Runtime
+Version: unspecified
+OS: other
+OS Details: PowerPC
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Normal
+Component: misc
+AssignedTo: lupus@ximian.com
+ReportedBy: piyush.garyali@honeywell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Summary: PPC: System.Reflection fails when JITted
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+
+[Description of Problem]
+
+The code (to be attached as a test case), fails on compilation
+on PowerPC.
+
+[Steps to reproduce the problem]
+1. find attached testcase "reflectioninvoke.cs"
+
+[Actual Results]
+Access Voilation
+
+[Expected Results]
+Invoking the static method SayHello()
+---------------------------------
+Hello
+
+Invoking the instance method AddUp()
+---------------------------------
+AddUp Called 1 times
+AddUp Called 2 times
+
+Invoking static method ComputeSum() with arguments/parameters
+---------------------------------
+100.09 + 184.45 = 284.54
+
+Invoking the field Name (Setting and Getting)
+---------------------------------
+Name contains initalName
+Name contains NewName
+
+Invoking the indexed property Item (Setting and Getting)
+---------------------------------
+Item[3] contains 3
+Item[3] contains NewValue after setting
+
+Getting the field Name and property Value
+---------------------------------
+Name contains NewName
+Value contains the value
+
+Invoking the method static method PrintName() with named arguments
+---------------------------------
+Mouse,Micky
+
+Invoking the method Swap() with ByRef parameters
+---------------------------------
+2, 1
+
+Invoking the default member of the TestClass2 type, PrintTime()
+---------------------------------
+12/12/2003 9:08:06 PM
+Hit <Enter> to exit
+
+[How often does this happen]
+everytime
+
+[Additional Information]
+
+------- Additional Comments From piyush.garyali@honeywell.com 2003-12-12 10:43 -------
+Created an attachment (id=6214)
+testcase for reflection invoke failure on powerPC
+
+
+------- Additional Comments From lupus@ximian.com 2003-12-17 07:27 -------
+This works for me with current cvs (if you take out the readline that
+is the topic of another bug report).
+
+------- Additional Comments From lupus@ximian.com 2003-12-17 09:46 -------
+The readline bug is fixed in cvs, now.
+Forgot to mention that the date is printed incorrectly in this test case
+for me (though it works correctly in a standalone test, will investigate).
+
+------- Additional Comments From piyush.garyali@honeywell.com 2003-12-18 07:47 -------
+Well, I was not able to get the test case to work so I broke it down
+into small pieces to get to the problem
+
+[code]
+using System;
+using System.IO;
+using System.Reflection;
+
+public class Invoke
+{
+ public static void Main()
+ {
+ Type t = typeof(TestClass);
+
+ t.InvokeMember("SayHello", BindingFlags.InvokeMethod,
+null, null, new object[] {} );
+ }
+}
+
+public class TestClass
+{
+ public static void SayHello()
+ {
+ Console.WriteLine("Hello");
+ }
+}
+
+After the code is compiled for System.ArgumentException..ctor, I get
+an Access Voilation exception
+
+The assembly code generate is:
+
+??
+mono_jit_compile_method() -> for System.ArgumentException..ctor
+?? (after the code is compiled)
+lwz r8, 0xb0(sp)
+lwz r9, 0xac(sp)
+lwz r10, 0xa8(sp)
+lfd f1, 0x48(sp)
+lfd f2, 0x40(sp)
+lfd f3, 0x38(sp)
+lfd f4, 0x30(sp)
+lfd f5, 0x28(sp)
+lfd f6, 0x20(sp)
+lfd f7, 0x18(sp)
+lfd f8, 0x10(sp)
+lwz sp, 0(sp)
+lwz r31, -4(sp)
+lwz r11, 4(sp)
+mtlr r11
+mtctr r0
+bctr
+ \-> mflr r0
+ stw r0, 4(sp)
+ stw r29, -4(sp)
+ stw r30, -8(sp)
+ stwu sp, -64(sp)
+ stw r3, 0x24(sp)
+ stw r4, 0x28(sp)
+ lwz r3, 0x24(sp)
+ mr r3, r3
+ lwz r4, 0x28(sp)
+ mr r4, r4
+ bl 0x77efe0
+ lwz r0, 0x44(sp)
+ mtlr r0
+ addic sp, sp, 0x40
+ lwz r29, -4(sp)
+ lwz r30, -8(sp)
+ blr
+ \-> lwz r3, 0xbc(sp)
+ mr r3, r3
+ bl start (0x25c730)
+ lwz r3, 0x1f8(sp)
+ ^^^^^^^^^^^^^^^^^^^^^^^
+OS Exception -- Attempt to read protected memory
+ \-> lwz r0, 0(zero)
+
+OS Exception -- Attempt to read protected memory
+
+The register contents are:
+pc 0x00000d00
+sp 0x01764a28
+r0 0x80000000
+r1 0x01764a28
+r2 0x0025f09c
+r3 0x00000033
+r4 0x00000000
+r5 0x00000000
+r6 0x00000000
+r7 0x00000000
+r8 0x00000000
+r9 0x00000000
+r10 0x00000000
+r11 0x00000000
+r12 0x00000000
+r13 0x00000003
+r14 0x01764e58
+r15 0x00002500
+r16 0x00000000
+r17 0x00000000
+r18 0x00000000
+r19 0x00000000
+r20 0x61670000
+r21 0x72452d00
+r22 0x00000000
+r23 0x00000000
+r24 0x008bdbb8
+r25 0x008bdbe0
+r26 0x00000001
+r27 0x00262d00
+r28 0x008bbc68
+r29 0x01764ae8
+r30 0x00000058
+r31 0x6d6f0001
+
+I am working on the 12/17/2003 cvs code.
+
+
+------- Additional Comments From lupus@ximian.com 2003-12-18 08:15 -------
+Make sure the last entry in the ChangeLog is:
+Wed Dec 17 15:31:41 CET 2003 Paolo Molaro <lupus@ximian.com>
+Just saying the 12/17 date doesn't tell me if you got the sources
+after or before the fixes went in (the fix for the likely issue you
+have is in version 1.12 of tramp-ppc.c).
+The error you report is consistent with the behaviout before the
+fixes: InvokeMember would throw an exception because it couldn't get
+correctly at all it's arguments and an argument check fails (hence the
+ArgumentException...). Since exception support is not yet implemented,
+the code fails later on.
+If you still get the error with current cvs, you may want to add some
+Console.WriteLine() in InvokeMember or debug which case makes it throw
+ the argument exception.
+
+------- Additional Comments From piyush.garyali@honeywell.com 2003-12-19 15:38 -------
+The testcase works fine for me but surprisingly only when the "--
+trace=all" is set. If the --trace=all is not set I get a Data
+Voilation exception pretty early when the following code from the
+test case is executed:
+
+[code]
+Console.WriteLine("Invoking the static method SayHello()");
+t.InvokeMember("SayHello", BindingFlags.InvokeMethod, null, null, new
+object [] {});
+TestClass c = new TestClass();
+
+.. shall attach the "Assembly generated"
+
+However, when the code is run using --trace=all, there are a couple
+of things which dont come as expected:
+*) Invoking static method ComputeSum() with arguments/parameters
+results in:
+ 0 + 0 = 0
+instead of:
+ 100.09 + 184.45 = 284.54
+
+*) Invoking the default member of the TestClass2 type, PrintTime()
+results in:
+00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0
+0,08,9f,7f,f6,35,e2,b7,6c,08,9f,7f,f6,35,e2,b
+which fails for you as well.
+
+Rest all of the parts are working fine.
+
+
+------- Additional Comments From piyush.garyali@honeywell.com 2003-12-19 15:39 -------
+Created an attachment (id=6278)
+Assembly generated during the crash
+