Purge caches on context destruction
Fixed a bug in generator::Kernel

The kernel cache used there is not static and should not be registered
for purging. The cache in generator::Kernel was destroyed before it was
attempted to be purged by Context destructor.

@bmerry: this led to a segfault in tests/generator.
Deregister kernel cache on destruction

This should help if the cache is destroyed before it was attempted to be
purge (see 9aa9277b).
Merge pull request #116 from ddemidov/purge-caches-on-context-destruction

Purge kernel caches on context destruction