Skip to content

Commit

Permalink
Correcting Spelling of 'occurrences'
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDaiki committed Sep 19, 2024
1 parent 8bf4fe5 commit 7ecaed9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions compiler/src/printASM.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ let print_asm_lines fmt lns =
let string_of_label name p =
Format.asprintf "L%s$%d" (escape name) (Conv.int_of_pos p)

let string_of_glob x occurences =
let count = Hashtbl.find_opt occurences x.v_name in
let string_of_glob x occurrences =
let count = Hashtbl.find_opt occurrences x.v_name in
match count with
| None ->
Hashtbl.add occurences x.v_name 1;
Hashtbl.add occurrences x.v_name 1;
Format.asprintf "G$%s" (escape x.v_name)
| Some count ->
Hashtbl.replace occurences x.v_name (count+1);
Hashtbl.replace occurrences x.v_name (count+1);
(*Adding the number of occurences to the label to avoid names conflict*)
Format.asprintf "G$%s$%d" (escape x.v_name) (count)

Expand All @@ -41,7 +41,7 @@ let string_of_glob x occurences =
(* -------------------------------------------------------------------- *)
let format_glob_data globs names =
(* Creating a Hashtable to count occurences of a label name*)
let occurences = BatHashtbl.create (List.length names) in
let occurrences = BatHashtbl.create (List.length names) in
let names =
List.map (fun ((x, _), p) -> (Conv.var_of_cvar x, Conv.z_of_cz p)) names
in
Expand All @@ -51,5 +51,5 @@ let format_glob_data globs names =
let b = LByte (Z.to_string (Conv.z_of_int8 b)) in
match List.find (fun (_, p) -> Z.equal (Z.of_int i) p) names with
| exception Not_found -> [ b ]
| x, _ -> [ LLabel (string_of_glob x occurences); b ])
| x, _ -> [ LLabel (string_of_glob x occurrences); b ])
globs)

0 comments on commit 7ecaed9

Please sign in to comment.