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

VM suggestions to improve portability and ROM-ability.

XMLWordPrintable

    • 1.1.6
    • x86
    • windows_nt
    • Verified


        1. In src\share\include\jmath.h (1.8 96/11/23) the protection against multiple
        inclusion is

        #ifndef _MATH_H_
        #define _MATH_H_
        ...
        #endif /* !_MATH_H_ */

        This should really be using _JMATH_H_, just in case the real <math.h> file
        is protecting itself with _MATH_H_.

        VC++ uses _INC_MATH, Solaris uses _MATH_H (no trailing underscore), and some
        compilers use _MATH_H_, so the unlucky compilers don't get a prototype for sqrt().



        2. In the file src\win32\java\include\typedefs_md.h (1.23 97/01/23) there is

           #define INT_OP(x,op,y) (((#@op=='/')||(#@op=='%')) ? ( (((x)==0x80000000)&&((y)==-1)) ? ((x) op 1) : ((x) op (y))) : ((x) op (y)))


        The #@op construct is peculiar to VC++, and is somewhat unnecessary: it can
        be replaced by a standard ANSI equivalent, namely

           #define INT_OP(x,op,y) (((#op[0]=='/')||(#op[0]=='%')) ? ( (((x)==0x80000000)&&((y)==-1)) ? ((x) op 1) : ((x) op (y))) : ((x) op (y)))



        3. classresolver.c (1.101 97/06/17) contains the following definition of
        FindLoadedClass :-

             static ClassClass *
             FindLoadedClass(char *name, struct Hjava_lang_ClassLoader *loader)
             {
                 int j;
                 ClassClass **pcb, *cb;
             
                 BINCLASS_LOCK();
                 pcb = binclasses;
                 for (j = nbinclasses; --j >= 0; pcb++) {
                     cb = *pcb;
                     if ((cbLoader(cb) == loader) &&
                         (strcmp(name, cbName(cb)) == 0))
                         break;
                 }
                 BINCLASS_UNLOCK();
                 if (j >= 0)
                     return cb;
                 return NULL;
             }

        The performance of the class resolver could be improved if the liner search
        were replaced with a faster mechanism. This is particularly important for
        environments that will run Java in ROM with preloaded classes -- eg: if
        1000 classes are preloaded into ROM then binclasses starts at 1000 and
        gets bigger.


        4. There are a number of structures defined in the interpreter which appear to
        be 'read-only' but which are not defined as 'const'. If these were specified
        as const these structures could be put in ROM.

        Here's a list of suggested candidate data structures which could become
        'const'.

          @(#)check_class.c 1.40 97/01/23
             
                static unsigned long isLetterTable0000through06FF[]
                static unsigned long isLetterTable0900through0EFF[]
                static unsigned long isLetterTable1080through11FF[]
                static unsigned long isLetterTable1E00through1FFF[]
                static unsigned long isLetterTable3000through33FF[]
                static unsigned long isLetterTableFB00throughFFFF[]
             
          @(#)classresolver.c 1.101 97/06/17
                
                struct primtype { ... } primitive_types[]
             
          @(#)gc.c 1.159 97/05/05
             
                struct arrayinfo arrayinfo[]
             
          @(#)inline.c 1.12 97/01/03
             
                static struct OpcodeInfoType OpcodeInfo[]
             
          opcodes.c (machine generated file)
             
                char *opnames[256]
             
          opcodes.in_out (machine generated file)
             
                char* opcode_in_out[][2]
             
          opcodes.length (machine generated file)
             
                short opcode_length[256]

              never Tom Rodriguez
              alanb Alan Bateman
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: