YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Some bugs in compiler and VM
VoidSpirit
#1 Posted : Wednesday, July 18, 2018 10:32:04 AM(UTC)
Rank: Member

Groups: Registered
Joined: 12/27/2016(UTC)
Posts: 10

Thanks: 0 times
Was thanked: 2 time(s) in 2 post(s)
I have found some bugs:

1. File "sqcompiler.cpp", all calls as:
_fs->AddInstruction(_OP_NEWOBJ, _fs->PushTarget(),0,NOT_TABLE);
here one argument before NOT_TABLE is missed. It works because NOT_TABLE==0

2. File "sqvm.cpp", call of MT_NEXTI for OT_INSTANCE in SQVM::FOREACH_OP:
after calling '_nexti' metamethod next iterator used for call of Get:
if(CallMetaMethod(closure, MT_NEXTI, 2, itr)) {
o4 = o2 = itr;
if(type(itr) == OT_NULL) _FINISH(exitpos);
if(!Get(o1, itr, o3, 0, DONT_FALL_BACK)) {
as a result, first item in enumeration will be missed.
fagiano
#2 Posted : Monday, July 30, 2018 4:56:44 AM(UTC)
Rank: Advanced Member

Groups: Registered, Administrators
Joined: 6/11/2005(UTC)
Posts: 1,060

Thanks: 0 times
Was thanked: 79 time(s) in 61 post(s)
Hi,

1) yes this is a bug, it doens't break anything but must be fixed(thank you)
2) I don't understand what you mean.

ciao
Alberto
Follow me on Twitter @squirrellang
VoidSpirit
#3 Posted : Wednesday, August 1, 2018 9:03:57 AM(UTC)
Rank: Member

Groups: Registered
Joined: 12/27/2016(UTC)
Posts: 10

Thanks: 0 times
Was thanked: 2 time(s) in 2 post(s)
fagiano wrote:

2) I don't understand what you mean.


This part of code begins enumeration from the second element missing the first element.
In the first call:
1. In the beginning of the enumeration _nexti metamethod takes the first index (0 or null) and returns the next index (1) wich stored in 'itr'
2. Get uses itr (with second index) for getting of element. So element #0 is missed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.069 seconds.