From 91d56f235fa39ec0cb64368049305f60c422a7ed Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 28 Apr 1999 09:21:05 +0000 Subject: [PATCH] new lvt handling git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@669 379699f6-c40d-0410-875b-85095c16579e --- .../decompiler/LocalVariableRangeList.java | 44 ++++++------------- jode/jode/decompiler/LocalVariableTable.java | 6 +-- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/jode/jode/decompiler/LocalVariableRangeList.java b/jode/jode/decompiler/LocalVariableRangeList.java index 07bfda1..d7cd0dd 100644 --- a/jode/jode/decompiler/LocalVariableRangeList.java +++ b/jode/jode/decompiler/LocalVariableRangeList.java @@ -23,31 +23,14 @@ import jode.type.Type; public class LocalVariableRangeList { - class MyLocalInfo extends LocalInfo { - int startAddr; - int endAddr; - MyLocalInfo next; - - MyLocalInfo(int slot, int s, int e, String n, Type t) { - super (slot); - startAddr = s; - endAddr = e; - setName(n); - setType(t); - next = null; - } - } - - MyLocalInfo list = null; - int slot; + LocalVarEntry list = null; - LocalVariableRangeList(int slot) { - this.slot = slot; + LocalVariableRangeList() { } - private void add(MyLocalInfo li) { - MyLocalInfo prev = null; - MyLocalInfo next = list; + private void add(LocalVarEntry li) { + LocalVarEntry prev = null; + LocalVarEntry next = list; while (next != null && next.endAddr < li.startAddr) { prev = next; next = next.next; @@ -55,8 +38,8 @@ public class LocalVariableRangeList { /* prev.endAddr < li.startAddr <= next.endAddr */ if (next != null && li.endAddr >= next.startAddr) { - if (next.getType().equals(li.getType()) - && next.getName().equals(li.getName())) { + if (next.type.equals(li.type) + && next.name.equals(li.name)) { /* Same type, same name and overlapping range. * This is the same local: extend next to the common * range and don't add li. @@ -74,24 +57,23 @@ public class LocalVariableRangeList { prev.next = li; } - private LocalInfo find(int addr) { - MyLocalInfo li = list; + private LocalVarEntry find(int addr) { + LocalVarEntry li = list; while (li != null && li.endAddr < addr) li = li.next; - if (li == null || li.startAddr > addr /* XXX addr+1? weired XXX */) { - LocalInfo temp = new LocalInfo(slot); - return temp; + if (li == null || li.startAddr > addr) { + return null; } return li; } public void addLocal(int startAddr, int endAddr, String name, Type type) { - MyLocalInfo li = new MyLocalInfo(slot,startAddr,endAddr,name,type); + LocalVarEntry li = new LocalVarEntry(startAddr,endAddr,name,type); add (li); } - public LocalInfo getInfo(int addr) { + public LocalVarEntry getInfo(int addr) { return find(addr); } } diff --git a/jode/jode/decompiler/LocalVariableTable.java b/jode/jode/decompiler/LocalVariableTable.java index f88cbad..c4bd7ba 100644 --- a/jode/jode/decompiler/LocalVariableTable.java +++ b/jode/jode/decompiler/LocalVariableTable.java @@ -29,16 +29,16 @@ public class LocalVariableTable { public LocalVariableTable(int maxLocals, LocalVariableInfo[] lvt) { locals = new LocalVariableRangeList[maxLocals]; for (int i=0; i < maxLocals; i++) - locals[i] = new LocalVariableRangeList(i); + locals[i] = new LocalVariableRangeList(); for (int i=0; i