  We used {\sl \textup{ab initio}} molecular dynamics simulations to calculate
the high-pressure melting temperatures of the three potential core components.
  The planetary adiabats were obtained by solving the hydrostatic equations in
a three-layer model adjusted to reproduce the measured gravitational moments.
Recently developed {\sl \textup{ab initio}} equations of state were used for
the envelope and the core. We find that the cores of the giant and ice-giant
planets of the solar system differ because the pressure-temperature conditions
encountered in each object correspond to different regions of the phase
diagrams. For Jupiter and Saturn, the results are compatible with a diffuse
core and mixing of a significant fraction of metallic elements in the envelope,
leading to a convective and/or a double-diffusion regime. We also find that
their solid cores vary in nature and size throughout the lifetimes of these
planets. The solid cores of the two giant planets are not primordial and
nucleate and grow as the planets cool.
  We estimate that the solid core of Jupiter is 3 Gyr old and that of Saturn is
1.5 Gyr old. The situation is less extreme for Uranus and Neptune, whose cores
are only partially melted.
  To model Jupiter, the time evolution of the interior structure of the giant
planets and exoplanets in general, their luminosity, and the evolution of the
tidal effects over their lifetimes, the core should be considered as
crystallizing and growing rather than gradually mixing into the envelope due to
the solubility of its components.
