< prev index next >

src/hotspot/share/opto/c2_CodeStubs.hpp

Print this page

  1 /*
  2  * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 80     _safepoint_offset(safepoint_offset) {}
 81   int max_size() const;
 82   void emit(C2_MacroAssembler& masm);
 83 };
 84 
 85 // We move non-hot code of the nmethod entry barrier to an out-of-line stub
 86 class C2EntryBarrierStub: public C2CodeStub {
 87 private:
 88   Label _guard; // Used on AArch64 and RISCV
 89 
 90 public:
 91   C2EntryBarrierStub() : C2CodeStub(),
 92     _guard() {}
 93 
 94   Label& guard() { return _guard; }
 95 
 96   int max_size() const;
 97   void emit(C2_MacroAssembler& masm);
 98 };
 99 




















100 #ifdef _LP64
101 class C2HandleAnonOMOwnerStub : public C2CodeStub {
102 private:
103   Register _monitor;
104   Register _tmp;
105 public:
106   C2HandleAnonOMOwnerStub(Register monitor, Register tmp = noreg) : C2CodeStub(),
107     _monitor(monitor), _tmp(tmp) {}
108   Register monitor() { return _monitor; }
109   Register tmp() { return _tmp; }
110   int max_size() const;
111   void emit(C2_MacroAssembler& masm);
112 };
113 #endif










114 
115 //-----------------------------C2GeneralStub-----------------------------------
116 // A generalized stub that can be used to implement an arbitrary stub in a
117 // type-safe manner. An example:
118 //
119 // Register dst; XMMRegister src;
120 // // The lambda defining how the code is emitted in the stub
121 // auto slowpath = [](C2_MacroAssembler& masm, C2GeneralStub<Register, XMMRegister>& stub) {
122 //   // Access the saved data in a type safe manner
123 //   Register dst = stub.get<0>();
124 //   XMMRegister src = stub.get<1>();
125 //   masm.bind(stub.entry());
126 //   ...
127 //   masm.jump(stub.continuation());
128 // }
129 // // Create a stub with 2 data fields being dst and src, a max size of 4 bytes
130 // // and predefined emission function
131 // auto stub = C2CodeStub::make<Register, XMMRegister>(dst, src, 4, slowpath);
132 // __ jump_conditional(stub->entry());
133 // ...

  1 /*
  2  * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 80     _safepoint_offset(safepoint_offset) {}
 81   int max_size() const;
 82   void emit(C2_MacroAssembler& masm);
 83 };
 84 
 85 // We move non-hot code of the nmethod entry barrier to an out-of-line stub
 86 class C2EntryBarrierStub: public C2CodeStub {
 87 private:
 88   Label _guard; // Used on AArch64 and RISCV
 89 
 90 public:
 91   C2EntryBarrierStub() : C2CodeStub(),
 92     _guard() {}
 93 
 94   Label& guard() { return _guard; }
 95 
 96   int max_size() const;
 97   void emit(C2_MacroAssembler& masm);
 98 };
 99 
100 class C2FastUnlockLightweightStub : public C2CodeStub {
101 private:
102   Register _obj;
103   Register _mark;
104   Register _t;
105   Register _thread;
106   Label _push_and_slow_path;
107   Label _check_successor;
108   Label _unlocked_continuation;
109 public:
110   C2FastUnlockLightweightStub(Register obj, Register mark, Register t, Register thread) : C2CodeStub(),
111     _obj(obj), _mark(mark), _t(t), _thread(thread) {}
112   int max_size() const;
113   void emit(C2_MacroAssembler& masm);
114   Label& push_and_slow_path() { return _push_and_slow_path; }
115   Label& check_successor() { return _check_successor; }
116   Label& unlocked_continuation() { return _unlocked_continuation; }
117   Label& slow_path_continuation() { return continuation(); }
118 };
119 
120 #ifdef _LP64
121 class C2HandleAnonOMOwnerStub : public C2CodeStub {
122 private:
123   Register _monitor;
124   Register _tmp;
125 public:
126   C2HandleAnonOMOwnerStub(Register monitor, Register tmp = noreg) : C2CodeStub(),
127     _monitor(monitor), _tmp(tmp) {}
128   Register monitor() { return _monitor; }
129   Register tmp() { return _tmp; }
130   int max_size() const;
131   void emit(C2_MacroAssembler& masm);
132 };
133 
134 class C2LoadNKlassStub : public C2CodeStub {
135 private:
136   Register _dst;
137 public:
138   C2LoadNKlassStub(Register dst) : C2CodeStub(), _dst(dst) {}
139   Register dst() { return _dst; }
140   int max_size() const;
141   void emit(C2_MacroAssembler& masm);
142 };
143 #endif // _LP64
144 
145 //-----------------------------C2GeneralStub-----------------------------------
146 // A generalized stub that can be used to implement an arbitrary stub in a
147 // type-safe manner. An example:
148 //
149 // Register dst; XMMRegister src;
150 // // The lambda defining how the code is emitted in the stub
151 // auto slowpath = [](C2_MacroAssembler& masm, C2GeneralStub<Register, XMMRegister>& stub) {
152 //   // Access the saved data in a type safe manner
153 //   Register dst = stub.get<0>();
154 //   XMMRegister src = stub.get<1>();
155 //   masm.bind(stub.entry());
156 //   ...
157 //   masm.jump(stub.continuation());
158 // }
159 // // Create a stub with 2 data fields being dst and src, a max size of 4 bytes
160 // // and predefined emission function
161 // auto stub = C2CodeStub::make<Register, XMMRegister>(dst, src, 4, slowpath);
162 // __ jump_conditional(stub->entry());
163 // ...
< prev index next >