mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	(OFFSET to IC). This IC must be same as corresponding getinlinecache instruction's IC operand. This change is for a little performance improvement (getting IC directly) and is for the AOT compilation development. * compile.c, iseq.c, insns.def: Change the approach to handling inline cahce (IC) type operand to enable the above change. This change also affects ISeq#to_a method. The inline cache operand will be dumped by fixnum, the index of inline cache, in other words, inline cache identity. * template/insns_info.inc.tmpl, tool/instruction.rb: No need to count inline cache size (insn_iclen()). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
		
			
				
	
	
		
			83 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/** -*-c-*-
 | 
						|
  This file contains instruction information for yarv instruction sequence.
 | 
						|
 | 
						|
  ----
 | 
						|
  This file is auto generated by insns2vm.rb
 | 
						|
  DO NOT TOUCH!
 | 
						|
 | 
						|
  If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
 | 
						|
  or insns2vm.rb
 | 
						|
 */
 | 
						|
 | 
						|
<%= insn_type_chars %>
 | 
						|
 | 
						|
static const char *const insn_name_info[] = {
 | 
						|
<%= insn_names %>
 | 
						|
};
 | 
						|
 | 
						|
static const char *const insn_operand_info[] = {
 | 
						|
<%= operands_info %>
 | 
						|
};
 | 
						|
 | 
						|
static const int insn_len_info[] = {
 | 
						|
<%= operands_num_info %>
 | 
						|
};
 | 
						|
 | 
						|
#ifdef USE_INSN_RET_NUM
 | 
						|
static const int insn_stack_push_num_info[] = {
 | 
						|
<%= stack_num_info %>
 | 
						|
};
 | 
						|
#endif
 | 
						|
 | 
						|
#ifdef USE_INSN_STACK_INCREASE
 | 
						|
static int
 | 
						|
insn_stack_increase(int depth, int insn, VALUE *opes)
 | 
						|
{
 | 
						|
  switch(insn){
 | 
						|
<%= stack_increase %>
 | 
						|
  default:
 | 
						|
    rb_bug("insn_sp_increase: unreachable");
 | 
						|
  }
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
/* some utilities */
 | 
						|
 | 
						|
static int
 | 
						|
insn_len(VALUE insn)
 | 
						|
{
 | 
						|
  return insn_len_info[(int)insn];
 | 
						|
}
 | 
						|
 | 
						|
static const char *
 | 
						|
insn_name(VALUE insn)
 | 
						|
{
 | 
						|
  return insn_name_info[(int)insn];
 | 
						|
}
 | 
						|
 | 
						|
static const char *
 | 
						|
insn_op_types(VALUE insn)
 | 
						|
{
 | 
						|
  return insn_operand_info[(int)insn];
 | 
						|
}
 | 
						|
 | 
						|
static int
 | 
						|
insn_op_type(VALUE insn, long pos)
 | 
						|
{
 | 
						|
  int len = insn_len(insn) - 1;
 | 
						|
  if(pos < len){
 | 
						|
    return insn_operand_info[(int)insn][pos];
 | 
						|
  }
 | 
						|
  else{
 | 
						|
    return 0;
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
#ifdef USE_INSN_RET_NUM
 | 
						|
static int
 | 
						|
insn_ret_num(VALUE insn)
 | 
						|
{
 | 
						|
  return insn_stack_push_num_info[(int)insn];
 | 
						|
}
 | 
						|
#endif
 |