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 evmc_execute helper #67

Merged
merged 1 commit into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/go/evmc/evmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static struct evmc_result execute_wrapper(struct evmc_instance* instance, int64_
};

struct extended_context ctx = {{&evmc_go_fn_table}, context_index};
return instance->execute(instance, &ctx.context, rev, &msg, code, code_size);
return evmc_execute(instance, &ctx.context, rev, &msg, code, code_size);
}
*/
import "C"
Expand Down
2 changes: 1 addition & 1 deletion examples/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int main()
msg.gas = gas;
msg.depth = 0;

struct evmc_result result = vm->execute(vm, &ctx, EVMC_HOMESTEAD, &msg, code, code_size);
struct evmc_result result = evmc_execute(vm, &ctx, EVMC_HOMESTEAD, &msg, code, code_size);

printf("Execution result:\n");
if (result.status_code != EVMC_SUCCESS)
Expand Down
15 changes: 15 additions & 0 deletions include/evmc/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ static inline int evmc_set_option(struct evmc_instance* instance,
return 0;
}

/**
* Executes code in the VM instance.
*
* @see evmc_execute_fn.
*/
static inline struct evmc_result evmc_execute(struct evmc_instance* instance,
struct evmc_context* context,
enum evmc_revision rev,
const struct evmc_message* msg,
uint8_t const* code,
size_t code_size)
{
return instance->execute(instance, context, rev, msg, code, code_size);
}

/**
* Releases the resources allocated to the execution result.
*
Expand Down