Jump to page: 1 2
Thread overview
[Issue 14892] -profile=gc doesn't account for GC API allocations
Aug 09, 2015
Walter Bright
Jan 18, 2022
Dlang Bot
Jan 18, 2022
Dlang Bot
Jan 18, 2022
Dlang Bot
Jan 18, 2022
Dlang Bot
Jan 18, 2022
Dlang Bot
Jan 19, 2022
Dlang Bot
Jan 19, 2022
Dlang Bot
Jan 26, 2022
Dlang Bot
August 09, 2015
https://issues.dlang.org/show_bug.cgi?id=14892

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           Severity|normal                      |enhancement

--
January 18, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx

--
January 18, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

--- Comment #1 from hsteoh@quickfur.ath.cx ---
Looked at the dmd code for this. Apparently -profile=gc works by detecting language constructs that trigger an allocation, and replacing the druntime calls with alternative druntime calls that inject tracing information. Direct calls to the GC allocator are not detected since this is triggered by language constructs only.

There are a few possible approaches I can see:

1) Detect calls to specific druntime symbols and substitute them with the tracing versions when compiling with -profile=gc. This is perhaps the simplest quick-fix solution, but it's rather hackish, and may or may not work well depending on how much information is available at the callsite.

2) Move the magic out of the compiler and delegate to druntime/Phobos so that commonly-used GC allocation triggering functions like std.array.array can decide how to implement tracing. E.g., set a version=profileGC and have std.array.array call the tracing version of the allocator instead of the one it's currently using. This approach is more flexible, but could be prone to abuse.

3) Variation on (2): templatize the affected druntime functions so that they *always* receive all the information they need to do tracing, but when version=profileGC is not set, this information is discarded and the non-tracing code is called. When version=profileGC is set, branch to the tracing versions of the code. Then in places like std.array.array, Phobos could meaningfully provide the allocation call with something pointing to user code (rather than std.array.array itself).

--
January 18, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@quickfur created dlang/druntime pull request #3681 "Issue 14892: need to wrap _d_newarrayU as well for -profile=gc." mentioning this issue:

- Issue 14892: need to wrap _d_newarrayU as well for -profile=gc.

https://github.com/dlang/druntime/pull/3681

--
January 18, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@quickfur created dlang/dmd pull request #13545 "Partial fix for issue 14892: define D_ProfileGC for -profile=gc" mentioning this issue:

- Partial fix for issue 14892: define D_ProfileGC.

  To enable Phobos to propagate file/line/function information from user
  code to the trace functions.

https://github.com/dlang/dmd/pull/13545

--
January 18, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@quickfur created dlang/phobos pull request #8361 "WIP: Fix issue 14892: std.array.array support for -profile=gc." fixing this issue:

- Fix issue 14892: std.array.array support for -profile=gc.

https://github.com/dlang/phobos/pull/8361

--
January 18, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/druntime pull request #3681 "Issue 14892: need to wrap _d_newarrayU as well for -profile=gc." was merged into master:

- 58b3e1ee6f526ac5167a16cf744c1dc1488684aa by H. S. Teoh:
  Issue 14892: need to wrap _d_newarrayU as well for -profile=gc.

https://github.com/dlang/druntime/pull/3681

--
January 18, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13545 "Partial fix for issue 14892: define D_ProfileGC for -profile=gc" was merged into master:

- 0474a7e35d94dbc8e731e64aff27a2f961cb4114 by H. S. Teoh:
  Partial fix for issue 14892: define D_ProfileGC.

  To enable Phobos to propagate file/line/function information from user
  code to the trace functions.

https://github.com/dlang/dmd/pull/13545

--
January 19, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #8361 "Fix issue 14892: std.array.array support for -profile=gc." was merged into master:

- 75d7378f66e8891426dbff24268233673d6a2f86 by H. S. Teoh:
  Fix issue 14892: std.array.array support for -profile=gc.

https://github.com/dlang/phobos/pull/8361

--
January 19, 2022
https://issues.dlang.org/show_bug.cgi?id=14892

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #8 from hsteoh@quickfur.ath.cx ---
Just realized that the Phobos PR has not *completely* fixed this issue: calls to GC.malloc for example are still missed. Will post a follow-up PR on that soon.

--
« First   ‹ Prev
1 2