Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16403#discussion_r93968567
  
    --- Diff: common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java 
---
    @@ -244,6 +257,34 @@ public static void throwException(Throwable t) {
           LONG_ARRAY_OFFSET = _UNSAFE.arrayBaseOffset(long[].class);
           FLOAT_ARRAY_OFFSET = _UNSAFE.arrayBaseOffset(float[].class);
           DOUBLE_ARRAY_OFFSET = _UNSAFE.arrayBaseOffset(double[].class);
    +
    +      // determine whether double access should be aligned.
    +      String arch = System.getProperty("os.arch", "");
    +      if (arch.matches("^(arm|arm32)")) {
    +        logger.info(
    +            "Host platform '{}' requires aligned double access. "+
    +            "Creating an aligned buffer for unsafe double reads.",
    +            arch);
    +
    +        // allocate a 2x memory block to ensure buffer used is 8-byte 
aligned. Java
    +        // objects are always aligned, so we just need to ensure the 
offset is aligned
    +        // to an 8-byte boundary
    +        byte[] heapObj = new byte[16];
    +        long offset = BYTE_ARRAY_OFFSET;
    +        long bufferSize = 16;
    +        for (long i = 0; i < 8; ++i ) {
    --- End diff --
    
    Spacing:
    
    ```
    for (long i = 0; i < 8; i++) {
      if ((offset + i) % 8 == 0) {
    ```
    
    Why a long?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to