*** jit/jit-apply-x86-64.c	Tue Jun 29 07:20:33 2010
--- jit/jit-apply-x86-64.c	Fri Dec 17 11:26:08 2010
***************
*** 774,779 ****
--- 774,782 ----
  				jit_memcpy(&(builder->apply_args->word_regs[builder->word_used]),
  												value, size);
  				++(builder->word_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->float_used);
+ #endif
  			}
  			else if((arg_class == X86_64_ARG_SSE) &&
  					(builder->float_used < JIT_APPLY_NUM_FLOAT_REGS))
***************
*** 782,787 ****
--- 785,793 ----
  				jit_memcpy(&(builder->apply_args->float_regs[builder->float_used]),
  												value, size);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  			}
  			else
  			{
***************
*** 812,817 ****
--- 818,826 ----
  				jit_memcpy(&(builder->apply_args->float_regs[builder->float_used]),
  											value, size);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  			}
  			else if(arg_class1 == X86_64_ARG_INTEGER &&
  					arg_class2 == X86_64_ARG_INTEGER &&
***************
*** 821,854 ****
--- 830,888 ----
  				jit_memcpy(&(builder->apply_args->word_regs[builder->word_used]),
  											value, size);
  				(builder->word_used) += 2;
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				(builder->float_used) += 2;
+ #endif
  			}
  			else if(arg_class1 == X86_64_ARG_INTEGER &&
  					arg_class2 == X86_64_ARG_SSE &&
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 					((builder->float_used + 1) < JIT_APPLY_NUM_FLOAT_REGS) &&
+ 					((builder->word_used + 1) < JIT_APPLY_NUM_WORD_REGS))
+ #else
  					(builder->float_used < JIT_APPLY_NUM_FLOAT_REGS) &&
  					(builder->word_used < JIT_APPLY_NUM_WORD_REGS))
+ #endif
  			{
  				/* The first eightbyte is passed in a general purpose */
  				/* register and the second eightbyte in a sse register */
  				builder->apply_args->word_regs[builder->word_used] =
  											((jit_nint *)value)[0];
  				++(builder->word_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->float_used);
+ #endif
  				jit_memcpy(&(builder->apply_args->float_regs[builder->float_used]),
  											((char *)value) + 8, size - 8);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  			}
  			else if(arg_class1 == X86_64_ARG_SSE &&
  					arg_class2 == X86_64_ARG_INTEGER &&
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 					((builder->float_used + 1) < JIT_APPLY_NUM_FLOAT_REGS) &&
+ 					((builder->word_used + 1) < JIT_APPLY_NUM_WORD_REGS))
+ #else
  					(builder->float_used < JIT_APPLY_NUM_FLOAT_REGS) &&
  					(builder->word_used < JIT_APPLY_NUM_WORD_REGS))
+ #endif
  			{
  				/* The first eightbyte is passed in a sse register and */
  				/* the second eightbyte in a general purpose  register */
  				jit_memcpy(&(builder->apply_args->float_regs[builder->float_used]),
  											value, 8);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  				jit_memcpy(&(builder->apply_args->word_regs[builder->word_used]),
  											((char *)value) + 8, size - 8);
  				++(builder->word_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->float_used);
+ #endif
  			}
  			else
  			{
***************
*** 892,897 ****
--- 926,934 ----
  						   &(builder->apply_args->word_regs[builder->word_used]),
  						   size);
  				++(builder->word_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->float_used);
+ #endif
  			}
  			else if((arg_class == X86_64_ARG_SSE) &&
  					(builder->float_used < JIT_APPLY_NUM_FLOAT_REGS))
***************
*** 901,906 ****
--- 938,946 ----
  						   &(builder->apply_args->float_regs[builder->float_used]),
  						   size);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  			}
  			else
  			{
***************
*** 933,938 ****
--- 973,981 ----
  						   &(builder->apply_args->float_regs[builder->float_used]),
  						   size);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  			}
  			else if(arg_class1 == X86_64_ARG_INTEGER &&
  					arg_class2 == X86_64_ARG_INTEGER &&
***************
*** 943,969 ****
--- 986,1031 ----
  						   &(builder->apply_args->word_regs[builder->word_used]),
  						   size);
  				(builder->word_used) += 2;
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				(builder->float_used) += 2;
+ #endif
  			}
  			else if(arg_class1 == X86_64_ARG_INTEGER &&
  					arg_class2 == X86_64_ARG_SSE &&
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 					((builder->float_used + 1) < JIT_APPLY_NUM_FLOAT_REGS) &&
+ 					((builder->word_used + 1) < JIT_APPLY_NUM_WORD_REGS))
+ #else
  					(builder->float_used < JIT_APPLY_NUM_FLOAT_REGS) &&
  					(builder->word_used < JIT_APPLY_NUM_WORD_REGS))
+ #endif
  			{
  				/* The first eightbyte is passed in a general purpose */
  				/* register and the second eightbyte in a sse register */
  				((jit_nint *)value)[0] =
  					builder->apply_args->word_regs[builder->word_used];
  				++(builder->word_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->float_used);
+ #endif
  
  				jit_memcpy(((char *)value) + 8,
  						   &(builder->apply_args->float_regs[builder->float_used]),
  						   size - 8);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  			}
  			else if(arg_class1 == X86_64_ARG_SSE &&
  					arg_class2 == X86_64_ARG_INTEGER &&
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 					((builder->float_used + 1) < JIT_APPLY_NUM_FLOAT_REGS) &&
+ 					((builder->word_used + 1) < JIT_APPLY_NUM_WORD_REGS))
+ #else
  					(builder->float_used < JIT_APPLY_NUM_FLOAT_REGS) &&
  					(builder->word_used < JIT_APPLY_NUM_WORD_REGS))
+ #endif
  			{
  				/* The first eightbyte is passed in a sse register and */
  				/* the second eightbyte in a general purpose  register */
***************
*** 971,981 ****
--- 1033,1049 ----
  						   &(builder->apply_args->float_regs[builder->float_used]),
  						   8);
  				++(builder->float_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->word_used);
+ #endif
  
  				jit_memcpy(((char *)value) + 8,
  						   &(builder->apply_args->word_regs[builder->word_used]),
  						   size - 8);
  				++(builder->word_used);
+ #ifdef JIT_APPLY_ARG_REGISTERS_OVERLAP
+ 				++(builder->float_used);
+ #endif
  			}
  			else
  			{
*** tools/gen-apply.c	Tue Jul  6 12:11:06 2010
--- tools/gen-apply.c	Fri Dec 17 11:30:28 2010
***************
*** 2056,2065 ****
  		printf("\t\t\tjit_memcpy(&__temp, (builder)->apply_args->word_regs + (builder)->word_used, __split * sizeof(jit_nint)); \\\n");
  		printf("\t\t\tjit_memcpy(((jit_nint *)&__temp) + __split, (builder)->apply_args->stack_args, (__num_words - __split) * sizeof(jit_nint)); \\\n");
  		printf("\t\t\t(builder)->word_used = %s; \\\n", word_reg_limit);
- 		if (arg_registers_overlap && num_float_regs > 0)
- 		{
- 			printf("\t\t\t(builder)->float_used = %s; \\\n", word_reg_limit);
- 		}
  		printf("\t\t\t(builder)->stack_used = __num_words - __split; \\\n");
  		printf("\t\t} \\\n");
  		printf("\t\telse \\\n");
--- 2056,2061 ----
***************
*** 2068,2078 ****
  		printf("\t\t\tjit_memcpy(&__temp, (builder)->apply_args->stack_args + (builder)->stack_used, sizeof(__temp)); \\\n");
  		printf("\t\t\t(builder)->stack_used += __num_words * sizeof(jit_nint); \\\n");
  		printf("\t\t\t(builder)->word_used = %s; \\\n", word_reg_limit);
  		if (arg_registers_overlap && num_float_regs > 0)
  		{
! 			printf("\t\t\t(builder)->float_used = %s; \\\n", word_reg_limit);
  		}
- 		printf("\t\t} \\\n");
  	}
  	else
  	{
--- 2064,2074 ----
  		printf("\t\t\tjit_memcpy(&__temp, (builder)->apply_args->stack_args + (builder)->stack_used, sizeof(__temp)); \\\n");
  		printf("\t\t\t(builder)->stack_used += __num_words * sizeof(jit_nint); \\\n");
  		printf("\t\t\t(builder)->word_used = %s; \\\n", word_reg_limit);
+ 		printf("\t\t} \\\n");
  		if (arg_registers_overlap && num_float_regs > 0)
  		{
! 			printf("\t\t(builder)->float_used = (builder)->word_used; \\\n");
  		}
  	}
  	else
  	{
