Skip to content

Commit

Permalink
fix: Re-introduce limited case CP pruning due to incomplete class spe…
Browse files Browse the repository at this point in the history
…c insights
  • Loading branch information
Col-E committed Feb 18, 2022
1 parent bc1ccdc commit 62da8c3
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,18 @@ public void transform() {
if (index == 0 || index >= max - 1)
continue;
ConstPoolEntry cpe = pool.get(index);
logger.info("Removing now unused CP entry: {}={}", index, cpe.getClass().getSimpleName());
pool.set(index, new CpInt(0));
switch (cpe.getTag()) {
case ConstantPool.DYNAMIC:
case ConstantPool.INVOKE_DYNAMIC:
logger.debug("Removing now unused CP entry: {}={}", index, cpe.getClass().getSimpleName());
pool.set(index, new CpInt(0));
break;
default:
// TODO: When the full class file specification is complete we can aggressively prune other types.
// - for now we only remove specific X_DYNAMIC types since we can be sure removing them is safe
// in the context of references to it being removed due to an invalid BootstrapMethodsAttribute
break;
}
}
}

Expand Down

0 comments on commit 62da8c3

Please sign in to comment.