[Vm-dev] ARM Cog progress

Eliot Miranda eliot.miranda at gmail.com
Thu Jun 11 22:45:19 UTC 2015


Hi Ryan,

On Tue, Jun 9, 2015 at 10:58 PM, Ryan Macnak <rmacnak at gmail.com> wrote:

>
> On Tue, Jun 9, 2015 at 8:36 AM, Eliot Miranda <eliot.miranda at gmail.com>
> wrote:
>>
>> Hi Ryan,
>>
>>     IMO the likely issue is register usage in trampoline calls.  The JIT
>> tries to reduce register saving and restoring across trampoline calls by
>> using a notion of the ABI's caller-saved registers.  Callee-saved registers
>> shouldn't be an issue because either a run-time call returns to the same
>> trampoline that invoked it, hence restoring callee-saved registers, or
>> enters machine code via an enlopmart which assumes no registers are live
>> and restores any and all registers as appropriate.  But there could be bugs
>> here, and certainly gcc could change over versions, perhaps becoming more
>> aggressive in register saving, and surfacing previously undetected bugs
>> here.
>>
>
> I've been using the same compiler versions though, did this change
> recently in Cog?
>
> The runtime entries should be marked "extern". Compare a VM that works at
> -O3.
> <https://github.com/dart-lang/sdk/blob/6542a451c38c650a5ce9323e474982384a5daf31/runtime/vm/runtime_entry.h#L67>
>

OK, so the compiler is interpreting "void foo(decl)" differently to "extern
void foo(decl); void foo(decl)".  Back in the day these were equivalent and
C compilers only teated "static" as meaningful.  e.g. The C Programming
Language, 2nd ed, sec A11.2 Linkage, p 228:
    "As discussed in §A10.2, the first external declaration for an
identifier gives the identifier internal linkage if the static specifier is
used, external linkage otherwise."
but I guess providing optimized intra-compilation-unit linkage produces
some benefits.  Anyway, see VMMaker.oscog-eem.1349 which now spits out
extern or static for each function declaration.  I'll commit C source soon.


> Some quick and dirty sed hacking and this partially fixes NSVM on clang
> 3.4 (can now complete the test suite without crashing about half of the
> time).
>
> find ns*src -name '*.c' -o -name '*.h' -print0 | xargs -0 sed -i '' -e
> 's/void ce/extern void ce/'
> find ns*src -name '*.c' -o -name '*.h' -print0 | xargs -0 sed -i '' -e
> 's/void (\*ce/extern void (\*ce/'
> find ns*src -name '*.c' -o -name '*.h' -print0 | xargs -0 sed -i '' -e
> 's/sqInt ce/extern sqInt ce/'
> find ns*src -name '*.c' -o -name '*.h' -print0 | xargs -0 sed -i '' -e
> 's/VM_EXPORT extern/extern/'
> find ns*src -name '*.c' -o -name '*.h' -print0 | xargs -0 sed -i '' -e
> 's/static extern/static/'
> find ns*src -name '*.c' -o -name '*.h' -print0 | xargs -0 sed -i '' -e
> 's/extern sqInt cesoRetAddr/sqInt cesoRetAddr/'
>
> One thing to do is compare a StackInterpreter VM against Cog, at least to
>> locate the blame.
>
>
> The stack VM is fine.
>
>
>
>
>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150611/5972f019/attachment.htm


More information about the Vm-dev mailing list