[Vm-dev] 64-bit stack vm: Help needed: we need quick implementation for those symbols on x64 platform

Igor Stasenko siguctua at gmail.com
Tue Aug 28 22:05:43 UTC 2012


Thanks, Eliot.
Guillermo started working on that thing, and i really hope with our
help he will manage to do it.
And then once we will have 64-bit stack VM working, it will open a
straight road to 64-bit jit implementation.


On 28 August 2012 20:44, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
>
>
> On Tue, Aug 28, 2012 at 8:47 AM, Guillermo Polito <guillermopolito at gmail.com> wrote:
>>
>>
>> the rest is COMPILED
>> this is the only thing which prevents from linking StackVM and getting a binary on Mac OSX.
>> Since x86 are similar to x64. i expect this can be done without much changes in assembler code.
>>
>> Please help/advice.
>>
>> Undefined symbols for architecture x86_64:
>>   "_sqLowLevelMFence", referenced from:
>>       _forceInterruptCheck in gcc3x-interp.c.o
>>       _primitiveLongRunningPrimitiveSemaphore in gcc3x-interp.c.o
>>       _markAndTraceInterpreterOops in gcc3x-interp.c.o
>>       _primitiveDoPrimitiveWithArgs in gcc3x-interp.c.o
>>       _beRootIfOld in gcc3x-interp.c.o
>>       _updatePointersInRangeFromto in gcc3x-interp.c.o
>>       _setInterruptPending in gcc3x-interp.c.o
>>       ...
>>   "_sqCompareAndSwapRes", referenced from:
>>       _signalSemaphoreWithIndex in sqExternalSemaphores.c.o
>
>
> this line in platforms/Cross/vm/sqMemoryFence.h should work fine:
>
>  #   define sqLowLevelMFence() asm volatile ("mfence")
>
>> ld: symbol(s) not found for architecture x86_64
>> collect2: ld returned 1 exit status
>> make[2]: *** [/Users/guillermopolito/Pharo/vm/self-compiled/blessed/results/StackVM.app/Contents/MacOS/StackVM] Error 1
>> make[1]: *** [CMakeFiles/StackVM.dir/all] Error 2
>> make: *** [all] Error 2
>>
>
> again the macro definitions in platforms/Cross/vm/sqAtomicOps.h shoild be fine:
>
> # define sqCompareAndSwap(var,old,new) \
>     asm volatile ("movl %1, %%eax; lock cmpxchg %2, %0" \
>                     : "=m"(var) \
>                     : "g"(old), "r"(new), "m"(var)\
>                     : "memory", "%eax")
>
> # define sqCompareAndSwapRes(var,old,new,res) \
>     asm volatile ("movl %2, %%eax; lock cmpxchg %3, %0; movl %%eax, %1" \
>                     : "=m"(var), "=g"(res) \
>                     : "g"(old), "r"(new), "m"(var) \
>                     : "memory", "%eax")
>
> All you have to do is take these definitions and add them in a separate arm for x86-64, e.g.
>
> #if defined(__GNUC__) && (defined(i386) || defined(__i386) || defined(__i386__) || defined(_X86_))
> ....existing definitions...
> #else
> ...
>
> becomes
>
> #if defined(__GNUC__)
> #   if defined(i386) || defined(__i386) || defined(__i386__) || defined(_X86_))
> ....existing definitions...
> #   elif defined(x64) /* or whatever else x86-64 is called */
> ....copy of x86 definitions that use assembler (i.e. *not*  asm volatile (".byte 0x0f;.byte 0xae;.byte 0xf0")) ...
> #   endif
> #else
> ...
>
>
> --
> best,
> Eliot
>
>



-- 
Best regards,
Igor Stasenko.


More information about the Vm-dev mailing list