dotgnu-general
[Top][All Lists]
Advanced

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

Re: [Dotgnu-general] Porting dotnet to Minix 3


From: Alexander Samilovskih
Subject: Re: [Dotgnu-general] Porting dotnet to Minix 3
Date: Sun, 17 Feb 2013 12:48:36 +0700

I investigated it further and find out that code tries to malloc 0
bytes, there is problem in function DefaultValueAttribute -
attributeInfo->ctorArgs[0].evalValue.un.strValue.str is empty and it
is not related to virtual memory. I commented out
ILGenOutOfMemory(info) and was able to finish compilation without
other errors. I can compile helloworld, can disassemble it, but cannot
run it:
# cscc helloworld.cs
# ilrun a.out
Memory fault (core dumped)
#

# ildasm a.out
// Input: a.out
// Image type: EXE
// Native code present: No
// 32-bit only: No
// Length of IL data: 1536

.assembly extern mscorlib
{
        .ver 2:0:0:0
        .publickeytoken = (B7 7A 5C 56 19 34 E0 89)   // .z\V.4..
}
.assembly a
{
        .hash algorithm 0x00008004
        .ver 0:0:0:0
}
.module a.out
// MVID: {949EBA3B-D1E0-0B1A-DD29-E0CCB80C3831}
.class private auto ansi Program
    extends [mscorlib]System.Object
{
        .method private static hidebysig void Main() cil managed
        {
                // Start of method header: 2050
                .entrypoint
                .maxstack  8
        ?L2051:
                ldstr      "Hello world"
                call       void
[mscorlib]System.Console::WriteLine(class System.String)
                ret
        }
        .method public hidebysig specialname rtspecialname instance
void .ctor() cil managed
        {
                // Start of method header: 205c
                .maxstack  8
        ?L205d:
                ldarg.0
                call       instance void [mscorlib]System.Object::.ctor()
                ret
        }
}

and I couldnt get any stacktrace from core.

2013/2/16 Alexander Samilovskih <address@hidden>:
> I found out that message "virtual memory exhausted" comes out from
> pnet/codegen/cg_genattr.c function DefaultValueAttribute:
> utf16 = StringToUTF16(str, &blobLen,
> attributeInfo->ctorArgs[0].evalValue.un.strValue.len);
>                         if(!utf16)
>                         {
>                                 ILGenOutOfMemory(info);
>                         }
>
> StringToUTF16 returns 0 because ILMalloc failing here:
> utf16 = (char *)ILMalloc(*len * 2);
>
> Is it possible to reduce compilation size? I tried to choose different
> pnet-profiles, but with "kernel" there is a lot of link errors. I
> excluded networking from full-profile, but it did not help... I saw
> that pnetlib has separate profiles folder, but I configured it without
> any options(because in readme nothing said about profiles)
>
> 2013/2/12 Alexander Samilovskih <address@hidden>:
>> sorry, yes I meant dirent. Yes I tried this macro, but it ends up in
>> another segmentation fault, then i changed allocation a bit -
>> http://pastebin.com/cqFZtPYd
>> it helped me to compile valuable amount of code, but stops on this
>> http://pastebin.com/tfm4ZYZK
>> with virtual memory exhausted, my workaround bring memory leak in
>> code? or this is related to minix runtime. If i choose 128 bytes for
>> var result, then assersion from malloc.c thrown
>>
>> 2013/2/12 Aleksey Demakov <address@hidden>:
>>> Hi,
>>>
>>> Are you referring to struct dirent? I see there is BROKEN_DIRENT macro
>>> used in the code, can you check if defining it fixes your problem?
>>>
>>> Regards,
>>> Aleksey
>>>
>>> On Tue, Feb 12, 2013 at 5:33 PM, Alexander Samilovskih
>>> <address@hidden> wrote:
>>>> I think I found porting bug. In function ILReadDir: there is only
>>>> memory allocation for dentry, but no allocation for dentry->d_name,
>>>> which is on linux 256 bytes long, but it is not garanteed by POSIX, on
>>>> minix it is 1 byte long. This was the reason of segfault
>>>>
>>>> 2013/2/12 Alexander Samilovskih <address@hidden>:
>>>>> stack trace of csant, something wrong with walking directories
>>>>>
>>>>> +0x7fb98bf
>>>>> ILReadDir+0x15
>>>>> CSAntDirNext+0x32
>>>>> ProcessDirStack+0x9a6
>>>>> CSAntFileSetLoad+0xc9
>>>>> CSAntTask_ResGen+0x70
>>>>> BuildTarget+0x19a
>>>>> CSAntBuild+0x250
>>>>> main+0x503
>>>>> ___start+0xe2
>>>>> _start+0x17
>>>>>
>>>>> 2013/2/10 Alexander Samilovskih <address@hidden>:
>>>>>> switched compiler to gcc
>>>>>>
>>>>>> gmake[2]: Entering directory `/home/new/pnet/engine'
>>>>>> gcc -DHAVE_CONFIG_H -I. -I../include    -I../libffi/include -fno-gcse
>>>>>> -fno-inline-functions -fno-unit-at-a-time -I../support -I../libgc/incl
>>>>>> ude -I../libgc/libatomic_ops/src -I../include  -I../libffi/include -I.
>>>>>> -DBUILD_PROFILE_NAME="\"full\"" -g -O2 -Wall -c cctormgr.c
>>>>>> /usr/pkg/bin/bash ./mklabel.sh "awk" ./cvm.h >cvm_labels.h
>>>>>> gcc -DHAVE_CONFIG_H -I. -I../include    -I../libffi/include -fno-gcse
>>>>>> -fno-inline-functions -fno-unit-at-a-time -I../support -I../libgc/incl
>>>>>> ude -I../libgc/libatomic_ops/src -I../include  -I../libffi/include -I.
>>>>>> -DBUILD_PROFILE_NAME="\"full\"" -g -O2 -Wall -c cvm.c
>>>>>> In file included from cvm.c:834:
>>>>>> cvm_call.c: In function '_ILCVMInterpreter':
>>>>>> cvm_call.c:2127: warning: pointer targets in passing argument 1 of
>>>>>> 'ILInterlockedIncrement' differ in signedness
>>>>>> ../support/interlocked_x86.h:53: note: expected 'ILInt32 *' but
>>>>>> argument is of type 'ILUInt32 *'
>>>>>> cvm.c:597: warning: optimization may eliminate reads and/or writes to
>>>>>> register variables
>>>>>> cvm.c:597: warning: optimization may eliminate reads and/or writes to
>>>>>> register variables
>>>>>> cvm.c:597: warning: optimization may eliminate reads and/or writes to
>>>>>> register variables
>>>>>> cvm.c:985: error: unable to find a register to spill in class 'SIREG'
>>>>>> cvm.c:985: error: this is the insn:
>>>>>> (insn 418 413 419 27 cvm.c:74 (parallel [
>>>>>>             (set (reg:SI 2 cx [7087])
>>>>>>                 (const_int 0 [0x0]))
>>>>>>             (set (reg/f:SI 1 dx [orig:7085 stacktop.275 ] [7085])
>>>>>>                 (plus:SI (reg/f:SI 6864 [ stacktop.275 ])
>>>>>>                     (reg:SI 7079)))
>>>>>>             (set (reg:SI 0 ax [7086])
>>>>>>                 (plus:SI (reg:SI 0 ax [7083])
>>>>>>                     (reg:SI 7079)))
>>>>>>             (set (mem/s:BLK (reg/f:SI 6864 [ stacktop.275 ]) [0 A32])
>>>>>>                 (mem:BLK (reg:SI 0 ax [7083]) [0 A8]))
>>>>>>             (use (reg:SI 7079))
>>>>>>         ]) 637 {*rep_movqi} (expr_list:REG_DEAD (reg:SI 0 ax [7083])
>>>>>>         (expr_list:REG_DEAD (reg:SI 7079)
>>>>>>             (expr_list:REG_DEAD (reg/f:SI 6864 [ stacktop.275 ])
>>>>>>                 (expr_list:REG_UNUSED (reg:SI 2 cx [7087])
>>>>>>                     (expr_list:REG_UNUSED (reg:SI 0 ax [7086])
>>>>>>                         (expr_list:REG_UNUSED (reg/f:SI 1 dx
>>>>>> [orig:7085 stacktop.275 ] [7085])
>>>>>>                             (nil))))))))
>>>>>> cvm.c:985: confused by earlier errors, bailing out
>>>>>> gmake[2]: *** [cvm.o] Error 1



reply via email to

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