On the critical points of planar polynomial Hamiltonian systems