Commit 15e60efc authored by Eduardo Souza's avatar Eduardo Souza

Change pointers to addrspace(1), making them GC-able.

parent 8e3bd074
Pipeline #5504 failed with stages
in 23 minutes and 54 seconds
......@@ -1374,7 +1374,7 @@ pub unsafe fn gen_instr_new_hybrid(
let calloc = LLVMBuildBitCast(
llvm_internal_context.builder,
calloc,
LLVMPointerType(llvm_type, 0),
LLVMPointerType(llvm_type, 1),
name.as_str().as_ptr() as *const c_char
);
......@@ -1441,7 +1441,7 @@ pub unsafe fn gen_instr_new(
let var_ptr = LLVMBuildBitCast(
llvm_internal_context.builder,
ptr,
LLVMPointerType(llvm_type, 0),
LLVMPointerType(llvm_type, 1),
name.as_str().as_ptr() as *const c_char
);
......@@ -1991,7 +1991,7 @@ pub unsafe fn gen_instr_new_thread(
let llvm_stack = gen_llvm_value(llvm_internal_context, stack, store);
let mut llvm_stack_elm_type =
vec![LLVMPointerType(LLVMInt8Type(), 0), LLVMInt32Type()];
vec![LLVMPointerType(LLVMInt8Type(), 1), LLVMInt32Type()];
let llvm_stack_elm_type = LLVMStructType(
llvm_stack_elm_type.as_mut_ptr(),
llvm_stack_elm_type.len() as c_uint,
......@@ -2016,7 +2016,7 @@ pub unsafe fn gen_instr_new_thread(
let array_ptr_cast = LLVMBuildBitCast(
llvm_internal_context.builder,
array_ptr,
LLVMPointerType(llvm_stack_array_type, 0),
LLVMPointerType(llvm_stack_array_type, 1),
"a_cast\0".as_ptr() as *const c_char
);
......@@ -2044,7 +2044,7 @@ pub unsafe fn gen_instr_new_thread(
"a_p\0".as_ptr() as *const c_char
);
let pointer_type = LLVMPointerType(LLVMInt64Type(), 0);
let pointer_type = LLVMPointerType(LLVMInt64Type(), 1);
let calloc_bitcast = LLVMBuildBitCast(
llvm_internal_context.builder,
calloc_val,
......@@ -2141,7 +2141,7 @@ pub unsafe fn gen_instr_new_thread(
}
let llvm_thread_local = match thread_local {
None => LLVMConstNull(LLVMPointerType(LLVMInt8Type(), 0)),
None => LLVMConstNull(LLVMPointerType(LLVMInt8Type(), 1)),
Some(v) => {
let thread_local = ins.ops.get(*v).unwrap();
gen_llvm_value(llvm_internal_context, thread_local, store)
......@@ -2545,7 +2545,7 @@ pub unsafe fn gen_instr_throw(
"exc\0".as_ptr() as *const c_char
);
let exception_loc_cast = LLVMBuildBitCast(
let exception_loc_cast = LLVMBuildAddrSpaceCast(
llvm_internal_context.builder,
exception_loc,
exception_llvm_type,
......@@ -2567,7 +2567,7 @@ pub unsafe fn gen_instr_throw(
panic!("function does not exist");
}
let null_const = LLVMConstNull(LLVMPointerType(LLVMInt8Type(), 0));
let null_const = LLVMConstNull(LLVMPointerType(LLVMInt8Type(), 1));
let mut args = vec![exception_loc, null_const.clone(), null_const];
......@@ -2605,10 +2605,10 @@ pub unsafe fn gen_instr_new_stack(
size
};
let func_ref_bitcast = LLVMBuildBitCast(
let func_ref_bitcast = LLVMBuildAddrSpaceCast(
llvm_internal_context.builder,
func_ref_llvm,
LLVMPointerType(LLVMInt8Type(), 0),
LLVMPointerType(LLVMInt8Type(), 1),
"fn_arg\0".as_ptr() as *const c_char
);
......
......@@ -1089,29 +1089,29 @@ pub unsafe fn gen_llvm_type(
}
MuType_::IRef(mu_type) => {
if mu_type.is_void() {
LLVMPointerType(LLVMInt8Type(), 0)
LLVMPointerType(LLVMInt8Type(), 1)
} else {
let internal_type =
gen_llvm_type(llvm_internal_context, mu_type);
LLVMPointerType(internal_type, 0)
LLVMPointerType(internal_type, 1)
}
}
MuType_::Ref(mu_type) => {
if mu_type.is_void() {
LLVMPointerType(LLVMInt8Type(), 0)
LLVMPointerType(LLVMInt8Type(), 1)
} else {
let internal_type =
gen_llvm_type(llvm_internal_context, mu_type);
LLVMPointerType(internal_type, 0)
LLVMPointerType(internal_type, 1)
}
}
MuType_::UPtr(mu_type) => {
if mu_type.is_void() {
LLVMPointerType(LLVMInt8Type(), 0)
LLVMPointerType(LLVMInt8Type(), 1)
} else {
let internal_type =
gen_llvm_type(llvm_internal_context, mu_type);
LLVMPointerType(internal_type, 0)
LLVMPointerType(internal_type, 1)
}
}
MuType_::FuncRef(sig) => LLVMPointerType(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment