mergeKill added (which doesn't combine the locals)

set unused entries in backing array to null
remove fixed (remove local using same slot, even if it differs)


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1071 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent f4d9aff1da
commit 8d4691f8b0
  1. 26
      jode/jode/flow/SlotSet.java

@ -111,13 +111,14 @@ public final class SlotSet extends AbstractSet implements Cloneable {
}
/**
* Removes a local info from this variable set.
* Removes a slot from this variable set.
*/
public boolean remove(Object li) {
li = ((LocalInfo) li).getLocalInfo();
int slot = ((LocalInfo) li).getSlot();
for (int i=0; i<count;i++) {
if (locals[i].getLocalInfo() == li) {
if (locals[i].getSlot() == slot) {
locals[i] = locals[--count];
locals[count] = null;
return true;
}
}
@ -174,7 +175,7 @@ public final class SlotSet extends AbstractSet implements Cloneable {
/**
* Merges this SlotSet with another. For all slots occuring
* in both variable sets, all corresponding LocalInfos are merged.
* The variable sets are not changed (use union for this).
* The sets are not changed (use addAll for this).
* @return The merged variables.
* @param vs the other variable set. */
public void merge(VariableSet vs) {
@ -187,4 +188,21 @@ public final class SlotSet extends AbstractSet implements Cloneable {
}
}
}
/**
* Add the slots in kill to the current set, unless there are
* already in this set. This differs from addAll, in the fact that it
* doesn't combine the locals.
*
* @param kill The other kill set.
*/
public void mergeKill(SlotSet kill) {
grow(kill.size());
big_loop:
for (Iterator i = kill.iterator(); i.hasNext(); ) {
LocalInfo li2 = (LocalInfo) i.next();
if (!containsSlot(li2.getSlot()))
add(li2.getLocalInfo());
}
}
}

Loading…
Cancel
Save