4 Replies Latest reply: Feb 11, 2009 6:39 PM by 807557 RSS

    Compiler Class in Extended RTSJ

    807557
      Hello Friends,

      For my real time application i am using following options at the start of the VM.
      -XX:+ITCRT -XX:+ITCJLT -XX:+CompilePreLoaded -Drtsj.precompile=nhrt.precompile -Drtjs.preload=itc.preload -Drtsj.preinit=itc.preinit

      But i want to give the compile list of method and class list for the pre initialization, programatically at the run time.For this i found methods in the RTJ Documentation. According to documentation we can do this by using mark(), preinit() and preload() method of the Compiler Class. when i tried to find this compiler class in the library of the RTJ i m unable to ...............i am able to find only api of the Compiler class but at the time of implementation class is not present in the jar files.......................

      please tell me where i can find this Compiler class for RTJ or in which jar file this class is present

      Also tell me if Compiler class is not present then how i can do the above step.............

      Thanks
        • 1. Re: Compiler Class in Extended RTSJ
          807557
          Sorry for the delayed response.

          If you really want to find it look in jre/lib/rt2.jar

          But you don't need to find it to use it. Just use javac from the Java RTS release and it knows where to find rt2.jar.

          Please use the latest Java RTS 2.1 release.

          David Holmes
          • 2. Re: Compiler Class in Extended RTSJ
            807557
            By the way ...
            qasdkja wrote:
            For my real time application i am using following options at the start of the VM.
            -XX:+ITCRT -XX:+ITCJLT -XX:+CompilePreLoaded -Drtsj.precompile=nhrt.precompile -Drtjs.preload=itc.preload -Drtsj.preinit=itc.preinit
            -XX:+ITCRT is the default, you don't need to set it.

            If you specifiy preload and preinit then preload is ignored as preinit implies preload. Note however the files have different contents as you can load classes that you never use (and hence those classes don't get initialized).

            David Holmes
            • 3. Re: Compiler Class in Extended RTSJ
              807557
              Hi,

              I think I've got the same problem as qasdkja. I'm trying to generate the List of classes to be preinitialized programmatically during runtime. So I'm using the preinit() method of the Compiler class in my code.
              myRealtimeThread {
              ...
              ConstructorOfMyRealtimeThread() {
              ...
              Compiler.preinit();
              ...}}
              But when I'm trying to compile it with this command:
              /opt/SUNWrtjv/bin/javac -classpath /opt/SUNWrtjv/jre/lib/rt2.jar MyProgram.java
              This Error occurs:
              cannot find symbol
              symbol: method preinit()
              location: class java.lang.Compiler
              And myRealtimeThread is not compiled, so that I can't use the VM afterwards (with the parameters: -XX:+RTSJBuildClassInitializationList) to create the list out of my myRealtimeThread.class code.

              Maybe I have missunderstood the usage of Compiler.preinit()!? Maybe someone can explain its correct usage or give a short example for compiling this correctly.
              • 4. Re: Compiler Class in Extended RTSJ
                807557
                This Error occurs:
                cannot find symbol
                symbol: method preinit()
                location: class *java.lang.*Compiler
                You want com.sun.rtsjx.Compiler. I'll get the Compilation Guide fixed to make that clear.
                And myRealtimeThread is not compiled, so that I can't use the VM afterwards (with the parameters: -XX:+RTSJBuildClassInitializationList) to create the list out of my myRealtimeThread.class code.

                Maybe I have missunderstood the usage of Compiler.preinit()!? Maybe someone can explain its correct usage or give a short example for compiling this correctly.
                I think you have misunderstood. ITC can perform pre-initialization based on the -Drtsj.preinit=<filename> option passed at VM startup. This will cause the listed file to be read and for each class listed there to be pre-initialized. This list can be generated for you by using the -XX:+RTSJBuildClassInitializationList runtime option - which creates a list of all classes that were compiled-at-initialization time (ie those classes compiled because of the precompile list.) Alternatively you can use the com.sun.rtsjx.Compiler class to perform dynamic "pre-initialization" at runtime by passing it a URL to a file that contains the list of classes to be immediately initialized - the idea being that you would have created the contents of this file at runtime based on information that only became available to you at runtime.

                Hope this clarifies things.

                David Holmes