In SICStus Prolog, there is a hook for expanding a goal: goal_expansion/6
which is called both at compile time and at runtime during metacalling. These calls incur quite some runtime overhead which slows down metacalling. The purpose of my expansion is optimization only. So semantically the goals and expanded goals are equivalent.
How can I disable such calls at runtime?
(It seems I would have to abolish goal_expansion/6
which looks a bit crass to me. It would also hamper lightweight recompilation).