Performance considerations are crucial for DBMSes and have led to numerous innovations in DBMS architecture in recent years, including columnar stores, the operator-ata-time execution model, and query compilation. However, there are some sources of runtime overhead that these techniques do not address. Micro-specialization uses information about runtime invariants in DBMS code to dynamically specialize frequently executed code snippets, thereby optimizing away overheads arising from the generic nature of the original DBMS code. However, micro-specialization as originally presented suffers from some shortcomings that limit its applicability. It is limited in the kinds of invariants that it considers and its application to modern architectural features, such as operator-at-a-time model and query compilation, can be problematic. Furthermore, some of the overheads that are eliminated in the original work on micro-specialization of PostgreSQL are also optimized away in columnar store architectures, thereby raising the question of whether the approach can yield comparably significant performance improvements on modern DBMS architectures. Our research generalizes micro-specialization to address these shortcomings. The principal contributions are as follows. First, we introduce the notion of a class of generalized invariants, that enables a much wider variety of optimizations, including many that would not be possible in the original formulation of micro-specialization. Second, we extend traditional micro-specialization to deal with key characteristics of modern DBMS architectures, namely, columnar-store, operator-at-a-time model, and query compilation. Third, we show that the resulting approach of generalized microspecialization is able to obtain significant performance increases on a modern DBMS architecture that are already highly optimized through these three extant approaches.