projects
/
nestedvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ca3a024
)
compiler off by one error
author
brian
<brian@brianweb.net>
Mon, 10 May 2004 08:56:20 +0000
(
01:56
-0700)
committer
brian
<brian@brianweb.net>
Mon, 10 May 2004 08:56:20 +0000
(
01:56
-0700)
darcs-hash:
20040510085620
-24bed-
6f066a24b8de5ab9b52366ea06f898ccd1a7ef16
.gz
src/org/ibex/nestedvm/ClassFileCompiler.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/nestedvm/ClassFileCompiler.java
b/src/org/ibex/nestedvm/ClassFileCompiler.java
index
bcd069e
..
0092c0f
100644
(file)
--- a/
src/org/ibex/nestedvm/ClassFileCompiler.java
+++ b/
src/org/ibex/nestedvm/ClassFileCompiler.java
@@
-150,14
+150,14
@@
public class ClassFileCompiler extends Compiler implements org.apache.bcel.Const
a(InstructionConstants.IUSHR);
int beg = text.addr >>> methodShift;
a(InstructionConstants.IUSHR);
int beg = text.addr >>> methodShift;
- int end = ((text.addr + text.size) >>> methodShift);
+ int end = ((text.addr + text.size + maxBytesPerMethod - 1) >>> methodShift);
// This data is redundant but BCEL wants it
// This data is redundant but BCEL wants it
- int[] matches = new int[end-beg+1];
- for(int i=beg;i<=end;i++) matches[i-beg] = i;
+ int[] matches = new int[end-beg];
+ for(int i=beg;i<end;i++) matches[i-beg] = i;
TABLESWITCH ts = new TABLESWITCH(matches,new InstructionHandle[matches.length],null);
a(ts);
TABLESWITCH ts = new TABLESWITCH(matches,new InstructionHandle[matches.length],null);
a(ts);
- for(int n=beg;n<=end;n++){
+ for(int n=beg;n<end;n++){
InstructionHandle h = a(fac.createInvoke(fullClassName,"run_"+toHex(n<<methodShift),Type.VOID,Type.NO_ARGS,INVOKESPECIAL));
a(InstructionFactory.createBranchInstruction(GOTO,start));
ts.setTarget(n-beg,h);
InstructionHandle h = a(fac.createInvoke(fullClassName,"run_"+toHex(n<<methodShift),Type.VOID,Type.NO_ARGS,INVOKESPECIAL));
a(InstructionFactory.createBranchInstruction(GOTO,start));
ts.setTarget(n-beg,h);