|
1 | 1 | /*******************************************************************\
|
2 | 2 |
|
3 |
| -Module: Java Static Initializers |
| 3 | +Module: Synthetic methods map |
4 | 4 |
|
5 | 5 | Author: Chris Smowton, [email protected]
|
6 | 6 |
|
|
9 | 9 | #ifndef CPROVER_JAVA_BYTECODE_SYNTHETIC_METHODS_MAP_H
|
10 | 10 | #define CPROVER_JAVA_BYTECODE_SYNTHETIC_METHODS_MAP_H
|
11 | 11 |
|
| 12 | +/// \file |
| 13 | +/// Synthetic methods are particular methods internally generated by the |
| 14 | +/// Java frontend (cf. normal methods which are translated from Java |
| 15 | +/// bytecode). This file provides an enumeration specifying the kind of a |
| 16 | +/// particular synthetic method and a common type of a map giving a collection |
| 17 | +/// of synthetic methods. |
| 18 | +/// Functions stubs and array.clone() functions are also generated by the Java |
| 19 | +/// frontend but are not recorded using this framework, but may be in future. |
| 20 | + |
| 21 | +/// Synthetic method kinds. |
12 | 22 | enum class synthetic_method_typet
|
13 | 23 | {
|
| 24 | + /// A static initializer wrapper |
| 25 | + /// (code of the form `if(!already_run) clinit(); already_run = true;`) |
| 26 | + /// These are generated for both user and stub types, to ensure the actual |
| 27 | + /// static initializer is only run once on any given path. |
14 | 28 | STATIC_INITIALIZER_WRAPPER,
|
| 29 | + /// A generated (synthetic) static initializer function for a stub type. |
| 30 | + /// Because we don't have the bytecode for a stub type (by definition), we |
| 31 | + /// generate a static initializer function to initialize its static fields. |
15 | 32 | STUB_CLASS_STATIC_INITIALIZER
|
16 | 33 | };
|
17 | 34 |
|
| 35 | +/// Maps method names on to a synthetic method kind. |
18 | 36 | typedef std::unordered_map<irep_idt, synthetic_method_typet, irep_id_hash>
|
19 | 37 | synthetic_methods_mapt;
|
20 | 38 |
|
|
0 commit comments