/*
* 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.
*/
/**
* An Java instruction
*
* 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.
*/
public
long where;
int pc;
int opc;
//JCOV
relatively of source code */
ignored for coverage */
/**
* Constructor
*/
this.flagCondInverted = flagCondInverted;
}
/**
* Constructor
*/
this.flagNoCovered = flagNoCovered;
}
/**
* Constructor
*/
this.flagNoCovered = flagNoCovered;
}
//end JCOV
/**
* Constructor
*/
}
/**
* When deciding between a lookupswitch and a tableswitch, this
* value is used in determining how much size increase is
* acceptable.
*/
public static final double SWITCHRATIO;
static {
// Set SWITCHRATIO from the property javac.switchratio
// if it exists and is reasonable. Otherwise, set
// SWITCHRATIO to 1.5, meaning that we will accept a 1.5x
// blowup (for the instruction) to use a tableswitch instead
// of a lookupswitch.
double ratio = 1.5;
try {
}
} catch (NumberFormatException ee) {}
}
SWITCHRATIO = ratio;
}
/**
* Accessor
*/
public int getOpcode() {
return pc;
}
return value;
}
}
/**
* Optimize
*/
switch (opc) {
case opc_dstore: case opc_astore:
// Don't keep the LocalVariable info around, unless we
// are actually going to generate a local variable table.
}
break;
case opc_goto: {
// goto to the next instruction, obsolete
break;
}
// We optimize
//
// goto Tag
// ...
// Tag:
// return
//
// except when we're generating debuggable code. When
// we're generating debuggable code, we leave it alone,
// in order to provide better stepping behavior. Consider
// a method the end of which looks like this:
//
// ...
// break;
// } // end of loop
// } // end of method
//
// If we optimize the goto away, we'll be left with a
// single instruction (return) and the need to ascribe that
// instruction to two source lines (the break statement and
// the method's right curly). Can't get there from here.
// Depending on which line-number ascription we choose, the
// stepping user will step directly from the break statement
// back into the caller of the method (case 1) or from the
// statement that precedes the break statement to the method's
// right curly (case 2). Similarly, he'll be able to set a
// breakpoint on the break statement (case 1) or the method's
// right curly (case 2), but not on both. Neither case 1 nor
// case 2 is desirable. .We want him to see both the break
// statement and the method's right curly when stepping,
// and we want him to be able to set a breakpoint on either or
// both. So we suppress the optimization when generating
// debuggable code.
// (Above notes from brucek@eng in JDK1.0.2, copied here
// by kelly.ohair@eng for JDK1.1)
//
// With the changes to allow -O and -g at the same time,
// I've changed the condition to be whether optimization is
// on instead of the debugging flag being off.
// - david.stoutamire@eng for 1.2
// goto to return
break;
}
}
break;
}
case opc_ifnull: case opc_ifnonnull:
// branch to next instruction, obsolete
break;
}
// Conditional branch over goto, invert
// Note that you can't invert all conditions, condition
switch (opc) {
}
//JCOV
//end JCOV
}
break;
case opc_if_acmpeq: case opc_if_acmpne:
case opc_if_icmpeq: case opc_if_icmpne:
case opc_if_icmpgt: case opc_if_icmpge:
case opc_if_icmplt: case opc_if_icmple:
// branch to next instruction, obsolete
break;
}
// Conditional branch over goto, invert
switch (opc) {
}
//JCOV
//end JCOV
}
break;
case opc_tableswitch:
case opc_lookupswitch: {
}
// Compute the approximate sizes of a tableswitch and a
// lookupswitch. Decide which one we want to generate.
} else {
}
break;
}
}
}
/**
* Collect constants into the constant table
*/
switch (opc) {
case opc_dstore: case opc_astore:
if (value instanceof LocalVariable) {
}
return;
case opc_new: case opc_putfield:
case opc_putstatic: case opc_getfield:
case opc_getstatic: case opc_invokevirtual:
case opc_invokespecial: case opc_invokestatic:
case opc_invokeinterface: case opc_instanceof:
case opc_checkcast:
return;
case opc_anewarray:
return;
case opc_multianewarray:
return;
case opc_ldc:
case opc_ldc_w:
if ((v >= -1) && (v <= 5)) {
opc = opc_iconst_0 + v;
return;
} else if ((v >= -(1 << 7)) && (v < (1 << 7))) {
opc = opc_bipush;
return;
} else if ((v >= -(1 << 15)) && (v < (1 << 15))) {
opc = opc_sipush;
return;
}
if (v == 0) {
opc = opc_fconst_0;
return;
}
} else if (v == 1) {
opc = opc_fconst_1;
return;
} else if (v == 2) {
opc = opc_fconst_2;
return;
}
}
return;
case opc_ldc2_w:
if (v == 0) {
opc = opc_lconst_0;
return;
} else if (v == 1) {
opc = opc_lconst_1;
return;
}
if (v == 0) {
opc = opc_dconst_0;
return;
}
} else if (v == 1) {
opc = opc_dconst_1;
return;
}
}
return;
case opc_try:
}
}
return;
case opc_nop:
return;
}
}
/**
* Balance the stack
*/
int balance() {
switch (opc) {
return 0;
return 1;
case opc_dconst_1:
return 2;
return -1;
case opc_lreturn: case opc_dreturn:
return -2;
return -3;
case opc_lastore: case opc_dastore:
return -4;
case opc_multianewarray:
case opc_getfield:
case opc_putfield:
case opc_getstatic:
case opc_putstatic:
case opc_invokevirtual:
case opc_invokespecial:
case opc_invokeinterface:
case opc_invokestatic:
}
}
/**
* Return the size of the instruction
*/
switch (opc) {
return 0;
case opc_bipush: case opc_newarray:
return 2;
case opc_if_icmple:
return 3;
case opc_ldc:
case opc_ldc_w:
return 2;
} else {
return 3;
}
if (v < 4) {
if (v < 0) {
+ "\nThis error possibly resulted from poorly constructed class paths.");
}
return 1;
} else if (v <= 255) {
return 2;
} else {
return 4;
}
}
case opc_iinc: {
if (register < 0) {
}
return 3;
} else {
return 6;
}
}
case opc_dstore: case opc_astore: {
if (v < 4) {
if (v < 0) {
}
return 1;
} else if (v <= 255) {
return 2;
} else {
return 4;
}
}
case opc_ret: {
if (v <= 255) {
if (v < 0) {
}
return 2;
} else {
return 4;
}
}
case opc_ldc2_w: case opc_new:
case opc_putstatic: case opc_getstatic:
case opc_putfield: case opc_getfield:
case opc_invokevirtual: case opc_invokespecial:
case opc_invokestatic: case opc_instanceof:
case opc_checkcast: case opc_anewarray:
return 3;
case opc_multianewarray:
return 4;
case opc_invokeinterface:
case opc_goto_w:
case opc_jsr_w:
return 5;
case opc_tableswitch: {
int n = 1;
}
case opc_lookupswitch: {
int n = 1;
}
case opc_nop:
return 2;
else
return 1;
}
// most opcodes are only 1 byte long
return 1;
}
/**
* Generate code
*/
switch (opc) {
break;
case opc_bipush: case opc_newarray:
break;
break;
case opc_dstore: case opc_astore:
break;
case opc_astore + 256:
break;
case opc_sipush:
break;
case opc_ldc:
break;
case opc_ldc_w: case opc_ldc2_w:
case opc_new: case opc_putstatic:
case opc_getstatic: case opc_putfield:
case opc_getfield: case opc_invokevirtual:
case opc_invokespecial: case opc_invokestatic:
case opc_instanceof: case opc_checkcast:
break;
case opc_iinc:
break;
case opc_iinc + 256:
break;
case opc_anewarray:
break;
case opc_multianewarray:
break;
case opc_invokeinterface:
break;
break;
case opc_goto_w:
case opc_jsr_w:
break;
case opc_tableswitch: {
}
}
break;
}
case opc_lookupswitch: {
int n = pc + 1;
for(; (n % 4) != 0 ; n++) {
}
}
break;
}
case opc_nop:
else
return;
}
// fall through
default:
break;
}
}
/**
* toString
*/
switch (opc) {
case opc_try:
case opc_dead:
return prefix + "dead";
case opc_iinc: {
}
default:
} else if (value instanceof Instruction) {
} else {
}
} else {
}
}
}
}