4 inline void break_optimization(void *arg
) {
5 __asm__
__volatile__("" : : "r" (arg
) : "memory");
8 // Tests will instantiate this class to pad out bit sets to test out the
9 // various ways we can represent the bit set (32-bit inline, 64-bit inline,
10 // memory). Instantiating this class will trigger the instantiation of I
11 // templates with I virtual tables for classes deriving from T, I-2 of which
12 // will be of size sizeof(void*) * 5, 1 of which will be of size sizeof(void*)
13 // * 3, and 1 of which will be of size sizeof(void*) * 9. (Under the MS ABI
14 // each virtual table will be sizeof(void*) bytes smaller). Each category
15 // of virtual tables is aligned to a different power of 2, precluding the
16 // all-ones optimization. As a result, the bit vector for the base class will
17 // need to contain at least I*2 entries to accommodate all the derived virtual
19 template <typename T
, unsigned I
>
22 break_optimization(new Deriver
<T
, I
-1>);
30 struct Deriver
<T
, 0> : T
{
36 struct Deriver
<T
, 1> : T
{
38 break_optimization(new Deriver
<T
, 0>);
49 // Instantiate enough classes to force CFI checks for type T to use bit
50 // vectors of size 32 (if B32 defined), 64 (if B64 defined) or >64 (if BM
53 void create_derivers() {
55 break_optimization(new Deriver
<T
, 10>);
59 break_optimization(new Deriver
<T
, 25>);
63 break_optimization(new Deriver
<T
, 40>);