public static void destroyLogicContextHook(Context self) {
    KeyValueList.setDynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_MONOTONICp, Stella.FALSE_WRAPPER, Stella.FALSE_WRAPPER);
    { Object old$Context$000 = Stella.$CONTEXT$.get();
      Object old$Module$000 = Stella.$MODULE$.get();

      try {
        Native.setSpecial(Stella.$CONTEXT$, self);
        Native.setSpecial(Stella.$MODULE$, ((Context)(Stella.$CONTEXT$.get())).baseModule);
        { LogicObject i = null;
          Iterator iter000 = Logic.locallyConceivedInstances(self).allocateIterator();

          while (iter000.nextP()) {
            i = ((LogicObject)(iter000.value));
            LogicObject.destroyTerm(i);
          }
        }

      } finally {
        Stella.$MODULE$.set(old$Module$000);
        Stella.$CONTEXT$.set(old$Context$000);
      }
    }
    if (Stella_Object.isaP(self, Logic.SGT_STELLA_MODULE)) {
      Logic.clearLogicModuleHook(((Module)(self)));
      self.surrogateValueInverse.surrogateValue = null;
    }
    if (Stella_Object.isaP(self, Logic.SGT_STELLA_WORLD)) {
      Logic.unlinkInferenceCache(((World)(self)));
      Logic.unlinkPropagationEnvironment(self);
    }
    self.dynamicSlots.clear();
  }