Minor fixes.

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1288 379699f6-c40d-0410-875b-85095c16579e
master
hoenicke 24 years ago
parent 854a466d67
commit 8c85a88d39
  1. 9
      jode/jode/bytecode/BasicBlockReader.java
  2. 2
      jode/jode/bytecode/BasicBlockWriter.java
  3. 8
      jode/jode/bytecode/BasicBlocks.java
  4. 2
      jode/jode/bytecode/Instruction.java

@ -1,4 +1,4 @@
/* BasicBlockReader Copyright (C) 1999-20000 Jochen Hoenicke. /* BasicBlockReader Copyright (C) 1999-2000 Jochen Hoenicke.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -205,7 +205,7 @@ class BasicBlockReader implements Opcodes {
} }
private void convertHandlers() { private Handler[] convertHandlers() {
int newCount = 0; int newCount = 0;
for (int i=0; i < handlers.length; i++) { for (int i=0; i < handlers.length; i++) {
if ((infos[handlers[i].catcher].flags & IS_REACHABLE) != 0) if ((infos[handlers[i].catcher].flags & IS_REACHABLE) != 0)
@ -232,7 +232,7 @@ class BasicBlockReader implements Opcodes {
handlers[i].type); handlers[i].type);
} }
} }
bb.setExceptionHandlers(newHandlers); return newHandlers;
} }
private void convertBlock(int firstAddr, int count) { private void convertBlock(int firstAddr, int count) {
@ -297,8 +297,7 @@ class BasicBlockReader implements Opcodes {
} }
if (start != -1) if (start != -1)
convertBlock(start, count); convertBlock(start, count);
bb.setBlocks(blocks, getSuccBlock(0)); bb.setBlocks(blocks, getSuccBlock(0), convertHandlers());
convertHandlers();
} }
public void readCode(ConstantPool cp, public void readCode(ConstantPool cp,

@ -1,4 +1,4 @@
/* BasicBlockWriter Copyright (C) 1999-20000 Jochen Hoenicke. /* BasicBlockWriter Copyright (C) 1999-2000 Jochen Hoenicke.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

@ -161,15 +161,12 @@ public class BasicBlocks extends BinaryInfo {
maxLocals = ml; maxLocals = ml;
} }
public void setBlocks(Block[] blocks, Block startBlock) { public void setBlocks(Block[] blocks, Block startBlock,
Handler[] handlers) {
for (int i = 0; i < blocks.length; i++) for (int i = 0; i < blocks.length; i++)
blocks[i].blockNr = i; blocks[i].blockNr = i;
this.blocks = blocks; this.blocks = blocks;
this.startBlock = startBlock; this.startBlock = startBlock;
this.exceptionHandlers = null;
}
public void setExceptionHandlers(Handler[] handlers) {
exceptionHandlers = handlers.length == 0 ? Handler.EMPTY : handlers; exceptionHandlers = handlers.length == 0 ? Handler.EMPTY : handlers;
ArrayList activeHandlers = new ArrayList(); ArrayList activeHandlers = new ArrayList();
for (int i = 0; i < blocks.length; i++) { for (int i = 0; i < blocks.length; i++) {
@ -185,6 +182,7 @@ public class BasicBlocks extends BinaryInfo {
blocks[i].catchers = blocks[i].catchers =
(Handler[]) activeHandlers.toArray(Handler.EMPTY); (Handler[]) activeHandlers.toArray(Handler.EMPTY);
} }
// TransformSubroutine.createSubroutineInfo(this);
} }
/** /**

@ -114,7 +114,7 @@ public class Instruction implements Opcodes{
* @exception IllegalArgumentException if opcode is not opc_ldc or * @exception IllegalArgumentException if opcode is not opc_ldc or
* opc_ldc2_w. * opc_ldc2_w.
*/ */
public Instruction forOpcode(int opcode, Object constant) { public static Instruction forOpcode(int opcode, Object constant) {
if (opcode == opc_ldc || opcode == opc_ldc2_w) if (opcode == opc_ldc || opcode == opc_ldc2_w)
return new ConstantInstruction(opcode, constant); return new ConstantInstruction(opcode, constant);
throw new IllegalArgumentException("Instruction has no constant"); throw new IllegalArgumentException("Instruction has no constant");

Loading…
Cancel
Save