mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
a0f12a0258
Use ID instead of GENTRY for gvars. Global variables are compiled into GENTRY (a pointer to struct rb_global_entry). This patch replace this GENTRY to ID and make the code simple. We need to search GENTRY from ID every time (st_lookup), so additional overhead will be introduced. However, the performance of accessing global variables is not important now a day and this simplicity helps Ractor development.
51 lines
1.3 KiB
Text
51 lines
1.3 KiB
Text
%# -*- 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"
|
|
|
|
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
|