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

JNI CallFloatMethod() fails in 1.3/1.3.1 ONLY

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.0, 1.3.1
    • hotspot
    • sparc
    • solaris_7, solaris_8

      Name: krC82822 Date: 05/20/2001


      orig synopsis: "Native call to ()F method produces bug report request"

      20 May 2001, eval1127@eng -- reproducible with 1.3.0 and
      final 1.3.1 release on Solaris 2.8.

      NOT reproducible with merlin (1.4) beta build 65:
          java version "1.4.0-beta"
          Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
          Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
      ----------------
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
      Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)


      Error message:
      #
      # HotSpot Virtual Machine Error, Unexpected Signal 11
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Error ID: 4F533F534F4C415249530E435050079A 01
      #
      # Problematic Thread: prio=5 tid=0x2a180 nid=0x1 runnable
      #
      Abort (core dumped)

      Java source code (AdderFrame.java)
      import java.awt.*;
      import java.awt.event.*;

      public class AdderFrame extends Frame implements ActionListener
      {

          TextField text1,text2,answertext;
          Label pluslabel;
          Button button1;

          public AdderFrame()
          {

              super("1st awt button thing");
              setSize(600,600);
              addWindowListener(new BasicWindowMonitor());

              Panel adderpanel = new Panel();

              text1 = new TextField(10);
              text1.setText("1.5");
              adderpanel.add(text1);

              pluslabel = new Label("+");
              adderpanel.add(pluslabel);

              text2 = new TextField(10);
              adderpanel.add(text2);

              button1 = new Button("=");
              adderpanel.add(button1);
              button1.addActionListener(this);

              answertext = new TextField(10);
              adderpanel.add(answertext);

              add(adderpanel);

          }

          public void actionPerformed(ActionEvent e)
          {

              if(e.getSource() == button1)
              {
                  float sum = Float.parseFloat(text1.getText()) +
      Float.parseFloat(text2.getText());
                  answertext.setText(String.valueOf(sum));
                  float dummy=getParam1();
              }

          }

          public float getParam1()
          {

              float value = Float.parseFloat(text1.getText());
              System.out.println(String.valueOf(value));
              return value;

          }

          public static void main(String[] args)
          {

              AdderFrame af1 = new AdderFrame();

              af1.setVisible(true);

          }

      }


      Java source code (BasicWindowMonitor.java)
      import java.awt.event.*;
      import java.awt.Window;

      public class BasicWindowMonitor extends WindowAdapter
      {

          public void windowClosing(WindowEvent e)
          {
              
              Window w = e.getWindow();
              w.setVisible(false);
              w.dispose();
              System.exit(0);

          }

      }

      C++ source code: (mainprog.cpp)
      #include <jni.h>
      #include <stdlib.h>

      int main()
      {

              JNIEnv *env;
              JavaVM *jvm;
              JavaVMInitArgs vm_args;
              JavaVMOption options[1];
              jint res;
              jclass cls;
              jmethodID mid,mid2;
              jstring jstr;
              jobjectArray args;
              char classpath[1024];

              options[0].optionString="-Dverbose";

              vm_args.version = JNI_VERSION_1_2;
              vm_args.options=options;
              vm_args.nOptions=1;
              vm_args.ignoreUnrecognized=JNI_TRUE;

              printf("1\n");

              printf("2\n");

              /*Create the java VM*/
              res=JNI_CreateJavaVM(&jvm,(void **)&env,&vm_args);

              printf("3\n");

              if(res<0){
                      fprintf(stderr, "Can't create Java VM\n");
                      exit(1);
              }

              printf("4\n");

              cls=env->FindClass("AdderFrame");

              if(cls==0){

                      fprintf(stderr,"Can't find AdderFrame class\n");
                      exit(1);

              }

              printf("5\n");

              mid=env->GetStaticMethodID(cls,"main","([Ljava/lang/String;)V");

              if(mid==0){

                      fprintf(stderr,"Can't find AdderFrame.main\n");
                      exit(1);

              }

              printf("6\n");

              jstr=env->NewStringUTF(" from C++!");
              if(jstr==0){

                      fprintf(stderr,"Out of memory.\n");
                      exit(1);

              }

              printf("7\n");

              args=env->NewObjectArray(1,env->FindClass("java/lang/String"),jstr);

              if(args==0){

                      fprintf(stderr,"Out of memory.\n");
                      exit(1);

              }

              printf("8\n");

              env->CallStaticVoidMethod(cls,mid,args);

              printf("9\n");

              mid2=env->GetMethodID(cls,"getParam1","()F");

              if(mid2==0)
              {
                  fprintf(stderr,"Can't find AdderFrame.getParam1\n");
                  exit(1);
              }

      /* ERROR OCCURS HERE:*/

              float p1 = env->CallFloatMethod(cls,mid2);

      /* END OF WHERE ERROR OCCURS */

              jvm->DestroyJavaVM();

      }

      ---------

      20 May 2001, eval1127@eng -- results for final 1.3.1 release on Solaris:

      1
      2
      3
      4
      5
      6
      7
      8
      9

      Unexpected Signal : 10 occurred at PC=0xff108c44
      Function name=JVM_CurrentTimeMillis
      Library=/space/j2sdk1_3_1/jre/lib/sparc/libjvm.so

      Current Java thread:

      Dynamic libraries:
      0x10000 ./a.out
      0xff000000 /space/j2sdk1_3_1/jre/lib/sparc/libjvm.so
      0xff3a0000 /usr/lib/libdl.so.1
      0xfefc0000 /usr/lib/libthread.so.1
      0xff360000 /usr/dist/pkgs/devpro/5.x-sparc/lib/libm.so.1
      0xfef50000 /usr/lib/libC.so.5
      0xff390000 /usr/lib/libw.so.1
      0xfee00000 /usr/lib/libc.so.1
      0xfef10000 /usr/lib/libCrun.so.1
      0xfeef0000 /usr/lib/libsocket.so.1
      0xfed00000 /usr/lib/libnsl.so.1
      0xfede0000 /usr/lib/libmp.so.2
      0xfeed0000 /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
      0xfecd0000 /space/j2sdk1_3_1/jre/lib/sparc/native_threads/libhpi.so
      0xfeca0000 /space/j2sdk1_3_1/jre/lib/sparc/libverify.so
      0xfec50000 /space/j2sdk1_3_1/jre/lib/sparc/libjava.so
      0xfec20000 /space/j2sdk1_3_1/jre/lib/sparc/libzip.so
      0xfe2a0000 /usr/lib/locale/en_US.ISO8859-1/en_US.ISO8859-1.so.2
      0xfe1e0000 /space/j2sdk1_3_1/jre/lib/sparc/libawt.so
      0xfac80000 /space/j2sdk1_3_1/jre/lib/sparc/motif21/libmawt.so
      0xfe180000 /space/j2sdk1_3_1/jre/lib/sparc/libmlib_image.so
      0xf4980000 /usr/dt/lib/libXm.so.4
      0xfd090000 /usr/openwin/lib/libXt.so.4
      0xfe150000 /usr/openwin/lib/libXext.so.0
      0xfe130000 /usr/openwin/lib/libXtst.so.1
      0xf4880000 /usr/openwin/lib/libX11.so.4
      0xfd3e0000 /usr/openwin/lib/libSM.so.6
      0xfd060000 /usr/openwin/lib/libICE.so.6
      0xf4780000 /space/j2sdk1_3_1/jre/lib/sparc/libfontmanager.so
      0xfafa0000 /usr/openwin/lib/libdps.so.5
      0xfd3b0000 /usr/openwin/lib/locale/common/xlibi18n.so.2
      0xfd020000 /usr/openwin/lib/locale/common/ximlocal.so.2
      0xfaee0000 /usr/openwin/lib/locale/iso8859-1/xomEuro.so.2
      0xfaec0000 /usr/lib//liblayout.so

      Local Time = Sun May 20 20:04:40 2001
      Elapsed Time = 5
      #
      # HotSpot Virtual Machine Error : 10
      # Error ID : 4F530E43505002CC 01
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
      #
      # An error report file has been saved as hs_err_pid20030.log.
      # Please refer to the file for further information.
      #
      Abort (core dumped)


      (Review ID: 123790)
      ======================================================================

            chrisphi Chris Phillips
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: