Skip to content

Commit d3842de

Browse files
committed
* vm_opts.h: enable optimization - operand unifications.
Operand unification technique enable to combine an instruction and specific operands and make new instruction. * defs/opt_operand.def: add several configuration of operand unifications. * insns.def: use `int' instead to suppress warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 51ee08f commit d3842de

File tree

4 files changed

+27
-50
lines changed

4 files changed

+27
-50
lines changed

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Tue Dec 04 13:55:07 2012 Koichi Sasada <[email protected]>
2+
3+
* vm_opts.h: enable optimization - operand unifications.
4+
Operand unification technique enable to combine
5+
an instruction and specific operands and make new
6+
instruction.
7+
8+
* defs/opt_operand.def: add several configuration
9+
of operand unifications.
10+
11+
* insns.def: use `int' instead to suppress warning.
12+
113
Mon Dec 3 17:58:53 2012 NARUSE, Yui <[email protected]>
214

315
* parse.y: replase parser->enc with current_enc.

defs/opt_operand.def

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,16 @@
77
# wildcard: *
88
#
99

10-
__END__
11-
12-
getlocal 2
13-
getlocal 3
14-
getlocal 4
15-
16-
setlocal 2
17-
setlocal 3
18-
setlocal 4
19-
20-
getdynamic *, 0
21-
getdynamic 1, 0
22-
getdynamic 2, 0
23-
getdynamic 3, 0
24-
getdynamic 4, 0
25-
26-
setdynamic *, 0
27-
setdynamic 1, 0
28-
setdynamic 2, 0
29-
setdynamic 3, 0
30-
setdynamic 4, 0
10+
getlocal *, 0
11+
getlocal *, 1
12+
setlocal *, 0
13+
setlocal *, 1
3114

3215
putobject INT2FIX(0)
3316
putobject INT2FIX(1)
34-
putobject Qtrue
35-
putobject Qfalse
36-
37-
# CALL
38-
send *, *, Qfalse, 0, *
39-
send *, 0, Qfalse, 0, *
40-
send *, 1, Qfalse, 0, *
41-
send *, 2, Qfalse, 0, *
42-
send *, 3, Qfalse, 0, *
43-
44-
# FCALL
45-
send *, *, Qfalse, 0x04, *
46-
send *, 0, Qfalse, 0x04, *
47-
send *, 1, Qfalse, 0x04, *
48-
send *, 2, Qfalse, 0x04, *
49-
send *, 3, Qfalse, 0x04, *
50-
51-
# VCALL
52-
send *, 0, Qfalse, 0x0c, *
53-
5417

5518
__END__
5619

57-
58-
20+
putobject Qtrue
21+
putobject Qfalse
5922

insns.def

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ getlocal
5757
()
5858
(VALUE val)
5959
{
60-
rb_num_t i;
60+
int i, lev = (int)level;
6161
VALUE *ep = GET_EP();
62-
for (i = 0; i < level; i++) {
63-
ep = GET_PREV_EP(ep);
62+
63+
for (i = 0; i < lev; i++) {
64+
ep = GET_PREV_EP(ep);
6465
}
6566
val = *(ep - idx);
6667
}
@@ -78,9 +79,10 @@ setlocal
7879
(VALUE val)
7980
()
8081
{
81-
rb_num_t i;
82+
int i, lev = (int)level;
8283
VALUE *ep = GET_EP();
83-
for (i = 0; i < level; i++) {
84+
85+
for (i = 0; i < lev; i++) {
8486
ep = GET_PREV_EP(ep);
8587
}
8688
*(ep - idx) = val;

vm_opts.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define OPT_BLOCKINLINING 0
4242

4343
/* architecture independent, affects generated code */
44-
#define OPT_OPERANDS_UNIFICATION 0
44+
#define OPT_OPERANDS_UNIFICATION 1
4545
#define OPT_INSTRUCTIONS_UNIFICATION 0
4646
#define OPT_UNIFY_ALL_COMBINATION 0
4747
#define OPT_STACK_CACHING 0
@@ -50,7 +50,7 @@
5050
#define SUPPORT_JOKE 0
5151

5252
#ifndef VM_COLLECT_USAGE_DETAILS
53-
#define VM_COLLECT_USAGE_DETAILS 0
53+
#define VM_COLLECT_USAGE_DETAILS 0
5454
#endif
5555

5656
#endif /* RUBY_VM_OPTS_H */

0 commit comments

Comments
 (0)