Skip to content

Commit 5cacfa4

Browse files
authored
Adding GC: MMTk tag to Julia's banner when building with MMTk (#72)
* Adding GC: MMTk tag to banner when running with MMTk * Getting info about MMTk build and printing it out * Fixing whitespace
1 parent 7a953be commit 5cacfa4

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/gc-interface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ JL_DLLEXPORT void jl_gc_collect(jl_gc_collection_t collection);
100100
JL_DLLEXPORT int gc_is_collector_thread(int tid) JL_NOTSAFEPOINT;
101101
// Pinning objects; Returns whether the object has been pinned by this call.
102102
JL_DLLEXPORT unsigned char jl_gc_pin_object(void* obj);
103+
// Returns the version of which GC implementation is being used according to the list of supported GCs
104+
JL_DLLEXPORT const char* jl_active_gc_impl(void);
103105

104106
// ========================================================================= //
105107
// Metrics

src/gc-mmtk.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ JL_DLLEXPORT unsigned char jl_gc_pin_object(void* obj) {
310310
// GC Statistics
311311
// ========================================================================= //
312312

313+
JL_DLLEXPORT const char* jl_active_gc_impl(void) {
314+
const char* mmtk_version = get_mmtk_version();
315+
return mmtk_version;
316+
}
317+
313318
int64_t last_gc_total_bytes = 0;
314319
int64_t last_live_bytes = 0; // live_bytes at last collection
315320
int64_t live_bytes = 0;

src/gc-stock.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4000,6 +4000,10 @@ JL_DLLEXPORT void jl_gc_wb2_slow(const void *parent, const void* ptr) JL_NOTSAFE
40004000
{
40014001
}
40024002

4003+
JL_DLLEXPORT const char* jl_active_gc_impl(void) {
4004+
return "";
4005+
}
4006+
40034007
#ifdef __cplusplus
40044008
}
40054009
#endif

stdlib/REPL/src/REPL.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,6 +1771,8 @@ function banner(io::IO = stdout; short = false)
17711771
end
17721772
end
17731773

1774+
gc_version = unsafe_string(ccall(:jl_active_gc_impl, Ptr{UInt8}, ()))
1775+
17741776
commit_date = isempty(Base.GIT_VERSION_INFO.date_string) ? "" : " ($(split(Base.GIT_VERSION_INFO.date_string)[1]))"
17751777

17761778
if get(io, :color, false)::Bool
@@ -1784,7 +1786,7 @@ function banner(io::IO = stdout; short = false)
17841786

17851787
if short
17861788
print(io,"""
1787-
$(d3)o$(tx) | Version $(VERSION)$(commit_date)
1789+
$(d3)o$(tx) | Version $(VERSION)$(commit_date) $(gc_version)
17881790
$(d2)o$(tx) $(d4)o$(tx) | $(commit_string)
17891791
""")
17901792
else
@@ -1795,14 +1797,14 @@ function banner(io::IO = stdout; short = false)
17951797
$(jl)| | | | | | |/ _` |$(tx) |
17961798
$(jl)| | |_| | | | (_| |$(tx) | Version $(VERSION)$(commit_date)
17971799
$(jl)_/ |\\__'_|_|_|\\__'_|$(tx) | $(commit_string)
1798-
$(jl)|__/$(tx) |
1800+
$(jl)|__/$(tx) | $(gc_version)
17991801
18001802
""")
18011803
end
18021804
else
18031805
if short
18041806
print(io,"""
1805-
o | Version $(VERSION)$(commit_date)
1807+
o | Version $(VERSION)$(commit_date) $(gc_version)
18061808
o o | $(commit_string)
18071809
""")
18081810
else
@@ -1814,7 +1816,7 @@ function banner(io::IO = stdout; short = false)
18141816
| | | | | | |/ _` | |
18151817
| | |_| | | | (_| | | Version $(VERSION)$(commit_date)
18161818
_/ |\\__'_|_|_|\\__'_| | $(commit_string)
1817-
|__/ |
1819+
|__/ | $(gc_version)
18181820
18191821
""")
18201822
end

0 commit comments

Comments
 (0)