Skip to content

Commit

Permalink
Combine a move + jump sequence into the move_jump instruction
Browse files Browse the repository at this point in the history
That will save one word and small amount of time for
each occurrence.
  • Loading branch information
bjorng committed Jan 17, 2011
1 parent 40dd4f8 commit 51ddd20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions erts/emulator/beam/beam_emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,11 @@ extern int count_instructions;
SET_I((BeamInstr *) CallDest); \
Dispatch();

#define MoveJump(Src) \
r(0) = (Src); \
SET_I((BeamInstr *) Arg(0)); \
Goto(*I);

#define GetList(Src, H, T) do { \
Eterm* tmp_ptr = list_val(Src); \
H = CAR(tmp_ptr); \
Expand Down
8 changes: 8 additions & 0 deletions erts/emulator/beam/ops.tab
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ system_limit j

move R R =>

move C=cxy r | jump Lbl => move_jump Lbl C

%macro: move_jump MoveJump -nonext
move_jump f n
move_jump f c
move_jump f x
move_jump f y

move X1=x Y1=y | move X2=x Y2=y => move2 X1 Y1 X2 Y2
move Y1=y X1=x | move Y2=y X2=x => move2 Y1 X1 Y2 X2
move X1=x X2=x | move X3=x X4=x => move2 X1 X2 X3 X4
Expand Down

0 comments on commit 51ddd20

Please sign in to comment.