Skip to content

Commit

Permalink
Remove Istore_symbol (plus some Win64 fixes) (#955)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell committed Dec 27, 2016
1 parent d1eecfc commit f206344
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
11 changes: 8 additions & 3 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,19 @@ Next version (4.05.0):
(Jeremy Yallop,
review by Damien Doligez, Alain Frisch, Daniel Bünzli, Fabrice Le Fessant)

- PR#7427, GPR#959: Don't delete let bodies in Cmmgen (Mark Shinwell)
- GPR#934: check for integer overflow in Bytes.extend
(Jeremy Yallop, review by Gabriel Scherer)

- MPR#6594, GPR#955: Remove "Istore_symbol" specific operation on x86-64.
This is more robust and in particular avoids assembly failures on Win64.
(Mark Shinwell, review by Xavier Leroy, testing by David Allsopp and
Olivier Andrieu)

- GPR#956 Keep possibly-effectful expressions when optimizing multiplication
by zero.
(Jeremy Yallop)

- GPR#934: check for integer overflow in Bytes.extend
(Jeremy Yallop, review by Gabriel Scherer)
- PR#7427, GPR#959: Don't delete let bodies in Cmmgen (Mark Shinwell)

- GPR#987: alloc_sockaddr: don't assume a null terminator. It is not inserted
on macOS by system calls that fill in a struct sockaddr (e.g. getsockname).
Expand Down
2 changes: 1 addition & 1 deletion asmcomp/amd64/CSE.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ method! class_of_operation op =
| Ispecific spec ->
begin match spec with
| Ilea _ -> Op_pure
| Istore_int(_, _, is_asg) | Istore_symbol(_, _, is_asg) -> Op_store is_asg
| Istore_int(_, _, is_asg) -> Op_store is_asg
| Ioffset_loc(_, _) -> Op_store true
| Ifloatarithmem _ | Ifloatsqrtf _ -> Op_load
| Ibswap _ | Isqrtf -> super#class_of_operation op
Expand Down
10 changes: 5 additions & 5 deletions asmcomp/amd64/arch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ type specific_operation =
Ilea of addressing_mode (* "lea" gives scaled adds *)
| Istore_int of nativeint * addressing_mode * bool
(* Store an integer constant *)
| Istore_symbol of string * addressing_mode * bool (* Store a symbol *)
| Ioffset_loc of int * addressing_mode (* Add a constant to a location *)
| Ifloatarithmem of float_operation * addressing_mode
(* Float arith operation with memory *)
Expand Down Expand Up @@ -109,10 +108,6 @@ let print_specific_operation printreg op ppf arg =
fprintf ppf "[%a] := %nd %s"
(print_addressing printreg addr) arg n
(if is_assign then "(assign)" else "(init)")
| Istore_symbol(lbl, addr, is_assign) ->
fprintf ppf "[%a] := \"%s\" %s"
(print_addressing printreg addr) arg lbl
(if is_assign then "(assign)" else "(init)")
| Ioffset_loc(n, addr) ->
fprintf ppf "[%a] +:= %i" (print_addressing printreg addr) arg n
| Isqrtf ->
Expand All @@ -131,3 +126,8 @@ let print_specific_operation printreg op ppf arg =
(Array.sub arg 1 (Array.length arg - 1))
| Ibswap i ->
fprintf ppf "bswap_%i %a" i printreg arg.(0)

let win64 =
match Config.system with
| "win64" | "mingw64" | "cygwin" -> true
| _ -> false
6 changes: 1 addition & 5 deletions asmcomp/amd64/emit.mlp
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,6 @@ let emit_instr fallthrough i =
I.lea (addressing addr NONE i 0) (res i 0)
| Lop(Ispecific(Istore_int(n, addr, _))) ->
I.mov (nat n) (addressing addr QWORD i 0)
| Lop(Ispecific(Istore_symbol(s, addr, _))) ->
assert (not !Clflags.pic_code && not !Clflags.dlcode);
add_used_symbol s;
load_symbol_addr s (addressing addr QWORD i 0)
| Lop(Ispecific(Ioffset_loc(n, addr))) ->
I.add (int n) (addressing addr QWORD i 0)
| Lop(Ispecific(Ifloatarithmem(op, addr))) ->
Expand Down Expand Up @@ -988,7 +984,7 @@ let begin_assembly() =
end;


if !Clflags.dlcode then begin
if !Clflags.dlcode || Arch.win64 then begin
(* from amd64.S; could emit these constants on demand *)
begin match system with
| S_macosx -> D.section ["__TEXT";"__literal16"] None ["16byte_literals"]
Expand Down
5 changes: 1 addition & 4 deletions asmcomp/amd64/proc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ let fp = Config.with_frame_pointers

(* Which ABI to use *)

let win64 =
match Config.system with
| "win64" | "mingw64" | "cygwin" -> true
| _ -> false
let win64 = Arch.win64

(* Registers available for register allocation *)

Expand Down
2 changes: 1 addition & 1 deletion asmcomp/amd64/reload.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ method! reload_operation op arg res =
then (arg, res)
else super#reload_operation op arg res
| Iconst_symbol _ ->
if !Clflags.pic_code || !Clflags.dlcode
if !Clflags.pic_code || !Clflags.dlcode || Arch.win64
then super#reload_operation op arg res
else (arg, res)
| _ -> (* Other operations: all args and results in registers *)
Expand Down
2 changes: 0 additions & 2 deletions asmcomp/amd64/selection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ method! select_store is_assign addr exp =
(Ispecific(Istore_int(Nativeint.of_int n, addr, is_assign)), Ctuple [])
| Cconst_natpointer n when self#is_immediate_natint n ->
(Ispecific(Istore_int(n, addr, is_assign)), Ctuple [])
| Cconst_symbol s when not (!Clflags.pic_code || !Clflags.dlcode) ->
(Ispecific(Istore_symbol(s, addr, is_assign)), Ctuple [])
| _ ->
super#select_store is_assign addr exp

Expand Down

0 comments on commit f206344

Please sign in to comment.