[aot] use hashtable for caching typespec of classes