[Oberon] Oberon performance (long)

rotaru at centrum.cz rotaru at centrum.cz
Tue Apr 15 19:08:42 CEST 2003


To everyone who is curious...

J. Templ has already mentioned in his ``Ofront User Guide'' (1995):
  
  The translation of Oberon programs to C makes thousands of person
years invested
  into aggressively optimizing C compilers available to the Oberon
community. Oberon
  compilers that optimize equaly well can only be expected when Oberon
is as
  wide-spread as C.

(I have tried to use it on my Debian distro, but it requieres
xlibs.3.3 or so, a very obsolete library)


  And those who are even more curious may look at the example below.

MODULE Simple;

TYPE
	Simple	= OBJECT
	VAR 
		x, y, z	: LONGINT;
		
		PROCEDURE &Init;
		BEGIN
			x := 1; y := 10; z := 100;
		END Init;
		
		PROCEDURE Sum* (): LONGINT;
		BEGIN
			RETURN (x + y + z)
		END Sum;
		
		PROCEDURE Set (n: LONGINT);
		BEGIN
			x := n; y := 10 * n; z := 100 * n;
		END Set;
		
	END Simple;

END Simple.


  And here folows part of  [Decoder.Decode Simple.Obx ~]  output, where
I have marked (and kind of commented) those instructions which
an agressively optimizing compiler would have been "optimized away",
or changed with better ones.

PROCEDURE Simple.Init
0007H: 55                                  PUSH    EBP
0008H: 8B EC                               MOV     EBP,ESP
000AH: 8B 5D 08                            MOV     EBX,8[EBP]
000DH: C7 03 01 00 00 00                   MOV     0[EBX],1
0013H: 8B 5D 08                            MOV     EBX,8[EBP] ;?
address already loaded
0016H: C7 43 04 0A 00 00 00                MOV     4[EBX],10
001DH: 8B 5D 08                            MOV     EBX,8[EBP]
0020H: C7 43 08 64 00 00 00                MOV     8[EBX],100 ;?
address already loaded
0027H: 8B E5                               MOV     ESP,EBP
0029H: 5D                                  POP     EBP
002AH: C2 04 00                            RET     4

PROCEDURE Simple.Sum
002DH: 55                                  PUSH    EBP
002EH: 8B EC                               MOV     EBP,ESP
0030H: 8B 5D 08                            MOV     EBX,8[EBP]
0033H: 8B 55 08                            MOV     EDX,8[EBP] ;?
addres already in EBX
0036H: 8B 03                               MOV     EAX,0[EBX]
0038H: 03 42 04                            ADD     EAX,4[EDX] ;? ADD
EAX, 4[EBX]
003BH: 8B 5D 08                            MOV     EBX,8[EBP] ;?
address already loaded
003EH: 03 43 08                            ADD     EAX,8[EBX]
0041H: 8B E5                               MOV     ESP,EBP
0043H: 5D                                  POP     EBP
0044H: C2 04 00                            RET     4
0047H: 6A 03                               PUSH    3  
0049H: CC                                  INT     3

PROCEDURE Simple.Set
004AH: 55                                  PUSH    EBP
004BH: 8B EC                               MOV     EBP,ESP
004DH: 8B 5D 08                            MOV     EBX,8[EBP]
0050H: 8B 55 0C                            MOV     EDX,12[EBP] ;
loading n;
0053H: 89 13                               MOV     0[EBX],EDX
0055H: B8 0A 00 00 00                      MOV     EAX,10
005AH: F7 6D 0C                            IMUL    12[EBP]     ; IMUl
EDX (foster)
005DH: 8B 5D 08                            MOV     EBX,8[EBP]  ;
addres already in EBX
0060H: 89 43 04                            MOV     4[EBX],EAX
0063H: B8 64 00 00 00                      MOV     EAX,100
0068H: F7 6D 0C                            IMUL    12[EBP]     ; IMUl
EDX (foster)
006BH: 8B 5D 08                            MOV     EBX,8[EBP]  ;
addres already in EBX
006EH: 89 43 08                            MOV     8[EBX],EAX
0071H: 8B E5                               MOV     ESP,EBP
0073H: 5D                                  POP     EBP
0074H: C2 08 00                            RET     8


  I have no idea, how hard will it be to change this.I did take a look at 
the code in PC*.Mod (for an hour or so) and I have run into these lines

  ...
  ELSIF x.mode = Reg THEN
      (* O.K. already loaded *)

  ...
  ELSIF x.mode = Ref THEN
     <dereference the pointer>

May be a new "ELSIF (x.mode = Ref) & (x.base.mode = Reg) THEN" should
be added? (Just thinking aloud/astray)

  I'm tempted to give it a try, but how many lines will I have to change?
What is your estimate, Patrick?

V. Rotaru
--
P. S.
And one more question?  To change my e-mail address I should register
off and on again?

VR.



  


----------------------------------
E-mail akcelerátor, spam filtr, bezpečnostní agent. Rychle a bezpečně s Centrum.cz E-mail! http://home.centrum.cz/reklama/email/email_vyhody.html






More information about the Oberon mailing list