Skip to content

Conversation

@adinn
Copy link
Collaborator

@adinn adinn commented Jun 21, 2017

As promised here is a unit test to check writes to direct byte buffers, It passes on x86 and AArch64 with the latest head.

n.b. I reverted the AArch64 address lowering code to revert the fix that updated usages one by one and, as expected, the unaligned int writes failed because the second byte of the int was being written at offset 1 rather than offset 2. So, this test would have caught the error in the original commit.

@adinn adinn force-pushed the direct_byte_buffer_unit_test branch from 77fbdc3 to 49d5be0 Compare June 21, 2017 14:22
@dougxc dougxc self-assigned this Jun 21, 2017
@dougxc dougxc added the accept label Jun 21, 2017
@dougxc
Copy link
Member

dougxc commented Jun 21, 2017

Looks good to me - thanks for doing this.

@christhalinger
Copy link
Contributor

Why are there no long tests?

@dougxc
Copy link
Member

dougxc commented Jun 21, 2017

Long tests?

@christhalinger
Copy link
Contributor

Too brief :) What I was trying to say, the new test tests for all basic datatypes except long:

 +        ret.byteValue = buffer.get();
 +        ret.byteValue += buffer.get();
 +        ret.shortValue = buffer.getShort();
 +        ret.intValue = buffer.getInt();
 +        ret.doubleValue = buffer.getDouble();
 +        ret.floatValue = buffer.getFloat();

Is there a reason?

@adinn
Copy link
Collaborator Author

adinn commented Jun 22, 2017

Hi Chris!

Well, the immediate reason is that this test does all the same checks as the non-direct byte buffer test. However, you have a point that writing longs ought to be tested.

I was going to suggest as an excuse for this omission that these tests exercise cases where a fragment of the standard transfer unit is transferred i.e. that they test disassembly and reassembly of elements that make up such units, both at aligned and unaligned offsets. However, i) that doesn't apply when transferring doubles and ii) I am not sure there is any reason to omit testing that a full unit is transferred correctly both at aligned and unaligned offsets.

So, yes, there is no good reason and, indeed, both tests are not actually as comprehensive as they need to be(also, in related news, the internet is broken! ;-) Perhaps this could be fixed with a follow-up commit?

@dougxc
Copy link
Member

dougxc commented Jun 22, 2017

Unless there's an urgency for this PR, I'd prefer the extra tests to be added here to reduce the integration overhead on my side... pretty please... ;-)

@adinn
Copy link
Collaborator Author

adinn commented Jun 22, 2017

ok, I updated both byte buffer tests to check reads and writes of longs :-)

@dougxc dougxc merged commit 2e706c6 into oracle:master Jun 22, 2017
@christhalinger
Copy link
Contributor

Cool, thanks. Can you fix the internet too?

@adinn adinn deleted the direct_byte_buffer_unit_test branch June 23, 2017 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants