thread locals instead of locks for vars in Types.scala