Skip to content

fix a bug about convert func#203

Merged
lightszero merged 1 commit intomasterfrom
Branch_lights_fix_convert_bug
Mar 13, 2020
Merged

fix a bug about convert func#203
lightszero merged 1 commit intomasterfrom
Branch_lights_fix_convert_bug

Conversation

@lightszero
Copy link
Copy Markdown
Member

@lightszero lightszero commented Mar 12, 2020

@superboyiii

1.fix a bug about convert func:#196

we Insert a Opcode Convert,but compiler read last opcode for a number when parse Opcode newarr.Compiler will get a error opcode:Convert. had fix it.

2.add some unittest for it.

notice:

//quick way
//compiler can optimize static var as a PushData
static readonly byte[] OwnerVar = new byte[] { 0xf6, 0x64, 0x43, 0x49, 0x8d, 0x38, 0x78, 0xd3, 0x2b, 0x99, 0x4e, 0x4e, 0x12, 0x83, 0xc6, 0x93, 0x44, 0x21, 0xda, 0xfe };
//very very very slow way
//new byte[] is not  a const value,it will waste many opcode to create it.
        private static byte[] Owner()
        {
            var bs = new byte[] { 0xf6, 0x64, 0x43, 0x49, 0x8d, 0x38, 0x78, 0xd3, 0x2b, 0x99, 0x4e, 0x4e, 0x12, 0x83, 0xc6, 0x93, 0x44, 0x21, 0xda, 0xfe };
            return bs;
        }
//and this is same thing,very slow
// Owner=>new byte[] { 0xf6, 0x64, 0x43, 0x49, 0x8d, 0x38, 0x78, 0xd3, 0x2b, 0x99, 0x4e, 0x4e, 0x12, 0x83, 0xc6, 0x93, 0x44, 0x21, 0xda, 0xfe };

#196

because Insert a Opcode Convert

but newarr still get last opcode for a PushNumber

2.add some unittest for it.
@lightszero lightszero requested review from Tommo-L and shargon and removed request for Tommo-L March 12, 2020 11:48
Copy link
Copy Markdown
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works as expected

return null;
}

static readonly byte[] OwnerVar = new byte[] { 0xf6, 0x64, 0x43, 0x49, 0x8d, 0x38, 0x78, 0xd3, 0x2b, 0x99, 0x4e, 0x4e, 0x12, 0x83, 0xc6, 0x93, 0x44, 0x21, 0xda, 0xfe };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forget me, we have already supported global static variables, right?

@superboyiii
Copy link
Copy Markdown
Member

superboyiii commented Mar 13, 2020

Tested, it works well now.
@lightszero

@lightszero lightszero merged commit b51c2b1 into master Mar 13, 2020
@lightszero lightszero deleted the Branch_lights_fix_convert_bug branch March 13, 2020 06:15
Jim8y pushed a commit that referenced this pull request Aug 3, 2025
#196
because Insert a Opcode Convert
but newarr still get last opcode for a PushNumber
2.add some unittest for it.
Jim8y pushed a commit that referenced this pull request Aug 18, 2025
#196

because Insert a Opcode Convert

but newarr still get last opcode for a PushNumber

2.add some unittest for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants