1008 break; |
1008 break; |
1009 case putstatic: |
1009 case putstatic: |
1010 state.pop(((Symbol)(pool.pool[od])).erasure(types)); |
1010 state.pop(((Symbol)(pool.pool[od])).erasure(types)); |
1011 break; |
1011 break; |
1012 case new_: |
1012 case new_: |
1013 state.push(uninitializedObject(((Symbol)(pool.pool[od])).erasure(types), cp-3)); |
1013 Symbol sym; |
|
1014 if (pool.pool[od] instanceof UniqueType) { |
|
1015 // Required by change in Gen.makeRef to allow |
|
1016 // annotated types. |
|
1017 // TODO: is this needed anywhere else? |
|
1018 sym = ((UniqueType)(pool.pool[od])).type.tsym; |
|
1019 } else { |
|
1020 sym = (Symbol)(pool.pool[od]); |
|
1021 } |
|
1022 state.push(uninitializedObject(sym.erasure(types), cp-3)); |
1014 break; |
1023 break; |
1015 case sipush: |
1024 case sipush: |
1016 state.push(syms.intType); |
1025 state.push(syms.intType); |
1017 break; |
1026 break; |
1018 case if_acmp_null: |
1027 case if_acmp_null: |
1970 for (int i = 0; i < varBufferSize; ++i) { |
1979 for (int i = 0; i < varBufferSize; ++i) { |
1971 LocalVar lv = varBuffer[i]; |
1980 LocalVar lv = varBuffer[i]; |
1972 if (lv == null || lv.sym == null |
1981 if (lv == null || lv.sym == null |
1973 || lv.sym.annotations.isTypesEmpty() |
1982 || lv.sym.annotations.isTypesEmpty() |
1974 || !lv.sym.isExceptionParameter()) |
1983 || !lv.sym.isExceptionParameter()) |
1975 return; |
1984 continue; |
1976 |
|
1977 int exidx = findExceptionIndex(lv); |
|
1978 |
1985 |
1979 for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) { |
1986 for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) { |
1980 TypeAnnotationPosition p = ta.position; |
1987 TypeAnnotationPosition p = ta.position; |
1981 p.exception_index = exidx; |
1988 // At this point p.type_index contains the catch type index. |
1982 } |
1989 // Use that index to determine the exception table index. |
1983 } |
1990 // We can afterwards discard the type_index. |
1984 } |
1991 // A TA position is shared for all type annotations in the |
1985 |
1992 // same location; updating one is enough. |
1986 private int findExceptionIndex(LocalVar lv) { |
1993 // Use -666 as a marker that the exception_index was already updated. |
|
1994 if (p.type_index != -666) { |
|
1995 p.exception_index = findExceptionIndex(p.type_index); |
|
1996 p.type_index = -666; |
|
1997 } |
|
1998 } |
|
1999 } |
|
2000 } |
|
2001 |
|
2002 private int findExceptionIndex(int catchType) { |
|
2003 if (catchType == Integer.MIN_VALUE) { |
|
2004 // We didn't set the catch type index correctly. |
|
2005 // This shouldn't happen. |
|
2006 // TODO: issue error? |
|
2007 return -1; |
|
2008 } |
1987 List<char[]> iter = catchInfo.toList(); |
2009 List<char[]> iter = catchInfo.toList(); |
1988 int len = catchInfo.length(); |
2010 int len = catchInfo.length(); |
1989 for (int i = 0; i < len; ++i) { |
2011 for (int i = 0; i < len; ++i) { |
1990 char[] catchEntry = iter.head; |
2012 char[] catchEntry = iter.head; |
1991 iter = iter.tail; |
2013 iter = iter.tail; |
1992 char handlerpc = catchEntry[2]; |
2014 char ct = catchEntry[3]; |
1993 if (lv.start_pc == handlerpc + 1) { |
2015 if (catchType == ct) { |
1994 return i; |
2016 return i; |
1995 } |
2017 } |
1996 } |
2018 } |
1997 return -1; |
2019 return -1; |
1998 } |
2020 } |