Bug 15504 – core.demangle uses exception handling for normal control flow

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P4
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-03T10:17:04Z
Last change time
2024-01-31T10:56:02Z
Assigned to
alex.jercaianu
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2016-01-03T10:17:04Z
Exceptions should only be used for exceptional conditions, like errors. demangle is using them for normal control flow - this results in slow code because the EH support is predicated on EH not being in the normal control flow. https://github.com/D-Programming-Language/druntime/blob/master/src/core/demangle.d
Comment #1 by dlang-bugzilla — 2017-06-26T14:10:34Z
(In reply to Walter Bright from comment #0) > https://github.com/D-Programming-Language/druntime/blob/master/src/core/ > demangle.d Permalink to that day's version: https://github.com/dlang/druntime/blob/43a7e6830980cd242c1fbae145cffdf7be397069/src/core/demangle.d To find the offending code, search for catch(...) blocks. Permalink to today's version, which still has the problematic code: https://github.com/dlang/druntime/blob/68ba136a3ce7ff9c66580b2efd659a27aa035dd8/src/core/demangle.d
Comment #2 by feklushkin.denis — 2020-11-16T00:34:25Z
Also demangle consumes megabytes of memory for each unsucessful demangle. This causes demangling unittests fails on low-memory system. Little related discussion here: https://github.com/dlang/druntime/pull/3262
Comment #3 by razvan.nitu1305 — 2023-07-10T16:02:32Z
Comment #4 by feklushkin.denis — 2024-01-30T01:31:23Z
Straightforward attempt to fix: https://github.com/dlang/dmd/pull/16114
Comment #5 by feklushkin.denis — 2024-01-31T10:56:02Z