Page MenuHomeFreeBSD

amd64: micro-optimize vptopte()/vtopde() further
ClosedPublic

Authored by kib on Jan 8 2022, 5:16 AM.

Details

Summary
Eliminate shlq $3,address shift after masking of the va is done, which
is needed to convert pt_entry_t[] array index into byte offset.
Do it by preshifting the mask, and compensating the right shift of va.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib requested review of this revision.Jan 8 2022, 5:16 AM

I'll take a look at this tomorrow.

As an aside, have you seen how the compiler implements the static variable pg_g? It's implementing pg_g using a single byte of storage and performing a size extending load of the byte followed by a left shift by 8 wherever the variable is used to recreate a value of the declared type, pt_entry. Removing static from the variable definition reduces the code size by 240 bytes.

In D33786#764217, @alc wrote:

As an aside, have you seen how the compiler implements the static variable pg_g? It's implementing pg_g using a single byte of storage and performing a size extending load of the byte followed by a left shift by 8 wherever the variable is used to recreate a value of the declared type, pt_entry. Removing static from the variable definition reduces the code size by 240 bytes.

Will you commit the change? Or do you want me to add it to the series?

In D33786#764218, @kib wrote:
In D33786#764217, @alc wrote:

As an aside, have you seen how the compiler implements the static variable pg_g? It's implementing pg_g using a single byte of storage and performing a size extending load of the byte followed by a left shift by 8 wherever the variable is used to recreate a value of the declared type, pt_entry. Removing static from the variable definition reduces the code size by 240 bytes.

Will you commit the change? Or do you want me to add it to the series?

Ping?

This revision is now accepted and ready to land.Feb 1 2022, 3:06 PM
This revision was automatically updated to reflect the committed changes.