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/cross-catch.cpp

    r815c6ae r54651005  
    1111int main(int argc, char * argv[]) {
    1212        unsigned int times = 1;
     13        bool should_throw = false;
    1314        if (1 < argc) {
    1415                times = strtol(argv[1], nullptr, 10);
     
    1819        for (unsigned int count = 0 ; count < times ; ++count) {
    1920                try {
    20                         // ...
     21                        asm volatile ("# try block" : "=rm" (should_throw));
     22                        if (should_throw) {
     23                                throw NotRaisedException();
     24                        }
    2125                } catch (NotRaisedException &) {
    22                         // ...
     26                        asm volatile ("# catch block");
    2327                }
    2428        }
Note: See TracChangeset for help on using the changeset viewer.