Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4068833

VM assumes that endianness of jlong and double is the same

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.0
    • hotspot
    • None
    • generic
    • solaris_2.5.1

      There are lots of places in the VM that assume that if a double is
      {big,little}-endian, then so is a jlong/int64_t. Apparently this is not true
      for all platforms (ARM reported this problem), so the code is not portable if
      the ll_* functions are operating on the native long long type. It is
      undesirable to rewrite all the ll_* functions just to change the endianness,
      because it would slow down math operations on Java long values.

      Example from classload.c:

                 case CONSTANT_Long:
                 case CONSTANT_Double: {
                     unsigned high = get4bytes(context);
                     unsigned low = get4bytes(context);
                     int64_t value;
                     value = ll_add(ll_shl(uint2ll(high), 32), uint2ll(low));
                     SET_INT64(t1, &constant_pool[i], value);

      dean.long@Eng 1997-07-31

            sliangsunw Sheng Liang (Inactive)
            dlong Dean Long
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: