CBMC
java_bytecode_parsert Class Referencefinal
+ Inheritance diagram for java_bytecode_parsert:
+ Collaboration diagram for java_bytecode_parsert:

Classes

struct  pool_entryt
 

Public Member Functions

 java_bytecode_parsert (bool skip_instructions, message_handlert &message_handler)
 
bool parse () override
 
- Public Member Functions inherited from parsert
 parsert ()
 
 parsert (message_handlert &message_handler)
 
virtual ~parsert ()
 
bool read (char &ch)
 
bool eof ()
 
void parse_error (const std::string &message, const std::string &before)
 
void inc_line_no ()
 
void set_line_no (unsigned _line_no)
 
void set_file (const irep_idt &file)
 
irep_idt get_file () const
 
unsigned get_line_no () const
 
unsigned get_column () const
 
void set_column (unsigned _column)
 
void set_source_location (exprt &e)
 
void set_function (const irep_idt &function)
 
void advance_column (unsigned token_width)
 

Public Attributes

java_bytecode_parse_treet parse_tree
 
- Public Attributes inherited from parsert
std::istream * in
 
std::string this_line
 
std::string last_line
 
std::vector< exprtstack
 
messaget log
 

Private Types

using classt = java_bytecode_parse_treet::classt
 
using methodt = java_bytecode_parse_treet::methodt
 
using fieldt = java_bytecode_parse_treet::fieldt
 
using instructiont = java_bytecode_parse_treet::instructiont
 
using annotationt = java_bytecode_parse_treet::annotationt
 
using method_handle_typet = java_class_typet::method_handle_kindt
 
using lambda_method_handlet = java_bytecode_parse_treet::classt::lambda_method_handlet
 
using constant_poolt = std::vector< pool_entryt >
 

Private Member Functions

pool_entrytpool_entry (u2 index)
 
exprtconstant (u2 index)
 
const typet type_entry (u2 index)
 
void rClassFile ()
 
void rconstant_pool ()
 
void rinterfaces ()
 
void rfields ()
 
void rmethods ()
 
void rmethod ()
 
void rinner_classes_attribute (const u4 &attribute_length)
 Corresponds to the element_value structure Described in Java 8 specification 4.7.6 https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6 Parses the InnerClasses attribute for the current parsed class, which contains an array of information about its inner classes. More...
 
std::vector< irep_idtrexceptions_attribute ()
 Corresponds to the element_value structure Described in Java 8 specification 4.7.5 https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.5 Parses the Exceptions attribute for the current method, and returns a vector of exceptions. More...
 
void rclass_attribute ()
 
void rRuntimeAnnotation_attribute (std::vector< annotationt > &)
 
void rRuntimeAnnotation (annotationt &)
 
void relement_value_pairs (annotationt::element_value_pairst &)
 
exprt get_relement_value ()
 Corresponds to the element_value structure Described in Java 8 specification 4.7.16.1 https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.16.1. More...
 
void rmethod_attribute (methodt &method)
 
void rfield_attribute (fieldt &)
 
void rcode_attribute (methodt &method)
 
void read_verification_type_info (methodt::verification_type_infot &)
 
void rbytecode (std::vector< instructiont > &)
 
void get_class_refs ()
 Get the class references for the benefit of a dependency analysis. More...
 
void get_class_refs_rec (const typet &)
 
void get_annotation_class_refs (const std::vector< annotationt > &annotations)
 For each of the given annotations, get a reference to its class and recursively get class references of the values it stores. More...
 
void get_annotation_value_class_refs (const exprt &value)
 See java_bytecode_parsert::get_annotation_class_refs. More...
 
void parse_local_variable_type_table (methodt &method)
 Parses the local variable type table of a method. More...
 
std::optional< lambda_method_handletparse_method_handle (const class method_handle_infot &entry)
 Read method handle pointed to from constant pool entry at index, return type of method handle and name if lambda function is found. More...
 
void read_bootstrapmethods_entry ()
 Read all entries of the BootstrapMethods attribute of a class file. More...
 
void skip_bytes (std::size_t bytes)
 
template<typename T >
read ()
 
void store_unknown_method_handle (size_t bootstrap_method_index)
 Creates an unknown method handle and puts it into the parsed_class. More...
 

Private Attributes

constant_poolt constant_pool
 
const bool skip_instructions = false
 

Additional Inherited Members

- Protected Attributes inherited from parsert
source_locationt source_location
 
unsigned line_no
 
unsigned previous_line_no
 
unsigned column
 

Detailed Description

Definition at line 27 of file java_bytecode_parser.cpp.

Member Typedef Documentation

◆ annotationt

◆ classt

◆ constant_poolt

using java_bytecode_parsert::constant_poolt = std::vector<pool_entryt>
private

Definition at line 61 of file java_bytecode_parser.cpp.

◆ fieldt

◆ instructiont

◆ lambda_method_handlet

◆ method_handle_typet

◆ methodt

Constructor & Destructor Documentation

◆ java_bytecode_parsert()

java_bytecode_parsert::java_bytecode_parsert ( bool  skip_instructions,
message_handlert message_handler 
)
inline

Definition at line 30 of file java_bytecode_parser.cpp.

Member Function Documentation

◆ constant()

exprt& java_bytecode_parsert::constant ( u2  index)
inlineprivate

Definition at line 81 of file java_bytecode_parser.cpp.

◆ get_annotation_class_refs()

void java_bytecode_parsert::get_annotation_class_refs ( const std::vector< annotationt > &  annotations)
private

For each of the given annotations, get a reference to its class and recursively get class references of the values it stores.

Definition at line 611 of file java_bytecode_parser.cpp.

◆ get_annotation_value_class_refs()

void java_bytecode_parsert::get_annotation_value_class_refs ( const exprt value)
private

◆ get_class_refs()

void java_bytecode_parsert::get_class_refs ( )
private

Get the class references for the benefit of a dependency analysis.

Definition at line 496 of file java_bytecode_parser.cpp.

◆ get_class_refs_rec()

void java_bytecode_parsert::get_class_refs_rec ( const typet src)
private

Definition at line 581 of file java_bytecode_parser.cpp.

◆ get_relement_value()

exprt java_bytecode_parsert::get_relement_value ( )
private

Corresponds to the element_value structure Described in Java 8 specification 4.7.16.1 https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.16.1.

Returns
An exprt that represents the particular value of annotations field. This is usually one of: a byte, number of some sort, string, character, enum, Class type, array or another annotation.

Definition at line 1525 of file java_bytecode_parser.cpp.

◆ parse()

bool java_bytecode_parsert::parse ( )
overridevirtual

Implements parsert.

Definition at line 382 of file java_bytecode_parser.cpp.

◆ parse_local_variable_type_table()

void java_bytecode_parsert::parse_local_variable_type_table ( methodt method)
private

Parses the local variable type table of a method.

The LVTT holds generic type information for variables in the local variable table (LVT). At most as many variables as present in the LVT can be in the LVTT.

Definition at line 1850 of file java_bytecode_parser.cpp.

◆ parse_method_handle()

std::optional< java_bytecode_parsert::lambda_method_handlet > java_bytecode_parsert::parse_method_handle ( const class method_handle_infot entry)
private

Read method handle pointed to from constant pool entry at index, return type of method handle and name if lambda function is found.

Parameters
entrythe constant pool entry of the methodhandle_info structure
Returns
the method_handle type of the methodhandle_structure, either for a recognized bootstrap method or for a lambda function

Definition at line 1920 of file java_bytecode_parser.cpp.

◆ pool_entry()

pool_entryt& java_bytecode_parsert::pool_entry ( u2  index)
inlineprivate

Definition at line 67 of file java_bytecode_parser.cpp.

◆ rbytecode()

void java_bytecode_parsert::rbytecode ( std::vector< instructiont > &  instructions)
private

Definition at line 884 of file java_bytecode_parser.cpp.

◆ rclass_attribute()

void java_bytecode_parsert::rclass_attribute ( )
private

Definition at line 1682 of file java_bytecode_parser.cpp.

◆ rClassFile()

void java_bytecode_parsert::rClassFile ( )
private

Definition at line 432 of file java_bytecode_parser.cpp.

◆ rcode_attribute()

void java_bytecode_parsert::rcode_attribute ( methodt method)
private

Definition at line 1286 of file java_bytecode_parser.cpp.

◆ rconstant_pool()

void java_bytecode_parsert::rconstant_pool ( )
private

Definition at line 643 of file java_bytecode_parser.cpp.

◆ read()

template<typename T >
T java_bytecode_parsert::read ( )
inlineprivate

Definition at line 132 of file java_bytecode_parser.cpp.

◆ read_bootstrapmethods_entry()

void java_bytecode_parsert::read_bootstrapmethods_entry ( )
private

Read all entries of the BootstrapMethods attribute of a class file.

Definition at line 1973 of file java_bytecode_parser.cpp.

◆ read_verification_type_info()

void java_bytecode_parsert::read_verification_type_info ( methodt::verification_type_infot v)
private

Definition at line 1444 of file java_bytecode_parser.cpp.

◆ relement_value_pairs()

void java_bytecode_parsert::relement_value_pairs ( annotationt::element_value_pairst element_value_pairs)
private

Definition at line 1505 of file java_bytecode_parser.cpp.

◆ rexceptions_attribute()

std::vector< irep_idt > java_bytecode_parsert::rexceptions_attribute ( )
private

Corresponds to the element_value structure Described in Java 8 specification 4.7.5 https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.5 Parses the Exceptions attribute for the current method, and returns a vector of exceptions.

Definition at line 1667 of file java_bytecode_parser.cpp.

◆ rfield_attribute()

void java_bytecode_parsert::rfield_attribute ( fieldt field)
private

Definition at line 1265 of file java_bytecode_parser.cpp.

◆ rfields()

void java_bytecode_parsert::rfields ( )
private

Definition at line 843 of file java_bytecode_parser.cpp.

◆ rinner_classes_attribute()

void java_bytecode_parsert::rinner_classes_attribute ( const u4 attribute_length)
private

Corresponds to the element_value structure Described in Java 8 specification 4.7.6 https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6 Parses the InnerClasses attribute for the current parsed class, which contains an array of information about its inner classes.

We are interested in getting information only for inner classes, which is determined by checking if the parsed class matches any of the inner classes in its inner class array. If the parsed class is not an inner class, then it is ignored. When a parsed class is an inner class, the accessibility information for the parsed class is overwritten, and the parsed class is marked as an inner class.

Definition at line 1591 of file java_bytecode_parser.cpp.

◆ rinterfaces()

void java_bytecode_parsert::rinterfaces ( )
private

Definition at line 834 of file java_bytecode_parser.cpp.

◆ rmethod()

void java_bytecode_parsert::rmethod ( )
private

Definition at line 1775 of file java_bytecode_parser.cpp.

◆ rmethod_attribute()

void java_bytecode_parsert::rmethod_attribute ( methodt method)
private

Definition at line 1152 of file java_bytecode_parser.cpp.

◆ rmethods()

void java_bytecode_parsert::rmethods ( )
private

Definition at line 1752 of file java_bytecode_parser.cpp.

◆ rRuntimeAnnotation()

void java_bytecode_parsert::rRuntimeAnnotation ( annotationt annotation)
private

Definition at line 1497 of file java_bytecode_parser.cpp.

◆ rRuntimeAnnotation_attribute()

void java_bytecode_parsert::rRuntimeAnnotation_attribute ( std::vector< annotationt > &  annotations)
private

Definition at line 1484 of file java_bytecode_parser.cpp.

◆ skip_bytes()

void java_bytecode_parsert::skip_bytes ( std::size_t  bytes)
inlineprivate

Definition at line 118 of file java_bytecode_parser.cpp.

◆ store_unknown_method_handle()

void java_bytecode_parsert::store_unknown_method_handle ( size_t  bootstrap_method_index)
private

Creates an unknown method handle and puts it into the parsed_class.

Parameters
bootstrap_method_indexThe current index in the bootstrap entry table

Definition at line 2109 of file java_bytecode_parser.cpp.

◆ type_entry()

const typet java_bytecode_parsert::type_entry ( u2  index)
inlineprivate

Definition at line 86 of file java_bytecode_parser.cpp.

Member Data Documentation

◆ constant_pool

constant_poolt java_bytecode_parsert::constant_pool
private

Definition at line 63 of file java_bytecode_parser.cpp.

◆ parse_tree

java_bytecode_parse_treet java_bytecode_parsert::parse_tree

Definition at line 49 of file java_bytecode_parser.cpp.

◆ skip_instructions

const bool java_bytecode_parsert::skip_instructions = false
private

Definition at line 65 of file java_bytecode_parser.cpp.


The documentation for this class was generated from the following file: