@@ -130,34 +130,6 @@ static std::string architecture_string(T value, const char *s)
130
130
std::string (s) + " =" + std::to_string (value) + " ;\n " ;
131
131
}
132
132
133
- // / The maximum allocation size is determined by the number of bits that
134
- // / are left in the pointer of width \p pointer_width.
135
- // /
136
- // / The allocation size cannot exceed the number represented by the (signed)
137
- // / offset, otherwise it would not be possible to store a pointer into a
138
- // / valid bit of memory. Therefore, the max allocation size is
139
- // / 2^(offset_bits - 1), where the offset bits is the number of bits left in the
140
- // / pointer after the object bits.
141
- // /
142
- // / The offset must be signed, as a pointer can point to the end of the memory
143
- // / block, and needs to be able to point back to the start.
144
- // / \param pointer_width: The width of the pointer
145
- // / \param object_bits : The number of bits used to represent the ID
146
- // / \return The size in bytes of the maximum allocation supported.
147
- static mp_integer
148
- max_malloc_size (std::size_t pointer_width, std::size_t object_bits)
149
- {
150
- PRECONDITION (pointer_width >= 1 );
151
- PRECONDITION (object_bits < pointer_width);
152
- PRECONDITION (object_bits >= 1 );
153
- const auto offset_bits = pointer_width - object_bits;
154
- // We require the offset to be able to express upto allocation_size - 1,
155
- // but also down to -allocation_size, therefore the size is allowable
156
- // is number of bits, less the signed bit.
157
- const auto bits_for_positive_offset = offset_bits - 1 ;
158
- return ((mp_integer)1 ) << (mp_integer)bits_for_positive_offset;
159
- }
160
-
161
133
void ansi_c_internal_additions (std::string &code)
162
134
{
163
135
// clang-format off
@@ -181,9 +153,9 @@ void ansi_c_internal_additions(std::string &code)
181
153
CPROVER_PREFIX " size_t size, " CPROVER_PREFIX " bool zero);\n "
182
154
" void " CPROVER_PREFIX " deallocate(void *);\n "
183
155
184
- CPROVER_PREFIX " size_t " CPROVER_PREFIX " max_malloc_size= " +
185
- integer2string ( max_malloc_size (config. ansi_c . pointer_width , config
186
- . bv_encoding . object_bits ))+" ;\n "
156
+ CPROVER_PREFIX " thread_local " CPROVER_PREFIX " size_t "
157
+ CPROVER_PREFIX " max_malloc_size= " +
158
+ integer2string (config. max_malloc_size ( ))+" ;\n "
187
159
188
160
// this is ANSI-C
189
161
" extern " CPROVER_PREFIX " thread_local const char __func__["
0 commit comments