Ignore:
Timestamp:
Jul 20, 2021, 3:31:20 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
86fc350
Parents:
815c6ae
Message:

Added asm statements to the exception benchmarks to prevent unwanted optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/resume-detor.cfa

    r815c6ae r54651005  
    1212
    1313void ^?{}(WithDestructor & this) {
    14     // ...
     14        asm volatile ("# destructor body");
    1515}
    1616
    1717void unwind_destructor(unsigned int frames) {
    18     if (frames) {
     18        if (frames) {
    1919
    20         WithDestructor object;
    21         unwind_destructor(frames - 1);
    22     } else {
    23         throwResume (empty_exception){&empty_vt};
    24     }
     20                WithDestructor object;
     21                unwind_destructor(frames - 1);
     22        } else {
     23                throwResume (empty_exception){&empty_vt};
     24        }
    2525}
    2626
     
    3636
    3737        Time start_time = timeHiRes();
    38     for (int count = 0 ; count < times ; ++count) {
    39         try {
    40             unwind_destructor(total_frames);
    41         } catchResume (empty_exception *) {
    42             // ...
    43         }
    44     }
     38        for (int count = 0 ; count < times ; ++count) {
     39                try {
     40                        unwind_destructor(total_frames);
     41                } catchResume (empty_exception *) {
     42                        asm volatile ("# fixup block");
     43                }
     44        }
    4545        Time end_time = timeHiRes();
    4646        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
Note: See TracChangeset for help on using the changeset viewer.