• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #37591

pending completion
#37591

push

local

web-flow
Allocation Profiler: Types for all allocations (#50337)

Pass the types to the allocator functions.

-------

Before this PR, we were missing the types for allocations in two cases:

1. allocations from codegen
2. allocations in `gc_managed_realloc_`

The second one is easy: those are always used for buffers, right?

For the first one: we extend the allocation functions called from
codegen, to take the type as a parameter, and set the tag there.

I kept the old interfaces around, since I think that they cannot be
removed due to supporting legacy code?

------

An example of the generated code:
```julia
  %ptls_field6 = getelementptr inbounds {}**, {}*** %4, i64 2
  %13 = bitcast {}*** %ptls_field6 to i8**
  %ptls_load78 = load i8*, i8** %13, align 8
  %box = call noalias nonnull dereferenceable(32) {}* @ijl_gc_pool_alloc_typed(i8* %ptls_load78, i32 1184, i32 32, i64 4366152144) #7
```

Fixes #43688.
Fixes #45268.

Co-authored-by: Valentin Churavy <vchuravy@users.noreply.github.com>

72755 of 84117 relevant lines covered (86.49%)

22738368.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.36
/stdlib/Markdown/src/render/plain.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
plain(x) = sprint(plain, x)
×
4

5
function plain(io::IO, content::Vector)
36✔
6
    isempty(content) && return
36✔
7
    for md in content[1:end-1]
62✔
8
        plain(io, md)
15✔
9
        println(io)
15✔
10
    end
25✔
11
    plain(io, content[end])
36✔
12
end
13

14
plain(io::IO, md::MD) = plain(io, md.content)
36✔
15

16
function plain(io::IO, header::Header{l}) where l
2✔
17
    print(io, "#"^l*" ")
2✔
18
    plaininline(io, header.text)
2✔
19
    println(io)
2✔
20
end
21

22
function plain(io::IO, code::Code)
6✔
23
    # If the code includes a fenced block this will break parsing,
24
    # so it must be enclosed by a longer ````-sequence.
25
    n = mapreduce(m -> length(m.match), max, eachmatch(r"^`+"m, code.code); init=2) + 1
6✔
26
    println(io, "`" ^ n, code.language)
6✔
27
    println(io, code.code)
6✔
28
    println(io, "`" ^ n)
6✔
29
end
30

31
function plain(io::IO, p::Paragraph)
22✔
32
    plaininline(io, p.content)
22✔
33
    println(io)
22✔
34
end
35

36
function plain(io::IO, list::List)
×
37
    for (i, item) in enumerate(list.items)
×
38
        print(io, isordered(list) ? "$(i + list.ordered - 1). " : "  * ")
×
39
        lines = split(rstrip(sprint(plain, item)), "\n")
×
40
        for (n, line) in enumerate(lines)
×
41
            print(io, (n == 1 || isempty(line)) ? "" : "    ", line)
×
42
            n < length(lines) && println(io)
×
43
        end
×
44
        println(io)
×
45
    end
×
46
end
47

48
function plain(io::IO, q::BlockQuote)
×
49
    s = sprint(plain, q.content)
×
50
    for line in split(rstrip(s), "\n")
×
51
        println(io, isempty(line) ? ">" : "> ", line)
×
52
    end
×
53
    println(io)
×
54
end
55

56
function plain(io::IO, f::Footnote)
×
57
    print(io, "[^", f.id, "]:")
×
58
    s = sprint(plain, f.text)
×
59
    lines = split(rstrip(s), "\n")
×
60
    # Single line footnotes are printed on the same line as their label
61
    # rather than taking up an additional line.
62
    if length(lines) == 1
×
63
        println(io, " ", lines[1])
×
64
    else
65
        println(io)
×
66
        for line in lines
×
67
            println(io, isempty(line) ? "" : "    ", line)
×
68
        end
×
69
        println(io)
×
70
    end
71
end
72

73
function plain(io::IO, md::Admonition)
×
74
    s = sprint(plain, md.content)
×
75
    title = md.title == uppercasefirst(md.category) ? "" : " \"$(md.title)\""
×
76
    println(io, "!!! ", md.category, title)
×
77
    for line in split(rstrip(s), "\n")
×
78
        println(io, isempty(line) ? "" : "    ", line)
×
79
    end
×
80
    println(io)
×
81
end
82

83
function plain(io::IO, md::HorizontalRule)
×
84
    println(io, "-" ^ 3)
×
85
end
86

87
function plain(io::IO, l::LaTeX)
×
88
    println(io, '$', '$')
×
89
    println(io, l.formula)
×
90
    println(io, '$', '$')
×
91
end
92

93
function plain(io::IO, md)
×
94
    show(io,  MIME"text/plain"(), md)
×
95
    println(io)
×
96
end
97

98
# Inline elements
99

100
plaininline(x) = sprint(plaininline, x)
171✔
101

102
function plaininline(io::IO, md...)
15✔
103
    for el in md
15✔
104
        plaininline(io, el)
69✔
105
    end
69✔
106
end
107

108
plaininline(io::IO, md::Vector) = !isempty(md) && plaininline(io, md...)
26✔
109

110
plaininline(io::IO, f::Footnote) = print(io, "[^", f.id, "]")
×
111

112
plaininline(io::IO, link::Link) = plaininline(io, "[", link.text, "](", link.url, ")")
2✔
113

114
plaininline(io::IO, md::Image) = plaininline(io, "![", md.alt, "](", md.url, ")")
×
115

116
plaininline(io::IO, s::AbstractString) = print(io, s)
224✔
117

118
plaininline(io::IO, md::Bold) = plaininline(io, "**", md.text, "**")
×
119

120
plaininline(io::IO, md::Italic) = plaininline(io, "*", md.text, "*")
×
121

122
function plaininline(io::IO, md::Code)
25✔
123
    if occursin("`", md.code)
25✔
124
        n = maximum(length(m.match) for m in eachmatch(r"(`+)", md.code))
×
125
        s = "`"^((iseven(n) ? 1 : 2) + n)
×
126
        print(io, s, Base.startswith(md.code, "`") ? " " : "")
×
127
        print(io, md.code, endswith(md.code, "`") ? " " : "", s)
×
128
    else
129
        print(io, "`", md.code, "`")
25✔
130
    end
131
end
132

133
plaininline(io::IO, br::LineBreak) = println(io)
×
134

135
plaininline(io::IO, x) = show(io, MIME"text/plain"(), x)
×
136

137
# show
138

139
Base.show(io::IO, md::MD) = plain(io, md)
23✔
140
Base.show(io::IO, ::MIME"text/markdown", md::MD) = plain(io, md)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc