Building stack VM on windows fails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Building stack VM on windows fails

Igor Stasenko
 
There are two undefined symbols:


Linking C executable results/StackVM.exe
Creating library file: results/libStackVM.dll.a
CMakeFiles/StackVM.dir/objects.a(gcc3x-interp.c.obj): In function `returnAsThrou
ghCallbackContext':
c:/hudson/workspace/StackWin32/cog/src/vm/gcc3x-interp.c:34699: undefined refere
nce to `siglongjmp'
CMakeFiles/StackVM.dir/objects.a(sqWin32Prefs.c.obj): In function `CreatePrefsMe
nu':
c:/hudson/workspace/StackWin32/cog/platforms/win32/vm/sqWin32Prefs.c:374: undefi
ned reference to `recordPrimTraceFunc'


 - siglongjmp
(it is found however in cointerp.c so JIT-flavored VMs don't have this
problem, but not stack ones)


The recordPrimTraceFunc() are used like following:

#if STACKVM
extern sqInt recordPrimTraceFunc();
#endif
...
#if STACKVM
    if (recordPrimTraceFunc())
      AppendMenu(hMenu, MF_STRING | MF_UNCHECKED, ID_DUMPPRIMLOG,
               TEXT("Dump recent primitives"));
#endif


again, it is defined in cogit.h/.c but obviously not in stack
interpreter, since stack not using cogit.

Maybe you meant
#if !STACKVM
?
Then it makes sense.

--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: Building stack VM on windows fails

Eliot Miranda-2
 
Hi Igor,

On Thu, Jun 30, 2011 at 11:05 AM, Igor Stasenko <[hidden email]> wrote:
 
There are two undefined symbols:


Linking C executable results/StackVM.exe
Creating library file: results/libStackVM.dll.a
CMakeFiles/StackVM.dir/objects.a(gcc3x-interp.c.obj): In function `returnAsThrou
ghCallbackContext':
c:/hudson/workspace/StackWin32/cog/src/vm/gcc3x-interp.c:34699: undefined refere
nce to `siglongjmp'
CMakeFiles/StackVM.dir/objects.a(sqWin32Prefs.c.obj): In function `CreatePrefsMe
nu':
c:/hudson/workspace/StackWin32/cog/platforms/win32/vm/sqWin32Prefs.c:374: undefi
ned reference to `recordPrimTraceFunc'

You need to generate the following defines at the start of interpreter C file. See e.g. gcc3x-cointerp.c.

/*
 * Define sigsetjmp and siglongjmp to be the most minimal setjmp/longjmp available on the platform.
 */
#if WIN32
# define sigsetjmp(jb,ssmf) setjmp(jb)
# define siglongjmp(jb,v) longjmp(jb,v)
#else
# define sigsetjmp(jb,ssmf) _setjmp(jb)
# define siglongjmp(jb,v) _longjmp(jb,v)
#endif 


In Cog setjmp is used a lot to jump form machine code back into the interpreter, so choosing the most minimal setjmp/longjmp is important.  Alas both Win32 and Unix have their own different ideas as to what a minimal setjmp/longjmp is (see sigsetjmp(3) on unix).  In my VMMaker the defines are generated in CoInterpreter class>>preambleCCode and NewspeakInterpreter class>preambleCCode.  Looks like the CoInterpreter one needs moving up to StackInterpreter right?




 - siglongjmp
(it is found however in cointerp.c so JIT-flavored VMs don't have this
problem, but not stack ones)


The recordPrimTraceFunc() are used like following:

#if STACKVM
extern sqInt recordPrimTraceFunc();
#endif
...
#if STACKVM
   if (recordPrimTraceFunc())
     AppendMenu(hMenu, MF_STRING | MF_UNCHECKED, ID_DUMPPRIMLOG,
              TEXT("Dump recent primitives"));
#endif


again, it is defined in cogit.h/.c but obviously not in stack
interpreter, since stack not using cogit.

Maybe you meant
#if !STACKVM
?
Then it makes sense.

--
Best regards,
Igor Stasenko AKA sig.




--
best,
Eliot

Reply | Threaded
Open this post in threaded view
|

Re: Building stack VM on windows fails

Igor Stasenko

On 4 July 2011 19:37, Eliot Miranda <[hidden email]> wrote:

>
> Hi Igor,
>
> On Thu, Jun 30, 2011 at 11:05 AM, Igor Stasenko <[hidden email]> wrote:
>>
>>
>> There are two undefined symbols:
>>
>>
>> Linking C executable results/StackVM.exe
>> Creating library file: results/libStackVM.dll.a
>> CMakeFiles/StackVM.dir/objects.a(gcc3x-interp.c.obj): In function `returnAsThrou
>> ghCallbackContext':
>> c:/hudson/workspace/StackWin32/cog/src/vm/gcc3x-interp.c:34699: undefined refere
>> nce to `siglongjmp'
>> CMakeFiles/StackVM.dir/objects.a(sqWin32Prefs.c.obj): In function `CreatePrefsMe
>> nu':
>> c:/hudson/workspace/StackWin32/cog/platforms/win32/vm/sqWin32Prefs.c:374: undefi
>> ned reference to `recordPrimTraceFunc'
>
> You need to generate the following defines at the start of interpreter C file. See e.g. gcc3x-cointerp.c.
> /*
>  * Define sigsetjmp and siglongjmp to be the most minimal setjmp/longjmp available on the platform.
>  */
> #if WIN32
> # define sigsetjmp(jb,ssmf) setjmp(jb)
> # define siglongjmp(jb,v) longjmp(jb,v)
> #else
> # define sigsetjmp(jb,ssmf) _setjmp(jb)
> # define siglongjmp(jb,v) _longjmp(jb,v)
> #endif
>
> In Cog setjmp is used a lot to jump form machine code back into the interpreter, so choosing the most minimal setjmp/longjmp is important.  Alas both Win32 and Unix have their own different ideas as to what a minimal setjmp/longjmp is (see sigsetjmp(3) on unix).  In my VMMaker the defines are generated in CoInterpreter class>>preambleCCode and NewspeakInterpreter class>preambleCCode.  Looks like the CoInterpreter one needs moving up to StackInterpreter right?
>

I guess so. Since these macros are used in stack vm as well.

And what about  recordPrimTraceFunc() is my guess are correct that it
should be used with
#if COGVM
instead of
#if STACKVM
?

>>
>>
>>  - siglongjmp
>> (it is found however in cointerp.c so JIT-flavored VMs don't have this
>> problem, but not stack ones)
>>
>>
>> The recordPrimTraceFunc() are used like following:
>>
>> #if STACKVM
>> extern sqInt recordPrimTraceFunc();
>> #endif
>> ...
>> #if STACKVM
>>    if (recordPrimTraceFunc())
>>      AppendMenu(hMenu, MF_STRING | MF_UNCHECKED, ID_DUMPPRIMLOG,
>>               TEXT("Dump recent primitives"));
>> #endif
>>
>>
>> again, it is defined in cogit.h/.c but obviously not in stack
>> interpreter, since stack not using cogit.
>>
>> Maybe you meant
>> #if !STACKVM
>> ?
>> Then it makes sense.
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>
>
>
> --
> best,
> Eliot
>
>



--
Best regards,
Igor Stasenko AKA sig.