Efficient Tabling Mechanisms for Logic Programs