mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Remove redundant code in the compiler.
During instruction translation (linked list -> iseq generation), we can treat `TS_VALUE` and `TS_ISEQ` the same as they are just embedded in the generated sequences. The only difference between `TS_ISE` and `TS_IC` is that an inline storage entry may contain a markable `VALUE` pointer at some point, so we need to flag the iseq as containing markable objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									162cbfe631
								
							
						
					
					
						commit
						d8583b132c
					
				
					 1 changed files with 4 additions and 21 deletions
				
			
		
							
								
								
									
										25
									
								
								compile.c
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								compile.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2120,17 +2120,8 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
 | 
			
		|||
		      case TS_NUM:	/* ulong */
 | 
			
		||||
			generated_iseq[code_index + 1 + j] = FIX2INT(operands[j]);
 | 
			
		||||
			break;
 | 
			
		||||
		      case TS_ISEQ:	/* iseq */
 | 
			
		||||
			{
 | 
			
		||||
			    VALUE v = operands[j];
 | 
			
		||||
			    generated_iseq[code_index + 1 + j] = v;
 | 
			
		||||
			    if (!SPECIAL_CONST_P(v)) {
 | 
			
		||||
				RB_OBJ_WRITTEN(iseq, Qundef, v);
 | 
			
		||||
				FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
 | 
			
		||||
			    }
 | 
			
		||||
			    break;
 | 
			
		||||
			}
 | 
			
		||||
		      case TS_VALUE:	/* VALUE */
 | 
			
		||||
		      case TS_ISEQ:	/* iseq */
 | 
			
		||||
			{
 | 
			
		||||
			    VALUE v = operands[j];
 | 
			
		||||
			    generated_iseq[code_index + 1 + j] = v;
 | 
			
		||||
| 
						 | 
				
			
			@ -2141,6 +2132,9 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
 | 
			
		|||
			    }
 | 
			
		||||
			    break;
 | 
			
		||||
			}
 | 
			
		||||
		      case TS_ISE: /* inline storage entry */
 | 
			
		||||
			/* Treated as an IC, but may contain a markable VALUE */
 | 
			
		||||
			FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
 | 
			
		||||
		      case TS_IC: /* inline cache */
 | 
			
		||||
			{
 | 
			
		||||
			    unsigned int ic_index = FIX2UINT(operands[j]);
 | 
			
		||||
| 
						 | 
				
			
			@ -2151,17 +2145,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
 | 
			
		|||
			    generated_iseq[code_index + 1 + j] = (VALUE)ic;
 | 
			
		||||
			    break;
 | 
			
		||||
			}
 | 
			
		||||
		      case TS_ISE: /* inline storage entry */
 | 
			
		||||
			{
 | 
			
		||||
			    unsigned int ic_index = FIX2UINT(operands[j]);
 | 
			
		||||
			    IC ic = (IC)&body->is_entries[ic_index];
 | 
			
		||||
			    if (UNLIKELY(ic_index >= body->is_size)) {
 | 
			
		||||
				rb_bug("iseq_set_sequence: ic_index overflow: index: %d, size: %d", ic_index, body->is_size);
 | 
			
		||||
			    }
 | 
			
		||||
			    generated_iseq[code_index + 1 + j] = (VALUE)ic;
 | 
			
		||||
			    FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
 | 
			
		||||
			    break;
 | 
			
		||||
			}
 | 
			
		||||
		      case TS_CALLINFO: /* call info */
 | 
			
		||||
			{
 | 
			
		||||
			    struct rb_call_info *base_ci = (struct rb_call_info *)operands[j];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue