[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
GameMonkey Script • View topic - 64-bit gmLibHooks.cpp assertion fails

GameMonkey Script

GameMonkey Script Forums
It is currently Sat Sep 26, 2020 9:49 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Mon Oct 08, 2018 11:00 am 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15
Continuing the talk about the 64-bit issue: "gmLibHooks.cpp" throws an assertion exception.
viewtopic.php?p=3111#p3111

<code>
*reference = a_machine.AllocPermanantStringObject(&stringTable[*reference])->GetRef();
</code>

In "gmConfig_p.h" changed the "#if 0" to "#if 1" (to use 64-bit data types) and "GM_PTR_SIZE_64" is also set. But this made no difference.

I don't think I can reproduce the bug in gme. If you have no idea, I'll try to provide what I find when I dig into the problem further (or I may try to circumvent it).


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 09, 2018 10:51 am 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 09, 2018 11:20 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708
No ideas yet. I did examine the code, but every part I looked at appeared okay. I examined the code generation and execution sections related to your description.

1) You said it asserted in gmLibHooks::BindLib() after case BC_SETGLOBAL. Can you please tell me the exact instruction that was being processed? eg. (eg. BC_GETGLOBAL)
This is the value used by the switch statement: switch(*(instruction32++))

2) At the assert location
GM_ASSERT(*reference >= 0 && *reference < (gmptr) strings.m_size);
What is the full value of *reference in hex?
I'd like to see the upper and lower 32bit words.

3) You've examined the gmConfig_p.h file. Can you please check that the file you're looking at is the one being used?
You can place #error in the code, compile, and confirm that line of code is being compiled.

4) You said your build is 64bit. Can you confirm _M_X64 and GM_PTR_SIZE_64 are set and being used correctly. You can sizeof(gmptr) to verify etc.

5) See if you can make a stand alone reproduction case that I can run using just GME to execute plain script.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 09, 2018 11:35 am 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15
Thank you Greg!

I'll examine it further. Already do.

I previously said that "foreach(k in l) { }" causes the assertion, forget that, actually that does not seem true. I just got it running without the assertion a few times.

So at this point I'm confused and will try to follow your steps.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 09, 2018 1:49 pm 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15


Last edited by bavoha on Tue Oct 09, 2018 2:57 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 09, 2018 2:42 pm 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15
Ok, I figured the first part of the binary is the string table. Then the length and the instructions/functions. Leaves the puzzle why the instructions on 32 and 64 bit come out different in BindLib.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 09, 2018 2:50 pm 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 09, 2018 3:08 pm 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15
Yep, the "foreach" opcode is too short in 64-bit. You see the 0x38 that it then uses as the next instruction.

I have no idea where to fix this tho.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 10, 2018 8:18 am 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 10, 2018 9:00 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708
Excellent detective work there!
The foreach was indeed inconsistently sized.
I've pushed a fix for this. Please let me know if it works well for you.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 10, 2018 9:23 am 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15
Thank you!

Looks like it works, I've a pretty complex script with a dozent of foreach's that I now run without problems :)

I've to add, I now use gmscript for more than 6 years now, including it in dozens of projects and this was the first problem I ever had. Excellent library!

After reaching 64-bit and MacOS support, my next big goal is to integrate a debugger :)

Have a great day, I will now :)


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 10, 2018 9:55 am 
Offline

Joined: Fri Nov 04, 2016 11:43 pm
Posts: 15


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 10, 2018 10:47 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708
Your fall through case fix is correct, thanks!

Great to hear you've made good use of GM.
I still think it remains a pretty cool and useful tool.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group