Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify fix_sdescs by removing redundant check

  • Loading branch information...
commit 789c452ee6777386e465ad66fa58084a6d5ccd20 1 parent c28b0d5
@yiannist authored
Showing with 8 additions and 12 deletions.
  1. +8 −12 lib/hipe/llvm/hipe_llvm_main.erl
View
20 lib/hipe/llvm/hipe_llvm_main.erl
@@ -427,25 +427,21 @@ find_offsets([{Off,Arity}|Rest], Offsets, Acc) ->
[I | RestOffsets] = lists:dropwhile(fun (Y) -> Y<Off end, Offsets),
find_offsets(Rest, RestOffsets, [{I, Arity}|Acc]).
-%% The function below corrects the arity of calls, that are identified
-%% by offset, in the stack descriptors.
+%% The function below corrects the stack descriptors of calls with arguments
+%% that are passed on the stack (more the NR_ARG_REGS) by subtracting the
+%% number of stacked arguments from the frame size and from the offset of the
+%% roots.
fix_sdescs([], SDescs) -> SDescs;
fix_sdescs([{Offset, Arity} | Rest], SDescs) ->
case lists:keyfind(Offset, 2, SDescs) of
false ->
fix_sdescs(Rest, SDescs);
- {?SDESC, Offset, SDesc} ->
- {ExnHandler, FrameSize, StkArity, Roots} = SDesc,
+ {?SDESC, Offset, {ExnHandler, FrameSize, StkArity, Roots}} ->
FixedRoots = [X - Arity || X <- tuple_to_list(Roots)],
- NewRoots =
- case FixedRoots of
- [H|_] when H >= 0 -> list_to_tuple(FixedRoots);
- _ -> Roots
- end,
- NewSDesc =
- {?SDESC, Offset, {ExnHandler, FrameSize - Arity, StkArity, NewRoots}},
+ FixedSDesc =
+ {?SDESC, Offset, {ExnHandler, FrameSize - Arity, StkArity, FixedRoots}},
RestSDescs = lists:keydelete(Offset, 2, SDescs),
- fix_sdescs(Rest, [NewSDesc | RestSDescs])
+ fix_sdescs(Rest, [FixedSDesc | RestSDescs])
end.
Please sign in to comment.
Something went wrong with that request. Please try again.