Fix code heap compaction bug introduced recently
							parent
							
								
									424ced9e2d
								
							
						
					
					
						commit
						f05f919973
					
				| 
						 | 
				
			
			@ -379,6 +379,8 @@ CELL compute_heap_forwarding(F_HEAP *heap)
 | 
			
		|||
			scan->forwarding = (F_BLOCK *)address;
 | 
			
		||||
			address += scan->size;
 | 
			
		||||
		}
 | 
			
		||||
		else if(scan->status == B_MARKED)
 | 
			
		||||
			critical_error("Why is the block marked?",0);
 | 
			
		||||
 | 
			
		||||
		scan = next_block(heap,scan);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -391,6 +393,14 @@ F_COMPILED *forward_xt(F_COMPILED *compiled)
 | 
			
		|||
	return block_to_compiled(compiled_to_block(compiled)->forwarding);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void forward_frame_xt(F_STACK_FRAME *frame)
 | 
			
		||||
{
 | 
			
		||||
	CELL offset = (CELL)FRAME_RETURN_ADDRESS(frame) - (CELL)frame_code(frame);
 | 
			
		||||
	F_COMPILED *forwarded = forward_xt(frame_code(frame));
 | 
			
		||||
	frame->xt = (XT)(forwarded + 1);
 | 
			
		||||
	FRAME_RETURN_ADDRESS(frame) = (XT)((CELL)forwarded + offset);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void forward_object_xts(void)
 | 
			
		||||
{
 | 
			
		||||
	begin_scan();
 | 
			
		||||
| 
						 | 
				
			
			@ -413,6 +423,11 @@ void forward_object_xts(void)
 | 
			
		|||
			if(quot->compiledp != F)
 | 
			
		||||
				set_quot_xt(quot,forward_xt(quot->code));
 | 
			
		||||
		}
 | 
			
		||||
		else if(type_of(obj) == CALLSTACK_TYPE)
 | 
			
		||||
		{
 | 
			
		||||
			F_CALLSTACK *stack = untag_object(obj);
 | 
			
		||||
			iterate_callstack_object(stack,forward_frame_xt);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* End the heap scan */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								vm/cpu-arm.h
								
								
								
								
							
							
						
						
									
										17
									
								
								vm/cpu-arm.h
								
								
								
								
							| 
						 | 
				
			
			@ -5,23 +5,6 @@ register CELL rs asm("r6");
 | 
			
		|||
 | 
			
		||||
#define F_FASTCALL
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	/* In compiled quotation frames, position within the array.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL scan;
 | 
			
		||||
 | 
			
		||||
	/* In compiled quotation frames, the quot->array slot.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL array;
 | 
			
		||||
 | 
			
		||||
	/* In all compiled frames, the XT on entry. */
 | 
			
		||||
	XT xt;
 | 
			
		||||
 | 
			
		||||
	/* Frame size in bytes */
 | 
			
		||||
	CELL size;
 | 
			
		||||
} F_STACK_FRAME;
 | 
			
		||||
 | 
			
		||||
#define FRAME_RETURN_ADDRESS(frame) *(XT *)(frame_successor(frame) + 1)
 | 
			
		||||
 | 
			
		||||
void c_to_factor(CELL quot);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								vm/cpu-ppc.h
								
								
								
								
							
							
						
						
									
										17
									
								
								vm/cpu-ppc.h
								
								
								
								
							| 
						 | 
				
			
			@ -1,20 +1,3 @@
 | 
			
		|||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	/* In compiled quotation frames, position within the array.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL scan;
 | 
			
		||||
 | 
			
		||||
	/* In compiled quotation frames, the quot->array slot.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL array;
 | 
			
		||||
 | 
			
		||||
	/* In all compiled frames, the XT on entry. */
 | 
			
		||||
	XT xt;
 | 
			
		||||
 | 
			
		||||
	/* Frame size in bytes */
 | 
			
		||||
	CELL size;
 | 
			
		||||
} F_STACK_FRAME;
 | 
			
		||||
 | 
			
		||||
#define FACTOR_CPU_STRING "ppc"
 | 
			
		||||
#define F_FASTCALL
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								vm/cpu-x86.h
								
								
								
								
							
							
						
						
									
										17
									
								
								vm/cpu-x86.h
								
								
								
								
							| 
						 | 
				
			
			@ -1,22 +1,5 @@
 | 
			
		|||
#define FRAME_RETURN_ADDRESS(frame) *(XT *)(frame_successor(frame) + 1)
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	/* In compiled quotation frames, position within the array.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL scan;
 | 
			
		||||
 | 
			
		||||
	/* In compiled quotation frames, the quot->array slot.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL array;
 | 
			
		||||
 | 
			
		||||
	/* In all compiled frames, the XT on entry. */
 | 
			
		||||
	XT xt;
 | 
			
		||||
 | 
			
		||||
	/* Frame size in bytes */
 | 
			
		||||
	CELL size;
 | 
			
		||||
} F_STACK_FRAME;
 | 
			
		||||
 | 
			
		||||
INLINE void flush_icache(CELL start, CELL len) {}
 | 
			
		||||
 | 
			
		||||
F_FASTCALL void c_to_factor(CELL quot);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								vm/layouts.h
								
								
								
								
							
							
						
						
									
										17
									
								
								vm/layouts.h
								
								
								
								
							| 
						 | 
				
			
			@ -255,3 +255,20 @@ typedef struct {
 | 
			
		|||
	/* tagged */
 | 
			
		||||
	CELL length;
 | 
			
		||||
} F_CALLSTACK;
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	/* In compiled quotation frames, position within the array.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL scan;
 | 
			
		||||
 | 
			
		||||
	/* In compiled quotation frames, the quot->array slot.
 | 
			
		||||
	In compiled word frames, unused. */
 | 
			
		||||
	CELL array;
 | 
			
		||||
 | 
			
		||||
	/* In all compiled frames, the XT on entry. */
 | 
			
		||||
	XT xt;
 | 
			
		||||
 | 
			
		||||
	/* Frame size in bytes */
 | 
			
		||||
	CELL size;
 | 
			
		||||
} F_STACK_FRAME;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue