Fix AllocatedValue and make it more dynamic. #153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ValueExtractionSynthesizer::SynthesizeSVRInit is currently transforming into code that is not standards compliant. The issue is mostly that either a constructor or cling::printValue can throw which leaves AllocatedValue thinking the memory it allocated is a valid object and running it's destructor when it shouldn't.
I solved this by reserving the byte before the payload memory for ValueExtractionSynthesizer::SynthesizeSVRInit to use and mark that construction has finished properly.
This PR has the relevant changes for AllocatedValue and also uses the reserved byte to allow it to only allocate the space required for caching the destructor and array-size fields for the type it is building.
The last commit is the disabling of the fix, as the changes to ValueExtractionSynthesizer::SynthesizeSVRInit are not included, and I probably won't back port what I have in that arena.
I can submit the changes I have to ValueExtractionSynthesizer::SynthesizeSVRInit which were done to avoid the copying that occurs when value-printing as well as provide an implementation that is not dependent on C++/overloading, but the transformation should basically become:
Relevant code for ValueExtractionSynthesizer::SynthesizeSVRInit: