@@ -89,14 +89,13 @@ class java_bytecode_parsert final : public parsert
89
89
90
90
void rClassFile ();
91
91
void rconstant_pool ();
92
- void rinterfaces (classt &parsed_class);
93
- void rfields (classt &parsed_class);
94
- void rmethods (classt &parsed_class);
95
- void rmethod (classt &parsed_class);
96
- void
97
- rinner_classes_attribute (classt &parsed_class, const u4 &attribute_length);
92
+ void rinterfaces ();
93
+ void rfields ();
94
+ void rmethods ();
95
+ void rmethod ();
96
+ void rinner_classes_attribute (const u4 &attribute_length);
98
97
std::vector<irep_idt> rexceptions_attribute ();
99
- void rclass_attribute (classt &parsed_class );
98
+ void rclass_attribute ();
100
99
void rRuntimeAnnotation_attribute (std::vector<annotationt> &);
101
100
void rRuntimeAnnotation (annotationt &);
102
101
void relement_value_pairs (annotationt::element_value_pairst &);
@@ -113,7 +112,7 @@ class java_bytecode_parsert final : public parsert
113
112
void parse_local_variable_type_table (methodt &method);
114
113
optionalt<lambda_method_handlet>
115
114
parse_method_handle (const class method_handle_infot &entry);
116
- void read_bootstrapmethods_entry (classt & );
115
+ void read_bootstrapmethods_entry ();
117
116
118
117
void skip_bytes (std::size_t bytes)
119
118
{
@@ -149,9 +148,8 @@ class java_bytecode_parsert final : public parsert
149
148
}
150
149
151
150
void store_unknown_method_handle (
152
- classt &parsed_class,
153
151
size_t bootstrap_method_index,
154
- std::vector<u2> u2_values) const ;
152
+ std::vector<u2> u2_values);
155
153
};
156
154
157
155
#define CONSTANT_Class 7
@@ -470,9 +468,9 @@ void java_bytecode_parsert::rClassFile()
470
468
if (super_class!=0 )
471
469
parsed_class.super_class = constant (super_class).type ().get (ID_C_base_name);
472
470
473
- rinterfaces (parsed_class );
474
- rfields (parsed_class );
475
- rmethods (parsed_class );
471
+ rinterfaces ();
472
+ rfields ();
473
+ rmethods ();
476
474
477
475
// count elements of enum
478
476
if (parsed_class.is_enum )
@@ -483,7 +481,7 @@ void java_bytecode_parsert::rClassFile()
483
481
const u2 attributes_count = read <u2>();
484
482
485
483
for (std::size_t j=0 ; j<attributes_count; j++)
486
- rclass_attribute (parsed_class );
484
+ rclass_attribute ();
487
485
488
486
get_class_refs ();
489
487
@@ -837,22 +835,22 @@ void java_bytecode_parsert::rconstant_pool()
837
835
});
838
836
}
839
837
840
- void java_bytecode_parsert::rinterfaces (classt &parsed_class )
838
+ void java_bytecode_parsert::rinterfaces ()
841
839
{
842
840
const u2 interfaces_count = read <u2>();
843
841
844
842
for (std::size_t i=0 ; i<interfaces_count; i++)
845
- parsed_class.implements .push_back (
843
+ parse_tree. parsed_class .implements .push_back (
846
844
constant (read <u2>()).type ().get (ID_C_base_name));
847
845
}
848
846
849
- void java_bytecode_parsert::rfields (classt &parsed_class )
847
+ void java_bytecode_parsert::rfields ()
850
848
{
851
849
const u2 fields_count = read <u2>();
852
850
853
851
for (std::size_t i=0 ; i<fields_count; i++)
854
852
{
855
- fieldt &field= parsed_class.add_field ();
853
+ fieldt &field = parse_tree. parsed_class .add_field ();
856
854
857
855
const u2 access_flags = read <u2>();
858
856
const u2 name_index = read <u2>();
@@ -1595,9 +1593,9 @@ exprt java_bytecode_parsert::get_relement_value()
1595
1593
// / information for the parsed class is overwritten, and the parsed class is
1596
1594
// / marked as an inner class.
1597
1595
void java_bytecode_parsert::rinner_classes_attribute (
1598
- classt &parsed_class,
1599
1596
const u4 &attribute_length)
1600
1597
{
1598
+ classt &parsed_class = parse_tree.parsed_class ;
1601
1599
std::string name = parsed_class.name .c_str ();
1602
1600
const u2 number_of_classes = read <u2>();
1603
1601
const u4 number_of_bytes_to_be_read = number_of_classes * 8 + 2 ;
@@ -1685,8 +1683,10 @@ std::vector<irep_idt> java_bytecode_parsert::rexceptions_attribute()
1685
1683
return exceptions;
1686
1684
}
1687
1685
1688
- void java_bytecode_parsert::rclass_attribute (classt &parsed_class )
1686
+ void java_bytecode_parsert::rclass_attribute ()
1689
1687
{
1688
+ classt &parsed_class = parse_tree.parsed_class ;
1689
+
1690
1690
const u2 attribute_name_index = read <u2>();
1691
1691
const u4 attribute_length = read <u4>();
1692
1692
@@ -1743,23 +1743,22 @@ void java_bytecode_parsert::rclass_attribute(classt &parsed_class)
1743
1743
1744
1744
// mark as read in parsed class
1745
1745
parsed_class.attribute_bootstrapmethods_read = true ;
1746
- read_bootstrapmethods_entry (parsed_class );
1746
+ read_bootstrapmethods_entry ();
1747
1747
}
1748
1748
else if (attribute_name == " InnerClasses" )
1749
1749
{
1750
- java_bytecode_parsert::rinner_classes_attribute (
1751
- parsed_class, attribute_length);
1750
+ java_bytecode_parsert::rinner_classes_attribute (attribute_length);
1752
1751
}
1753
1752
else
1754
1753
skip_bytes (attribute_length);
1755
1754
}
1756
1755
1757
- void java_bytecode_parsert::rmethods (classt &parsed_class )
1756
+ void java_bytecode_parsert::rmethods ()
1758
1757
{
1759
1758
const u2 methods_count = read <u2>();
1760
1759
1761
1760
for (std::size_t j=0 ; j<methods_count; j++)
1762
- rmethod (parsed_class );
1761
+ rmethod ();
1763
1762
}
1764
1763
1765
1764
#define ACC_PUBLIC 0x0001u
@@ -1777,9 +1776,9 @@ void java_bytecode_parsert::rmethods(classt &parsed_class)
1777
1776
#define ACC_ANNOTATION 0x2000u
1778
1777
#define ACC_ENUM 0x4000u
1779
1778
1780
- void java_bytecode_parsert::rmethod (classt &parsed_class )
1779
+ void java_bytecode_parsert::rmethod ()
1781
1780
{
1782
- methodt &method= parsed_class.add_method ();
1781
+ methodt &method = parse_tree. parsed_class .add_method ();
1783
1782
1784
1783
const u2 access_flags = read <u2>();
1785
1784
const u2 name_index = read <u2>();
@@ -1937,7 +1936,7 @@ java_bytecode_parsert::parse_method_handle(const method_handle_infot &entry)
1937
1936
// / Read all entries of the `BootstrapMethods` attribute of a class file.
1938
1937
// / \param parsed_class: the class representation of the class file that is
1939
1938
// / currently parsed
1940
- void java_bytecode_parsert::read_bootstrapmethods_entry (classt &parsed_class )
1939
+ void java_bytecode_parsert::read_bootstrapmethods_entry ()
1941
1940
{
1942
1941
const u2 num_bootstrap_methods = read <u2>();
1943
1942
for (size_t bootstrap_method_index = 0 ;
@@ -1990,8 +1989,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
1990
1989
// understand
1991
1990
if (num_bootstrap_arguments < 3 )
1992
1991
{
1993
- store_unknown_method_handle (
1994
- parsed_class, bootstrap_method_index, std::move (u2_values));
1992
+ store_unknown_method_handle (bootstrap_method_index, std::move (u2_values));
1995
1993
debug ()
1996
1994
<< " format of BootstrapMethods entry not recognized: too few arguments"
1997
1995
<< eom;
@@ -2018,8 +2016,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
2018
2016
debug () << " format of BootstrapMethods entry not recognized: extra "
2019
2017
" arguments of wrong type"
2020
2018
<< eom;
2021
- store_unknown_method_handle (
2022
- parsed_class, bootstrap_method_index, std::move (u2_values));
2019
+ store_unknown_method_handle (bootstrap_method_index, std::move (u2_values));
2023
2020
continue ;
2024
2021
}
2025
2022
@@ -2036,8 +2033,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
2036
2033
debug () << " format of BootstrapMethods entry not recognized: arguments "
2037
2034
" wrong type"
2038
2035
<< eom;
2039
- store_unknown_method_handle (
2040
- parsed_class, bootstrap_method_index, std::move (u2_values));
2036
+ store_unknown_method_handle (bootstrap_method_index, std::move (u2_values));
2041
2037
continue ;
2042
2038
}
2043
2039
@@ -2050,8 +2046,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
2050
2046
debug () << " format of BootstrapMethods entry not recognized: method "
2051
2047
" handle not recognised"
2052
2048
<< eom;
2053
- store_unknown_method_handle (
2054
- parsed_class, bootstrap_method_index, std::move (u2_values));
2049
+ store_unknown_method_handle (bootstrap_method_index, std::move (u2_values));
2055
2050
continue ;
2056
2051
}
2057
2052
@@ -2065,12 +2060,12 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
2065
2060
lambda_method_handle->u2_values = std::move (u2_values);
2066
2061
debug () << " lambda function reference "
2067
2062
<< id2string (lambda_method_handle->lambda_method_name )
2068
- << " in class \" " << parsed_class.name << " \" "
2063
+ << " in class \" " << parse_tree. parsed_class .name << " \" "
2069
2064
<< " \n interface type is "
2070
2065
<< id2string (pool_entry (interface_type_argument.ref1 ).s )
2071
2066
<< " \n method type is "
2072
2067
<< id2string (pool_entry (method_type_argument.ref1 ).s ) << eom;
2073
- parsed_class.add_method_handle (
2068
+ parse_tree. parsed_class .add_method_handle (
2074
2069
bootstrap_method_index, *lambda_method_handle);
2075
2070
}
2076
2071
}
@@ -2081,10 +2076,10 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
2081
2076
// / table
2082
2077
// / \param u2_values: The indices of the arguments for the call
2083
2078
void java_bytecode_parsert::store_unknown_method_handle (
2084
- java_bytecode_parsert::classt &parsed_class,
2085
2079
size_t bootstrap_method_index,
2086
- std::vector<u2> u2_values) const
2080
+ std::vector<u2> u2_values)
2087
2081
{
2088
2082
const lambda_method_handlet lambda_method_handle (std::move (u2_values));
2089
- parsed_class.add_method_handle (bootstrap_method_index, lambda_method_handle);
2083
+ parse_tree.parsed_class .add_method_handle (
2084
+ bootstrap_method_index, lambda_method_handle);
2090
2085
}
0 commit comments