Re: [fpc-devel]default calling convention change for i386

2003-12-26 Thread Ingmar Tulva
On Wed, 24 Dec 2003, Peter Vreman wrote:

}Most important was compatibility, second is speed. In the drystone test
}there was a performance gain of at least 10%.

Okay, I think this answers the question :)

}> Register convention saves opcode space in the called function, because
}> within
}> the instruction opcode,  registers are encoded with small bit fields,
}> whereas
}> offsets into a stack frame are encoded as (8-, 16-, or 32-bit) words,
}> unless
}> the processor supports something like short offsets. Actually, I don't
}> know
}> if the i386 does support such short offsets. AFAIK, the 68000 does not.
}
}Sorry, this is not correct. The code size is increased with register
}calling. The reason is that in the called routines the passed registers
}need to be saved in the local stackframe. When we have register variables
}support (currently not working for 1.9.x) this can be reduced.

This is exactly what makes me doubt in the benefits of register calling.
Because of the small number of registers to spare, the whole process of
calling and executing a subroutine looks like this to me:

1. Calculate values of parameters and push them into stack, one by one.
2. Pop the values into appropriate registers (omitted when not using
register convention)
3. Call the subroutine.
4. Push parameters into stack (omitted when not using register convention)
5. Access parameters in stack as they are needed.

Well, this is just an oversimplified theory. As Peter noted, the practice
might be somewhat more pleasant :)

--

Ingmar

--

"Experience is what you get when you don't get what you want"


___
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re[2]: [fpc-devel]default calling convention change for i386

2003-12-24 Thread Ingmar Tulva
On Wed, 24 Dec 2003, Pavel V. Ozerski wrote:

}IT> Bad news :(
}
}IT> Is this true for all {$mode }'s or only {$mode delphi} ?
}
}Why bad, Try to add {$calling oldfpccall} into your source

Just personal taste, nothing else :) No, I'm not complaining, do what
you find is right.

Anyway, has someone actually analyzed how benefitial register calling
convention is? Sure it provides huge speed boost in case of a function
which adds two arguments together and returns the result - or is it so
sure? In fact, I imagine that in most cases, register convention will
eventually be detrimental to both speed and code size.

Again, no complain intended, just curiousity.

--

Ingmar

--

"Experience is what you get when you don't get what you want"


___
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel]default calling convention change for i386

2003-12-24 Thread Ingmar Tulva
Bad news :(

Is this true for all {$mode }'s or only {$mode delphi} ?

On Wed, 24 Dec 2003, Peter Vreman wrote:

}Hi all,
}
}>From today the default calling convention for i386 is changed from stdcall
}(the default since 1.9.0) to register calling. This means that you have to
}look at how assembler code loads the arguments and maybe store them
}yourself in local variables.
}
}The register calling is compatible with delphi, so delphi assembler can
}now be used without changes. If there are still incompatibilities with
}delphi register calling please report the to the fpc-devel mailinglist
}including some same code.

--

Ingmar

--

"Experience is what you get when you don't get what you want"


___
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel