From 8c3e84869273512ffa2f9a72fed085ed08c547f2 Mon Sep 17 00:00:00 2001 From: Alexander Astapchuk Date: Fri, 23 Mar 2007 12:04:57 +0600 Subject: [PATCH] [drlvm][jet]fix for HARMONY-1840 - incorrect JSR processing --- vm/jitrino/src/jet/compiler.cpp | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/vm/jitrino/src/jet/compiler.cpp b/vm/jitrino/src/jet/compiler.cpp index 7ad0390..8a3e832 100644 --- a/vm/jitrino/src/jet/compiler.cpp +++ b/vm/jitrino/src/jet/compiler.cpp @@ -874,13 +874,21 @@ bool Compiler::comp_gen_insts(unsigned pc, unsigned parentPC, if (bbinfo.processed) { if (bbinfo.jsr_target) { // we're processing JSR subroutine - assert(jsr_lead == pc); - // Simply load the state back to the parent's - BBState* prevState = m_bbStates[parentPC]; - assert(m_jsrStates.find(jsr_lead) != m_jsrStates.end()); - const BBState* jsrState = m_jsrStates[jsr_lead]; - //prevState.jframe.init(&jsrState.jframe); - *prevState = *jsrState; + if (jsr_lead != NOTHING) { + assert(jsr_lead == pc); + // Simply load the state back to the parent's + BBState* prevState = m_bbStates[parentPC]; + assert(m_jsrStates.find(jsr_lead) != m_jsrStates.end()); + const BBState* jsrState = m_jsrStates[jsr_lead]; + //prevState.jframe.init(&jsrState.jframe); + *prevState = *jsrState; + } + else { + // we have a fall through (and not through a JSR) path + // to a subroutine + // do nothing here - we only need to return the state + // back for JSR + } } return false; } -- 1.5.0.rc4