Mutable terms in Prolog form an abstract data type that supports back-trackable destructive assignment. They are intensively used in Constraint Logic Programming and the implementation of constraint solvers. When implemented in XSB, a tabled logic programming system, the underlying mechanism to support mutable terms provides in addition an important way to save table space. In this paper we describe our implementation of mutable terms in XSB. The implementation of mutable terms is considerably more complex than in a normal Prolog system. First, since mutable terms can appear in a subgoal call and may be updated in an answer, the substitution factoring mechanism in XSB's variant engine must be extended to handle them. Second, to ensure that direct invocation and retrieval from the table give equivalent results, multiple occurrences of the same mutable term in a subgoal and/or an answer must be maintained as shared whenever we copy terms into and out of a table. The XSB tabling engine has to be extended, and special modifications are required for the structure of subgoal table and answer table. The mechanism to preserve the sharing of mutable terms is also proved to be an efficient way of reducing table sizes, as an unchanged mutable term is only saved once in the subgoal table or answer table no matter how many times it appears in the subgoal and the corresponding answer (the new value of a changed mutable term is saved once in the answer table). Used in tailed programs, this mechanism can significantly improve time and space performance.