[Mono-bugs] [Bug 52037][Nor] Changed - System.DateTime.get_Now fails on execution

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 19 Dec 2003 16:06:06 -0500 (EST)


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 piyush.garyali@honeywell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=52037

--- shadow/52037	2003-12-17 11:52:18.000000000 -0500
+++ shadow/52037.tmp.4416	2003-12-19 16:06:06.000000000 -0500
@@ -0,0 +1,267 @@
+Bug#: 52037
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: PowerPC
+Status: RESOLVED   
+Resolution: FIXED
+Severity: Unknown
+Priority: Normal
+Component: misc
+AssignedTo: lupus@ximian.com                            
+ReportedBy: piyush.garyali@honeywell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: System.DateTime.get_Now fails on execution
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+System.DateTime.Ticks fails when executing JIT compiled code for 
+System.DateTime.get_Now when running the program below:
+
+Steps to reproduce the problem:
+1. Run the following program
+
+using System;
+
+namespace Foo
+{
+  class Test
+  {
+    static void Main()
+    {
+      long start = 0;
+      start =  DateTime.Now.Ticks;			
+    }
+  }
+}
+
+Actual Results:
+Access Voilation
+
+Expected Results:
+Should assign current tick to start.
+
+How often does this happen? 
+Everytime
+
+Additional Information:
+The Call Stack looks the following:
+
+?? --> access voilation exception
+??
+mono_jit_runtime_invoke()
+mono_runtime_invoke()
+mono_runtime_class_init()
+mono_jit_compile_method_inner()
+mono_jit_compile_method()
+mono_compile_method()
+ppc_magic_trampoline()
+??
+??
+
+------- Additional Comments From lupus@ximian.com  2003-12-13 12:12 -------
+Fixed in cvs.
+
+------- Additional Comments From piyush.garyali@honeywell.com  2003-12-17 02:52 -------
+The code crashes after it does a mono_jit_compile_method for 
+System.Single.IsNaN. To get an approximate postion, I checked on 
+windows and found that it comes again into mono_jit_compile_method 
+for System.HashTable.IsPrime. So, on my machine the crash is 
+somewhere between the two.
+
+The call stack for the crash looks something like this.
+
+??	
+??
+ppc_magic_trampoline() [Method: System.Single.IsNaN]
+ \- mono_compile_method() [Method: System.Single.IsNaN]
+    \- mono_jit_compile_method()[Method: System.Single.IsNaN]
+?? 
+(after it comes out of ppc_magic_trampoline, this is the code which 
+is executed)
+lwz r3, 0xc4(sp)
+lwz r4, 0xc0(sp) 
+lwz r5, 0xbc(sp)
+lwz r6, 0xb8(sp)
+lwz r7, 0xb4(sp)
+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)
+mtlr r0
+blrl
+ \->	mflr r0
+	stw r0, 4(sp)
+	stwu sp, -48(sp)
+	stfs f1, 0x24(sp)
+	lfs f3, 0x24(sp)
+	lfs f4, 0x24(sp)
+	fcmpo f3, f4
+	li r3, 0
+	bne 0x8f6cb0
+	li r3, 1
+	cmpwi r3, 0
+	li r3, 0
+	bne 0x8f6cc0
+	li r3, 1
+	lwz r0, 0x34(sp)
+	mtlr r0
+	addic sp, sp, 0x30
+	blr
+	 \->	lwz r11, 0(sp)
+		lwz r31, -4(r11)
+		mr  sp, r11
+		lwz r0, 4(sp)
+		mtlr
+		blr
+		\->	stb       r3, 0x38(sp)
+			cmpwi     r3, 0
+			beq       0x8f6ae0>>here
+			lis       r3, 0x8c
+			ori       r3, r3, 0x8c10
+			bl        0x2669b8
+			stw       r3, 0x3c(sp)
+			lis       r4, 0x8e
+			ori       r4, r4, 0x3a90
+			lis       r5, 0x8e
+			ori       r5, r5, 0x3a60
+			lwz       r6, 0x3c(sp)
+			mr        r3, r6
+			lwz       r0, 0(r6)
+			bl        0x8dcc00
+			lwz       r3, 0x3c(sp)
+			mr        r3, r3
+			bl        start(0x25c728)
+			cmplwi    r31, 0
+			bne       0x8f6af8
+			mr        r3, r31
+			addi      r3, r3, 1
+			stw       r3, 0x30(sp)
+			mr        r31, r3
+			lis       r11, 0x8e
+			ori       r11, r11, 0x3ec8
+			lfs       f9, 0(r11)
+			lfs       f3, 0x4c(sp)
+			fmul      f9, f9, f3
+			lfd       f3, 0x68(sp)
+			stfs      f9, 0x10(r30)
+			mr        r3, r31
+			li        r0, 0
+			lis       r0, 0x4330
+			stw       r3, -8(sp)
+			xoris     r3, r11, 0x8000
+			stw       r11, -4(sp)
+			lfd       f7, -8(sp)
+			li        r11, 0x138
+		<-----  lfd       f0, 0(r11)   --> crashes
+		<-----	fsub      f7, f7, f0   --> somewhere
+		<-----	lfs       f8, 0x10(r30)--> here!!
+			fdiv      f6, f7, f8
+			fmr       f5, f6
+			stfd      f5, 0x28(sp)
+			lfd       f3, 0x28(sp)
+			lis       r11, 0x8e
+			ori       r11, r11, 0x3f38
+			lfd       f4, 0(r11)
+			fcmpo     f3, f4
+			ble       0x8f6b98
+			lis       r3, 0x8c
+			ori       r3, r3, 0x8d00
+			bl        0x2669b8
+			stw       r3, 0x40(sp)
+			lis       r4, 0x8e
+
+Register contents at the time of crash
+pc	0x00001400
+sp	0x017643a0
+r0	0x43300000
+r1	0x017643a0
+r2	0x0025e280
+r3	0x808e3ec8
+r4	0x00000001
+r5	0x008e9108
+r6	0x00000000
+r7	0x00000000
+r8	0x00000000
+r9	0x00000000
+r10	0x00000000
+r11	0x00000138
+r12	0x008f6c88
+r13	0x00262a2c
+r14	0x01764e58
+r15	0x00000000
+r16	0x00000000
+r17	0x00000000
+r18	0x00000000
+r19	0x00000000
+r20	0x00000000
+r21	0x00000000
+r22	0x00000000
+r23	0x00000000
+r24	0x008bca98
+r25	0x008bcac0
+r26	0x00000001
+r27	0x00000000
+r28	0x00000000
+r29	0x00000000
+r30	0x008e9108
+r31	0x00000001
+
+------- Additional Comments From lupus@ximian.com  2003-12-17 07:38 -------
+The hashtable/isnan bug has been fixed in cvs on the 15th.
+make sure you have updated from cvs the mini-ppc.c file.
+Grep for CEE_CONV_R8 and a few lines later you'll find:
+ppc_load (code, ppc_r11, &adjust_val);
+The ppc assembly you pasted is the (wrong) assembly that was generated
+before the fix.
+
+------- Additional Comments From piyush.garyali@honeywell.com  2003-12-17 11:27 -------
+instead of ppc_load(code, ppc_r11, &adjust_val) I have ppc_li(code, 
+ppc_r11, &adjust_val) in my code and I checked it with the latest in 
+cvs and it reads the same.
+
+I am still getting the Access Voilation when running the following 
+assembly lines which is generated
+
+0x8f6b30:	39600138   li        r11, 0x138
+0x8f6b34:	c80b0000   lfd       f0, 0(r11)
+                           ^^^^^^^^^^^^^^^^^^^^^
+0x1400:         << Unreadable Memory >>
+
+The register contents are the following
+r11	0x00000138
+
+I tried changing it to ppc_load to see if that helps but it doesnt as 
+it gives a Warning in the compilation phase itself. So I guess I am 
+with the same code as in cvs
+
+
+------- Additional Comments From piyush.garyali@honeywell.com  2003-12-17 11:52 -------
+running on the old code, please ignore last comment. 
+
+My apologies. :(
+
+------- Additional Comments From piyush.garyali@honeywell.com  2003-12-19 16:06 -------
+Unfortunately this still is a problem. I am on the daily snapshot 
+dated 12/19/2003.
+
+..ENTER: System.String:Concat
+...ENTER: System.ArgumentOutOfRangeException:.ctor
+....ENTER: System.ArgumentException:.ctor 
+.....LEAVE: System.ArgumentException:.ctor
+....LEAVE: System.ArgumentOutOfRangeException:.ctor 
+
+attaching the assembly generated.
+
+