157 lines
8.7 KiB
HTML
157 lines
8.7 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Select which mode to use when running a Java program" />
|
||
|
<meta name="abstract" content="When you run a Java program, you can select which mode you would like to use. All modes verify the code and create a Java program object to hold the preverified form of the program." />
|
||
|
<meta name="description" content="When you run a Java program, you can select which mode you would like to use. All modes verify the code and create a Java program object to hold the preverified form of the program." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="runtperf.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="selmod" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Select which mode to use when running a Java program</title>
|
||
|
</head>
|
||
|
<body id="selmod"><a name="selmod"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Select which mode to use when running a Java program</h1>
|
||
|
<div><p>When you run a Java™ program, you can select which mode
|
||
|
you would like to use. All modes verify the code and create a Java program
|
||
|
object to hold the preverified form of the program.</p>
|
||
|
<p>You can use any of the following modes:</p>
|
||
|
<ul><li>Interpreted</li>
|
||
|
<li>Direct processing</li>
|
||
|
<li>Just-In-Time (JIT) compile</li>
|
||
|
<li>Just-In-Time (JIT) compile and direct processing</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><thead align="left"><tr><th align="left" valign="top" id="d0e38">Selection mode</th>
|
||
|
<th align="left" valign="top" id="d0e40">Details</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" headers="d0e38 "><strong>Interpreted</strong></td>
|
||
|
<td valign="top" headers="d0e40 "> <p>Each bytecode is interpreted at runtime.</p>
|
||
|
<p>For information
|
||
|
on running your Java program in the interpreted mode, see the <a href="../cl/runjva.htm" target="_blank">Run Java (RUNJVA)
|
||
|
command</a>.</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" headers="d0e38 "><strong>Direct Processing</strong></td>
|
||
|
<td valign="top" headers="d0e40 "> <p>Machine instructions for a method are generated during the first
|
||
|
call to that method, and saved for use the next time that the program runs.
|
||
|
One copy is also shared for the entire system.</p>
|
||
|
<p>For information on
|
||
|
running your Java program using direct processing, see the <a href="../cl/runjva.htm" target="_blank">Run Java (RUNJVA)
|
||
|
command</a>.</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" headers="d0e38 "><strong>Just-In-Time (JIT) compile</strong></td>
|
||
|
<td valign="top" headers="d0e40 "> <p><span class="keyword">i5/OS™</span> interprets Java methods
|
||
|
until reaching the threshold specified by the os400.jit.mmi.threshold Java system
|
||
|
property. After reaching the threshold, <span class="keyword">i5/OS</span> uses
|
||
|
the JIT compiler to compile methods into native machine instructions.</p>
|
||
|
<p>To
|
||
|
use the <a href="jit.htm">Just-In-Time compiler</a>, you need to set
|
||
|
the compiler value to <samp class="codeph">jitc</samp>. You can set the value by adding
|
||
|
an environment variable or setting the java.compiler system property. Select
|
||
|
one method from the list below to set the compiler value:</p>
|
||
|
<ul><li>From a command line prompt on your iSeries™ server, add the environment variable
|
||
|
by using the Add Environment Variable (ADDENVVAR) command. Then, run your Java program
|
||
|
using the Run Java (RUNJVA) command or JAVA command. For example,
|
||
|
use: <pre>ADDENVVAR ENVVAR (JAVA_COMPILER) VALUE(jitc)
|
||
|
JAVA CLASS(Test)</pre>
|
||
|
</li>
|
||
|
<li>Set the java.compiler system property on the iSeries command line. For example, enter <samp class="codeph">JAVA
|
||
|
CLASS(Test) PROP((java.compiler jitc))</samp></li>
|
||
|
<li>Set the java.compiler system property on the Qshell Interpreter command
|
||
|
line. For example, enter <samp class="codeph">java -Djava.compiler=jitc Test</samp></li>
|
||
|
</ul>
|
||
|
Once you set this value, the JIT compiler optimizes all of the Java code
|
||
|
before running it.</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" headers="d0e38 "><strong>Just-In-Time (JIT) compile and Direct Processing</strong></td>
|
||
|
<td valign="top" headers="d0e40 "> <p>The most common way to use the Just-In-Time (JIT) compiler is with
|
||
|
the <samp class="codeph">jit_de</samp> option. When running with this option, programs
|
||
|
that have already been optimized with direct processing run in direct processing
|
||
|
mode. Programs that have not been optimized for direct optimization run in
|
||
|
JIT mode.</p>
|
||
|
<p>To use JIT and direct processing together, you need to set
|
||
|
the compiler value to <samp class="codeph">jitc_de</samp>. You can set the value by adding
|
||
|
an environment variable or setting the java.compiler system property. Select
|
||
|
one method from the following list to set the compiler value:</p>
|
||
|
<ul><li>Add the environment variable by entering the Add Environment Variable
|
||
|
(ADDENVVAR) command on the iSeries command line. Then, run your Java program
|
||
|
using the Run Java (RUNJVA) command or JAVA command. For example,
|
||
|
enter <pre>ADDENVVAR ENVVAR (JAVA_COMPILER) VALUE(jitc_de)
|
||
|
JAVA CLASS(Test)</pre>
|
||
|
</li>
|
||
|
<li>Set the java.compiler system property on the iSeries command line. For example, enter <samp class="codeph">JAVA
|
||
|
CLASS(Test) PROP((java.compiler jitc_de))</samp></li>
|
||
|
<li>Set the java.compiler system property on the Qshell Interpreter command
|
||
|
line. For example, enter <samp class="codeph">java -Djava.compiler=jitc_de Test</samp></li>
|
||
|
</ul>
|
||
|
Once this value is set, the Java program for the class file that was
|
||
|
created as direct processing is used. If the Java program was not created as direct processing,
|
||
|
the class file is optimized by the JIT prior to running. For more information,
|
||
|
see <a href="jitde.htm">Comparison of Just-In-Time compiler and direct
|
||
|
processing</a></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<p>There are three ways that you can run a Java program (CL, QSH, and JNI). Each has
|
||
|
a unique way to specify the mode. This table shows how that is done.</p>
|
||
|
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><thead align="left"><tr><th align="left" valign="top" id="d0e212">Mode</th>
|
||
|
<th align="left" valign="top" id="d0e214">CL Command</th>
|
||
|
<th align="left" valign="top" id="d0e216">QShell Command</th>
|
||
|
<th align="left" valign="top" id="d0e218">JNI Invocation API</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" headers="d0e212 ">Interpret</td>
|
||
|
<td valign="top" headers="d0e214 ">INTERPRET(*YES)</td>
|
||
|
<td valign="top" headers="d0e216 ">-Djava.compiler=NONE -interpret</td>
|
||
|
<td valign="top" headers="d0e218 ">os400.run.mode=interpret</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" headers="d0e212 ">DE</td>
|
||
|
<td valign="top" headers="d0e214 ">INTERPRET(*NO)</td>
|
||
|
<td valign="top" headers="d0e216 ">-Djava.compiler=NONE</td>
|
||
|
<td valign="top" headers="d0e218 "> <ul><li>os400.run.mode= program_created=pc</li>
|
||
|
<li>os400.create.type= direct</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" headers="d0e212 ">JIT</td>
|
||
|
<td valign="top" headers="d0e214 ">INTERPRET(*JIT)</td>
|
||
|
<td valign="top" headers="d0e216 ">-Djava.compiler=jitc</td>
|
||
|
<td valign="top" headers="d0e218 ">os400.run.mode=jitc</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" headers="d0e212 ">JIT_DE(default)</td>
|
||
|
<td valign="top" headers="d0e214 ">INTERPRET(*OPTIMIZE) OPTIMIZE(*JIT)</td>
|
||
|
<td valign="top" headers="d0e216 ">-Djava.compiler=jitc_de</td>
|
||
|
<td valign="top" headers="d0e218 ">os400.run.mode=jitc_de</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="runtperf.htm" title="Understanding the following considerations can help you improve the performance of your Java applications.">Java performance considerations</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|