diff options
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/arch/i386/_context.S | 56 | ||||
| -rw-r--r-- | src/rt/intrinsics/intrinsics.i386.ll.in | 23 | ||||
| -rw-r--r-- | src/rt/intrinsics/intrinsics.x86_64.ll.in | 23 | ||||
| -rw-r--r-- | src/rt/rust_log.cpp | 2 |
4 files changed, 57 insertions, 47 deletions
diff --git a/src/rt/arch/i386/_context.S b/src/rt/arch/i386/_context.S index faee99284a5..b892342ee31 100644 --- a/src/rt/arch/i386/_context.S +++ b/src/rt/arch/i386/_context.S @@ -20,19 +20,19 @@ The registers_t variable is in (%esp) swap_registers: // save the old context movl 4(%esp), %eax - //movl %eax, 0(%eax) - movl %ebx, 4(%eax) - //movl %ecx, 8(%eax) - //movl %edx, 12(%eax) - movl %ebp, 16(%eax) - movl %esi, 20(%eax) - movl %edi, 24(%eax) - //movl %cs, 32(%eax) - //movl %ds, 34(%eax) - //movl %ss, 36(%eax) - //movl %es, 38(%eax) - //movl %fs, 40(%eax) - //movl %gs, 42(%eax) + //movl %eax, 0(%eax) + movl %ebx, 4(%eax) + //movl %ecx, 8(%eax) + //movl %edx, 12(%eax) + movl %ebp, 16(%eax) + movl %esi, 20(%eax) + movl %edi, 24(%eax) + //movl %cs, 32(%eax) + //movl %ds, 34(%eax) + //movl %ss, 36(%eax) + //movl %es, 38(%eax) + //movl %fs, 40(%eax) + //movl %gs, 42(%eax) // save the flags pushf @@ -48,20 +48,20 @@ swap_registers: // restore the new context movl 4(%esp), %eax - movl 4(%eax), %ebx - // save ecx for later... - //movl 12(%eax), %edx - movl 16(%eax), %ebp - movl 20(%eax), %esi - movl 24(%eax), %edi - movl 28(%eax), %esp - // We can't actually change this... - //movl 32(%eax), %cs - //movl 34(%eax), %ds - //movl 36(%eax), %ss - //movl 38(%eax), %es - //movl 40(%eax), %fs - //movl 42(%eax), %gs + movl 4(%eax), %ebx + // save ecx for later... + //movl 12(%eax), %edx + movl 16(%eax), %ebp + movl 20(%eax), %esi + movl 24(%eax), %edi + movl 28(%eax), %esp + // We can't actually change this... + //movl 32(%eax), %cs + //movl 34(%eax), %ds + //movl 36(%eax), %ss + //movl 38(%eax), %es + //movl 40(%eax), %fs + //movl 42(%eax), %gs // restore the flags movl 44(%eax), %ecx @@ -70,7 +70,7 @@ swap_registers: // ok, now we can restore ecx //movl 8(%eax), %ecx - + // Return! jmp *48(%eax) diff --git a/src/rt/intrinsics/intrinsics.i386.ll.in b/src/rt/intrinsics/intrinsics.i386.ll.in index 93cc32fe995..971314dba56 100644 --- a/src/rt/intrinsics/intrinsics.i386.ll.in +++ b/src/rt/intrinsics/intrinsics.i386.ll.in @@ -53,7 +53,7 @@ target triple = "@CFG_TARGET_TRIPLE@" %struct.rust_vec = type { i32, i32, [0 x i8] } %"struct.std::_Rb_tree<void *, std::pair<void *const, const type_desc *>, std::_Select1st<std::pair<void *const, const type_desc *> >, std::less<void *>, std::allocator<std::pair<void *const, const type_desc *> > >::_Rb_tree_impl" = type { %struct.rust_cond, %"struct.std::_Rb_tree_node_base", i32 } %"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* } -%struct.type_desc = type { %struct.type_desc**, i32, i32, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, i32, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*, i8*, i8)*, i8*, %struct.rust_shape_tables*, i32, i32, %struct.UT_hash_handle, i32, [0 x %struct.type_desc*] } +%struct.type_desc = type { %struct.type_desc**, i32, i32, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i32, void (i8*, i8*, %struct.type_desc**, i8*, i8*, i8)*, i8*, %struct.rust_shape_tables*, i32, i32, %struct.UT_hash_handle, i32, [0 x %struct.type_desc*] } @.str = private unnamed_addr constant [42 x i8] c"attempt to cast values of differing sizes\00" @.str1 = private unnamed_addr constant [33 x i8] c"src/rt/intrinsics/intrinsics.cpp\00" @@ -78,7 +78,7 @@ define void @rust_intrinsic_ptr_offset(%struct.rust_task* nocapture %task, i8** ret void } -define void @rust_intrinsic_cast(%struct.rust_task* %task, i8* nocapture %retptr, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) { +define void @rust_intrinsic_cast(%struct.rust_task* nocapture %task, i8* nocapture %retptr, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) { %1 = getelementptr inbounds %struct.type_desc* %t1, i32 0, i32 1 %2 = load i32* %1, align 4 %3 = getelementptr inbounds %struct.type_desc* %t2, i32 0, i32 1 @@ -87,7 +87,7 @@ define void @rust_intrinsic_cast(%struct.rust_task* %task, i8* nocapture %retptr br i1 %5, label %7, label %6 ; <label>:6 ; preds = %0 - tail call void @upcall_fail(%struct.rust_task* %task, i8* getelementptr inbounds ([42 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8]* @.str1, i32 0, i32 0), i32 32) + tail call void @upcall_fail(i8* getelementptr inbounds ([42 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8]* @.str1, i32 0, i32 0), i32 32) br label %8 ; <label>:7 ; preds = %0 @@ -98,7 +98,7 @@ define void @rust_intrinsic_cast(%struct.rust_task* %task, i8* nocapture %retptr ret void } -declare void @upcall_fail(%struct.rust_task*, i8*, i8*, i32) +declare void @upcall_fail(i8*, i8*, i32) declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind @@ -107,11 +107,16 @@ define void @rust_intrinsic_addr_of(%struct.rust_task* nocapture %task, i8** noc ret void } -define void @rust_intrinsic_recv(%struct.rust_task* %task, i8** %retptr, %struct.type_desc* nocapture %ty, %class.rust_port* %port) { - %1 = bitcast %struct.rust_task* %task to i8* - %2 = bitcast i8** %retptr to i32* - tail call void @port_recv(i8* %1, i32* %2, %class.rust_port* %port) +define void @rust_intrinsic_recv(%struct.rust_task* nocapture %task, i8** %retptr, %struct.type_desc* nocapture %ty, %class.rust_port* %port) { + %1 = bitcast i8** %retptr to i32* + tail call void @port_recv(i32* %1, %class.rust_port* %port) ret void } -declare void @port_recv(i8*, i32*, %class.rust_port*) +declare void @port_recv(i32*, %class.rust_port*) + +define void @rust_intrinsic_get_type_desc(%struct.rust_task* nocapture %task, i8** nocapture %retptr, %struct.type_desc* %ty) nounwind { + %ty.c = bitcast %struct.type_desc* %ty to i8* + store i8* %ty.c, i8** %retptr, align 4 + ret void +} diff --git a/src/rt/intrinsics/intrinsics.x86_64.ll.in b/src/rt/intrinsics/intrinsics.x86_64.ll.in index 50e2e9178d4..77c05e1e1e5 100644 --- a/src/rt/intrinsics/intrinsics.x86_64.ll.in +++ b/src/rt/intrinsics/intrinsics.x86_64.ll.in @@ -53,7 +53,7 @@ target triple = "@CFG_TARGET_TRIPLE@" %"struct.std::_Rb_tree<void *, std::pair<void *const, const type_desc *>, std::_Select1st<std::pair<void *const, const type_desc *> >, std::less<void *>, std::allocator<std::pair<void *const, const type_desc *> > >::_Rb_tree_impl" = type { %struct.rust_cond, %"struct.std::_Rb_tree_node_base", i64 } %"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* } %struct.stk_seg = type { i32, i64, [0 x i8] } -%struct.type_desc = type { %struct.type_desc**, i64, i64, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*)*, i64, void (i8*, %struct.rust_task*, i8*, %struct.type_desc**, i8*, i8*, i8)*, i8*, %struct.rust_shape_tables*, i64, i64, %struct.UT_hash_handle, i64, [0 x %struct.type_desc*] } +%struct.type_desc = type { %struct.type_desc**, i64, i64, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i64, void (i8*, i8*, %struct.type_desc**, i8*, i8*, i8)*, i8*, %struct.rust_shape_tables*, i64, i64, %struct.UT_hash_handle, i64, [0 x %struct.type_desc*] } @.str = private unnamed_addr constant [42 x i8] c"attempt to cast values of differing sizes\00" @.str1 = private unnamed_addr constant [33 x i8] c"src/rt/intrinsics/intrinsics.cpp\00" @@ -78,7 +78,7 @@ define void @rust_intrinsic_ptr_offset(%struct.rust_task* nocapture %task, i8** ret void } -define void @rust_intrinsic_cast(%struct.rust_task* %task, i8* nocapture %retptr, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) { +define void @rust_intrinsic_cast(%struct.rust_task* nocapture %task, i8* nocapture %retptr, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) { %1 = getelementptr inbounds %struct.type_desc* %t1, i64 0, i32 1 %2 = load i64* %1, align 8 %3 = getelementptr inbounds %struct.type_desc* %t2, i64 0, i32 1 @@ -87,7 +87,7 @@ define void @rust_intrinsic_cast(%struct.rust_task* %task, i8* nocapture %retptr br i1 %5, label %7, label %6 ; <label>:6 ; preds = %0 - tail call void @upcall_fail(%struct.rust_task* %task, i8* getelementptr inbounds ([42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8]* @.str1, i64 0, i64 0), i64 32) + tail call void @upcall_fail(i8* getelementptr inbounds ([42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8]* @.str1, i64 0, i64 0), i64 32) br label %8 ; <label>:7 ; preds = %0 @@ -98,7 +98,7 @@ define void @rust_intrinsic_cast(%struct.rust_task* %task, i8* nocapture %retptr ret void } -declare void @upcall_fail(%struct.rust_task*, i8*, i8*, i64) +declare void @upcall_fail(i8*, i8*, i64) declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind @@ -107,11 +107,16 @@ define void @rust_intrinsic_addr_of(%struct.rust_task* nocapture %task, i8** noc ret void } -define void @rust_intrinsic_recv(%struct.rust_task* %task, i8** %retptr, %struct.type_desc* nocapture %ty, %class.rust_port* %port) { - %1 = bitcast %struct.rust_task* %task to i8* - %2 = bitcast i8** %retptr to i64* - tail call void @port_recv(i8* %1, i64* %2, %class.rust_port* %port) +define void @rust_intrinsic_recv(%struct.rust_task* nocapture %task, i8** %retptr, %struct.type_desc* nocapture %ty, %class.rust_port* %port) { + %1 = bitcast i8** %retptr to i64* + tail call void @port_recv(i64* %1, %class.rust_port* %port) ret void } -declare void @port_recv(i8*, i64*, %class.rust_port*) +declare void @port_recv(i64*, %class.rust_port*) + +define void @rust_intrinsic_get_type_desc(%struct.rust_task* nocapture %task, i8** nocapture %retptr, %struct.type_desc* %ty) nounwind { + %ty.c = bitcast %struct.type_desc* %ty to i8* + store i8* %ty.c, i8** %retptr, align 8 + ret void +} diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp index e0d799f7caa..270b716679d 100644 --- a/src/rt/rust_log.cpp +++ b/src/rt/rust_log.cpp @@ -42,7 +42,7 @@ hash(uintptr_t ptr) { ptr = ptr ^ (ptr >> 14); ptr = (ptr + (ptr << 2)) + (ptr << 4); // ptr * 21 ptr = ptr ^ (ptr >> 28); - ptr = ptr + (ptr << 31); + ptr = ptr + (ptr << 31); # else # error "hash() not defined for this pointer size" # endif |
