1 /* |
1 /* |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
646 hdr.init(rp, rplimit, UNSIGNED5_spec); |
646 hdr.init(rp, rplimit, UNSIGNED5_spec); |
647 minver = hdr.getInt(); |
647 minver = hdr.getInt(); |
648 majver = hdr.getInt(); |
648 majver = hdr.getInt(); |
649 hdrVals += 2; |
649 hdrVals += 2; |
650 |
650 |
651 int majmin[3][2] = { |
651 int majmin[4][2] = { |
652 {JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION}, |
652 {JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION}, |
653 {JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION}, |
653 {JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION}, |
654 {JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION} |
654 {JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION}, |
|
655 {JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION} |
655 }; |
656 }; |
656 int majminfound = false; |
657 int majminfound = false; |
657 for (int i = 0 ; i < 3 ; i++) { |
658 for (int i = 0 ; i < 4 ; i++) { |
658 if (majver == majmin[i][0] && minver == majmin[i][1]) { |
659 if (majver == majmin[i][0] && minver == majmin[i][1]) { |
659 majminfound = true; |
660 majminfound = true; |
660 break; |
661 break; |
661 } |
662 } |
662 } |
663 } |
663 if (majminfound == null) { |
664 if (majminfound == null) { |
664 char message[200]; |
665 char message[200]; |
665 sprintf(message, "@" ERROR_FORMAT ": magic/ver = " |
666 sprintf(message, "@" ERROR_FORMAT ": magic/ver = " |
666 "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d\n", |
667 "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d\n", |
667 magic, majver, minver, |
668 magic, majver, minver, |
668 JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION, |
669 JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION, |
669 JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION, |
670 JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION, |
670 JAVA_PACKAGE_MAGIC, JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION); |
671 JAVA_PACKAGE_MAGIC, JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION, |
|
672 JAVA_PACKAGE_MAGIC, JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION); |
671 abort(message); |
673 abort(message); |
672 } |
674 } |
673 CHECK; |
675 CHECK; |
674 |
676 |
675 archive_options = hdr.getInt(); |
677 archive_options = hdr.getInt(); |
2479 ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations); |
2481 ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations); |
2480 ad.readBandData(METHOD_ATTR_RuntimeVisibleParameterAnnotations); |
2482 ad.readBandData(METHOD_ATTR_RuntimeVisibleParameterAnnotations); |
2481 ad.readBandData(METHOD_ATTR_RuntimeInvisibleParameterAnnotations); |
2483 ad.readBandData(METHOD_ATTR_RuntimeInvisibleParameterAnnotations); |
2482 ad.readBandData(METHOD_ATTR_AnnotationDefault); |
2484 ad.readBandData(METHOD_ATTR_AnnotationDefault); |
2483 CHECK; |
2485 CHECK; |
|
2486 |
|
2487 count = ad.predefCount(METHOD_ATTR_MethodParameters); |
|
2488 method_MethodParameters_NB.readData(count); |
|
2489 count = method_MethodParameters_NB.getIntTotal(); |
|
2490 method_MethodParameters_name_RUN.readData(count); |
|
2491 method_MethodParameters_flag_I.readData(count); |
|
2492 CHECK; |
2484 break; |
2493 break; |
2485 |
2494 |
2486 case ATTR_CONTEXT_CODE: |
2495 case ATTR_CONTEXT_CODE: |
2487 // (keep this code aligned with its brother in unpacker::write_attrs) |
2496 // (keep this code aligned with its brother in unpacker::write_attrs) |
2488 count = ad.predefCount(CODE_ATTR_StackMapTable); |
2497 count = ad.predefCount(CODE_ATTR_StackMapTable); |
4415 for (j = 0; j < count; j++) { |
4424 for (j = 0; j < count; j++) { |
4416 putref(method_Exceptions_RC.getRefN()); |
4425 putref(method_Exceptions_RC.getRefN()); |
4417 } |
4426 } |
4418 break; |
4427 break; |
4419 |
4428 |
|
4429 case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_MethodParameters): |
|
4430 aname = cp.sym[cpool::s_MethodParameters]; |
|
4431 putu1(count = method_MethodParameters_NB.getByte()); |
|
4432 for (j = 0; j < count; j++) { |
|
4433 putref(method_MethodParameters_name_RUN.getRefN()); |
|
4434 putu4(method_MethodParameters_flag_I.getInt()); |
|
4435 } |
|
4436 break; |
|
4437 |
4420 case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_StackMapTable): |
4438 case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_StackMapTable): |
4421 aname = cp.sym[cpool::s_StackMapTable]; |
4439 aname = cp.sym[cpool::s_StackMapTable]; |
4422 // (keep this code aligned with its brother in unpacker::read_attrs) |
4440 // (keep this code aligned with its brother in unpacker::read_attrs) |
4423 putu2(count = code_StackMapTable_N.getInt()); |
4441 putu2(count = code_StackMapTable_N.getInt()); |
4424 for (j = 0; j < count; j++) { |
4442 for (j = 0; j < count; j++) { |