ncave / dna-redux

Running C#/F# code in Node.js or Browser with WebAssembly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

segfaults on ARM32 (armv7a)

eloraiby opened this issue · comments

@ncave building DNA on armv7a (native) and running helloworld.dll would segfault. An F# hello world application on ARM would run if System.Console.WriteLine is used, but printfn will segfault when writing a string (unrelated to missing CustomAttributeData). Have you been able to run it on ARM ?

@eloraiby No, I haven't tried it on ARM. Does the same code work on other platforms? Are you using printfn "%A"? Cause that doesn't work yet, try using the other format parameters, like "%s" or "%d" or "%O".

@ncave I am using printfn "%s", printfn "%A" will not execute since it's missing the custom attribute data implementation. I am still working in it and hope we can collaborate on this issue.

Side note: Valgrind is showing memory leaks and at least 2 memory corruptions when executing a hello world.

Are you planning on implementing customattributedata soon ? any road map a la F# status page ? :)

@eloraiby I can try adding it, let me know if you figure out what's causing the ARM segfault or the memory leaks (those were noted in the Bugs.txt, but no cause was given).

@eloraiby I checked in some progress on the printfn %A, it works now with one reference type parameter.
Had nothing to do with CustomAttributeData, so I didn't add that (it's not being used anywhere).

@ncave thanks, I will update and check. I suspect the segfault has to do with memory alignment. This will take a day or two to confirm and will be back to you with results.

@ncave I have updated an execution dump for ARM32, you can find it on:
dump

This is from appcs.dll, if you have an idea, it might accelerate my work. Nonetheless, I m closing in.

I have tried an am64 build on linux, it crashes in the metadataphase. (more on that when I finish with the arm32 bug)

@eloraiby Thanks, I'm trying to fix the ldfld with boxed value types larger than 4 bytes, so printfn %A can do doubles, longs, etc.

Do you mind sharing the source for this dump, or is it in your fork? Is it only failing on ARM, or in the browser/node/windows too?

@ncave the source is in my repo, activated DEBUG_PRINT and _DEBUG + few fprintf(stderr,...). Will take a deeper look tonight. Keep me posted please if you end up finding the root cause before me.

@eloraiby You can enable the JIT op printing to see which one is actually failing.

@ncave indeed that's what I used.

@ncave a helloworld app with Console.WriteLine("Hello World") works, Console.WriteLine("Hello World {0}", 1); crashes on JIT_BLT_I32I32_end, in StringBuilder::Append.

@eloraiby Awesome, thanks for narrowing it down. Do you have an easy setup to test ARM, do you mind sharing your flow? Does it work on ARMv8?

@ncave no armv8 yet, I m using an asus chromebook c201 (arm rockchip) with crouton. it's faster/easier to debug arm directly. I believe you can achieve the same on a raspberry pi 3 or odroid. qemu might be slower but is feasable.

@ncave fixed it :), will make a pull request with the fix.

fixed with #15 , closing