Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some GCLowering cleanup and add support for FCAs #33389

Merged
merged 2 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/codegen_shared.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// This file is a part of Julia. License is MIT: https://julialang.org/license

#include <utility>
#include <llvm/Support/Debug.h>
#include <llvm/IR/DebugLoc.h>
#include <llvm/IR/IRBuilder.h>

enum AddressSpace {
Generic = 0,
Expand All @@ -17,6 +19,15 @@ enum AddressSpace {
#define JLCALL_F_CC (CallingConv::ID)37 // (jl_value_t *arg0, jl_value_t **argv, uint32_t nargv)
#define JLCALL_F2_CC (CallingConv::ID)38 // (jl_value_t *arg0, jl_value_t **argv, uint32_t nargv, jl_value_t *extra)

// return how many Tracked pointers are in T (count > 0),
// and if there is anything else in T (all == false)
struct CountTrackedPointers {
unsigned count = 0;
bool all = true;
bool derived = false;
CountTrackedPointers(llvm::Type *T);
};

static inline void llvm_dump(llvm::Value *v)
{
v->print(llvm::dbgs(), true);
Expand Down
10 changes: 7 additions & 3 deletions src/llvm-final-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Value *FinalLowerGC::lowerNewGCFrame(CallInst *target, Function &F)
T_prjlvalue,
0,
ConstantInt::get(T_int32, nRoots + 2));
gcframe->setAlignment(16);
gcframe->insertAfter(target);
gcframe->takeName(target);

Expand All @@ -88,17 +89,20 @@ Value *FinalLowerGC::lowerNewGCFrame(CallInst *target, Function &F)
Value *args[4] = {
tempSlot_i8, // dest
ConstantInt::get(Type::getInt8Ty(F.getContext()), 0), // val
ConstantInt::get(T_int32, sizeof(jl_value_t*)*(nRoots+2)), // len
ConstantInt::get(T_int32, sizeof(jl_value_t*) * (nRoots + 2)), // len
ConstantInt::get(Type::getInt1Ty(F.getContext()), 0)}; // volatile
#else
Value *args[5] = {
tempSlot_i8, // dest
ConstantInt::get(Type::getInt8Ty(F.getContext()), 0), // val
ConstantInt::get(T_int32, sizeof(jl_value_t*)*(nRoots+2)), // len
ConstantInt::get(T_int32, 0), // align
ConstantInt::get(T_int32, sizeof(jl_value_t*) * (nRoots + 2)), // len
ConstantInt::get(T_int32, 16), // align
ConstantInt::get(Type::getInt1Ty(F.getContext()), 0)}; // volatile
#endif
CallInst *zeroing = CallInst::Create(memset, makeArrayRef(args));
#if JL_LLVM_VERSION >= 70000
cast<MemSetInst>(zeroing)->setDestAlignment(16);
#endif
zeroing->setMetadata(LLVMContext::MD_tbaa, tbaa_gcframe);
zeroing->insertAfter(tempSlot_i8);

Expand Down
Loading