File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/asm Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -198,8 +198,24 @@ public void emitString(String s, int pos) {
198198 * including) {@code position()} is returned
199199 * @return the data in this buffer or a trimmed copy if {@code trimmedCopy} is {@code true}
200200 */
201- public byte [] close (boolean trimmedCopy ) {
201+ public final byte [] close (boolean trimmedCopy ) {
202+ return closeAligned (trimmedCopy , 0 );
203+ }
204+
205+ /**
206+ * Closes this assembler. No extra data can be written to this assembler after this call.
207+ *
208+ * @param trimmedCopy if {@code true}, then a copy of the underlying byte array up to (but not
209+ * including) {@code position()} is returned
210+ * @param alignment if {@code > 0}, then align the end of the code buffer with NOPs to the
211+ * specified alignment
212+ * @return the data in this buffer or a trimmed copy if {@code trimmedCopy} is {@code true}
213+ */
214+ public byte [] closeAligned (boolean trimmedCopy , int alignment ) {
202215 checkAndClearLabelsWithPatches ();
216+ if (alignment > 0 && position () % alignment != 0 ) {
217+ this .align (alignment );
218+ }
203219 finalCodeSize = position ();
204220 return codeBuffer .close (trimmedCopy );
205221 }
You can’t perform that action at this time.
0 commit comments