/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// JCOV
// end JCOV
/**
* This class is used to assemble the bytecode instructions for a method.
*
* WARNING: The contents of this source file are not part of any
* supported API. Code that depends on them does so at its own risk:
* they are subject to change or removal without notice.
*
* @author Arthur van Hoff
*/
public final
int maxdepth;
int maxvar;
int maxpc;
/**
* Add an instruction
*/
}
}
}
}
// JCOV
}
}
}
static int[] arrayModifiers =
static int[] arrayModifiersOpc =
//end JCOV
/**
* Optimize instructions and mark those that can be reached
*/
case NOTREACHED:
break;
case REACHED:
return;
case NEEDED:
break;
}
case opc_label:
case opc_dead:
}
break;
case opc_ifeq:
case opc_ifne:
case opc_ifgt:
case opc_ifge:
case opc_iflt:
case opc_ifle:
case opc_if_icmpeq:
case opc_if_icmpne:
case opc_if_icmpgt:
case opc_if_icmpge:
case opc_if_icmplt:
case opc_if_icmple:
case opc_if_acmpeq:
case opc_if_acmpne:
case opc_ifnull:
case opc_ifnonnull:
break;
case opc_goto:
return;
case opc_jsr:
break;
case opc_ret:
case opc_return:
case opc_ireturn:
case opc_lreturn:
case opc_freturn:
case opc_dreturn:
case opc_areturn:
case opc_athrow:
return;
case opc_tableswitch:
case opc_lookupswitch: {
}
return;
}
case opc_try: {
}
break;
}
}
}
}
/**
* Eliminate instructions that are not reached
*/
boolean eliminate() {
boolean change = false;
} else {
change = true;
}
}
return change;
}
/**
* Optimize the byte codes
*/
//listing(System.out);
do {
// Figure out which instructions are reached
// Eliminate instructions that are not reached
}
/**
* Collect all constants into the constant table
*/
// Collect constants for arguments only
// if a local variable table is generated
}
}
}
// Collect constants from the instructions
}
}
/**
* Determine stack size, count local variables
*/
//Environment.debugOutput(inst.toString() + ": " + depth + " => " +
// (depth + inst.balance()));
if (depth < 0) {
}
}
case opc_label:
throw new CompilerError("stack depth error " +
}
return;
}
break;
case opc_ifeq:
case opc_ifne:
case opc_ifgt:
case opc_ifge:
case opc_iflt:
case opc_ifle:
case opc_if_icmpeq:
case opc_if_icmpne:
case opc_if_icmpgt:
case opc_if_icmpge:
case opc_if_icmplt:
case opc_if_icmple:
case opc_if_acmpeq:
case opc_if_acmpne:
case opc_ifnull:
case opc_ifnonnull:
break;
case opc_goto:
return;
case opc_jsr:
break;
case opc_ret:
case opc_return:
case opc_ireturn:
case opc_lreturn:
case opc_freturn:
case opc_dreturn:
case opc_areturn:
case opc_athrow:
return;
case opc_iload:
case opc_fload:
case opc_aload:
case opc_istore:
case opc_fstore:
case opc_astore: {
if (v > maxvar)
maxvar = v;
break;
}
case opc_lload:
case opc_dload:
case opc_lstore:
case opc_dstore: {
if (v > maxvar)
maxvar = v;
break;
}
case opc_iinc: {
if (v > maxvar)
maxvar = v + 1;
break;
}
case opc_tableswitch:
case opc_lookupswitch: {
}
return;
}
case opc_try: {
}
break;
}
}
}
}
/**
* Generate code
*/
throws IOException {
//listing(System.out);
int sum = 0;
}
}
// Make sure the stack balances. Also calculate maxvar and maxstack
try {
} catch (CompilerError e) {
throw e;
}
// Assign PCs
}
}
}
// Write header
// Generate code
}
// write exceptions
if (nexceptions > 0) {
//listing(System.out);
}
}
/**
* Write the exceptions table
*/
void writeExceptions(Environment env, DataOutputStream out, ConstantPool tab, Instruction first, Instruction last) throws IOException {
//System.out.println("EXCEPTION: " + env.getSource() + ", pc=" + inst.pc + ", end=" + td.getEndLabel().pc + ", hdl=" + cd.getLabel().pc + ", tp=" + cd.getType());
} else {
}
}
}
}
}
//JCOV
/**
* Write the coverage table
*/
public void writeCoverageTable(Environment env, ClassDefinition c, DataOutputStream out, ConstantPool tab, long whereField) throws IOException {
boolean begseg = false;
boolean begmeth = false;
int numberTry = 0;
int count = 0;
if (!begmeth) {
else
count++;
begmeth = true;
}
boolean findTry = false;
findTry = true;
break;
}
}
if (!findTry) {
count++;
begseg = true;
}
}
}
case opc_label:
begseg = false;
break;
case opc_ifeq:
case opc_ifne:
case opc_ifnull:
case opc_ifnonnull:
case opc_ifgt:
case opc_ifge:
case opc_iflt:
case opc_ifle:
case opc_if_icmpeq:
case opc_if_icmpne:
case opc_if_icmpgt:
case opc_if_icmpge:
case opc_if_icmplt:
case opc_if_icmple:
case opc_if_acmpeq:
case opc_if_acmpne: {
if ( inst.flagCondInverted ) {
} else {
}
count += 2;
begseg = false;
break;
}
case opc_goto: {
begseg = false;
break;
}
case opc_ret:
case opc_return:
case opc_ireturn:
case opc_lreturn:
case opc_freturn:
case opc_dreturn:
case opc_areturn:
case opc_athrow: {
break;
}
case opc_try: {
begseg = false;
break;
}
case opc_tableswitch: {
count++;
}
if (!sw.getDefault()) {
count++;
} else {
count++;
}
begseg = false;
break;
}
case opc_lookupswitch: {
count++;
}
if (!sw.getDefault()) {
count++;
} else {
count++;
}
begseg = false;
break;
}
}
}
for (int i = 0; i < count; i++) {
}
}
}
/*
* Increase count of methods for native methods
*/
}
/*
* Create class jcov element
*/
blank = " ";
}
}
return classJcovLine;
}
/*
* generate coverage data
*/
for (int i = CT_FIRST_KIND; i <= CT_LAST_KIND; i++) {
if (JcovClassCountArray[i] != 0) {
JcovClassCountArray[i] = 0;
}
}
}
/*
* generate file of coverage data
*/
try {
new BufferedInputStream(
new FileInputStream(outFile)));
boolean first = true;
// this is a good Jcov file
first = true;
if (idx != -1) {
}
first = false;
break;
}
}
}
if (first) // re-write old class
}
}
}
}
}
catch (FileNotFoundException e) {
}
catch (IOException e) {
}
}
// end JCOV
/**
* Write the linenumber table
*/
public void writeLineNumberTable(Environment env, DataOutputStream out, ConstantPool tab) throws IOException {
long ln = -1;
int count = 0;
if ((n > 0) && (ln != n)) {
ln = n;
count++;
}
}
ln = -1;
if ((n > 0) && (ln != n)) {
ln = n;
//System.out.println("pc = " + inst.pc + ", ln = " + ln);
}
}
}
/**
* Figure out when registers contain a legal value. This is done
* using a simple data flow algorithm. This information is later used
* to generate the local variable table.
*/
// Been here before. Erase any conflicts.
for (int i = 0 ; i < maxvar ; i++) {
if (f[i] != locals[i]) {
f[i] = null;
}
}
return;
}
// Remember the set of active registers at this point
case opc_istore_2: case opc_istore_3:
case opc_fstore_2: case opc_fstore_3:
case opc_astore_2: case opc_astore_3:
case opc_lstore_2: case opc_lstore_3:
case opc_dstore_2: case opc_dstore_3:
}
break;
case opc_label:
return;
case opc_if_acmpeq: case opc_if_acmpne:
case opc_ifnull: case opc_ifnonnull:
case opc_jsr:
break;
case opc_goto:
return;
case opc_athrow: case opc_ret:
return;
case opc_tableswitch:
case opc_lookupswitch: {
}
return;
}
case opc_try: {
}
break;
}
}
}
}
/**
* Write the local variable table. The necessary constants have already been
* added to the constant table by the collect() method. The flowFields method
* is used to determine which variables are alive at each pc.
*/
public void writeLocalVariableTable(Environment env, MemberDefinition field, DataOutputStream out, ConstantPool tab) throws IOException {
int i = 0;
// Initialize arguments
int reg = 0;
}
}
// Initialize arguments again
for (i = 0; i < maxvar; i++)
int reg = 0;
}
}
case opc_fstore_3:
case opc_astore_2: case opc_astore_3:
case opc_lstore_2: case opc_lstore_3:
case opc_dstore_2: case opc_dstore_3:
}
}
break;
case opc_label: {
// flush previous labels
for (i = 0 ; i < maxvar ; i++) {
}
}
// init new labels
for (i = 0; i < maxvar; i++)
} else {
}
for (i = 0 ; i < maxvar ; i++) {
}
break;
}
}
}
// flush remaining labels
for (i = 0 ; i < maxvar ; i++) {
}
}
// write the local variable table
}
/**
* Return true if empty
*/
public boolean empty() {
}
/**
* Print the byte codes
*/
}
}
}