Remove compiled slot from quotations since its not needed
							parent
							
								
									f5a7ee6d13
								
							
						
					
					
						commit
						6e08e29a3a
					
				|  | @ -448,7 +448,6 @@ M: quotation ' | |||
|         array>> ' | ||||
|         quotation [ | ||||
|             emit ! array | ||||
|             f ' emit ! compiled | ||||
|             f ' emit ! cached-effect | ||||
|             f ' emit ! cache-counter | ||||
|             0 emit ! xt | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ CONSTANT: deck-bits 18 | |||
| : underlying-alien-offset ( -- n ) bootstrap-cell alien tag-number - ; inline | ||||
| : tuple-class-offset ( -- n ) bootstrap-cell tuple tag-number - ; inline | ||||
| : word-xt-offset ( -- n ) 10 bootstrap-cells \ word tag-number - ; inline | ||||
| : quot-xt-offset ( -- n ) 5 bootstrap-cells quotation tag-number - ; inline | ||||
| : quot-xt-offset ( -- n ) 4 bootstrap-cells quotation tag-number - ; inline | ||||
| : word-code-offset ( -- n ) 11 bootstrap-cells \ word tag-number - ; inline | ||||
| : array-start-offset ( -- n ) 2 bootstrap-cells array tag-number - ; inline | ||||
| : compiled-header-size ( -- n ) 4 bootstrap-cells ; inline | ||||
|  |  | |||
|  | @ -211,7 +211,6 @@ bi | |||
| 
 | ||||
| "quotation" "quotations" create { | ||||
|     { "array" { "array" "arrays" } read-only } | ||||
|     { "compiled" read-only } | ||||
|     "cached-effect" | ||||
|     "cache-counter" | ||||
| } define-builtin | ||||
|  | @ -514,6 +513,7 @@ tuple | |||
|     { "reset-inline-cache-stats" "generic.single" (( -- )) } | ||||
|     { "inline-cache-stats" "generic.single" (( -- stats )) } | ||||
|     { "optimized?" "words" (( word -- ? )) } | ||||
|     { "quot-compiled?" "quotations" (( quot -- ? )) } | ||||
| } [ [ first3 ] dip swap make-primitive ] each-index | ||||
| 
 | ||||
| ! Bump build number | ||||
|  |  | |||
|  | @ -68,10 +68,10 @@ static void *xt_pic(word *w, cell tagged_quot) | |||
| 	else | ||||
| 	{ | ||||
| 		quotation *quot = untag<quotation>(tagged_quot); | ||||
| 		if(quot->compiledp == F) | ||||
| 			return w->xt; | ||||
| 		else | ||||
| 		if(quot->code) | ||||
| 			return quot->xt; | ||||
| 		else | ||||
| 			return w->xt; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -409,7 +409,7 @@ void mark_object_code_block(object *object) | |||
| 	case QUOTATION_TYPE: | ||||
| 		{ | ||||
| 			quotation *q = (quotation *)object; | ||||
| 			if(q->compiledp != F) | ||||
| 			if(q->code) | ||||
| 				mark_code_block(q->code); | ||||
| 			break; | ||||
| 		} | ||||
|  |  | |||
|  | @ -158,7 +158,7 @@ void forward_object_xts() | |||
| 			{ | ||||
| 				quotation *quot = untag<quotation>(obj); | ||||
| 
 | ||||
| 				if(quot->compiledp != F) | ||||
| 				if(quot->code) | ||||
| 					quot->code = forward_xt(quot->code); | ||||
| 			} | ||||
| 			break; | ||||
|  | @ -194,7 +194,7 @@ void fixup_object_xts() | |||
| 		case QUOTATION_TYPE: | ||||
| 			{ | ||||
| 				quotation *quot = untag<quotation>(obj); | ||||
| 				if(quot->compiledp != F) | ||||
| 				if(quot->code) | ||||
| 					set_quot_xt(quot,quot->code); | ||||
| 				break; | ||||
| 			} | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ multiply_overflow: | |||
| 	 | ||||
| /* Note that the XT is passed to the quotation in r11 */ | ||||
| #define CALL_OR_JUMP_QUOT \ | ||||
| 	lwz r11,16(r3)	   /* load quotation-xt slot */ XX \ | ||||
| 	lwz r11,12(r3)	   /* load quotation-xt slot */ XX \ | ||||
| 
 | ||||
| #define CALL_QUOT \ | ||||
| 	CALL_OR_JUMP_QUOT XX \ | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ | |||
| 	pop %ebp ; \
 | ||||
| 	pop %ebx | ||||
| 
 | ||||
| #define QUOT_XT_OFFSET 16 | ||||
| #define QUOT_XT_OFFSET 12 | ||||
| 
 | ||||
| /* We pass a function pointer to memcpy to work around a Mac OS X | ||||
| ABI limitation which would otherwise require us to do a bizzaro PC-relative | ||||
|  |  | |||
|  | @ -61,7 +61,7 @@ | |||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| #define QUOT_XT_OFFSET 36 | ||||
| #define QUOT_XT_OFFSET 28 | ||||
| 
 | ||||
| /* We pass a function pointer to memcpy to work around a Mac OS X | ||||
| ABI limitation which would otherwise require us to do a bizzaro PC-relative | ||||
|  |  | |||
|  | @ -187,13 +187,13 @@ static void fixup_word(word *word) | |||
| 
 | ||||
| static void fixup_quotation(quotation *quot) | ||||
| { | ||||
| 	if(quot->compiledp == F) | ||||
| 		quot->xt = (void *)lazy_jit_compile; | ||||
| 	else | ||||
| 	if(quot->code) | ||||
| 	{ | ||||
| 		code_fixup("->xt); | ||||
| 		code_fixup("->code); | ||||
| 	} | ||||
| 	else | ||||
| 		quot->xt = (void *)lazy_jit_compile; | ||||
| } | ||||
| 
 | ||||
| static void fixup_alien(alien *d) | ||||
|  |  | |||
|  | @ -269,8 +269,6 @@ struct quotation : public object { | |||
| 	/* tagged */ | ||||
| 	cell array; | ||||
| 	/* tagged */ | ||||
| 	cell compiledp; | ||||
| 	/* tagged */ | ||||
| 	cell cached_effect; | ||||
| 	/* tagged */ | ||||
| 	cell cache_counter; | ||||
|  |  | |||
|  | @ -155,6 +155,7 @@ const primitive_type primitives[] = { | |||
| 	primitive_reset_inline_cache_stats, | ||||
| 	primitive_inline_cache_stats, | ||||
| 	primitive_optimized_p, | ||||
| 	primitive_quot_compiled_p, | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -272,14 +272,13 @@ void set_quot_xt(quotation *quot, code_block *code) | |||
| 
 | ||||
| 	quot->code = code; | ||||
| 	quot->xt = code->xt(); | ||||
| 	quot->compiledp = T; | ||||
| } | ||||
| 
 | ||||
| /* Allocates memory */ | ||||
| void jit_compile(cell quot_, bool relocating) | ||||
| { | ||||
| 	gc_root<quotation> quot(quot_); | ||||
| 	if(quot->compiledp != F) return; | ||||
| 	if(quot->code) return; | ||||
| 
 | ||||
| 	quotation_jit compiler(quot.value(),true,relocating); | ||||
| 	compiler.iterate_quotation(); | ||||
|  | @ -300,10 +299,10 @@ PRIMITIVE(array_to_quotation) | |||
| { | ||||
| 	quotation *quot = allot<quotation>(sizeof(quotation)); | ||||
| 	quot->array = dpeek(); | ||||
| 	quot->xt = (void *)lazy_jit_compile; | ||||
| 	quot->compiledp = F; | ||||
| 	quot->cached_effect = F; | ||||
| 	quot->cache_counter = F; | ||||
| 	quot->xt = (void *)lazy_jit_compile; | ||||
| 	quot->code = NULL; | ||||
| 	drepl(tag<quotation>(quot)); | ||||
| } | ||||
| 
 | ||||
|  | @ -354,4 +353,11 @@ VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack) | |||
| 	return quot.value(); | ||||
| } | ||||
| 
 | ||||
| PRIMITIVE(quot_compiled_p) | ||||
| { | ||||
| 	tagged<quotation> quot(dpop()); | ||||
| 	quot.untag_check(); | ||||
| 	dpush(tag_boolean(quot->code != NULL)); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -35,4 +35,6 @@ PRIMITIVE(quotation_xt); | |||
| 
 | ||||
| VM_ASM_API cell lazy_jit_compile_impl(cell quot, stack_frame *stack); | ||||
| 
 | ||||
| PRIMITIVE(quot_compiled_p); | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue