forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document synthetic methods generated by the Java frontend
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/*******************************************************************\ | ||
Module: Java Static Initializers | ||
Module: Synthetic methods map | ||
Author: Chris Smowton, [email protected] | ||
|
@@ -9,12 +9,31 @@ Author: Chris Smowton, [email protected] | |
#ifndef CPROVER_JAVA_BYTECODE_SYNTHETIC_METHODS_MAP_H | ||
#define CPROVER_JAVA_BYTECODE_SYNTHETIC_METHODS_MAP_H | ||
|
||
/// \file | ||
/// Synthetic methods are particular methods internally generated by the | ||
/// Java frontend, including thunks to ensure static initializers are run once | ||
/// and initializers created for unknown / stub types. Compare normal methods, | ||
/// which are translated from Java bytecode. This file provides an | ||
/// enumeration specifying the kind of a particular synthetic method and a | ||
/// common type of a map giving a collection of synthetic methods. | ||
/// Functions stubs and array.clone() functions are also generated by the Java | ||
/// frontend but are not recorded using this framework, but may be in future. | ||
|
||
/// Synthetic method kinds. | ||
enum class synthetic_method_typet | ||
{ | ||
/// A static initializer wrapper | ||
/// (code of the form `if(!already_run) clinit(); already_run = true;`) | ||
/// These are generated for both user and stub types, to ensure the actual | ||
/// static initializer is only run once on any given path. | ||
STATIC_INITIALIZER_WRAPPER, | ||
/// A generated (synthetic) static initializer function for a stub type. | ||
/// Because we don't have the bytecode for a stub type (by definition), we | ||
/// generate a static initializer function to initialize its static fields. | ||
STUB_CLASS_STATIC_INITIALIZER | ||
}; | ||
|
||
/// Maps method names on to a synthetic method kind. | ||
typedef std::unordered_map<irep_idt, synthetic_method_typet, irep_id_hash> | ||
synthetic_methods_mapt; | ||
|
||
|