File: optinsn.inc

package info (click to toggle)
ruby3.3 3.3.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 153,620 kB
  • sloc: ruby: 1,244,308; ansic: 836,474; yacc: 28,074; pascal: 6,748; sh: 3,913; python: 1,719; cpp: 1,158; makefile: 742; asm: 712; javascript: 394; lisp: 97; perl: 62; awk: 36; sed: 23; xml: 4
file content (128 lines) | stat: -rw-r--r-- 3,957 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* -*- C -*- */

/* This is  an auto-generated file  and is a  part of the  programming language
 * Ruby.   The person  who  created  a program  to  generate  this file  (``I''
 * hereafter) would like  to refrain from defining licensing  of this generated
 * source code.
 *
 * This file consists of many small  parts of codes copyrighted by each author,
 * not  only  the  ``I''  person.   Those  original  authors  agree  with  some
 * open-source license.  I  believe that the license we agree  is the condition
 * mentioned in  the file COPYING.  It  states "4.  You may  modify and include
 * the part of the software into any  other software ...".  But the problem is,
 * the license never makes it clear if  such modified parts still remain in the
 * same  license, or  not.   The fact  that  we agree  with  the source  code's
 * licensing terms does not automatically  define that of generated ones.  This
 * is the reason why this file is  under an unclear situation.  All what I know
 * is that above provision guarantees this file to exist.
 *
 * Please let me hesitate to declare  something about this nuanced contract.  I
 * am not in the position to take  over other authors' license to merge into my
 * one.  Changing them to (say) GPLv3 is not doable by myself.  Perhaps someday
 * it might turn  out to be okay to  say this file is under a  license.  I wish
 * the situation would become more clear in the future. */
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/**
  This file is for threaded code.

  ----
  This file is auto generated by insns2vm.rb
  DO NOT TOUCH!

  If you want to fix something, you must edit "tool/ruby_vm/views/optinsn.inc.erb"
  or tool/insns2vm.rb
 */

static INSN *
insn_operands_unification(INSN *iobj)
{
#ifdef OPT_OPERANDS_UNIFICATION
    VALUE *op = iobj->operands;

    switch (iobj->insn_id) {
    default:
        /* do nothing */;
        break;

    case BIN(getlocal):

        /* getlocal_WC_0(idx)()(val) */
        if ( op[1] == LONG2NUM(0) ) {
            iobj->insn_id      = BIN(getlocal_WC_0);
            iobj->operand_size = 1;
            break;
        }

        /* getlocal_WC_1(idx)()(val) */
        if ( op[1] == LONG2NUM(1) ) {
            iobj->insn_id      = BIN(getlocal_WC_1);
            iobj->operand_size = 1;
            break;
        }

        break;
    case BIN(setlocal):

        /* setlocal_WC_0(idx)(val)() */
        if ( op[1] == LONG2NUM(0) ) {
            iobj->insn_id      = BIN(setlocal_WC_0);
            iobj->operand_size = 1;
            break;
        }

        /* setlocal_WC_1(idx)(val)() */
        if ( op[1] == LONG2NUM(1) ) {
            iobj->insn_id      = BIN(setlocal_WC_1);
            iobj->operand_size = 1;
            break;
        }

        break;
    case BIN(putobject):

        /* putobject_INT2FIX_0_()()(val) */
        if ( op[0] == INT2FIX(0) ) {
            iobj->insn_id      = BIN(putobject_INT2FIX_0_);
            iobj->operand_size = 0;
            break;
        }

        /* putobject_INT2FIX_1_()()(val) */
        if ( op[0] == INT2FIX(1) ) {
            iobj->insn_id      = BIN(putobject_INT2FIX_1_);
            iobj->operand_size = 0;
            break;
        }

        break;
    }
#endif
    return iobj;
}

int
rb_insn_unified_local_var_level(VALUE insn)
{
#ifdef OPT_OPERANDS_UNIFICATION
    /* optimize rule */
    switch (insn) {
      default:
        return -1; /* do nothing */;
      case BIN(getlocal_WC_0):
        return 0;
      case BIN(getlocal_WC_1):
        return 1;
      case BIN(setlocal_WC_0):
        return 0;
      case BIN(setlocal_WC_1):
        return 1;
      case BIN(putobject_INT2FIX_0_):
        return INT2FIX(0);
      case BIN(putobject_INT2FIX_1_):
        return INT2FIX(1);
    }
#endif
    return -1;
}