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

Add pop operation #141

Merged
merged 1 commit into from
Jan 18, 2019
Merged

Add pop operation #141

merged 1 commit into from
Jan 18, 2019

Conversation

hea9549
Copy link
Member

@hea9549 hea9549 commented Jan 16, 2019

resolved: #125

details: implement pop opcode

I made a pop of vm. But I don't know if this is necessary.

  • Test case

@hea9549 hea9549 force-pushed the feature/op_pop branch 2 times, most recently from 1367be6 to 4b9a220 Compare January 16, 2019 04:29
if stack.len() == 0 {
return ErrStackEmpty
}
_ = stack.pop()
Copy link
Collaborator

Choose a reason for hiding this comment

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

if pop retuns err, why don't you return err?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean stack.pop() throws an error? stack.pop() does not return an error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah, I misunderstood :-D

Copy link
Collaborator

@boohyunsik boohyunsik left a comment

Choose a reason for hiding this comment

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

LGTM :-)

@hihiboss
Copy link
Member

Is it really fine just removing item??

@hea9549 @boohyunsik @zeroFruit @leesd556 @junbeomlee

Copy link
Collaborator

@AgwaB AgwaB left a comment

Choose a reason for hiding this comment

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

@hihiboss
I think it should be discussed especially with the compiler!

  1. Is it ok just pop without error handling?
    -> EVM don't handle that error. why?

  2. Is it ok just removing item ?
    -> EVM uses intPool, a temporary stack storage. why?

I'll register it to issue!

@hihiboss
Copy link
Member

@leesd556

Ok. Thank you!

@hea9549
Copy link
Member Author

hea9549 commented Jan 18, 2019

@hihiboss
I think it should be discussed especially with the compiler!

  1. Is it ok just pop without error handling?
    -> EVM don't handle that error. why?
  2. Is it ok just removing item ?
    -> EVM uses intPool, a temporary stack storage. why?

I'll register it to issue!

  1. I submit issue about this Requires a high-level opcode interface. #150

  2. I found lot's of article about intpool. In my opinion, an intpool is simply used for reuse. also written in evm's intpool.go

// intPool is a pool of big integers that
// can be reused for all big.Int operations.

It is used to reuse objects without creating new ones.

@AgwaB AgwaB merged commit f691536 into DE-labtory:develop Jan 18, 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.

[vm] Implement opcode Pop
4 participants