Relocated m_stack to libdeng1

Also spruced up the implementation a little.