Hi All! I'm working on the Android VM. (https://github.com/sbragagnolo/pharo-vm) So far I made my way on my own(I have a working compilation of the stack vm for android functional, but without uffi and quite slow ). But now i have a problem that I don't understand at all, i would like if someone can point me a clue :).
Im working on the VM+Jit for android. The device i'am using to test is a wiko pulp 4g[1], processor Quad-core 1.2 GHz Cortex-A53 with support for 32bits/64bits instructions [2]
I am compiling the VM with the following maker options:
*maker options: #(* * ObjectMemory Spur32BitCoMemoryManager* * FailImbalancedPrimitives false* * CogCompilerClass CogOutOfLineLiteralsARMCompiler* * ISA ARMv5).*
After some manual post processing (related to an other question that i will do in other thread), I arrive to compile and deploy the application in to my device.
But when I open the application I am having the following assertion failure ( defined in sqCogStackAlignment.h ),
*assert((getfp() & STACK_ALIGN_MASK) == STACK_FP_ALIGNMENT);*
and failing in the second call for the assertion, on the generated function *generateStackPointerCapture* on the generated file *cogitARMv5.c*, based on the method *Cogit>>#generateStackPointerCapture, *and not finishing the process, but just failing many other times in the same assertion (not sure if on the same function)
*=====================* static void generateStackPointerCapture(void) { sqInt oldMethodZoneBase; sqInt oldTrampolineTableIndex;
/* For the benefit of the following assert, assume the minimum at first. */ cFramePointerInUse = 0; assertCStackWellAligned(); oldMethodZoneBase = methodZoneBase; oldTrampolineTableIndex = trampolineTableIndex; generateCaptureCStackPointers(1); ceCaptureCStackPointers(); if (!((cFramePointerInUse = isCFramePointerInUse()))) { methodZoneBase = oldMethodZoneBase; trampolineTableIndex = oldTrampolineTableIndex; generateCaptureCStackPointers(0); } assertCStackWellAligned(); *// it fails Here* } *======================*
Here I'm lacking understanding, and even when after some painful time I arrived to be able to debug on my device when I leave the debugger just to run and randomly interrupt the process to know where is failing constantly (i'm almost sure that is an infinite loop, because of the standard output) It just die, or it stops without showing code, since is the code stored on the assembly files.
I have two obvious questions:
1) does the prepareVmMaker method that I defined makes sense? 2) any body can give me a hint about how to debug better this problem?
And finally, does any body have a hint in general about what can it be?
[1] http://www.gsmarena.com/wiko_pulp_4g-7811.php [2] http://www.arm.com/products/processors/cortex-a/cortex-a53-processor.php
Well the obvious candidate problem is that you don’t have the alignment of the stack sorted out yet. It certainly took some time to work it out or the initial linux/Pi cog.
Look into the required stack alignment for android - it is 4 byte, 8 byte, 16? Does it vary by some context dependent rule? Does your getfp() function actually return the frame pointer? Does android even use a frame pointer?
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Debugger: A tool that substitutes afterthought for forethought.
On Wed, Oct 5, 2016 at 5:29 PM, Santiago Bragagnolo < santiagobragagnolo@gmail.com> wrote:
Hi All! I'm working on the Android VM. (https://github.com/sbragagnolo/pharo-vm) So far I made my way on my own(I have a working compilation of the stack vm for android functional, but without uffi and quite slow ). But now i have a problem that I don't understand at all, i would like if someone can point me a clue :).
Im working on the VM+Jit for android. The device i'am using to test is a wiko pulp 4g[1], processor Quad-core 1.2 GHz Cortex-A53 with support for 32bits/64bits instructions [2]
I am compiling the VM with the following maker options:
*maker options: #(*
- ObjectMemory Spur32BitCoMemoryManager*
- FailImbalancedPrimitives false*
- CogCompilerClass CogOutOfLineLiteralsARMCompiler*
- ISA ARMv5).*
After some manual post processing (related to an other question that i will do in other thread), I arrive to compile and deploy the application in to my device.
But when I open the application I am having the following assertion failure ( defined in sqCogStackAlignment.h ),
*assert((getfp() & STACK_ALIGN_MASK) == STACK_FP_ALIGNMENT);*
and failing in the second call for the assertion, on the generated function *generateStackPointerCapture* on the generated file *cogitARMv5.c*, based on the method *Cogit>>#generateStackPointerCapture, *and not finishing the process, but just failing many other times in the same assertion (not sure if on the same function)
*=====================* static void generateStackPointerCapture(void) { sqInt oldMethodZoneBase; sqInt oldTrampolineTableIndex;
/* For the benefit of the following assert, assume the minimum at first. */ cFramePointerInUse = 0; assertCStackWellAligned(); oldMethodZoneBase = methodZoneBase; oldTrampolineTableIndex = trampolineTableIndex; generateCaptureCStackPointers(1); ceCaptureCStackPointers(); if (!((cFramePointerInUse = isCFramePointerInUse()))) { methodZoneBase = oldMethodZoneBase; trampolineTableIndex = oldTrampolineTableIndex; generateCaptureCStackPointers(0); } assertCStackWellAligned(); *// it fails Here* } *======================*
Here I'm lacking understanding, and even when after some painful time I arrived to be able to debug on my device when I leave the debugger just to run and randomly interrupt the process to know where is failing constantly (i'm almost sure that is an infinite loop, because of the standard output) It just die, or it stops without showing code, since is the code stored on the assembly files.
I have two obvious questions:
- does the prepareVmMaker method that I defined makes sense?
Look strange.
FailImbalancedPrimitives false => for the VM without the JIT. The default is true, just write nothing instead.
CogCompilerClass CogOutOfLineLiteralsARMCompiler ISA ARMv5 => The VM is generated for all back-ends on the word size. Just write nothing instead.
I believe maker options: #(ObjectMemory Spur32BitCoMemoryManager) is enough.
- any body can give me a hint about how to debug better this problem?
And finally, does any body have a hint in general about what can it be?
[1] http://www.gsmarena.com/wiko_pulp_4g-7811.php [2] http://www.arm.com/products/processors/cortex-a/cortex- a53-processor.php
vm-dev@lists.squeakfoundation.org