< prev index next >

src/hotspot/share/asm/assembler.cpp

Print this page
rev 52354 : 8213199: GC abstraction for Assembler::needs_explicit_null_check()


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/codeBuffer.hpp"
  27 #include "asm/macroAssembler.hpp"
  28 #include "asm/macroAssembler.inline.hpp"

  29 #include "runtime/atomic.hpp"
  30 #include "runtime/icache.hpp"
  31 #include "runtime/os.hpp"
  32 #include "runtime/thread.hpp"
  33 
  34 
  35 // Implementation of AbstractAssembler
  36 //
  37 // The AbstractAssembler is generating code into a CodeBuffer. To make code generation faster,
  38 // the assembler keeps a copy of the code buffers boundaries & modifies them when
  39 // emitting bytes rather than using the code buffers accessor functions all the time.
  40 // The code buffer is updated via set_code_end(...) after emitting a whole instruction.
  41 
  42 AbstractAssembler::AbstractAssembler(CodeBuffer* code) {
  43   if (code == NULL)  return;
  44   CodeSection* cs = code->insts();
  45   cs->clear_mark();   // new assembler kills old mark
  46   if (cs->start() == NULL)  {
  47     vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "CodeCache: no room for %s", code->name());
  48   }


 291   return &dcon->value;
 292 }
 293 void AbstractAssembler::update_delayed_values() {
 294   DelayedConstant::update_all();
 295 }
 296 
 297 void AbstractAssembler::block_comment(const char* comment) {
 298   if (sect() == CodeBuffer::SECT_INSTS) {
 299     code_section()->outer()->block_comment(offset(), comment);
 300   }
 301 }
 302 
 303 const char* AbstractAssembler::code_string(const char* str) {
 304   if (sect() == CodeBuffer::SECT_INSTS || sect() == CodeBuffer::SECT_STUBS) {
 305     return code_section()->outer()->code_string(str);
 306   }
 307   return NULL;
 308 }
 309 
 310 bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
 311   // Exception handler checks the nmethod's implicit null checks table
 312   // only when this method returns false.
 313 #ifdef _LP64
 314   if (UseCompressedOops && Universe::narrow_oop_base() != NULL) {
 315     assert (Universe::heap() != NULL, "java heap should be initialized");
 316     // The first page after heap_base is unmapped and
 317     // the 'offset' is equal to [heap_base + offset] for
 318     // narrow oop implicit null checks.
 319     uintptr_t base = (uintptr_t)Universe::narrow_oop_base();
 320     if ((uintptr_t)offset >= base) {
 321       // Normalize offset for the next check.
 322       offset = (intptr_t)(pointer_delta((void*)offset, (void*)base, 1));
 323     }
 324   }
 325 #endif
 326   return offset < 0 || os::vm_page_size() <= offset;
 327 }


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/codeBuffer.hpp"
  27 #include "asm/macroAssembler.hpp"
  28 #include "asm/macroAssembler.inline.hpp"
  29 #include "gc/shared/barrierSetAssembler.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/icache.hpp"
  32 #include "runtime/os.hpp"
  33 #include "runtime/thread.hpp"
  34 
  35 
  36 // Implementation of AbstractAssembler
  37 //
  38 // The AbstractAssembler is generating code into a CodeBuffer. To make code generation faster,
  39 // the assembler keeps a copy of the code buffers boundaries & modifies them when
  40 // emitting bytes rather than using the code buffers accessor functions all the time.
  41 // The code buffer is updated via set_code_end(...) after emitting a whole instruction.
  42 
  43 AbstractAssembler::AbstractAssembler(CodeBuffer* code) {
  44   if (code == NULL)  return;
  45   CodeSection* cs = code->insts();
  46   cs->clear_mark();   // new assembler kills old mark
  47   if (cs->start() == NULL)  {
  48     vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "CodeCache: no room for %s", code->name());
  49   }


 292   return &dcon->value;
 293 }
 294 void AbstractAssembler::update_delayed_values() {
 295   DelayedConstant::update_all();
 296 }
 297 
 298 void AbstractAssembler::block_comment(const char* comment) {
 299   if (sect() == CodeBuffer::SECT_INSTS) {
 300     code_section()->outer()->block_comment(offset(), comment);
 301   }
 302 }
 303 
 304 const char* AbstractAssembler::code_string(const char* str) {
 305   if (sect() == CodeBuffer::SECT_INSTS || sect() == CodeBuffer::SECT_STUBS) {
 306     return code_section()->outer()->code_string(str);
 307   }
 308   return NULL;
 309 }
 310 
 311 bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
 312   return BarrierSet::barrier_set()->barrier_set_assembler()->needs_explicit_null_check(offset);















 313 }
< prev index next >