sqGnu.h

John M McIntosh johnmci at smalltalkconsulting.com
Thu Apr 4 06:51:13 UTC 2002


>
>or (stripping out the actual work of the bytecode) just three instructions
>total:
>
>  11639 2b65 46      		incl %esi
>  11640 2b66 0FB62E  		movzbl (%esi),%ebp
>  11648 2b71 FF24AD40		jmp *jumpTable.586(,%ebp,4)
>  11648      240000
>
>where the regs are as described in the sqGnu.h file:
>
># define IP_REG asm("%esi")
># define SP_REG asm("%edi")
>
>It looks like the compiler assigned %ebp as CB_REG on its own.
>

Well the powerpc compiler does
L1616:
	addis r9,r31,ha16(L_receiver$non_lazy_ptr-L96$pb)
	lbzu r28,1(r26)
	lwz r9,lo16(L_receiver$non_lazy_ptr-L96$pb)(r9)
	addi r27,r27,4
	addis r11,r31,ha16(_jumpTable.433-L96$pb)
	lwz r10,0(r9)
	la r11,lo16(_jumpTable.433-L96$pb)(r11)
	slwi r9,r28,2
	lwz r0,4(r10)
	stw r0,0(r27)
	lwzx r11,r11,r9
	mtctr r11
	bctr

or after we fiddle a bit with the jumpTable by sticking it in r24

L1616:
	addis r9,r31,ha16(L_receiver$non_lazy_ptr-L96$pb)
	lbzu r28,1(r26)
	lwz r9,lo16(L_receiver$non_lazy_ptr-L96$pb)(r9)
	addi r27,r27,4
	slwi r10,r28,2
	lwz r11,0(r9)
	lwz r0,4(r11)
	stw r0,0(r27)
	lwzx r10,r10,r24
	mtctr r10
	bctr

which makes it more efficient.
-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list