Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement assemble func prototype #72

Merged
merged 1 commit into from
Jan 4, 2019

Conversation

AgwaB
Copy link
Collaborator

@AgwaB AgwaB commented Jan 2, 2019

details:
We need to discuss about #60
But when we implement opCodes( #61 ), it needs asm.code
( it is analyzed rawByteCode but the analysis is focused on cost maybe. )

I think it is better to implement the analysis properly after it is fully discussed!! so i implement prototype of analysis...

  • Test case

@AgwaB AgwaB changed the title Implement analysis func prototype Implement assemble func prototype Jan 3, 2019
@AgwaB
Copy link
Collaborator Author

AgwaB commented Jan 3, 2019

Moved analysis logic to assemble

@AgwaB AgwaB force-pushed the feature/vm/asm branch 3 times, most recently from 7201216 to c5b83a0 Compare January 3, 2019 14:21
@AgwaB
Copy link
Collaborator Author

AgwaB commented Jan 3, 2019

I think uint32To4Bytes is not a good naming. Anyone have any other opinion?


if !ok {
return nil, errors.New("Invalid byteCode")
}
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to predefine
var ErrInvalidOpcode = errors.New("Invalid byteCode") and return ErrInvalidOpcode

_, err := assemble(rawByteCode)
if err == nil {
t.Error("The desired error was not found ")
}
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to compare like this

if err != ErrInvalidOpcode{
    t.Error("The desired error was not found ")
}

asm.jump(2)
asm.jump(4)
asm.jump(10) // Error occur
}
Copy link
Member

Choose a reason for hiding this comment

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

It is important to distinguish between cases where err occurs and cases that do not occur.
In cases where err does not occur, it is necessary to check whether asm's pc value is correctly jumped.

Copy link
Member

@junbeomlee junbeomlee left a comment

Choose a reason for hiding this comment

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

LGTM

@junbeomlee junbeomlee merged commit 2f2a258 into DE-labtory:develop Jan 4, 2019
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.

2 participants