Useful theory.  I'll take a read.  Thank you again.

Gareth aka. Kit

On 03/10/2020 19:14, Jonas Maebe via fpc-devel wrote:
On 03/10/2020 18:43, J. Gareth Moreton via fpc-devel wrote:
Sounds like a fun thing to research, that's for sure.  Thanks Jonas.

I'm under the impression that exception code tends to be separated
anyway, so it can't easily be separated much further.
Implicit exception code, yes, but explicit try/except blocks can appear
anywhere.

Code that executes if, say, a LongInt variable equals "-1" might be cold
code, especially as that's often an error flag and is otherwise just one
value out of 2^32 possibilities (i.e. statistically unlikely to be
True), although it's tricky to know if an assumption is correct or not
given an arbitrary block of code, and what the penalty is if code that's
marked as cold is actually hot.
There's a pretty famous paper that investigated what kind of checks
often (in about 80% of the cases) result in taken/non-taken branches.
You can find it at
https://www.classes.cs.uchicago.edu/archive/2017/fall/32001-1/papers/ball-larus-branch-predict.pdf

You will indeed get penalties from mispredictions, but you can be as
conservative as you want.


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to