All pastes #146316 Raw Edit

Mine

public text v1 · immutable
#146316 ·published 2006-08-23 14:20 UTC
rendered paste body
Index: jit-rules-interp.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-interp.c,v
retrieving revision 1.25
diff -u -r1.25 jit-rules-interp.c
--- jit-rules-interp.c	14 Apr 2006 14:44:29 -0000	1.25
+++ jit-rules-interp.c	23 Aug 2006 14:16:49 -0000
@@ -1709,83 +1709,40 @@
 
 		default:
 		{
-			/* Whatever opcodes are left are ordinary operators,
-			   and the interpreter's opcode is identical to the JIT's */
-			if(insn->value2 && (insn->flags & JIT_INSN_DEST_IS_VALUE) != 0)
-			{
-				/* Generate code for a ternary operator with no real dest */
-				_jit_regs_load_to_top_three
-					(gen, insn->dest, insn->value1, insn->value2,
-					 (insn->flags & (JIT_INSN_DEST_NEXT_USE |
-					 				 JIT_INSN_DEST_LIVE)),
-					 (insn->flags & (JIT_INSN_VALUE1_NEXT_USE |
-					 				 JIT_INSN_VALUE1_LIVE)),
-					 (insn->flags & (JIT_INSN_VALUE2_NEXT_USE |
-					 				 JIT_INSN_VALUE2_LIVE)), 0);
-				jit_cache_opcode(&(gen->posn), insn->opcode);
-				adjust_working(gen, -3);
-			}
-			else if(insn->value2)
+			_jit_regs_t regs;
+			int adjustment;
+
+			_jit_regs_init(&regs, insn, _JIT_REGS_STACK);
+			adjustment = 0;
+			if(insn->dest)
 			{
-				/* Generate code for a binary operator */
-				reg = _jit_regs_load_to_top_two
-					(gen, insn->value1, insn->value2,
-					 (insn->flags & (JIT_INSN_VALUE1_NEXT_USE |
-					 				 JIT_INSN_VALUE1_LIVE)),
-					 (insn->flags & (JIT_INSN_VALUE2_NEXT_USE |
-					 				 JIT_INSN_VALUE2_LIVE)), 0);
-				jit_cache_opcode(&(gen->posn), insn->opcode);
-				adjust_working(gen, -1);
-				if(insn->dest)
+				_jit_regs_init_dest(&regs, insn, 0);
+				if((insn->flags & JIT_INSN_DEST_IS_VALUE) != 0)
 				{
-					if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0)
-					{
-						/* Record that the destination is in "reg" */
-						_jit_regs_set_value(gen, reg, insn->dest, 0);
-					}
-					else
-					{
-						/* No next use, so store to the destination */
-						_jit_gen_spill_reg(gen, reg, -1, insn->dest);
-						insn->dest->in_frame = 1;
-						_jit_regs_free_reg(gen, reg, 1);
-					}
+					--adjustment;
 				}
 				else
 				{
-					/* This is a note, with the result left on the stack */
-					_jit_regs_free_reg(gen, reg, 1);
+					++adjustment;
 				}
 			}
-			else
+			if(insn->value1)
 			{
-				/* Generate code for a unary operator */
-				reg = _jit_regs_load_to_top
-					(gen, insn->value1,
-					 (insn->flags & (JIT_INSN_VALUE1_NEXT_USE |
-					 				 JIT_INSN_VALUE1_LIVE)), 0);
-				jit_cache_opcode(&(gen->posn), insn->opcode);
-				if(insn->dest)
-				{
-					if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0)
-					{
-						/* Record that the destination is in "reg" */
-						_jit_regs_set_value(gen, reg, insn->dest, 0);
-					}
-					else
-					{
-						/* No next use, so store to the destination */
-						_jit_gen_spill_reg(gen, reg, -1, insn->dest);
-						insn->dest->in_frame = 1;
-						_jit_regs_free_reg(gen, reg, 1);
-					}
-				}
-				else
-				{
-					/* This is a note, with the result left on the stack */
-					_jit_regs_free_reg(gen, reg, 1);
-				}
+				_jit_regs_init_value1(&regs, insn, 0);
+				--adjustment;
+			}
+			if(insn->value2)
+			{
+				_jit_regs_init_value2(&regs, insn, 0);
+				--adjustment;
 			}
+
+			_jit_regs_assign(gen, &regs);
+			_jit_regs_gen(gen, &regs);
+			jit_cache_opcode(&(gen->posn), insn->opcode);
+			_jit_regs_commit(gen, &regs);
+
+			adjust_working(gen, adjustment);
 		}
 		break;
 	}