Skip to content
  • Andrea Gussoni's avatar
    cf42e497
    Introduce the Function Isolation Pass · cf42e497
    Andrea Gussoni authored
    This commit introduces the Function Isolation Pass. We use the
    information provided by the Function Boundaries Detection Pass to
    organize the code that `revamb` places inside the `root` function in
    different LLVM functions. To do this we obviously need to introduce some
    changes and tricks to handle the execution of the translated program.
    
    The main idea is to have two different realms (one where the isolated
    functions live, one in which we have basically the old root function).
    We start the execution from the realm of the *non isolated* functions,
    and we transfer, as soon as possible, the execution to the *isolated
    functions* realm. We then have a fallback mechanism to restore the
    execution in the right place in the *non isolated* functions realm, and
    so on.
    
    The largest change, besides the re-organization of the code in different
    functions, is the use of the exception handling mechanism provided by
    the LLVM framework in order to be able to manage the switch between the
    two realms.
    
    We also introduce the `support.h` header file, which contains a couple
    of definitions used by `support.c` and that need to be shared with some
    of the components involved in the translation process. We have defined
    some helper functions, directly in C, that we use both for handling the
    exception mechanism and for giving extra debug informations when an
    exception is raised.
    
    The `revamb-dump` utility now supports the `-i` option to specify the
    path were to save the new LLVM module.
    
    The `translate` utility now supports the `-i` option that produces a
    binary in which the function isolation has been applied.
    
    We also introduced some tests that apply the function isolation pass to
    the `Runtime/` tests already present. In this way we can verify that the
    translation and the following function isolation preserve the behavior
    of the program.
    
    When serializing the new LLVM module we regenerate the metadata used for
    debug purposes, and for doing this, since we not longer have only the
    `root` function, we have changed some details in the `DebugHelper` class
    in order to be able to emit the metadata for all the functions of our
    interest in a single shot.
    cf42e497
    Introduce the Function Isolation Pass
    Andrea Gussoni authored
    This commit introduces the Function Isolation Pass. We use the
    information provided by the Function Boundaries Detection Pass to
    organize the code that `revamb` places inside the `root` function in
    different LLVM functions. To do this we obviously need to introduce some
    changes and tricks to handle the execution of the translated program.
    
    The main idea is to have two different realms (one where the isolated
    functions live, one in which we have basically the old root function).
    We start the execution from the realm of the *non isolated* functions,
    and we transfer, as soon as possible, the execution to the *isolated
    functions* realm. We then have a fallback mechanism to restore the
    execution in the right place in the *non isolated* functions realm, and
    so on.
    
    The largest change, besides the re-organization of the code in different
    functions, is the use of the exception handling mechanism provided by
    the LLVM framework in order to be able to manage the switch between the
    two realms.
    
    We also introduce the `support.h` header file, which contains a couple
    of definitions used by `support.c` and that need to be shared with some
    of the components involved in the translation process. We have defined
    some helper functions, directly in C, that we use both for handling the
    exception mechanism and for giving extra debug informations when an
    exception is raised.
    
    The `revamb-dump` utility now supports the `-i` option to specify the
    path were to save the new LLVM module.
    
    The `translate` utility now supports the `-i` option that produces a
    binary in which the function isolation has been applied.
    
    We also introduced some tests that apply the function isolation pass to
    the `Runtime/` tests already present. In this way we can verify that the
    translation and the following function isolation preserve the behavior
    of the program.
    
    When serializing the new LLVM module we regenerate the metadata used for
    debug purposes, and for doing this, since we not longer have only the
    `root` function, we have changed some details in the `DebugHelper` class
    in order to be able to emit the metadata for all the functions of our
    interest in a single shot.
Loading