Skip to content

Commit

Permalink
Merge pull request ocaml-multicore/ocaml-multicore#809 from dra27/che…
Browse files Browse the repository at this point in the history
…ck-typo

Finish off tools/check-typo on the repo
  • Loading branch information
ctk21 committed Dec 20, 2021
2 parents 8fb9ecf + 1de4a5c commit afec103
Show file tree
Hide file tree
Showing 50 changed files with 253 additions and 324 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Expand Up @@ -51,6 +51,7 @@ api_docgen/alldoc.tex typo.missing-header
tools/mantis2gh_stripped.csv typo.missing-header
testsuite/disabled typo.missing-header

/README.md typo.long-line=may typo.very-long-line=may
*.adoc typo.long-line=may

# Github templates and scripts lack headers, have long lines
Expand All @@ -72,6 +73,9 @@ testsuite/disabled typo.missing-header
.depend typo.prune
/.depend.menhir typo.prune

# These can be fixed at some point
/tools/*.py typo.long-line

# Makefiles may contain tabs
Makefile* typo.makefile-whitespace=may

Expand Down
4 changes: 2 additions & 2 deletions api_docgen/Makefile.docfiles
Expand Up @@ -35,8 +35,8 @@ str_MLIS := str.mli
unix_MLIS := unix.mli unixLabels.mli
dynlink_MLIS := dynlink.mli
thread_MLIS := \
thread.mli event.mli \
threadUnix.mli
thread.mli event.mli \
threadUnix.mli

STDLIB=$(filter-out stdlib__Pervasives, $(STDLIB_MODULES))

Expand Down
12 changes: 9 additions & 3 deletions asmcomp/afl_instrument.ml
Expand Up @@ -42,13 +42,19 @@ let rec with_afl_logging b dbg =
let afl_area = V.create_local "shared_mem" in
let op oper args = Cop (oper, args, dbg) in
Clet(VP.create afl_area,
op (Cload ({memory_chunk=Word_int; mutability=Asttypes.Mutable; is_atomic=false})) [afl_area_ptr dbg],
Clet(VP.create cur_pos, op Cxor [op (Cload {memory_chunk=Word_int; mutability=Asttypes.Mutable; is_atomic=false})
op (Cload ({memory_chunk=Word_int;
mutability=Asttypes.Mutable;
is_atomic=false})) [afl_area_ptr dbg],
Clet(VP.create cur_pos, op Cxor [op (Cload {memory_chunk=Word_int;
mutability=Asttypes.Mutable;
is_atomic=false})
[afl_prev_loc dbg]; Cconst_int (cur_location, dbg)],
Csequence(
op (Cstore(Byte_unsigned, Assignment))
[op Cadda [Cvar afl_area; Cvar cur_pos];
op Cadda [op (Cload {memory_chunk=Byte_unsigned; mutability=Asttypes.Mutable; is_atomic=false})
op Cadda [op (Cload {memory_chunk=Byte_unsigned;
mutability=Asttypes.Mutable;
is_atomic=false})
[op Cadda [Cvar afl_area; Cvar cur_pos]];
Cconst_int (1, dbg)]],
op (Cstore(Word_int, Assignment))
Expand Down
4 changes: 3 additions & 1 deletion asmcomp/arm/selection.ml
Expand Up @@ -270,7 +270,9 @@ method private select_operation_softfp op args dbg =
(* Add coercions around loads and stores of 32-bit floats *)
| (Cload {memory_chunk=Single; mutability; is_atomic=false}, args) ->
(self#iextcall "__aeabi_f2d" typ_float [XInt],
[Cop(Cload {memory_chunk=Word_int; mutability; is_atomic=false}, args, dbg)])
[Cop(Cload {memory_chunk=Word_int;
mutability;
is_atomic=false}, args, dbg)])
| (Cstore (Single, init), [arg1; arg2]) ->
let arg2' =
Cop(Cextcall("__aeabi_d2f", typ_int, [XFloat], false),
Expand Down
4 changes: 3 additions & 1 deletion asmcomp/strmatch.ml
Expand Up @@ -76,7 +76,9 @@ module Make(I:I) = struct
let mk_let_cell id str ind body =
let dbg = Debuginfo.none in
let cell =
Cop(Cload {memory_chunk=Word_int; mutability=Asttypes.Mutable; is_atomic=false},
Cop(Cload {memory_chunk=Word_int;
mutability=Asttypes.Mutable;
is_atomic=false},
[Cop(Cadda,[str;Cconst_int(Arch.size_int*ind, dbg)], dbg)],
dbg) in
Clet(id, cell, body)
Expand Down
15 changes: 10 additions & 5 deletions lambda/translmod.ml
Expand Up @@ -966,7 +966,8 @@ let transl_store_subst = ref Ident.Map.empty

let nat_toplevel_name id =
try match Ident.Map.find id !transl_store_subst with
| Lprim(Pfield (pos, _, _), [Lprim(Pgetglobal glob, [], _)], _) -> (glob,pos)
| Lprim(Pfield (pos, _, _),
[Lprim(Pgetglobal glob, [], _)], _) -> (glob,pos)
| _ -> raise Not_found
with Not_found ->
fatal_error("Translmod.nat_toplevel_name: " ^ Ident.unique_name id)
Expand Down Expand Up @@ -1250,7 +1251,8 @@ let transl_store_structure ~scopes glob map prims aliases str =
(add_idents true ids subst) cont rem
| id :: idl ->
Llet(Alias, Pgenval, id,
Lprim(Pfield (pos, Pointer, Mutable), [Lvar mid], loc),
Lprim(Pfield (pos, Pointer, Mutable),
[Lvar mid], loc),
Lsequence(store_ident loc id,
store_idents (pos + 1) idl))
in
Expand Down Expand Up @@ -1521,7 +1523,8 @@ let transl_toplevel_item ~scopes item =
lambda_unit
| id :: ids ->
Lsequence(toploop_setvalue id
(Lprim(Pfield (pos, Pointer, Mutable), [Lvar mid], Loc_unknown)),
(Lprim(Pfield (pos, Pointer, Mutable),
[Lvar mid], Loc_unknown)),
set_idents (pos + 1) ids) in
Llet(Strict, Pgenval, mid,
transl_module ~scopes Tcoerce_none None modl, set_idents 0 ids)
Expand All @@ -1544,7 +1547,8 @@ let transl_toplevel_item ~scopes item =
lambda_unit
| id :: ids ->
Lsequence(toploop_setvalue id
(Lprim(Pfield (pos, Pointer, Mutable), [Lvar mid], Loc_unknown)),
(Lprim(Pfield (pos, Pointer, Mutable),
[Lvar mid], Loc_unknown)),
set_idents (pos + 1) ids)
in
Llet(pure, Pgenval, mid,
Expand Down Expand Up @@ -1647,7 +1651,8 @@ let transl_store_package component_names target_name coercion =
(fun pos _id ->
Lprim(Psetfield(pos, Pointer, Root_initialization),
[Lprim(Pgetglobal target_name, [], Loc_unknown);
Lprim(Pfield (pos, Pointer, Mutable), [Lvar blk], Loc_unknown)],
Lprim(Pfield (pos, Pointer, Mutable),
[Lvar blk], Loc_unknown)],
Loc_unknown))
0 pos_cc_list))
(*
Expand Down
6 changes: 4 additions & 2 deletions middle_end/closure/closure.ml
Expand Up @@ -54,7 +54,8 @@ let rec build_closure_env env_param pos = function
[] -> V.Map.empty
| id :: rem ->
V.Map.add id
(Uprim(P.Pfield(pos, Pointer, Immutable), [Uvar env_param], Debuginfo.none))
(Uprim(P.Pfield(pos, Pointer, Immutable),
[Uvar env_param], Debuginfo.none))
(build_closure_env env_param (pos+1) rem)

(* Auxiliary for accessing globals. We change the name of the global
Expand Down Expand Up @@ -483,7 +484,8 @@ let simplif_prim_pure ~backend fpc p (args, approxs) dbg =
(Uprim(p, args, dbg), Value_tuple (Array.of_list approxs))
end
(* Field access *)
| Pfield (n, _, _), _, [ Value_const(Uconst_ref(_, Some (Uconst_block(_, l)))) ]
| Pfield (n, _, _), _,
[ Value_const(Uconst_ref(_, Some (Uconst_block(_, l)))) ]
when n < List.length l ->
make_const (List.nth l n)
| Pfield(n, _, _), [ Uprim(P.Pmakeblock _, ul, _) ], [approx]
Expand Down
6 changes: 4 additions & 2 deletions middle_end/flambda/closure_conversion.ml
Expand Up @@ -91,7 +91,8 @@ let tupled_function_call_stub original_params unboxed_version ~closure_bound_var
let _, body =
List.fold_left (fun (pos, body) param ->
let lam : Flambda.named =
Prim (Pfield (pos, Pointer, Mutable), [tuple_param_var], Debuginfo.none)
Prim (Pfield (pos, Pointer, Mutable),
[tuple_param_var], Debuginfo.none)
in
pos + 1, Flambda.create_let param lam body)
(0, call) params
Expand Down Expand Up @@ -698,7 +699,8 @@ let lambda_to_flambda ~backend ~module_ident ~size lam
(Flambda.create_let result_v
(Prim (Pfield (0, Pointer, Mutable), [sym_v], Debuginfo.none))
(Flambda.create_let value_v
(Prim (Pfield (pos, Pointer, Mutable), [result_v], Debuginfo.none))
(Prim (Pfield (pos, Pointer, Mutable),
[result_v], Debuginfo.none))
(Var value_v))))
in
let module_initializer : Flambda.program_body =
Expand Down
44 changes: 0 additions & 44 deletions otherlibs/num/.depend

This file was deleted.

66 changes: 0 additions & 66 deletions otherlibs/num/.depend.nt

This file was deleted.

39 changes: 26 additions & 13 deletions runtime/arm64.S
Expand Up @@ -175,18 +175,21 @@ name:
* from the bottom of the OCaml stack. Clobbers REG. */
#define SWITCH_C_TO_OCAML(REG) \
SWITCH_C_TO_OCAML_NO_CTXT(REG); \
/* Pop the caml_context from the bottom of stack updating TRAP_OFF and return address. */ \
/* Pop the caml_context from the bottom of stack updating TRAP_OFF and
return address. */ \
ldr x30, [sp, 24]; \
ldr TRAP_OFF, [sp], 32

/* Restore exception handler for OCaml code. Cuts stack, and loads target address in TMP. */
/* Restore exception handler for OCaml code. Cuts stack, and loads target
address in TMP. */
#define RESTORE_EXN_HANDLER_OCAML \
LOAD_TL_VAR(caml_stack_high, TMP); \
sub sp, TMP, TRAP_OFF; \
ldr TMP, [sp, 8]; \
ldr TRAP_OFF, [sp], 16

/* Load [caml_system_stack_high - TRAP_OFF] into sp. Cuts the stack, and loads the target address in TMP. */
/* Load [caml_system_stack_high - TRAP_OFF] into sp. Cuts the stack, and loads
the target address in TMP. */
#define RESTORE_EXN_HANDLER_SYS \
LOAD_TL_VAR(caml_system_stack_high, TMP); \
sub sp, TMP, TRAP_OFF; \
Expand Down Expand Up @@ -220,11 +223,13 @@ caml_system__code_begin:

#define SAVE_ALL_REGS_AND_CALL(TARGET_FUN) \
/* Set up stack space, saving return address and frame pointer */ \
/* (2 regs RA/GP, 24 allocatable int regs, 24 caller-save float regs) * 8 */ \
/* (2 regs RA/GP, 24 allocatable int regs, 24 caller-save float regs) * 8 \
*/ \
stp x29, x30, [sp, -400]!; \
CFI_ADJUST(400); \
add x29, sp, 0 ; \
/* Save allocatable integer registers on the stack, in the order given in proc.ml */ \
/* Save allocatable integer registers on the stack, in the order given in \
proc.ml */ \
stp x0, x1, [sp, 16]; \
stp x2, x3, [sp, 32]; \
stp x4, x5, [sp, 48]; \
Expand Down Expand Up @@ -312,7 +317,8 @@ CFI_ENDPROC
.size caml_call_realloc_stack, .-caml_call_realloc_stack


/* TODO KC: define MK_CAML_ALLOC(SZ) macro for generating caml_allocX functions. */
/* TODO KC: define MK_CAML_ALLOC(SZ) macro for generating caml_allocX
functions. */

FUNCTION(caml_alloc1)
CFI_STARTPROC
Expand Down Expand Up @@ -690,7 +696,8 @@ CFI_STARTPROC
LOAD_TL_VAR(caml_current_stack, x1)
str xzr, Stack_sp(x1) /* zero SP */
ldr x20, Stack_handle_exception(x1) /* exception handler */
ldr x0, Stack_parent(x1) /* parent stack. Never NULL here. */
ldr x0, Stack_parent(x1) /* parent stack. Never NULL
here. */
/* Reset stack */
mov TMP, 1
str TMP, Stack_handle_value(x1)
Expand All @@ -715,7 +722,8 @@ CFI_STARTPROC
LOAD_TL_VAR(caml_current_stack, x1)
str xzr, Stack_sp(x1) /* zero SP */
ldr x20, Stack_handle_value(x1) /* value handler */
ldr x0, Stack_parent(x1) /* parent stack. Never NULL here. */
ldr x0, Stack_parent(x1) /* parent stack. Never NULL
here. */
/* Reset stack. First pop off fiber exn handler. */
add sp, sp, 16
CFI_ADJUST(-16)
Expand Down Expand Up @@ -744,7 +752,8 @@ CFI_STARTPROC
b.eq 1f
ldr x21, Stack_handle_effect(x20) /* effect handler */
mov TMP, 1
str TMP, Stack_parent(x20) /* Set parent stack of performer to NULL */
str TMP, Stack_parent(x20) /* Set parent stack of performer
to NULL */
/* Switch stacks */
SWITCH_OCAML_STACKS
/* Invoke effect handler */
Expand All @@ -769,8 +778,10 @@ CFI_STARTPROC
cmp x0, 1 /* Parent is NULL? */
b.eq 1f
str x1, Stack_parent(x2) /* Set performer as parent */
mov x20, x2 /* Save current stack in callee-saved x20 */
ldr x21, Stack_handle_effect(x2) /* Save effect handler in callee-saved x21 */
mov x20, x2 /* Save current stack in
callee-saved x20 */
ldr x21, Stack_handle_effect(x2) /* Save effect handler in
callee-saved x21 */
/* Switch stacks */
SWITCH_OCAML_STACKS
/* Invoke effect handler */
Expand Down Expand Up @@ -837,11 +848,13 @@ caml_system__code_end:
caml_system__frametable:
.quad 2 /* two descriptors */
.quad .Lcaml_retaddr /* return address into callback */
.short -1 /* negative frame size => use callback link */
.short -1 /* negative frame size => use callback
link */
.short 0 /* no roots */
.align 3
.quad .Lfiber_val_handler /* return address into fiber_val_handler */
.short -1 /* negative frame size => use callback link */
.short -1 /* negative frame size => use callback
link */
.short 0 /* no roots */
.align 3
.type caml_system__frametable, %object
Expand Down

0 comments on commit afec103

Please sign in to comment.