Skip to content

Commit

Permalink
optimization for short labels
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/newoolabmult@6004 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
Jacques Garrigue committed Dec 5, 2003
1 parent e685622 commit 3f1a4d0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions asmcomp/cmmgen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,14 @@ let lookup_tag obj tag =
| _ ->
untag_uint31 tag
in
let lab =
Cop(Cadda,
[Cop(Clsr,
[Cop(Clsl, [Cop(Cmuli, [tag; c]);
Cconst_int(size_addr*8 - 31)]);
m]);
Cconst_int 2]) in
let mul =
match tag with
Cconst_natint n when n < 0x40000000n && size_addr = 4 ->
Cop(Cmuli, [Cconst_natint (Nativeint.shift_left n 1); c])
| _ ->
Cop(Clsl, [Cop(Cmuli, [tag; c]); Cconst_int(size_addr*8 - 31)])
in
let lab = Cop(Cadda, [Cop(Clsr, [mul; m]); Cconst_int 2]) in
Clet(table, Cop (Cload Word, [obj]),
Cop(Cload Word,
[Cop (Cadda, [Cvar table; lsl_const lab log2_size_addr])])))
Expand Down

0 comments on commit 3f1a4d0

Please sign in to comment.