RFR: 8306706: Support out-of-line code generation for MachNodes

Quan Anh Mai qamai at openjdk.org
Sun Apr 23 18:56:42 UTC 2023


On Sun, 23 Apr 2023 18:22:35 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

> Hi,
> 
> This patch adds supports for MachNodes to emit an out-of-line piece of code in the stub section of the compiled method. This allows the separation of the uncommon path from the common one, which speeds up the common path a little bit and increases compiled code density. Please take a look and leave reviews.
> 
> Thanks a lot.

The generated node for the stub looks like this:

    class convF2I_reg_regStub : public C2CodeStub {
    private:
        const convF2I_reg_regNode* _node;
        PhaseRegAlloc* ra_;
        MachOper* opnd_array(uint index) const { return _node->opnd_array(index); }
    public:
        convF2I_reg_regStub(const convF2I_reg_regNode* node, PhaseRegAlloc* ra) : _node(node), ra_(ra) {}
        int max_size() const { return 23; }
        void emit(C2_MacroAssembler& masm);
    };

And the corresponding node's `emit` method has an additional section:

    void convF2I_reg_regNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
        cbuf.set_insts_mark();
        convF2I_reg_regStub* stub = new (Compile::current()->comp_arena()) convF2I_reg_regStub(this, ra_);
        if (!Compile::current()->output()->in_scratch_emit_size()) {
            Compile::current()->output()->add_stub(stub);
        }
        ...
    }

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

PR Comment: https://git.openjdk.org/jdk/pull/13602#issuecomment-1519131633


More information about the hotspot-compiler-dev mailing list