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

java: allocate execute result in C #558

Merged
merged 1 commit into from
Apr 26, 2021
Merged

java: allocate execute result in C #558

merged 1 commit into from
Apr 26, 2021

Conversation

axic
Copy link
Member

@axic axic commented Oct 19, 2020

This could be replaced with just passing buffers allocated based on #555.

Part of #548.

@@ -95,11 +108,14 @@ JNIEXPORT void JNICALL Java_org_ethereum_evmc_EvmcVm_execute(JNIEnv* jenv,
struct evmc_vm* evm = (struct evmc_vm*)(*jenv)->GetDirectBufferAddress(jenv, jevm);
assert(evm != NULL);
const struct evmc_host_interface* host = evmc_java_get_host_interface();
jobject jresult = allocateDirect(jenv, sizeof(struct evmc_result));
assert(jresult != NULL);
struct evmc_result* result =
(struct evmc_result*)(*jenv)->GetDirectBufferAddress(jenv, jresult);
assert(result != NULL);
*result = evmc_execute(evm, host, (struct evmc_host_context*)jcontext, (enum evmc_revision)jrev,
Copy link
Member Author

@axic axic Mar 23, 2021

Choose a reason for hiding this comment

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

This is still broken because it just copies the evmc_result struct, but the pointers to output are left loose. We need to move to a proper Java Result class, i.e. #555.

However, the PR does not change semantics.

@axic axic force-pushed the java-execute-alloc branch 2 times, most recently from f2db15a to bab5076 Compare March 23, 2021 13:12
@axic axic marked this pull request as ready for review March 23, 2021 13:14
@axic axic requested review from chfast and atoulme March 23, 2021 13:23
@atoulme
Copy link
Collaborator

atoulme commented Mar 24, 2021

It's been a while. Happy to approve this PR as it seems relatively small, but I have a hard time recalling all the context. If it helps land #555 that's great.

@codecov
Copy link

codecov bot commented Apr 26, 2021

Codecov Report

Merging #558 (ee5bad7) into master (56650cd) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #558   +/-   ##
=======================================
  Coverage   93.78%   93.78%           
=======================================
  Files          25       25           
  Lines        3746     3746           
=======================================
  Hits         3513     3513           
  Misses        233      233           

@chfast chfast merged commit 799278b into master Apr 26, 2021
@chfast chfast deleted the java-execute-alloc branch April 26, 2021 07:47
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.

3 participants