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

ObjectInputStream.c modified to get varargs to compile properly

XMLWordPrintable

      For the JDK 116 release on the DIGITAL UNIX platform running on DIGITAL's
      Alpha hardware, DIGITAL has changed, for the reasons listed below, the
      following JDK 116 source files in the shared part of the JDK.

      Compatibility of the changes with Sun's JDK was assured by visual inspection of
      the changes and by running the appropriate JCK test suites. No changes were
      made to modify any APIs nor to modify the virtual machine instruction set.

      1. The following files were modified in order to get them to compile on
      DIGITAL UNIX:

      Modified code in src/share/java/lang/ObjectInputStream.c to get varargs to
      compile. In the code ObjectInputStream.c, a parameter of type va_list is being
      passed by value.

      va_list is defined as a struct in /usr/include/va_list.h on Digital
      Unix. Since NULL cannot be promoted by the C compiler to be a struct
      type, we had to use our own version of a null va_list value to replace
      Javasoft's use of NULL.

      Here is the definition of va_list for Digital Unix:

        typedef struct {
              char **_a0; /* pointer to first homed integer arg */
              int _offset; /* byte offset of next param */
        } __va_list;


      Also modified code in src/share/java/lang/ObjectInputStream.c to properly
      handle ArrayAlloc() returning 0 when out of memory, along with a few long vs.
      int mods due to pointer size differences on DEC Alpha:
        

      Diffs:
      ======

      diff -r digital_src/src/share/java/lang/ObjectInputStream.c javasoft_src/src/share/java/lang/ObjectInputStream.c
      1d0
      < /* Modifications Copyright 1997 Digital Equipment Corporation */
      100,102d98
      < /*** cds - kludge to get va_list arg to compile ***/
      < va_list dummy = {NULL, 0};
      <
      114c110
      < int *fieldSeq = unhand(fieldSeqHandle)->body; /*** cds - was long ***/
      ---
      > long *fieldSeq = unhand(fieldSeqHandle)->body;
      167d162
      < /*** cds - added dummy as kludge ***/
      170c165
      < NULL, 0, dummy,
      ---
      > NULL, 0, NULL,
      194d188
      < /*** cds - added dummy as kludge ***/
      197c191
      < NULL, 0, dummy,
      ---
      > NULL, 0, NULL,
      306,307c300
      < /*** cds - was long ***/
      < int java_io_ObjectInputStream_invokeObjectReader(struct Hjava_io_ObjectInputStream *this,
      ---
      > long java_io_ObjectInputStream_invokeObjectReader(struct Hjava_io_ObjectInputStream *this,
      374,377c367,368
      < if ((obj = newobject(cb, 0, ee )) == 0) {
      < if (!exceptionOccurred(ee)) { /*** HDS - sun bug #4041297. ***/
      < SignalError(0, JAVAPKG "OutOfMemoryError", 0);
      < }
      ---
      > if ((obj = newobject(cb, 0, ee )) == 0) {
      > SignalError(0, JAVAPKG "OutOfMemoryError", 0);
      390c381
      < int length) /*** cds - was long ***/
      ---
      > long length)
      452,453c443
      < if (obj != 0) /*** HDS added check **/
      < unhand((HArrayOfObject *)obj)->body[length] = (JHandle*)elemcb;
      ---
      > unhand((HArrayOfObject *)obj)->body[length] = (JHandle*)elemcb;
      465,466c455
      < if (obj != 0) /*** HDS added check **/
      < unhand((HArrayOfObject *)obj)->body[length] = (JHandle*)elemcb;
      ---
      > unhand((HArrayOfObject *)obj)->body[length] = (JHandle*)elemcb;
      475,481d463
      < /* Check from out or memory.*/
      < if (obj == 0) {
      < if (!exceptionOccurred(ee)) { /*** HDS - sun bug #4041297. ***/
      < SignalError(0, JAVAPKG "OutOfMemoryError", 0);
      < }
      < return NULL;
      < }




            jfialli Joe Fialli
            jbenoit Jonathan Benoit (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: