From 886f5550616272d899745d62ec3076fb63a71054 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 1 Oct 2015 14:27:35 +0200 Subject: Use also fucntion id for local variables since atom is not unique. --- debug/Debug.ml | 6 +++--- debug/Debug.mli | 12 ++++++------ debug/DebugInformation.ml | 22 +++++++++++----------- debug/Dwarfgen.ml | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) (limited to 'debug') diff --git a/debug/Debug.ml b/debug/Debug.ml index 30ff288f..6da0927d 100644 --- a/debug/Debug.ml +++ b/debug/Debug.ml @@ -39,9 +39,9 @@ type implem = mutable add_lvar_scope: int -> ident -> int -> unit; mutable open_scope: atom -> int -> positive -> unit; mutable close_scope: atom -> int -> positive -> unit; - mutable start_live_range: atom -> positive -> int * int builtin_arg -> unit; - mutable end_live_range: atom -> positive -> unit; - mutable stack_variable: atom -> int * int builtin_arg -> unit; + mutable start_live_range: (atom * atom) -> positive -> int * int builtin_arg -> unit; + mutable end_live_range: (atom * atom) -> positive -> unit; + mutable stack_variable: (atom * atom) -> int * int builtin_arg -> unit; mutable function_end: atom -> positive -> unit; mutable add_label: atom -> positive -> int -> unit; mutable atom_parameter: ident -> ident -> atom -> unit; diff --git a/debug/Debug.mli b/debug/Debug.mli index a1b4408d..e9b566a5 100644 --- a/debug/Debug.mli +++ b/debug/Debug.mli @@ -37,9 +37,9 @@ type implem = mutable add_lvar_scope: int -> ident -> int -> unit; mutable open_scope: atom -> int -> positive -> unit; mutable close_scope: atom -> int -> positive -> unit; - mutable start_live_range: atom -> positive -> int * int builtin_arg -> unit; - mutable end_live_range: atom -> positive -> unit; - mutable stack_variable: atom -> int * int builtin_arg -> unit; + mutable start_live_range: (atom * atom) -> positive -> int * int builtin_arg -> unit; + mutable end_live_range: (atom * atom) -> positive -> unit; + mutable stack_variable: (atom * atom) -> int * int builtin_arg -> unit; mutable function_end: atom -> positive -> unit; mutable add_label: atom -> positive -> int -> unit; mutable atom_parameter: ident -> ident -> atom -> unit; @@ -68,9 +68,9 @@ val enter_function_scope: int -> int -> unit val add_lvar_scope: int -> ident -> int -> unit val open_scope: atom -> int -> positive -> unit val close_scope: atom -> int -> positive -> unit -val start_live_range: atom -> positive -> (int * int builtin_arg) -> unit -val end_live_range: atom -> positive -> unit -val stack_variable: atom -> int * int builtin_arg -> unit +val start_live_range: (atom * atom) -> positive -> (int * int builtin_arg) -> unit +val end_live_range: (atom * atom) -> positive -> unit +val stack_variable: (atom * atom) -> int * int builtin_arg -> unit val function_end: atom -> positive -> unit val add_label: atom -> positive -> int -> unit val generate_debug_info: (atom -> string) -> string -> debug_entries option diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml index 654c983c..1fe1a805 100644 --- a/debug/DebugInformation.ml +++ b/debug/DebugInformation.ml @@ -717,7 +717,7 @@ type var_location = | RangeLoc of var_range list | FunctionLoc of int * int builtin_arg (* Stack allocated variables *) -let var_locations: (atom,var_location) Hashtbl.t = Hashtbl.create 7 +let var_locations: (atom * atom,var_location) Hashtbl.t = Hashtbl.create 7 let scope_ranges: (int,scope_range list) Hashtbl.t = Hashtbl.create 7 @@ -759,33 +759,33 @@ let close_scope atom s_id lbl = Hashtbl.replace scope_ranges s_id new_r with Not_found -> () -let start_live_range atom lbl loc = - let old_r = begin try Hashtbl.find var_locations atom with Not_found -> (RangeLoc []) end in +let start_live_range (f,v) lbl loc = + let old_r = begin try Hashtbl.find var_locations (f,v) with Not_found -> (RangeLoc []) end in match old_r with | RangeLoc old_r -> let n_r = { range_start = Some lbl; range_end = None; var_loc = loc } in - open_vars := atom::!open_vars; - Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r)) + open_vars := v::!open_vars; + Hashtbl.replace var_locations (f,v) (RangeLoc (n_r::old_r)) | _ -> () (* Parameter that is passed as variable *) -let end_live_range atom lbl = +let end_live_range (f,v) lbl = try - let old_r = Hashtbl.find var_locations atom in + let old_r = Hashtbl.find var_locations (f,v) in match old_r with | RangeLoc (n_r::old_r) -> if n_r.range_end = None then (* We can skip non open locations *) let n_r = {n_r with range_end = Some lbl} in - Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r)) + Hashtbl.replace var_locations (f,v) (RangeLoc (n_r::old_r)) | _ -> () with Not_found -> () -let stack_variable atom (sp,loc) = - Hashtbl.add var_locations atom (FunctionLoc (sp,loc)) +let stack_variable (f,v) (sp,loc) = + Hashtbl.add var_locations (f,v) (FunctionLoc (sp,loc)) let function_end atom loc = IntSet.iter (fun id -> close_scope atom id loc) !open_scopes; open_scopes := IntSet.empty; - List.iter (fun atom -> end_live_range atom loc) !open_vars; + List.iter (fun id-> end_live_range (atom,id) loc) !open_vars; open_vars:= [] let compilation_section_start: (string,int * int * int * string) Hashtbl.t = Hashtbl.create 7 diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index 8f71d487..6c79ce0c 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -336,7 +336,7 @@ let range_entry_loc (sp,l) = let location_entry f_id atom = try begin - match (Hashtbl.find var_locations atom) with + match (Hashtbl.find var_locations (f_id,atom)) with | FunctionLoc (a,r) -> translate_function_loc a r | RangeLoc l -> -- cgit