We consider stable solutions of semilinear equations in a very general setting. The equation is set on a Polish topological space endowed with a measure and the linear operator is induced by a carré du champs (equivalently, the equation is set in a diffusion Markov triple). Under suitable curvature dimension conditions, we establish that stable solutions with integrable carré du champs are necessarily constant (weaker conditions characterize the structure of the carré du champs and carré du champ itéré). The proofs are based on a geometric Poincaré formula in this setting. From the general theorems established, several previous results are obtained as particular cases and new ones are provided as well.