File: _leaf_helpers.erb

package info (click to toggle)
jruby 9.4.8.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 89,244 kB
  • sloc: ruby: 548,574; java: 276,189; yacc: 25,873; ansic: 6,178; xml: 6,111; sh: 1,855; sed: 94; makefile: 78; jsp: 48; tcl: 40; exp: 12
file content (55 lines) | stat: -rw-r--r-- 1,532 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
%# -*- C -*-
%# Copyright (c) 2018 Urabe, Shyouhei.  All rights reserved.
%#
%# This file is a part of  the programming language Ruby.  Permission is hereby
%# granted, to either  redistribute and/or modify this file,  provided that the
%# conditions mentioned  in the  file COPYING  are met.   Consult the  file for
%# details.
%;
#line <%= __LINE__ + 1 %> <%=cstr __FILE__ %>

#include "iseq.h"

// This is used to tell MJIT that this insn would be leaf if CHECK_INTS didn't exist.
// It should be used only when RUBY_VM_CHECK_INTS is directly written in insns.def.
static bool leafness_of_check_ints = false;

static bool
leafness_of_defined(rb_num_t op_type)
{
    /* see also: vm_insnhelper.c:vm_defined() */
    switch (op_type) {
      case DEFINED_IVAR:
      case DEFINED_IVAR2:
      case DEFINED_GVAR:
      case DEFINED_CVAR:
      case DEFINED_YIELD:
      case DEFINED_REF:
      case DEFINED_ZSUPER:
        return false;
      case DEFINED_CONST:
      case DEFINED_CONST_FROM:
        /* has rb_autoload_load(); */
        return false;
      case DEFINED_FUNC:
      case DEFINED_METHOD:
        /* calls #respond_to_missing? */
        return false;
      default:
        rb_bug("unknown operand %ld: blame @shyouhei.", op_type);
    }
}

static bool
leafness_of_checkmatch(rb_num_t flag)
{
    /* see also: vm_insnhelper.c:check_match() */
    if (flag == VM_CHECKMATCH_TYPE_WHEN) {
        return true;
    }
    else {
        /* has rb_funcallv() */
        return false;
    }
}
#pragma RubyVM reset source