src/hotspot/share/asm/codeBuffer.cpp
changeset 51078 fc6cfe40e32a
parent 49594 898ef81cbc0e
child 54010 17fb726e6d8e
equal deleted inserted replaced
51077:9baa91bc7567 51078:fc6cfe40e32a
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   185   relocInfo* new_locs_limit = cs->locs_end();
   185   relocInfo* new_locs_limit = cs->locs_end();
   186   // Patch the limits.
   186   // Patch the limits.
   187   cs->_limit = new_limit;
   187   cs->_limit = new_limit;
   188   cs->_locs_limit = new_locs_limit;
   188   cs->_locs_limit = new_locs_limit;
   189   cs->_frozen = true;
   189   cs->_frozen = true;
   190   if (!next_cs->is_allocated() && !next_cs->is_frozen()) {
   190   if (next_cs != NULL && !next_cs->is_allocated() && !next_cs->is_frozen()) {
   191     // Give remaining buffer space to the following section.
   191     // Give remaining buffer space to the following section.
   192     next_cs->initialize(new_limit, old_limit - new_limit);
   192     next_cs->initialize(new_limit, old_limit - new_limit);
   193     next_cs->initialize_shared_locs(new_locs_limit,
   193     next_cs->initialize_shared_locs(new_locs_limit,
   194                                     old_locs_limit - new_locs_limit);
   194                                     old_locs_limit - new_locs_limit);
   195   }
   195   }
   492     CodeSection* dest_cs = dest->code_section(n);
   492     CodeSection* dest_cs = dest->code_section(n);
   493     if (!cs->is_empty()) {
   493     if (!cs->is_empty()) {
   494       // Compute initial padding; assign it to the previous non-empty guy.
   494       // Compute initial padding; assign it to the previous non-empty guy.
   495       // Cf. figure_expanded_capacities.
   495       // Cf. figure_expanded_capacities.
   496       csize_t padding = cs->align_at_start(buf_offset) - buf_offset;
   496       csize_t padding = cs->align_at_start(buf_offset) - buf_offset;
   497       if (padding != 0) {
   497       if (prev_dest_cs != NULL) {
   498         buf_offset += padding;
   498         if (padding != 0) {
   499         assert(prev_dest_cs != NULL, "sanity");
   499           buf_offset += padding;
   500         prev_dest_cs->_limit += padding;
   500           prev_dest_cs->_limit += padding;
       
   501         }
       
   502       } else {
       
   503         guarantee(padding == 0, "In first iteration no padding should be needed.");
   501       }
   504       }
   502       #ifdef ASSERT
   505       #ifdef ASSERT
   503       if (prev_cs != NULL && prev_cs->is_frozen() && n < (SECT_LIMIT - 1)) {
   506       if (prev_cs != NULL && prev_cs->is_frozen() && n < (SECT_LIMIT - 1)) {
   504         // Make sure the ends still match up.
   507         // Make sure the ends still match up.
   505         // This is important because a branch in a frozen section
   508         // This is important because a branch in a frozen section