projects
/
org.ibex.classgen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5171de5
)
minor bug fixes
author
brian
<brian@brianweb.net>
Sat, 29 May 2004 09:17:00 +0000
(09:17 +0000)
committer
brian
<brian@brianweb.net>
Sat, 29 May 2004 09:17:00 +0000
(09:17 +0000)
darcs-hash:
20040529091700
-24bed-
d7bee1ee6d57cc211b75e8912f0a1c1c04eeca60
.gz
src/org/ibex/classgen/MethodGen.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/classgen/MethodGen.java
b/src/org/ibex/classgen/MethodGen.java
index
6603ebd
..
0fc3074
100644
(file)
--- a/
src/org/ibex/classgen/MethodGen.java
+++ b/
src/org/ibex/classgen/MethodGen.java
@@
-371,6
+371,8
@@
public class MethodGen implements CGConst {
int codeSize = p;
int codeSize = p;
+ if(codeSize >= 65536) throw new ClassGen.Exn("method too large in size");
+
o.writeShort(maxStack);
o.writeShort(maxLocals);
o.writeInt(codeSize);
o.writeShort(maxStack);
o.writeShort(maxLocals);
o.writeInt(codeSize);
@@
-423,8
+425,14
@@
public class MethodGen implements CGConst {
default:
if((opdata & OP_BRANCH_FLAG) != 0) {
int v = pc[((Integer)arg).intValue()] - pc[i];
default:
if((opdata & OP_BRANCH_FLAG) != 0) {
int v = pc[((Integer)arg).intValue()] - pc[i];
- if(v < -32768 || v > 32767) throw new ClassGen.Exn("overflow of s2 offset");
- o.writeShort(v);
+ if(argLength == 2) {
+ if(v < -32768 || v > 32767) throw new ClassGen.Exn("overflow of s2 offset");
+ o.writeShort(v);
+ } else if(argLength == 4) {
+ o.writeInt(v);
+ } else {
+ throw new Error("should never happen");
+ }
} else if((opdata & OP_CPENT_FLAG) != 0) {
int v = ((CPGen.Ent)arg).getIndex();
if(argLength == 1) o.writeByte(v);
} else if((opdata & OP_CPENT_FLAG) != 0) {
int v = ((CPGen.Ent)arg).getIndex();
if(argLength == 1) o.writeByte(v);