GameMonkey Script

GitHub respository
Page 1 of 1

Author:  Greg [ Sun Mar 08, 2015 3:38 am ]
Post subject:  GitHub respository

I'm experimentally hosting my GMScript branch and some other FOSS projects on GitHub.
Please find them here:

Author:  Wingrove [ Wed Apr 25, 2018 11:24 am ]
Post subject:  Re: GitHub respository

Hi Greg, are you still using that repository? Is it worth checking out and playing around with?

Author:  Greg [ Wed Apr 25, 2018 10:27 pm ]
Post subject:  Re: GitHub respository

Welcome Wingrove :)

Yes, I am still using that repo and have recently done maintenance to ensure it compiles with VS2017 and has improved 64bit value support. I'm mostly using GM these days as a debug console interpreter, for debugging and testing applications.

If you're new to GM and want to play with it, that repo is a reasonably starting place. Other people have extended the language with various useful features. I can't speak for the status of any other projects or repos though.

Author:  bavoha [ Fri Oct 05, 2018 12:29 pm ]
Post subject:  Re: GitHub respository

Hey Greg,

I think I have a 64 bit issue, as my code runs very stable under 32-bit. I'm kinda lost how to fix it, trying for a while now...

In "gmLibHooks.cpp" an assertion throws an exception:

        case BC_GETDOT :
        case BC_SETDOT :
        case BC_GETTHIS :
        case BC_SETTHIS :
        case BC_GETGLOBAL :
        case BC_SETGLOBAL :
          gmptr * reference = (gmptr *) instruction;
          GM_ASSERT(*reference >= 0 && *reference < (gmptr) strings.m_size);
          *reference = a_machine.AllocPermanantStringObject(&stringTable[*reference])->GetRef();
          instruction += sizeof(gmptr);

This is while calling "ExecuteLib" in gmMachine. I believe it is because "instruction" is 32-bit wide but "reference" is 64-bit. It kinda randomly generates exception, indicating that the upper Dword is not allocated. Now I'm puzzled if the instructions should be 64-bit. As you see, the reference is updated with a 64-bit pointer.

Have you an idea how to fix it?


Author:  Greg [ Fri Oct 05, 2018 12:58 pm ]
Post subject:  Re: GitHub respository

Welcome back Bastian. I'll try to look into this soon.

I think you're saying that '*reference' appears to have a valid string index in the lower 32bit but junk in the higher 32bit as if not initialized properly?

1) Can you please tell me how your gmConfig_p.h defines gmint, gmfloat and gmptr?
2) Can you reproduce this by running gme.exe with a small script?
3) Which instruction was being executed at the time of the assert, and is it the same each time it fires? (eg. BC_SETGLOBAL)

Those things would be most helpful to investigate.

Author:  bavoha [ Fri Oct 05, 2018 1:18 pm ]
Post subject:  Re: GitHub respository

Hi Greg, thank you! I use gm-script a lot. Thank you for the quick response and excellent library!

I found this suspicious piece of code that is taken from "gmsrc/src/platform/win32msvc". Looks wrong to begin with (#if 1).

#if 1 // 32bit int
typedef int gmint;
typedef unsigned int gmuint;
#else // 64bit int
typedef __int64 gmint;
typedef unsigned __int64 gmuint;
#if 1 // 32bit float
typedef float gmfloat;
#else // 64bit float
typedef double gmfloat;

I will provide more info on Monday (gotta run). I've this bug on Windows and MacOS, I try to port xstart to 64-bit and MacOS (which should then work soon; along with compilation to stand-alone executable and more). I think reproducing is not that straightforward, I use game-monkey libraries for compilation of "include" files, that is where trouble is. But in 32-bit that works rock-solid.

   // add source to machine
   gmStreamBufferDynamic *stream = new gmStreamBufferDynamic();
   machine->CompileStringToLib(buffer, *stream);
   machine->ExecuteLib(*stream, 0, true, file, 0);
   machine->AddSourceCode(buffer, file);
   delete stream;

It fails at "BindLib" then:

bool gmMachine::ExecuteLib(gmStream &a_stream, int * a_threadId, bool a_now, const char * a_filename, gmVariable* a_this)
  gmFunctionObject * rootFunction = gmLibHooks::BindLib(*this, a_stream, a_filename);

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group