Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

puts incredibly nitpicky code reviewer hat on

Does the JVM allow using __attribute__ annotations? There's one for alignment, __attribute__((aligned(L1_DCACHE_LINE_SIZE))) (where L1_DCACHE_LINE_SIZE is defined by gcc -DL1_DCACHE_LINE_SIZE=`getconf LEVEL1_DCACHE_LINESIZE`) that could be used instead of the array, see: https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Common-Variabl...



C11 added `_Alignas`, and it looks like C++11 has `alignas`, so you don't need to rely on vendor-specific extensions for alignment, unless the JVM restricts itself to an earlier standard.

LEVEL1_DCACHE_LINESIZE looks to be specific to Linux and Solaris, however.


I think the array might be better because it works on all architectures and all platforms.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: