Avoid relocations in struct XFA_FMHtmlReserveCode.
Per Chromium's docs/native_relocations.md, sometimes it makes sense to
restructure read-only data to avoid relocations. In this case, the
results are as follows on Linux:
.rodata: +7360
.data.rel.ro: -8064
.rela.dyn: -12096
So even disregarding the relocation data, which varies on platform, the
amount of read-only data goes down as a result of this change.
Change-Id: I0ccc9b2c7c5820d86b1ed8cf5b70098a644dc776
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74733
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 245c0fe..ea79b20 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -43,7 +43,8 @@
struct XFA_FMHtmlReserveCode {
uint32_t m_uCode;
- const char* m_htmlReserve;
+ // Inline string data reduces size for small strings.
+ const char m_htmlReserve[12];
};
// Sorted by |m_htmlReserve|.