Author: markt
Date: Fri Sep 12 12:05:52 2014
New Revision: 1624509
URL: http://svn.apache.org/r1624509
Log:
Merge restoration of necessary code from trunk
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1397971-1397972
Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
------------------------------------------------------------------------------
Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1397971-1397972
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624509&r1=1624508&r2=1624509&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri
Sep 12 12:05:52 2014
@@ -541,4 +541,24 @@ public interface Constants {
public static final byte ITEM_Object = 7;
public static final byte ITEM_NewObject = 8;
+ /** Constants used to identify StackMapEntry types.
+ *
+ * For those types which can specify a range, the
+ * constant names the lowest value.
+ */
+ public static final int SAME_FRAME = 0;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME = 64;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED = 247;
+ public static final int CHOP_FRAME = 248;
+ public static final int SAME_FRAME_EXTENDED = 251;
+ public static final int APPEND_FRAME = 252;
+ public static final int FULL_FRAME = 255;
+
+ /** Constants that define the maximum value of
+ * those constants which store ranges. */
+
+ public static final int SAME_FRAME_MAX = 63;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_MAX = 127;
+ public static final int CHOP_FRAME_MAX = 250;
+ public static final int APPEND_FRAME_MAX = 254;
}
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java?rev=1624509&r1=1624508&r2=1624509&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
Fri Sep 12 12:05:52 2014
@@ -58,8 +58,10 @@ public final class Code extends Attribut
Code(int name_index, int length, DataInputStream file, ConstantPool
constant_pool)
throws IOException {
// Initialize with some default values which will be overwritten later
- this(name_index, length, (byte[]) null, (CodeException[]) null,
- (Attribute[]) null, constant_pool);
+ this(name_index, length, (byte[]) null,
+ (CodeException[]) null, (Attribute[]) null, constant_pool);
+ file.readUnsignedShort(); // Unused max_stack
+ file.readUnsignedShort(); // Unused max_locals
code_length = file.readInt();
code = new byte[code_length]; // Read byte code
file.readFully(code);
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java?rev=1624509&r1=1624508&r2=1624509&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
Fri Sep 12 12:05:52 2014
@@ -34,9 +34,38 @@ public final class StackMapEntry impleme
private static final long serialVersionUID = 1L;
+ private int number_of_locals;
+ private StackMapType[] types_of_locals;
+ private int number_of_stack_items;
+ private StackMapType[] types_of_stack_items;
+
+
+ /**
+ * Construct object from file stream.
+ * @param file Input stream
+ * @throws IOException
+ */
StackMapEntry(DataInputStream file) throws IOException {
- file.readShort(); // Unused byte_code_offset
- file.readShort(); // Unused number_of_locals
+ this(file.readShort(), file.readShort(), null, -1, null);
+ types_of_locals = new StackMapType[number_of_locals];
+ for (int i = 0; i < number_of_locals; i++) {
+ types_of_locals[i] = new StackMapType(file);
+ }
+ number_of_stack_items = file.readShort();
+ types_of_stack_items = new StackMapType[number_of_stack_items];
+ for (int i = 0; i < number_of_stack_items; i++) {
+ types_of_stack_items[i] = new StackMapType(file);
+ }
+ }
+
+
+ public StackMapEntry(int byte_code_offset, int number_of_locals,
+ StackMapType[] types_of_locals, int number_of_stack_items,
+ StackMapType[] types_of_stack_items) {
+ this.number_of_locals = number_of_locals;
+ this.types_of_locals = types_of_locals;
+ this.number_of_stack_items = number_of_stack_items;
+ this.types_of_stack_items = types_of_stack_items;
}
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java?rev=1624509&r1=1624508&r2=1624509&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
Fri Sep 12 12:05:52 2014
@@ -21,6 +21,8 @@ import java.io.DataInputStream;
import java.io.IOException;
import java.io.Serializable;
+import org.apache.tomcat.util.bcel.Constants;
+
/**
* This class represents a stack map entry recording the types of
* local variables and the the of stack items at a given byte code offset.
@@ -34,6 +36,12 @@ public final class StackMapTableEntry im
private static final long serialVersionUID = 1L;
+ private int frame_type;
+ private int number_of_locals;
+ private StackMapType[] types_of_locals;
+ private int number_of_stack_items;
+ private StackMapType[] types_of_stack_items;
+
/**
* Construct object from file stream.
@@ -41,7 +49,57 @@ public final class StackMapTableEntry im
* @throws IOException
*/
StackMapTableEntry(DataInputStream file) throws IOException {
- file.read(); // Unused frame_type
+ this(file.read(), -1, null, -1, null);
+
+ if (frame_type >= Constants.SAME_FRAME && frame_type <=
Constants.SAME_FRAME_MAX) {
+ // NO-OP
+ } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME &&
frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
+ number_of_stack_items = 1;
+ types_of_stack_items = new StackMapType[1];
+ types_of_stack_items[0] = new StackMapType(file);
+ } else if (frame_type ==
Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
+ file.readShort(); // Unused byte_code_offset_delta
+ number_of_stack_items = 1;
+ types_of_stack_items = new StackMapType[1];
+ types_of_stack_items[0] = new StackMapType(file);
+ } else if (frame_type >= Constants.CHOP_FRAME && frame_type <=
Constants.CHOP_FRAME_MAX) {
+ file.readShort(); // Unused byte_code_offset_delta
+ } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
+ file.readShort(); // Unused byte_code_offset_delta
+ } else if (frame_type >= Constants.APPEND_FRAME && frame_type <=
Constants.APPEND_FRAME_MAX) {
+ file.readShort(); // Unused byte_code_offset_delta
+ number_of_locals = frame_type - 251;
+ types_of_locals = new StackMapType[number_of_locals];
+ for (int i = 0; i < number_of_locals; i++) {
+ types_of_locals[i] = new StackMapType(file);
+ }
+ } else if (frame_type == Constants.FULL_FRAME) {
+ file.readShort(); // Unused byte_code_offset_delta
+ number_of_locals = file.readShort();
+ types_of_locals = new StackMapType[number_of_locals];
+ for (int i = 0; i < number_of_locals; i++) {
+ types_of_locals[i] = new StackMapType(file);
+ }
+ number_of_stack_items = file.readShort();
+ types_of_stack_items = new StackMapType[number_of_stack_items];
+ for (int i = 0; i < number_of_stack_items; i++) {
+ types_of_stack_items[i] = new StackMapType(file);
+ }
+ } else {
+ /* Can't happen */
+ throw new ClassFormatException ("Invalid frame type found while
parsing stack map table: " + frame_type);
+ }
+ }
+
+
+ public StackMapTableEntry(int tag, int number_of_locals,
+ StackMapType[] types_of_locals, int number_of_stack_items,
+ StackMapType[] types_of_stack_items) {
+ this.frame_type = tag;
+ this.number_of_locals = number_of_locals;
+ this.types_of_locals = types_of_locals;
+ this.number_of_stack_items = number_of_stack_items;
+ this.types_of_stack_items = types_of_stack_items;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]