<div dir="ltr">Hi Martin,<div><br></div><div>this makes sense. This is the right way to force alignment. I do not like the platform code in the shared file but do not think this is a big deal.<br><br>+#if defined (_WIN32) && defined (_MSC_VER)<br><br>Why do you think we need _MSC_VER too? Is OpenJDK on Windows even buildable with anything other than VC++?</div><div><br></div><div>Cheers, Thomas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 2, 2019 at 4:14 PM Doerr, Martin <<a href="mailto:martin.doerr@sap.com">martin.doerr@sap.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'd like to propose a fix for an old issue on 32 bit Windows (also for an 11u backport):<br>
<a href="https://bugs.openjdk.java.net/browse/JDK-8220348" rel="noreferrer" target="_blank">https://bugs.openjdk.java.net/browse/JDK-8220348</a><br>
<br>
Some jdk native methods use jni_SetLongArrayRegion with a stack allocated buffer.<br>
jni_SetLongArrayRegion uses Copy::conjoint_jlongs_atomic which requires jlongs to be 8 byte aligned (asserted).<br>
However, Windows 32 bit only uses 4 byte alignment for jlong arrays by default.<br>
I found such issues in the following files:<br>
src/java.prefs/windows/native/libprefs/WindowsPreferences.c<br>
src/java.security.jgss/share/native/libj2gss/GSSLibStub.c<br>
I suggest to use __declspec(align(8)) there.<br>
<br>
Webrev:<br>
<a href="http://cr.openjdk.java.net/~mdoerr/8220348_ntintel_stack_align/webrev.00/" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~mdoerr/8220348_ntintel_stack_align/webrev.00/</a><br>
Please review.<br>
<br>
I think using 8 byte alignment is not a disadvantage for 64 bit.<br>
<br>
I guess there are still people interested in this platform with jdk14. Otherwise I could contribute it as 11u only fix.<br>
<br>
Is there a better way to force 8 byte alignment for jlongs or jlong arrays on stack?<br>
Best regards,<br>
Martin<br>
<br>
</blockquote></div>