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

NMI static native method has non-null "this" value using JIT

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • P4
    • None
    • 1.2.2
    • vm-legacy
    • jit
    • x86
    • solaris_2.6

    Description



      Name: clC74495 Date: 12/01/99


      Using old-style NMI native methods together with the sunwjit JIT compiler
      on JDK 1.2.2 on Solaris/x86, the first ("this") parameter to a static native
      method is not null, as it should be (per Arnold & Gosling first edition
      A.2.2). If the JIT compiler is turned off, the correct result is
      obtained.

      I believe this bug has been present in 1.1.x versions of sunwjit as well.

      $ uname -a
      SunOS king 5.6 Generic_105182-03 i86pc i386 i86pc

      $ /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/java -version
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-001, green threads, sunwjit)

      $ cat caller.java
      class ABC { }

      public class caller {
              public static native void nm1(ABC a);

              public static void main(String args[]) {
                      ABC a = new ABC();
                      nm1(a);
                      System.exit(0);
              }

              static {
                      System.loadLibrary("nm");
              }
      }

      $ cat nm.c
      #include "caller.h"

      #include <stdio.h>

      void caller_nm1(struct Hcaller *s, struct HABC * a) {
              printf("Should be null, is %s\n", s ? "not null" : "null");
              printf("Should be not null, is %s\n", a ? "not null" : "null");
      }

      $ CC=`whence cc` JDK_ROOT=$j122b ./mk
      + rm -f caller.o nm.o libnm.so caller.c caller.h ABC.class caller.class
      + [ == clean ]
      + JDK_ROOT=/java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2/
      + CC=/export/home/SUNWspro/bin/cc
      + export CLASSPATH=.:
      + export LD_LIBRARY_PATH=.:
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/javac caller.java
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/javah -old caller
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/javah -old -stubs caller
      + /export/home/SUNWspro/bin/cc -I /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//include-old -I /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//include-old/solaris -KPIC caller.c nm.c -G -o libnm.so
      caller.c:
      nm.c:
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/java caller
      Should be null, is not null <<--- this is the bug
      Should be not null, is not null
      $
      $ JAVA_COMPILER= CC=`whence cc` JDK_ROOT=$j122b ./mk
      + rm -f caller.o nm.o libnm.so caller.c caller.h ABC.class caller.class
      + [ == clean ]
      + JDK_ROOT=/java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2/
      + CC=/export/home/SUNWspro/bin/cc
      + export CLASSPATH=.:
      + export LD_LIBRARY_PATH=.:
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/javac caller.java
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/javah -old caller
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/javah -old -stubs caller
      + /export/home/SUNWspro/bin/cc -I /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//include-old -I /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//include-old/solaris -KPIC caller.c nm.c -G -o libnm.so
      caller.c:
      nm.c:
      + /java/JDK-1_2_2_001-FCS.BINARY/jdk1.2.2//bin/java caller
      Should be null, is null
      Should be not null, is not null
      $
      (Review ID: 98424)
      ======================================================================

      Attachments

        Activity

          People

            hongzh Hong Zhang
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: