RFR: 8288477: nmethod header size reduction

Boris Ulasevich bulasevich at openjdk.org
Fri Jul 8 13:19:43 UTC 2022


On Thu, 7 Jul 2022 18:36:43 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> What about CompiledMethod?

I didn't find a way to reduce the size of CompiledMethod:


(gdb) ptype /o CompiledMethod
/* offset    |  size */  type = class CompiledMethod : public CodeBlob {
                         protected:
/*  120      |     1 */    enum CompiledMethod::MarkForDeoptimizationStatus _mark_for_deoptimization_status;
/*  120:23   |     4 */    unsigned int _has_unsafe_access : 1;
/*  120:22   |     4 */    unsigned int _has_method_handle_invokes : 1;
/*  120:21   |     4 */    unsigned int _has_wide_vectors : 1;
/*  120:20   |     4 */    unsigned int _has_monitors : 1;
/* XXX  4-bit hole  */
/* XXX  6-byte hole */
/*  128      |     8 */    class Method *_method;
/*  136      |     8 */    address _scopes_data_begin;
/*  144      |     8 */    address _deopt_handler_begin;
/*  152      |     8 */    address _deopt_mh_handler_begin;
/*  160      |    32 */    class PcDescContainer {
                             private:
/*  160      |    32 */        class PcDescCache {
                                 private:
/*  160      |    32 */            volatile PcDescPtr _pc_descs[4];

                                   /* total size (bytes):   32 */
                               } _pc_desc_cache;

                               /* total size (bytes):   32 */
                           } _pc_desc_container;
/*  192      |     8 */    class ExceptionCache * volatile _exception_cache;
/*  200      |     8 */    void *_gc_data;

                           /* total size (bytes):  208 */
                         }


> Would be interesting to profile fields access. I assume hot fields should be in first cache line. Or it is not important?

I don't have a heatmap of the nmethod structure. If the nmethod data is being actively accessed on a critical code path, it probably makes sense to move the hot fields together (it doesn't have to be the first cache line, I guess).

Yes, my concern was that reordering the fields as a side effect might impact performance due to a cache miss or something like that. I ran Renaissance Suite to make sure that performance is not affected.

-------------

PR: https://git.openjdk.org/jdk/pull/9165


More information about the hotspot-dev mailing list