core: Use array-based stack.