runtime: Use hashtables for metadata caches (again).
runtime: Use hashtables for metadata caches (again).

Using a linked list for metadata caches is pretty lame. Pull in llvm::DenseMap and hash_combine_range and use them to index instantiated metadata.

The previous attempt at this failed because tuple type metadata was laid out in a way that smashed the metadata cache key. Cache keys used to be laid out like this:

CacheEntry struct
-----------------
cache key
-----------------
variable-sized payload

And TupleTypeMetadata tried to tail-emplace its element array immediately after the main CacheEntry, forgetting the cache key was there. When we actually try to use that cache key to implement a hash table, bad things happen. Rearrange cache entries into the less error-prone layout:

cache key
-----------------
CacheEntry struct
-----------------
variable-sized payload

This also nicely avoids the need for a dynamic offset from the CacheEntry struct to its payload. A tail-allocated payload is likely to be more hot than the cache key, which is only needed at instantiation and lookup time.

Swift SVN r13205

karwa/swift,atrick/swift,roambotics/swift,deyton/swift,xedin/swift,benlangmuir/swift,kperryua/swift,SwiftAndroid/swift,swiftix/swift.old,rudkx/swift,MukeshKumarS/Swift,JaSpa/swift,ahoppen/swift,adrfer/swift,manavgabhawala/swift,aschwaighofer/swift,jmgc/swift,arvedviehweger/swift,emilstahl/swift,ken0nek/swift,rudkx/swift,jopamer/swift,calebd/swift,parkera/swift,uasys/swift,tjw/swift,emilstahl/swift,airspeedswift/swift,therealbnut/swift,modocache/swift,gribozavr/swift,roambotics/swift,alblue/swift,adrfer/swift,deyton/swift,roambotics/swift,KrishMunot/swift,karwa/swift,stephentyrone/swift,arvedviehweger/swift,karwa/swift,parkera/swift,Jnosh/swift,shahmishal/swift,modocache/swift,uasys/swift,devincoughlin/swift,jtbandes/swift,cbrentharris/swift,return/swift,russbishop/swift,airspeedswift/swift,ken0nek/swift,hughbe/swift,tjw/swift,natecook1000/swift,hooman/swift,gmilos/swift,JGiola/swift,tkremenek/swift,modocache/swift,dduan/swift,dreamsxin/swift,kperryua/swift,rudkx/swift,cbrentharris/swift,huonw/swift,emilstahl/swift,devincoughlin/swift,johnno1962d/swift,huonw/swift,kentya6/swift,tinysun212/swift-windows,manavgabhawala/swift,return/swift,xwu/swift,cbrentharris/swift,JGiola/swift,uasys/swift,CodaFi/swift,hooman/swift,practicalswift/swift,swiftix/swift,shajrawi/swift,OscarSwanros/swift,kusl/swift,manavgabhawala/swift,adrfer/swift,apple/swift,devincoughlin/swift,johnno1962d/swift,allevato/swift,ben-ng/swift,slavapestov/swift,codestergit/swift,khizkhiz/swift,return/swift,dreamsxin/swift,kusl/swift,jckarter/swift,kentya6/swift,kstaring/swift,ben-ng/swift,natecook1000/swift,harlanhaskins/swift,gottesmm/swift,gottesmm/swift,adrfer/swift,hughbe/swift,felix91gr/swift,allevato/swift,practicalswift/swift,sschiau/swift,MukeshKumarS/Swift,OscarSwanros/swift,rudkx/swift,nathawes/swift,SwiftAndroid/swift,tardieu/swift,kentya6/swift,aschwaighofer/swift,brentdax/swift,jtbandes/swift,jckarter/swift,arvedviehweger/swift,sdulal/swift,glessard/swift,zisko/swift,sdulal/swift,glessard/swift,IngmarStein/swift,slavapestov/swift,frootloops/swift,nathawes/swift,uasys/swift,arvedviehweger/swift,austinzheng/swift,jopamer/swift,MukeshKumarS/Swift,mightydeveloper/swift,johnno1962d/swift,tjw/swift,allevato/swift,gribozavr/swift,harlanhaskins/swift,swiftix/swift.old,xwu/swift,danielmartin/swift,aschwaighofer/swift,tardieu/swift,swiftix/swift,jopamer/swift,austinzheng/swift,KrishMunot/swift,airspeedswift/swift,alblue/swift,tjw/swift,johnno1962d/swift,kperryua/swift,dduan/swift,Jnosh/swift,tardieu/swift,amraboelela/swift,therealbnut/swift,practicalswift/swift,russbishop/swift,ben-ng/swift,dduan/swift,tkremenek/swift,alblue/swift,swiftix/swift.old,xedin/swift,kusl/swift,harlanhaskins/swift,jopamer/swift,JGiola/swift,dduan/swift,LeoShimonaka/swift,brentdax/swift,ahoppen/swift,manavgabhawala/swift,jmgc/swift,jopamer/swift,amraboelela/swift,gottesmm/swift,natecook1000/swift,zisko/swift,hooman/swift,natecook1000/swift,benlangmuir/swift,zisko/swift,swiftix/swift.old,SwiftAndroid/swift,allevato/swift,xwu/swift,arvedviehweger/swift,milseman/swift,uasys/swift,swiftix/swift.old,codestergit/swift,Jnosh/swift,lorentey/swift,danielmartin/swift,roambotics/swift,nathawes/swift,sdulal/swift,natecook1000/swift,jopamer/swift,khizkhiz/swift,khizkhiz/swift,swiftix/swift,gmilos/swift,kperryua/swift,parkera/swift,devincoughlin/swift,SwiftAndroid/swift,russbishop/swift,CodaFi/swift,swiftix/swift,khizkhiz/swift,gregomni/swift,glessard/swift,felix91gr/swift,JaSpa/swift,milseman/swift,benlangmuir/swift,KrishMunot/swift,allevato/swift,jckarter/swift,kstaring/swift,lorentey/swift,devincoughlin/swift,russbishop/swift,Ivacker/swift,jmgc/swift,alblue/swift,hughbe/swift,karwa/swift,johnno1962d/swift,brentdax/swift,brentdax/swift,swiftix/swift.old,amraboelela/swift,calebd/swift,xwu/swift,shahmishal/swift,amraboelela/swift,gribozavr/swift,tardieu/swift,codestergit/swift,parkera/swift,tinysun212/swift-windows,shahmishal/swift,jtbandes/swift,airspeedswift/swift,LeoShimonaka/swift,hooman/swift,huonw/swift,lorentey/swift,emilstahl/swift,alblue/swift,manavgabhawala/swift,atrick/swift,kentya6/swift,russbishop/swift,lorentey/swift,karwa/swift,gregomni/swift,practicalswift/swift,Ivacker/swift,kstaring/swift,sdulal/swift,amraboelela/swift,allevato/swift,CodaFi/swift,mightydeveloper/swift,apple/swift,calebd/swift,gribozavr/swift,zisko/swift,gmilos/swift,CodaFi/swift,KrishMunot/swift,shajrawi/swift,swiftix/swift.old,tkremenek/swift,kentya6/swift,jmgc/swift,nathawes/swift,zisko/swift,danielmartin/swift,apple/swift,milseman/swift,adrfer/swift,frootloops/swift,slavapestov/swift,devincoughlin/swift,modocache/swift,stephentyrone/swift,kstaring/swift,airspeedswift/swift,ben-ng/swift,glessard/swift,ahoppen/swift,shajrawi/swift,bitjammer/swift,adrfer/swift,JGiola/swift,tinysun212/swift-windows,alblue/swift,deyton/swift,kperryua/swift,CodaFi/swift,mightydeveloper/swift,SwiftAndroid/swift,gribozavr/swift,gmilos/swift,stephentyrone/swift,harlanhaskins/swift,arvedviehweger/swift,deyton/swift,IngmarStein/swift,cbrentharris/swift,mightydeveloper/swift,Jnosh/swift,parkera/swift,gottesmm/swift,practicalswift/swift,ken0nek/swift,natecook1000/swift,bitjammer/swift,gregomni/swift,emilstahl/swift,ahoppen/swift,benlangmuir/swift,apple/swift,jtbandes/swift,djwbrown/swift,kusl/swift,MukeshKumarS/Swift,jtbandes/swift,KrishMunot/swift,return/swift,djwbrown/swift,tardieu/swift,jckarter/swift,parkera/swift,gregomni/swift,djwbrown/swift,CodaFi/swift,natecook1000/swift,ben-ng/swift,nathawes/swift,CodaFi/swift,khizkhiz/swift,lorentey/swift,practicalswift/swift,sschiau/swift,danielmartin/swift,brentdax/swift,amraboelela/swift,codestergit/swift,sschiau/swift,modocache/swift,IngmarStein/swift,cbrentharris/swift,therealbnut/swift,xwu/swift,ahoppen/swift,ahoppen/swift,khizkhiz/swift,harlanhaskins/swift,return/swift,hughbe/swift,austinzheng/swift,johnno1962d/swift,jckarter/swift,milseman/swift,xwu/swift,djwbrown/swift,dduan/swift,devincoughlin/swift,sdulal/swift,felix91gr/swift,gregomni/swift,jtbandes/swift,milseman/swift,LeoShimonaka/swift,harlanhaskins/swift,xedin/swift,arvedviehweger/swift,manavgabhawala/swift,khizkhiz/swift,danielmartin/swift,gmilos/swift,shajrawi/swift,stephentyrone/swift,sdulal/swift,rudkx/swift,bitjammer/swift,kentya6/swift,gottesmm/swift,therealbnut/swift,felix91gr/swift,ken0nek/swift,ben-ng/swift,cbrentharris/swift,xedin/swift,xedin/swift,gregomni/swift,dduan/swift,djwbrown/swift,johnno1962d/swift,mightydeveloper/swift,djwbrown/swift,huonw/swift,sschiau/swift,therealbnut/swift,OscarSwanros/swift,cbrentharris/swift,tinysun212/swift-windows,aschwaighofer/swift,felix91gr/swift,airspeedswift/swift,ken0nek/swift,Ivacker/swift,harlanhaskins/swift,practicalswift/swift,lorentey/swift,allevato/swift,codestergit/swift,OscarSwanros/swift,Jnosh/swift,slavapestov/swift,calebd/swift,russbishop/swift,sdulal/swift,zisko/swift,tinysun212/swift-windows,shahmishal/swift,xedin/swift,emilstahl/swift,tardieu/swift,uasys/swift,cbrentharris/swift,JGiola/swift,atrick/swift,danielmartin/swift,kusl/swift,tjw/swift,stephentyrone/swift,kperryua/swift,tardieu/swift,dduan/swift,jckarter/swift,kusl/swift,hughbe/swift,glessard/swift,jmgc/swift,apple/swift,kstaring/swift,tkremenek/swift,kperryua/swift,LeoShimonaka/swift,practicalswift/swift,emilstahl/swift,tkremenek/swift,shajrawi/swift,codestergit/swift,Jnosh/swift,lorentey/swift,tkremenek/swift,calebd/swift,milseman/swift,shajrawi/swift,shahmishal/swift,Jnosh/swift,glessard/swift,frootloops/swift,karwa/swift,atrick/swift,tjw/swift,ken0nek/swift,felix91gr/swift,shahmishal/swift,LeoShimonaka/swift,gribozavr/swift,danielmartin/swift,bitjammer/swift,deyton/swift,ken0nek/swift,tjw/swift,sdulal/swift,ben-ng/swift,codestergit/swift,xedin/swift,deyton/swift,hughbe/swift,nathawes/swift,kstaring/swift,OscarSwanros/swift,parkera/swift,bitjammer/swift,JaSpa/swift,aschwaighofer/swift,airspeedswift/swift,gribozavr/swift,alblue/swift,hughbe/swift,karwa/swift,JaSpa/swift,huonw/swift,Ivacker/swift,deyton/swift,sschiau/swift,hooman/swift,therealbnut/swift,stephentyrone/swift,JaSpa/swift,IngmarStein/swift,roambotics/swift,sschiau/swift,devincoughlin/swift,austinzheng/swift,sschiau/swift,slavapestov/swift,sschiau/swift,jmgc/swift,benlangmuir/swift,kentya6/swift,IngmarStein/swift,KrishMunot/swift,Ivacker/swift,JGiola/swift,jtbandes/swift,adrfer/swift,milseman/swift,SwiftAndroid/swift,parkera/swift,frootloops/swift,zisko/swift,return/swift,rudkx/swift,gottesmm/swift,mightydeveloper/swift,JaSpa/swift,SwiftAndroid/swift,bitjammer/swift,gmilos/swift,return/swift,OscarSwanros/swift,IngmarStein/swift,djwbrown/swift,lorentey/swift,MukeshKumarS/Swift,shahmishal/swift,MukeshKumarS/Swift,tinysun212/swift-windows,calebd/swift,JaSpa/swift,benlangmuir/swift,huonw/swift,jmgc/swift,aschwaighofer/swift,russbishop/swift,kusl/swift,uasys/swift,Ivacker/swift,swiftix/swift,bitjammer/swift,calebd/swift,Ivacker/swift,modocache/swift,swiftix/swift.old,slavapestov/swift,OscarSwanros/swift,jckarter/swift,manavgabhawala/swift,LeoShimonaka/swift,mightydeveloper/swift,apple/swift,nathawes/swift,brentdax/swift,frootloops/swift,swiftix/swift,mightydeveloper/swift,gottesmm/swift,shajrawi/swift,frootloops/swift,hooman/swift,brentdax/swift,MukeshKumarS/Swift,LeoShimonaka/swift,austinzheng/swift,swiftix/swift,huonw/swift,modocache/swift,gmilos/swift,LeoShimonaka/swift,tinysun212/swift-windows,felix91gr/swift,kusl/swift,frootloops/swift,shahmishal/swift,aschwaighofer/swift,kstaring/swift,jopamer/swift,karwa/swift,roambotics/swift,amraboelela/swift,gribozavr/swift,shajrawi/swift,atrick/swift,Ivacker/swift,austinzheng/swift,tkremenek/swift,therealbnut/swift,xedin/swift,stephentyrone/swift,kentya6/swift,austinzheng/swift,hooman/swift,atrick/swift,KrishMunot/swift,emilstahl/swift,xwu/swift,slavapestov/swift,IngmarStein/swift