The following patch fixes the runtime crash for me.
But the issue is not the runtime, but a compiler bug since mcs generates
an int64 on stack as argument for newarr and this not correct.
Zoltan, please review & commit my patch.
Cheers,
Rodrigo
On Sat, Sep 19, 2009 at 6:29 AM, Marco Cecconi <[email protected]>wrote:
> Hello, I am running mono 2.4.2.3 under MacOSX Snow Leopard.
>
> marco-cecconis-macbook-pro:Debug marcocecconi$ cat ../../Main.cs
> using System;
>
> namespace Primes
> {
> class MainClass
> {
> public static void Main (string[] args)
> {
> const ulong max = 1000;
>
> bool[] numbers = new bool[max];
>
> for (ulong i = 0; i<max; i++)
> numbers[i] = true;
>
> for (ulong j = 1; j<max; j++)
> for (ulong k = (j+1)*2; k<max; k+=j+1)
> numbers[k] = false;
>
> for (ulong i = 0; i<max; i++)
> if (numbers[i])
> Console.WriteLine(i+1);
>
> Console.ReadLine();
>
> }
> }
> }
> marco-cecconis-macbook-pro:Debug marcocecconi$ mono -V
> Mono JIT compiler version 2.4.2.3 (tarball Mon Aug 31 09:54:11 MDT 2009)
> Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
> TLS: normal
> GC: Included Boehm (with typed GC)
> SIGSEGV: normal
> Notification: Thread + polling
> Architecture: x86
> Disabled: none
> marco-cecconis-macbook-pro:Debug marcocecconi$ mono -v Primes.exe
> Method (wrapper runtime-invoke) object:runtime_invoke_void__this___object
> (object,intptr,intptr,intptr) emitted at 0x8ed040 to 0x8ed0fd (code length
> 189) [Primes.exe]
> Method System.OutOfMemoryException:.ctor (string) emitted at 0x8ed100 to
> 0x8ed123 (code length 35) [Primes.exe]
> Method System.SystemException:.ctor (string) emitted at 0x8ed130 to
> 0x8ed153 (code length 35) [Primes.exe]
> Method System.Exception:.ctor (string) emitted at 0x8ed160 to 0x8ed178
> (code length 24) [Primes.exe]
> Method System.NullReferenceException:.ctor (string) emitted at 0x8ed178 to
> 0x8ed19b (code length 35) [Primes.exe]
> Method System.StackOverflowException:.ctor (string) emitted at 0x8ed1a0 to
> 0x8ed1b9 (code length 25) [Primes.exe]
> Method (wrapper runtime-invoke) Primes.MainClass:runtime_invoke_void_object
> (object,intptr,intptr,intptr) emitted at 0x8ed1c0 to 0x8ed27a (code length
> 186) [Primes.exe]
> **
> *ERROR:mini-codegen.c:1032:mono_local_regalloc: assertion failed: (reginfo
> [ins->sreg1].born_in > 0)
> Stacktrace:
>
> Abort trap*
>
>
> Marco Cecconi
> Encrypt your messages to me using this key: http://tinyurl.com/nhy4w
>
>
>
> _______________________________________________
> Mono-list maillist - [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c
index d0eaf97..3f18e21 100644
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -8425,6 +8425,15 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
if (cfg->generic_sharing_context)
context_used = mono_class_check_context_used (klass);
+ if (sp [0]->type == STACK_I8 || (SIZEOF_VOID_P == 8 && sp [0]->type == STACK_PTR)) {
+ MONO_INST_NEW (cfg, ins, OP_LCONV_TO_I4);
+ ins->sreg1 = sp [0]->dreg;
+ ins->type = STACK_I4;
+ ins->dreg = alloc_ireg (cfg);
+ MONO_ADD_INS (cfg->cbb, ins);
+ *sp = ins;
+ }
+
if (context_used) {
MonoInst *args [2];
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list