Emit gc glue and rearrange crate glue offsets slightly to have a regular order.

This commit is contained in:
Graydon Hoare 2010-06-25 15:43:55 -07:00
parent 2e3fa5bd68
commit 67d1f0a9aa
7 changed files with 26 additions and 10 deletions

View File

@ -145,6 +145,7 @@ type abi =
abi_activate: (Il.emitter -> unit);
abi_yield: (Il.emitter -> unit);
abi_unwind: (Il.emitter -> Common.nabi -> Common.fixup -> unit);
abi_gc: (Il.emitter -> unit);
abi_get_next_pc_thunk:
((Il.reg (* output *)
* Common.fixup (* thunk in objfile *)

View File

@ -1627,6 +1627,7 @@ let (abi:Abi.abi) =
Abi.abi_activate = activate_glue;
Abi.abi_yield = yield_glue;
Abi.abi_unwind = unwind_glue;
Abi.abi_gc = gc_glue;
Abi.abi_get_next_pc_thunk = Some get_next_pc_thunk;
Abi.abi_sp_reg = (Il.Hreg esp);

View File

@ -23,9 +23,10 @@ let declare_abi (llctx:Llvm.llcontext) (llmod:Llvm.llmodule) : abi =
i32; (* ptrdiff_t debug_info_off *)
i32; (* size_t debug_info_sz *)
i32; (* size_t activate_glue_off *)
i32; (* size_t main_exit_task_glue_off *)
i32; (* size_t unwind_glue_off *)
i32; (* size_t yield_glue_off *)
i32; (* size_t unwind_glue_off *)
i32; (* size_t gc_glue_off *)
i32; (* size_t main_exit_task_glue_off *)
i32; (* int n_rust_syms *)
i32; (* int n_c_syms *)
i32 (* int n_libs *)

View File

@ -53,9 +53,10 @@ let finalize_module
Llvm.const_int i32 0; (* ptrdiff_t debug_info_off *)
Llvm.const_int i32 0; (* size_t debug_info_sz *)
activate_glue_off; (* size_t activate_glue_off *)
exit_task_glue_off; (* size_t main_exit_task_glue_off *)
Llvm.const_int i32 0; (* size_t unwind_glue_off *)
yield_glue_off; (* size_t yield_glue_off *)
Llvm.const_int i32 0; (* size_t unwind_glue_off *)
Llvm.const_int i32 0; (* size_t gc_glue_off *)
exit_task_glue_off; (* size_t main_exit_task_glue_off *)
Llvm.const_int i32 rust_fn_count; (* int n_rust_syms *)
Llvm.const_int i32 c_fn_count; (* int n_c_syms *)
Llvm.const_int i32 0 (* int n_libs *)

View File

@ -30,6 +30,7 @@ type glue =
| GLUE_write of Ast.ty
| GLUE_read of Ast.ty
| GLUE_unwind
| GLUE_gc
| GLUE_get_next_pc
| GLUE_mark_frame of node_id (* node is the frame *)
| GLUE_drop_frame of node_id (* node is the frame *)
@ -135,6 +136,7 @@ type ctxt =
ctxt_spill_fixups: (node_id,fixup) Hashtbl.t;
ctxt_abi: Abi.abi;
ctxt_activate_fixup: fixup;
ctxt_gc_fixup: fixup;
ctxt_yield_fixup: fixup;
ctxt_unwind_fixup: fixup;
ctxt_exit_task_fixup: fixup;
@ -218,6 +220,7 @@ let new_ctxt sess abi crate =
ctxt_activate_fixup = new_fixup "activate glue";
ctxt_yield_fixup = new_fixup "yield glue";
ctxt_unwind_fixup = new_fixup "unwind glue";
ctxt_gc_fixup = new_fixup "gc glue";
ctxt_exit_task_fixup = new_fixup "exit-task glue";
ctxt_debug_aranges_fixup = new_fixup "debug_aranges section";
@ -1989,6 +1992,7 @@ let glue_str (cx:ctxt) (g:glue) : string =
| GLUE_write ty -> "glue$write$" ^ (ty_str ty)
| GLUE_read ty -> "glue$read$" ^ (ty_str ty)
| GLUE_unwind -> "glue$unwind"
| GLUE_gc -> "glue$gc"
| GLUE_get_next_pc -> "glue$get_next_pc"
| GLUE_mark_frame i -> "glue$mark_frame$" ^ (item_str cx i)
| GLUE_drop_frame i -> "glue$drop_frame$" ^ (item_str cx i)

View File

@ -4891,9 +4891,10 @@ let trans_visitor
Asm.WORD (word_ty_mach, Asm.M_SZ cx.ctxt_debug_info_fixup);
crate_rel_word cx.ctxt_activate_fixup;
crate_rel_word cx.ctxt_exit_task_fixup;
crate_rel_word cx.ctxt_unwind_fixup;
crate_rel_word cx.ctxt_yield_fixup;
crate_rel_word cx.ctxt_unwind_fixup;
crate_rel_word cx.ctxt_gc_fixup;
crate_rel_word cx.ctxt_exit_task_fixup;
tab_sz cx.ctxt_required_rust_sym_num;
tab_sz cx.ctxt_required_c_sym_num;
@ -4915,6 +4916,10 @@ let trans_visitor
(fun e -> abi.Abi.abi_unwind
e nabi_rust (upcall_fixup "upcall_exit"));
emit_aux_global_glue cx GLUE_gc
cx.ctxt_gc_fixup
abi.Abi.abi_gc;
ignore (get_exit_task_glue ());
begin

View File

@ -263,9 +263,10 @@ rust_crate
size_t debug_info_sz; // Size of .debug_info.
ptrdiff_t activate_glue_off;
ptrdiff_t exit_task_glue_off;
ptrdiff_t unwind_glue_off;
ptrdiff_t yield_glue_off;
ptrdiff_t unwind_glue_off;
ptrdiff_t gc_glue_off;
ptrdiff_t exit_task_glue_off;
public:
@ -278,9 +279,11 @@ public:
uintptr_t get_image_base() const;
ptrdiff_t get_relocation_diff() const;
activate_glue_ty get_activate_glue() const;
uintptr_t get_exit_task_glue() const;
uintptr_t get_unwind_glue() const;
uintptr_t get_yield_glue() const;
uintptr_t get_unwind_glue() const;
uintptr_t get_gc_glue() const;
uintptr_t get_exit_task_glue() const;
struct mem_area
{
rust_dom *dom;