Skip to content

Commit cafd9d0

Browse files
committed
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 84316bf commit cafd9d0

5 files changed

Lines changed: 18 additions & 6 deletions

File tree

src/gc-interface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ JL_DLLEXPORT void jl_gc_set_max_memory(uint64_t max_mem);
9898
JL_DLLEXPORT void jl_gc_collect(jl_gc_collection_t collection);
9999
// Returns whether the thread with `tid` is a collector thread
100100
JL_DLLEXPORT int gc_is_collector_thread(int tid) JL_NOTSAFEPOINT;
101+
// Returns the version of which GC implementation is being used according to the list of supported GCs
102+
JL_DLLEXPORT const char* jl_active_gc_impl(void);
101103

102104
// ========================================================================= //
103105
// Metrics

src/gc-mmtk.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@ JL_DLLEXPORT void jl_gc_prepare_to_collect(void)
306306
// GC Statistics
307307
// ========================================================================= //
308308

309+
JL_DLLEXPORT const char* jl_active_gc_impl(void) {
310+
const char* mmtk_version = get_mmtk_version();
311+
return mmtk_version;
312+
}
313+
309314
int64_t last_gc_total_bytes = 0;
310315
int64_t last_live_bytes = 0; // live_bytes at last collection
311316
int64_t live_bytes = 0;

src/gc-stock.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,6 +3993,10 @@ void jl_gc_notify_image_load(const char* img_data, size_t len)
39933993
// Do nothing
39943994
}
39953995

3996+
JL_DLLEXPORT const char* jl_active_gc_impl(void) {
3997+
return "";
3998+
}
3999+
39964000
#ifdef __cplusplus
39974001
}
39984002
#endif

src/llvm-late-gc-lowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,8 +2605,7 @@ bool LateLowerGCFrame::runOnFunction(Function &F, bool *CFGModified) {
26052605
if (auto *CI = dyn_cast<CallInst>(*it)) {
26062606
*CFGModified = true;
26072607

2608-
Value *callee = CI->getCalledOperand();
2609-
assert(callee == GCAllocBytes);
2608+
assert(CI->getCalledOperand() == GCAllocBytes);
26102609

26112610
auto newI = lowerGCAllocBytesLate(CI, F);
26122611
if (newI != CI) {

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)