[Vm-dev] Re: Issue 109 in cog: CogVM crashes with simple code

cog at googlecode.com cog at googlecode.com
Fri Nov 30 23:25:09 UTC 2012


Updates:
	Status: Fixed
	Owner: eliot.miranda at gmail.com
	Labels: -Priority-Medium Priority-High

Comment #1 on issue 109 by eliot.miranda at gmail.com: CogVM crashes with  
simple code
http://code.google.com/p/cog/issues/detail?id=109

OK, this is fixed.  Thanks, Jon.  The bug was that the pop of the folded  
constant did not record the implicit send in the folding, hence pc mapping  
was wrong.  i.e. 1-1 gets folded away to 0, and the code generator marks  
the result 0 as being the result of a send, but then the result gets  
discarded (when it is popped) without being noted in the pc map.  In the  
machine code there needs to be at least a nop generated, and in the map  
there needs to be an entry, to correspond to the send of +, so that when  
machine code pcs are mapped to bytecode pcs there are the correct number of  
entries in the map.  In the above case, the VM converts the interpreted  
frame to a machine code frame (coincidently) on the 20th iteration and  
needs to map the bytecode pc to the correct machine code pc to continue in  
machine code.  But because of the missing entry in the map for 1-1, the pc  
mapping machinery answered 0, and the VM ended up jumping into the void.



More information about the Vm-dev mailing list