Mercurial > hg > openjdk > bsd-port > jdk
changeset 8513:47bb3af1c6a9
8160094: Improve pack200 layout
Reviewed-by: jrose, mschoene
author | ksrini |
---|---|
date | Wed, 19 Oct 2016 02:13:26 +0100 |
parents | 6a71656816aa |
children | bd297baf4981 |
files | src/share/native/com/sun/java/util/jar/pack/unpack.cpp src/share/native/com/sun/java/util/jar/pack/zip.cpp |
diffstat | 2 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Wed Oct 19 00:21:08 2016 +0100 +++ b/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Wed Oct 19 02:13:26 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2618,6 +2618,7 @@ } assert(!b.le_bci || prevBCI == (int)to_bci(prevBII)); + CHECK; switch (b.le_len) { case 0: break; case 1: putu1(x); break; @@ -3709,6 +3710,10 @@ uint len = bcimap.length(); uint* map = (uint*) bcimap.base(); assert(len > 0); // must be initialized before using to_bci + if (len == 0) { + abort("bad bcimap"); + return 0; + } if (bii < len) return map[bii]; // Else it's a fractional or out-of-range BCI. @@ -3731,6 +3736,7 @@ break; case 8: // (8) [PH] putu2(to_bci(code_StackMapTable_P.getInt())); + CHECK; break; } } @@ -3778,6 +3784,7 @@ CHECK; for (int curIP = 0; ; curIP++) { + CHECK; int curPC = (int)(wpoffset() - codeBase); bcimap.add(curPC); ensure_put_space(10); // covers most instrs w/o further bounds check @@ -4007,6 +4014,7 @@ int curIP = code_fixup_source.get(i); int destIP = curIP + bc_label.getInt(); int span = to_bci(destIP) - to_bci(curIP); + CHECK; switch (type) { case 2: putu2_at(bp, (ushort)span); break; case 4: putu4_at(bp, span); break; @@ -4194,11 +4202,13 @@ if (tag <= 127) { // (64-127) [(2)] if (tag >= 64) put_stackmap_type(); + CHECK_0; } else if (tag <= 251) { // (247) [(1)(2)] // (248-251) [(1)] if (tag >= 247) putu2(code_StackMapTable_offset.getInt()); if (tag == 247) put_stackmap_type(); + CHECK_0; } else if (tag <= 254) { // (252) [(1)(2)] // (253) [(1)(2)(2)] @@ -4225,6 +4235,7 @@ putu2(count = code_LineNumberTable_N.getInt()); for (j = 0; j < count; j++) { putu2(to_bci(code_LineNumberTable_bci_P.getInt())); + CHECK_0; putu2(code_LineNumberTable_line.getInt()); } break; @@ -4235,9 +4246,11 @@ for (j = 0; j < count; j++) { int bii = code_LocalVariableTable_bci_P.getInt(); int bci = to_bci(bii); + CHECK_0; putu2(bci); bii += code_LocalVariableTable_span_O.getInt(); putu2(to_bci(bii) - bci); + CHECK_0; putref(code_LocalVariableTable_name_RU.getRefN()); CHECK_0; putref(code_LocalVariableTable_type_RS.getRefN()); @@ -4252,9 +4265,11 @@ for (j = 0; j < count; j++) { int bii = code_LocalVariableTypeTable_bci_P.getInt(); int bci = to_bci(bii); + CHECK_0; putu2(bci); bii += code_LocalVariableTypeTable_span_O.getInt(); putu2(to_bci(bii) - bci); + CHECK_0; putref(code_LocalVariableTypeTable_name_RU.getRefN()); CHECK_0; putref(code_LocalVariableTypeTable_type_RS.getRefN());
--- a/src/share/native/com/sun/java/util/jar/pack/zip.cpp Wed Oct 19 00:21:08 2016 +0100 +++ b/src/share/native/com/sun/java/util/jar/pack/zip.cpp Wed Oct 19 02:13:26 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -342,7 +342,7 @@ struct tm* s = gmtime_r(&t, &sbuf); if (s == NULL) { fprintf(u->errstrm, "Error: gmtime failure, invalid input archive\n"); - exit(2); + exit(-1); } modtime_cache = modtime; dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,