8160094: Improve pack200 layout
Reviewed-by: jrose, mschoene
This commit is contained in:
parent
573f0c765c
commit
8da66ad674
@ -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
|
||||
@ -2830,6 +2830,7 @@ void unpacker::putlayout(band** body) {
|
||||
}
|
||||
assert(!b.le_bci || prevBCI == (int)to_bci(prevBII));
|
||||
|
||||
CHECK;
|
||||
switch (b.le_len) {
|
||||
case 0: break;
|
||||
case 1: putu1(x); break;
|
||||
@ -4026,6 +4027,10 @@ uint unpacker::to_bci(uint bii) {
|
||||
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.
|
||||
@ -4048,6 +4053,7 @@ void unpacker::put_stackmap_type() {
|
||||
break;
|
||||
case 8: // (8) [PH]
|
||||
putu2(to_bci(code_StackMapTable_P.getInt()));
|
||||
CHECK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4095,6 +4101,7 @@ void unpacker::write_bc_ops() {
|
||||
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
|
||||
@ -4336,6 +4343,7 @@ void unpacker::write_bc_ops() {
|
||||
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;
|
||||
@ -4532,11 +4540,13 @@ int unpacker::write_attrs(int attrc, julong indexBits) {
|
||||
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)]
|
||||
@ -4563,6 +4573,7 @@ int unpacker::write_attrs(int attrc, julong indexBits) {
|
||||
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;
|
||||
@ -4573,9 +4584,11 @@ int unpacker::write_attrs(int attrc, julong indexBits) {
|
||||
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());
|
||||
@ -4590,9 +4603,11 @@ int unpacker::write_attrs(int attrc, julong indexBits) {
|
||||
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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user