Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mmtk/julia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c80b388e7f321af0f269a9788d0d31c5468a0e99
Choose a base ref
..
head repository: mmtk/julia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 66b1fa996572c68ce2ccbb9d1045928691adad60
Choose a head ref
Showing with 51 additions and 0 deletions.
  1. +1 −0 src/llvm-gc-interface-passes.h
  2. +46 −0 src/llvm-late-gc-lowering-mmtk.cpp
  3. +4 −0 src/llvm-late-gc-lowering-stock.cpp
1 change: 1 addition & 0 deletions src/llvm-gc-interface-passes.h
Original file line number Diff line number Diff line change
@@ -361,6 +361,7 @@ struct LateLowerGCFrame: private JuliaPassContext {
void PlaceGCFrameReset(State &S, unsigned R, unsigned MinColorRoot, ArrayRef<int> Colors, Value *GCFrame, Instruction *InsertBefore);
void PlaceRootsAndUpdateCalls(ArrayRef<int> Colors, int PreAssignedColors, State &S, std::map<Value *, std::pair<int, int>>);
void CleanupWriteBarriers(Function &F, State *S, const SmallVector<CallInst*, 0> &WriteBarriers, bool *CFGModified);
void CleanupGCPreserve(Function &F, CallInst *CI, Value *callee, Type *T_size);
bool CleanupIR(Function &F, State *S, bool *CFGModified);
void NoteUseChain(State &S, BBState &BBS, User *TheUser);
SmallVector<int, 1> GetPHIRefinements(PHINode *phi, State &S);
46 changes: 46 additions & 0 deletions src/llvm-late-gc-lowering-mmtk.cpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,52 @@

#include "llvm-gc-interface-passes.h"

void LateLowerGCFrame::CleanupGCPreserve(Function &F, CallInst *CI, Value *callee, Type *T_size) {
if (callee == gc_preserve_begin_func) {
// Initialize an IR builder.
IRBuilder<> builder(CI);

builder.SetCurrentDebugLocation(CI->getDebugLoc());
size_t nargs = 0;
State S2(F);

std::vector<Value*> args;
for (Use &U : CI->args()) {
Value *V = U;
if (isa<Constant>(V))
continue;
if (isa<PointerType>(V->getType())) {
if (isSpecialPtr(V->getType())) {
int Num = Number(S2, V);
if (Num >= 0) {
nargs++;
Value *Val = GetPtrForNumber(S2, Num, CI);
args.push_back(Val);
}
}
} else {
auto Nums = NumberAll(S2, V);
for (int Num : Nums) {
if (Num < 0)
continue;
Value *Val = GetPtrForNumber(S2, Num, CI);
args.push_back(Val);
nargs++;
}
}
}
args.insert(args.begin(), ConstantInt::get(T_size, nargs));

ArrayRef<Value*> args_llvm = ArrayRef<Value*>(args);
builder.CreateCall(getOrDeclare(jl_well_known::GCPreserveBeginHook), args_llvm );
} else if (callee == gc_preserve_end_func) {
// Initialize an IR builder.
IRBuilder<> builder(CI);
builder.SetCurrentDebugLocation(CI->getDebugLoc());
builder.CreateCall(getOrDeclare(jl_well_known::GCPreserveEndHook), {});
}
}

Value* LateLowerGCFrame::lowerGCAllocBytesLate(CallInst *target, Function &F)
{
assert(target->arg_size() == 3);
4 changes: 4 additions & 0 deletions src/llvm-late-gc-lowering-stock.cpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

#include "llvm-gc-interface-passes.h"

void LateLowerGCFrame::CleanupGCPreserve(Function &F, CallInst *CI, Value *callee, Type *T_size) {
// Do nothing for the stock GC
}

Value* LateLowerGCFrame::lowerGCAllocBytesLate(CallInst *target, Function &F)
{
// Do nothing for the stock GC