From 8e86ca8efac32967d3efaaea70693888bb595f70 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 20 Mar 1999 00:32:30 +0000 Subject: [PATCH] constructor parameters reordered (to be consistent) mapStackToLocal added git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@459 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/JsrBlock.java | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/jode/jode/flow/JsrBlock.java b/jode/jode/flow/JsrBlock.java index 6bd53fe..625e998 100644 --- a/jode/jode/flow/JsrBlock.java +++ b/jode/jode/flow/JsrBlock.java @@ -17,6 +17,7 @@ * $Id$ */ package jode.flow; +import jode.decompiler.LocalInfo; /** * This block represents a jsr instruction. A jsr instruction is @@ -31,7 +32,7 @@ public class JsrBlock extends StructuredBlock { */ StructuredBlock innerBlock; - public JsrBlock(Jump next, Jump subroutine) { + public JsrBlock(Jump subroutine, Jump next) { innerBlock = new EmptyBlock(subroutine); innerBlock.outer = this; setJump(next); @@ -56,6 +57,27 @@ public class JsrBlock extends StructuredBlock { return true; } + /** + * This is called after the analysis is completely done. It + * will remove all PUSH/stack_i expressions, (if the bytecode + * is correct).

+ * The default implementation merges the stack after each sub block. + * This may not be, what you want.

+ * + * @param initialStack the stackmap at begin of the block + * @return the stack after the block has executed. + * @throw RuntimeException if something did get wrong. + */ + public VariableStack mapStackToLocal(VariableStack stack) { + /* There shouldn't be any JSR blocks remaining, but who knows. + */ + /* The innerBlock is startet with a new stack entry (return address) + * It should GOTO immediately and never complete. + */ + innerBlock.mapStackToLocal(stack.push(new LocalInfo())); + return stack; + } + /** * Returns all sub block of this structured block. */