forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR ports #58 to `dev`. This PR is mostly the same as #58 except that 1. this PR does not remove transitive pinning of shadow stack roots (we know it is unsound to remove the transitive pinning at this stage), and 2. this PR includes minor refactoring for GC codegen interface.
- Loading branch information
Showing
13 changed files
with
190 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#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), {}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "llvm-gc-interface-passes.h" | ||
|
||
void LateLowerGCFrame::CleanupGCPreserve(Function &F, CallInst *CI, Value *callee, Type *T_size) { | ||
// Do nothing for the stock GC | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters