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: introduce proper types and minimise reliance on ByteBuffer/byte[] #555

Closed
wants to merge 9 commits into from

Conversation

axic
Copy link
Member

@axic axic commented Oct 9, 2020

Part of #548.

@atoulme
Copy link
Collaborator

atoulme commented Oct 10, 2020

I really like this idea. Would remove all guessing. Feels like you have some coding issues.

Do you intend for implementors to create Address, Bytes32 Uint256 objects? If so, they'll need public constructors.

@axic
Copy link
Member Author

axic commented Oct 12, 2020

@atoulme thanks! This is still work in progress, hence the draft mode, but I think this would be the safest way to handle things. Only issue is Message which is a mess due to the pointer thingie.

public Message() {}

public ByteBuffer getByteBuffer() {
// This is big endian by default, which is what we want.
Copy link
Member Author

Choose a reason for hiding this comment

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

ByteBuffer is set to big-endian by default, but we want to set it to native endian (helper to set: https://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#order(java.nio.ByteOrder)).

We can use ByteOrder for that: https://docs.oracle.com/javase/6/docs/api/java/nio/ByteOrder.html#nativeOrder()

@axic
Copy link
Member Author

axic commented Mar 23, 2021

Need to add Result class, and also pass Result/Message in HostContext.call.

@axic axic force-pushed the java-types branch 3 times, most recently from edeccd9 to 8209665 Compare March 23, 2021 14:12
@axic
Copy link
Member Author

axic commented Mar 23, 2021

This currently contains the desired API from the Java perspective, yet to actually implement all of this. I'm leaning towards now that the C part would need to just receive an instance of Result/Message and manually read/write the fields and compose the C struct, as opposed to trying to construct the C struct from within Java.

@axic axic changed the base branch from master to java-execute-alloc March 24, 2021 00:14
Base automatically changed from java-execute-alloc to master April 26, 2021 07:47
@axic
Copy link
Member Author

axic commented Mar 17, 2024

With #706 Java support was dropped -- closing this.

@axic axic closed this Mar 17, 2024
@axic axic deleted the java-types branch March 17, 2024 21:10
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.

2 participants