Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Add EVMC_TRAP_INSTRUCTION error code#56

Merged
chfast merged 2 commits intomasterfrom
trap-error
Aug 20, 2018
Merged

Add EVMC_TRAP_INSTRUCTION error code#56
chfast merged 2 commits intomasterfrom
trap-error

Conversation

@axic
Copy link
Copy Markdown
Member

@axic axic commented Aug 10, 2018

No description provided.

@axic axic requested a review from chfast August 10, 2018 11:36
* This is useful for WebAssembly implementations, where the `unreachable`
* instruction and various execution errors are turned into a trap.
*/
EVMC_TRAP_INSTRUCTION = 14,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should this be merged with EVMC_INVALID_INSTRUCTION?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather not, because trap can be caused not only by a contract design.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Decision: use EVMC_UNREACHABLE_INSTRUCTION here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In addition we could have EVMC_WEBASSEMBLY_TRAP for the generic trap case as specified by the wasm spec.

@chfast
Copy link
Copy Markdown
Member

chfast commented Aug 13, 2018

I'm not sure this is so great idea, because it only reference to the way the exception was implemented in Ewasm. If you cannot distinguish division by zero (wasm builtin trap condition) from ones caused by contract code explicitly, you might want to use generic EVMC_FAILURE.

@axic
Copy link
Copy Markdown
Member Author

axic commented Aug 18, 2018

@chfast updated.

@chfast chfast merged commit e319788 into master Aug 20, 2018
@chfast chfast deleted the trap-error branch August 20, 2018 09:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants