Ah that explains a lot of things, thanks for walking me through this!
On Friday, August 9, 2024 at 8:55:31 PM UTC+9 omer...@chromium.org wrote:
> Thanks, but note that your last test is not guaranteed to always succeed.
> You're checking that some value is not found on stack, and trying to
> prev
Thanks, but note that your last test is not guaranteed to always succeed.
You're checking that some value is not found on stack, and trying to
prevent leftover stale values on stack to make the test pass.
Most times this will likely work, but you can't 100% guarantee that some
value will not be p
It will be hard to guarantee that a pointer is never found anywhere on the
stack.
That's why we generally only tests that objects are retained with stack
scanning, not that they are reclaimed.
I would recommend dropping the test rather than trying to fix it.
On Thursday, August 8, 2024 at 2:59:1
For future reference, here is the test that verifies pointers in
std::variant can be retained but pointers in std::vector can not:
https://github.com/compilets/compilets/blob/abb49a4/cpp/runtime/tests/stack_unittest.cc
On Thursday, August 8, 2024 at 9:59:11 PM UTC+9 Cheng wrote:
> Thanks for the
Thanks for the explanation!
I was actually quite confused why pointer in vector was also retained, I'll
fix my tests.
On Thursday, August 8, 2024 at 8:00:44 PM UTC+9 omer...@chromium.org wrote:
> For some reasons my previous replies didn't get to the mailing list.
>
> The question is whether th
For some reasons my previous replies didn't get to the mailing list.
The question is whether the pointer itself is on the stack or not.
IIRC std::variant uses inline storage to store values, so a pointer that
you keep in a std::variant would be on stack and would be found by stack
scanning.
std:
To answer my own question, I wrote some tests:
https://github.com/compilets/compilets/commit/d69722fb36260caa278843311cb043f5fe8a90d7
It seems that pointers stored in containers can be retained.
(It would be great if someone can verify this though.)
On Thursday, August 8, 2024 at 9:11:33 AM UTC+9