summaryrefslogtreecommitdiff
path: root/src/cuda-sim/ptx_sim.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuda-sim/ptx_sim.cc')
-rw-r--r--src/cuda-sim/ptx_sim.cc13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/cuda-sim/ptx_sim.cc b/src/cuda-sim/ptx_sim.cc
index 85e6185..dffc128 100644
--- a/src/cuda-sim/ptx_sim.cc
+++ b/src/cuda-sim/ptx_sim.cc
@@ -358,6 +358,7 @@ void ptx_thread_info::callstack_push( unsigned pc, unsigned rpc, const symbol *r
m_last_was_call = true;
m_callstack.push_back( stack_entry(m_symbol_table,m_func_info,pc,rpc,return_var_src,return_var_dst,call_uid) );
m_regs.push_back( reg_map_t() );
+ m_local_mem_stack_pointer += m_func_info->local_mem_framesize();
}
#define POST_DOMINATOR 1 /* must match definition in shader.h */
@@ -368,7 +369,9 @@ extern void set_operand_value( const symbol *dst, const ptx_reg_t &data );
bool ptx_thread_info::callstack_pop()
{
assert( !m_callstack.empty() );
+ assert( m_local_mem_stack_pointer >= m_func_info->local_mem_framesize() );
m_func_info = m_callstack.back().m_func_info;
+ m_local_mem_stack_pointer -= m_func_info->local_mem_framesize();
m_symbol_table = m_callstack.back().m_symbol_table;
m_NPC = m_callstack.back().m_PC;
m_RPC_updated = true;
@@ -448,16 +451,6 @@ void ptx_thread_info::dump_modifiedregs()
}
}
-void ptx_thread_info::push_local_mem_stack()
-{
- m_local_mem_stack_pointer += m_func_info->local_mem_framesize();
-}
-
-void ptx_thread_info::pop_local_mem_stack()
-{
- m_local_mem_stack_pointer -= m_func_info->local_mem_framesize();
-}
-
void ptx_thread_info::set_npc( const function_info *f )
{
m_NPC = f->get_start_PC();