Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smart_holder trampoline shared_from_this support #3023

Merged
merged 67 commits into from
Jun 30, 2021

Commits on Jun 29, 2021

  1. Configuration menu
    Copy the full SHA
    d9ac283 View commit details
    Browse the repository at this point in the history
  2. Experiments: 1. disabling enable_shared_from_this, 2. using smart_hol…

    …der in test_class_sh_shared_from_this.cpp
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    007ab63 View commit details
    Browse the repository at this point in the history
  3. Breaking up test_shared_ptr_from_this_and_references into smaller sub…

    …tests. Skipping the only test that generates an ASAN heap-use-after-free.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    4e993f7 View commit details
    Browse the repository at this point in the history
  4. Restoring init_holder overload for std::enable_shared_from_this and o…

    …riginal tests/test_smart_ptr.py.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    bfaa006 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1fc5a02 View commit details
    Browse the repository at this point in the history
  6. enable_shared_from_this_from_raw_ptr_take_ownership_guard: better sta…

    …tic_assert that also triggers for derived classes.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    4a9f6ea View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    20aa407 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4d403f3 View commit details
    Browse the repository at this point in the history
  9. Fully emulating type_caster_base-related behavior: trying shared_from…

    …_this also for unowned pointees.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    3d603f2 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    60fd973 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    881b25c View commit details
    Browse the repository at this point in the history
  12. Experiment: undoing even more.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    f5ac855 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    bd13ad9 View commit details
    Browse the repository at this point in the history
  14. Revert "Experiment: restoring original smart_holder_type_casters.h fr…

    …om smart_holder branch."
    
    This reverts commit 19c5a36.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    8bb208a View commit details
    Browse the repository at this point in the history
  15. Revert "Experiment: undoing even more."

    This reverts commit 59bc2e1.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    e45ab22 View commit details
    Browse the repository at this point in the history
  16. Revert "Experiment: effectively undoing all shared_from_this modifica…

    …tions."
    
    This reverts commit d72d54e.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    5817c83 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    8fb1210 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    86e2024 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    2b46052 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    97d4dab View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    cad91e7 View commit details
    Browse the repository at this point in the history
  22. MSVC 2015 compatibility.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    9845f69 View commit details
    Browse the repository at this point in the history
  23. WIP snapshot.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    df25405 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    fdc91f8 View commit details
    Browse the repository at this point in the history
  25. WIP snapshot: replacing std::shared_ptr<bool> flag_ptr with simple …

    …`bool armed_flag`.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    d704167 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    307766f View commit details
    Browse the repository at this point in the history
  27. Inserting const_cast for std::get_deleter return, to keep Ubuntu …

    …20 GCC 6.3.0 happy.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    79c711e View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    87756ca View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    994800b View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    d3104be View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    2745c31 View commit details
    Browse the repository at this point in the history
  32. First attempt to make shared_from_this and trampolines play nicely. P…

    …asses all pybind11 and PyCLIF unit tests ASAN clean, but not the open_spiel iterated_prisoners_dilemma_test.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    86a4fb7 View commit details
    Browse the repository at this point in the history
  33. First fully successful attempt to make shared_from_this and trampol…

    …ines play nicely.
    
    Now also passes the open_spiel iterated_prisoners_dilemma_test ASAN clean, in addition to all pybind11 and PyCLIF unit tests.
    
    The problem was that calling `std::shared_ptr<void>::reset()` with a `void` pointer cannot possibly update the `shared_from_this` `weak_ptr`.
    
    The solution is to store a `shd_ptr_reset` function pointer in `guarded_deleter` (similar in idea to the stored function pointer for calling `delete`).
    
    This commit still includes all debugging code, i.e. is "dirty". The code will be cleaned up after the GitHub CI is fully successful.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    1c98886 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    69fcb36 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    691127c View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    ef5bc6d View commit details
    Browse the repository at this point in the history
  37. nodiscard fix.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    76deebe View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    c7c257f View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    da812cd View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    c469587 View commit details
    Browse the repository at this point in the history
  41. Adding test_pass_released_shared_ptr_as_unique_ptr, exercising new …

    …guard in smart_holder_type_casters.h.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    a17ad73 View commit details
    Browse the repository at this point in the history
  42. Minor clang-tidy fix.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    eb7c51f View commit details
    Browse the repository at this point in the history
  43. Leveraging new noop_deleter_acting_as_weak_ptr_owner to retrieve re…

    …leased `vptr`.
    
    The placeholder `vptr` is never exposed anymore, therefore the externally visible `use_count`s are more intuitive.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    3f190fb View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    bd40c4c View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    1d319b7 View commit details
    Browse the repository at this point in the history
  46. smart_holder_poc.h: type-erase raw_ptr before passing to shared_ptr::…

    …reset, to not trigger populating the shared_from_this weak_ptr. This way the only way the weak_ptr is populated is through loaded_as_shared_ptr. Breaks all but one test in test_class_sh_trampoline_shared_from_this.py, now marked skip WIP to test everything else with the GitHub CI.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    d68094d View commit details
    Browse the repository at this point in the history
  47. Simpler and safe implementation based on new requirement: C++ (outsid…

    …e of the Python object) needs to hold a shared_ptr before shared_from_this is called. This is more similar to the existing implementation on current smart_holder HEAD, but still uses a weak_ptr to always return the same shared_ptr as long as C++ does not let it expire.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    d94e348 View commit details
    Browse the repository at this point in the history
  48. Automatic clang-tidy fixes.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    1cb657d View commit details
    Browse the repository at this point in the history
  49. Adding // NOLINT for clang-tidy.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    4f88eac View commit details
    Browse the repository at this point in the history
  50. Adding test_pure_cpp_sft_raw_ptr (with 3 TODO: Fix), test_pure_cpp_sf…

    …t_shd_ptr (works as desired).
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    78ddb1a View commit details
    Browse the repository at this point in the history
  51. Preparation for being smarter about casting to void * to evade to s…

    …hared_from_this mechanism.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    75fcf5f View commit details
    Browse the repository at this point in the history
  52. Use casting to void * to evade to shared_from_this mechanism only i…

    …f `pointee_depends_on_holder_owner`, but currently only for `from_raw_ptr_take_ownership`.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    50ac3ef View commit details
    Browse the repository at this point in the history
  53. Resolving TODOs for from_unique_ptr void_cast_raw_ptr. Adding tes…

    …t to exercise the path through `cast`. The path through init.h is missing a test that would fail if the flag is incorrect. The plan is to systematically cover all situations (there are many that are not exercised for shared_from_this).
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    8870251 View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    73e8d71 View commit details
    Browse the repository at this point in the history
  55. Cleaning out debug code.

    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    7fc8313 View commit details
    Browse the repository at this point in the history
  56. Updating Catch version to latest, in hopes of resolving the GHA downl…

    …oad issue affecting all MSVC builds.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    7031875 View commit details
    Browse the repository at this point in the history
  57. Revert "Updating Catch version to latest, in hopes of resolving the G…

    …HA download issue affecting all MSVC builds."
    
    This reverts commit f4e1112.
    
    It didn't help.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    1528efb View commit details
    Browse the repository at this point in the history
  58. Configuration menu
    Copy the full SHA
    0956874 View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    3c69fee View commit details
    Browse the repository at this point in the history
  60. This change fixes the 6 unit tests in

    https://github.com/deepmind/open_spiel/tree/bbfb0259b5d26c1e3f05000f1f4a05b7ad60393e/open_spiel/python/mfg/algorithms
        best_response_value_test
        distribution_test
        fictitious_play_test
        greedy_policy_test
        nash_conv_test
        policy_value_test
    
    CAVEAT: The fix is NOT covered by pybind11 unit tests.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    9c84800 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    7663896 View commit details
    Browse the repository at this point in the history
  62. Adding unit tests: 2 x test_std_make_shared_factory

    Completes unit test coverage for the changed code in smart_holder_type_casters.h.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    f772ccd View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    815238c View commit details
    Browse the repository at this point in the history
  64. Adding test_multiple_registered_instances_for_same_pointee_leak. Subt…

    …le changes in smart_holder_type_caster_load, trying to work on weak_ptr for shared_ptr_trampoline_self_life_support, but that didn't work out. Manually fully leak-checked again.
    rwgk committed Jun 29, 2021
    Configuration menu
    Copy the full SHA
    0043fe5 View commit details
    Browse the repository at this point in the history
  65. Configuration menu
    Copy the full SHA
    4c64a9e View commit details
    Browse the repository at this point in the history
  66. Configuration menu
    Copy the full SHA
    08e9c60 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    45fbdfc View commit details
    Browse the repository at this point in the history