Browse Source

Final patches from ASM 5.0.2 release

Issue: SPR-11212
pull/529/head
Juergen Hoeller 12 years ago
parent
commit
fb66567bba
  1. 2
      spring-core/src/main/java/org/springframework/asm/ClassWriter.java
  2. 23
      spring-core/src/main/java/org/springframework/asm/Frame.java

2
spring-core/src/main/java/org/springframework/asm/ClassWriter.java

@ -756,7 +756,7 @@ public class ClassWriter extends ClassVisitor { @@ -756,7 +756,7 @@ public class ClassWriter extends ClassVisitor {
if (innerClasses == null) {
innerClasses = new ByteVector();
}
// §4.7.6 of the JVMS states "Every CONSTANT_Class_info entry in the
// Sec. 4.7.6 of the JVMS states "Every CONSTANT_Class_info entry in the
// constant_pool table which represents a class or interface C that is
// not a package member must have exactly one corresponding entry in the
// classes array". To avoid duplicates we keep track in the intVal field

23
spring-core/src/main/java/org/springframework/asm/Frame.java

@ -70,8 +70,8 @@ final class Frame { @@ -70,8 +70,8 @@ final class Frame {
* stack types. VALUE depends on KIND. For LOCAL types, it is an index in
* the input local variable types. For STACK types, it is a position
* relatively to the top of input frame stack. For BASE types, it is either
* one of the constants defined in FrameVisitor, or for OBJECT and
* UNINITIALIZED types, a tag and an index in the type table.
* one of the constants defined below, or for OBJECT and UNINITIALIZED
* types, a tag and an index in the type table.
*
* Output frames can contain types of any kind and with a positive or
* negative dimension (and even unassigned types, represented by 0 - which
@ -1417,6 +1417,7 @@ final class Frame { @@ -1417,6 +1417,7 @@ final class Frame {
// if t is the NULL type, merge(u,t)=u, so there is no change
return false;
} else if ((t & (DIM | BASE_KIND)) == (u & (DIM | BASE_KIND))) {
// if t and u have the same dimension and same base kind
if ((u & BASE_KIND) == OBJECT) {
// if t is also a reference type, and if u and t have the
// same dimension merge(u,t) = dim(t) | common parent of the
@ -1425,13 +1426,21 @@ final class Frame { @@ -1425,13 +1426,21 @@ final class Frame {
| cw.getMergedType(t & BASE_VALUE, u & BASE_VALUE);
} else {
// if u and t are array types, but not with the same element
// type, merge(u,t)=java/lang/Object
v = OBJECT | cw.addType("java/lang/Object");
// type, merge(u,t) = dim(u) - 1 | java/lang/Object
int vdim = ELEMENT_OF + (u & DIM);
v = vdim | OBJECT | cw.addType("java/lang/Object");
}
} else if ((t & BASE_KIND) == OBJECT || (t & DIM) != 0) {
// if t is any other reference or array type,
// merge(u,t)=java/lang/Object
v = OBJECT | cw.addType("java/lang/Object");
// if t is any other reference or array type, the merged type
// is min(udim, tdim) | java/lang/Object, where udim is the
// array dimension of u, minus 1 if u is an array type with a
// primitive element type (and similarly for tdim).
int tdim = (((t & DIM) == 0 || (t & BASE_KIND) == OBJECT) ? 0
: ELEMENT_OF) + (t & DIM);
int udim = (((u & DIM) == 0 || (u & BASE_KIND) == OBJECT) ? 0
: ELEMENT_OF) + (u & DIM);
v = Math.min(tdim, udim) | OBJECT
| cw.addType("java/lang/Object");
} else {
// if t is any other type, merge(u,t)=TOP
v = TOP;

Loading…
Cancel
Save