Hi Steve, Thanks for your tips. I'm simplifying the code towards single instruction lists now, having found a fairly simple way to generate IF opcodes and fix them up later.
I agree that the instruction lists seem fairly stable, including the ability to reference handles between lists prior to 'flattening' the code and generating the method. I was using this technique but can now simplify to a linear generation sequence with fixups. The fixup technique is to grab a BranchHandle (more readable than BranchInstruction :-) when appending the IF opcode, and to specify the IF with a 'null' target at construction. Later an InstructionHandle is taken when the forward target is appended to the instruction list. The branch handle has a convenient setTarget() method to set the target of its branch instruction. Regarding nested structures, I think that returning an InstructionList or object encapsulating list & important handles (eg break statements and jumps to end) would be a good approach. The alternative approach of generator inserting into a specified insertion point would I think suffer failure; it appears that neither append() nor insert() method provide a full range of insertion points, eg 'before beginning' and 'after end' points are not representable by InstructionHandle or null handles. So the external context has to handle append/ insert functionality, which is less ideal than something like the java.util.List API; no need to distinguish between 'existent' entries, 'insert' or 'append' there. Regards, Thomas ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 28, 2003 2:37 AM Subject: bcel-user Digest 27 Jul 2003 14:37:54 -0000 Issue 133 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
