Skip to content

Commit

Permalink
Merge pull request #535 from atoulme/use_direct_buffer
Browse files Browse the repository at this point in the history
java: Use allocateDirect instead of wrap in copy_code
  • Loading branch information
axic authored Sep 27, 2020
2 parents d0987e5 + 953e640 commit a2a3e32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bindings/java/java/src/main/java/org/ethereum/evmc/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ static ByteBuffer copy_code(int context_index, byte[] address, int code_offset)

if (code != null && code_offset > 0 && code_offset < code.length) {
int length = code.length - code_offset;
return ByteBuffer.wrap(code, 0, length);
return ByteBuffer.allocateDirect(length).put(code, code_offset, length);
}

return ByteBuffer.wrap(new byte[0]);
return ByteBuffer.allocateDirect(0);
}

/** Selfdestruct callback function. */
Expand Down

0 comments on commit a2a3e32

Please sign in to comment.