src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File c1-coops Sdiff src/cpu/sparc/vm

src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp

Print this page




  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_MacroAssembler.hpp"
  27 #include "c1/c1_Runtime1.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "gc_interface/collectedHeap.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "oops/arrayOop.hpp"
  32 #include "oops/markOop.hpp"
  33 #include "runtime/basicLock.hpp"
  34 #include "runtime/biasedLocking.hpp"
  35 #include "runtime/os.hpp"
  36 #include "runtime/stubRoutines.hpp"
  37 
  38 void C1_MacroAssembler::inline_cache_check(Register receiver, Register iCache) {
  39   Label L;
  40   const Register temp_reg = G3_scratch;
  41   // Note: needs more testing of out-of-line vs. inline slow case
  42   verify_oop(receiver);
  43   ld_ptr(receiver, oopDesc::klass_offset_in_bytes(), temp_reg);
  44   cmp(temp_reg, iCache);
  45   brx(Assembler::equal, true, Assembler::pt, L);
  46   delayed()->nop();
  47   AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub());
  48   jump_to(ic_miss, temp_reg);
  49   delayed()->nop();
  50   align(CodeEntryAlignment);
  51   bind(L);
  52 }
  53 
  54 
  55 void C1_MacroAssembler::explicit_null_check(Register base) {
  56   Unimplemented();
  57 }
  58 
  59 
  60 void C1_MacroAssembler::build_frame(int frame_size_in_bytes) {
  61 
  62   generate_stack_overflow_check(frame_size_in_bytes);
  63   // Create the frame.


 168   int      con_size_in_bytes,          // object size in bytes if   known at compile time
 169   Register t1,                         // temp register
 170   Register t2,                         // temp register
 171   Label&   slow_case                   // continuation point if fast allocation fails
 172 ) {
 173   if (UseTLAB) {
 174     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
 175   } else {
 176     eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
 177   }
 178 }
 179 
 180 
 181 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
 182   assert_different_registers(obj, klass, len, t1, t2);
 183   if (UseBiasedLocking && !len->is_valid()) {
 184     ld_ptr(klass, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes(), t1);
 185   } else {
 186     set((intx)markOopDesc::prototype(), t1);
 187   }
 188   st_ptr(t1  , obj, oopDesc::mark_offset_in_bytes       ());
 189   st_ptr(klass, obj, oopDesc::klass_offset_in_bytes      ());
 190   if (len->is_valid()) st(len  , obj, arrayOopDesc::length_offset_in_bytes());










 191 }
 192 
 193 
 194 void C1_MacroAssembler::initialize_body(Register base, Register index) {
 195   assert_different_registers(base, index);
 196   Label loop;
 197   bind(loop);
 198   subcc(index, HeapWordSize, index);
 199   brx(Assembler::greaterEqual, true, Assembler::pt, loop);
 200   delayed()->st_ptr(G0, base, index);
 201 }
 202 
 203 
 204 void C1_MacroAssembler::allocate_object(
 205   Register obj,                        // result: pointer to object after successful allocation
 206   Register t1,                         // temp register
 207   Register t2,                         // temp register
 208   Register t3,                         // temp register
 209   int      hdr_size,                   // object header size in words
 210   int      obj_size,                   // object size in words


 218   if (!is_simm13(obj_size * wordSize)) {
 219     // would need to use extra register to load
 220     // object size => go the slow case for now
 221     br(Assembler::always, false, Assembler::pt, slow_case);
 222     delayed()->nop();
 223     return;
 224   }
 225   try_allocate(obj, noreg, obj_size * wordSize, t2, t3, slow_case);
 226 
 227   initialize_object(obj, klass, noreg, obj_size * HeapWordSize, t1, t2);
 228 }
 229 
 230 void C1_MacroAssembler::initialize_object(
 231   Register obj,                        // result: pointer to object after successful allocation
 232   Register klass,                      // object klass
 233   Register var_size_in_bytes,          // object size in bytes if unknown at compile time; invalid otherwise
 234   int      con_size_in_bytes,          // object size in bytes if   known at compile time
 235   Register t1,                         // temp register
 236   Register t2                          // temp register
 237   ) {
 238   const int hdr_size_in_bytes = instanceOopDesc::base_offset_in_bytes();
 239 
 240   initialize_header(obj, klass, noreg, t1, t2);
 241 
 242 #ifdef ASSERT
 243   {
 244     Label ok;
 245     ld(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), t1);
 246     if (var_size_in_bytes != noreg) {
 247       cmp(t1, var_size_in_bytes);
 248     } else {
 249       cmp(t1, con_size_in_bytes);
 250     }
 251     brx(Assembler::equal, false, Assembler::pt, ok);
 252     delayed()->nop();
 253     stop("bad size in initialize_object");
 254     should_not_reach_here();
 255 
 256     bind(ok);
 257   }
 258 




  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_MacroAssembler.hpp"
  27 #include "c1/c1_Runtime1.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "gc_interface/collectedHeap.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "oops/arrayOop.hpp"
  32 #include "oops/markOop.hpp"
  33 #include "runtime/basicLock.hpp"
  34 #include "runtime/biasedLocking.hpp"
  35 #include "runtime/os.hpp"
  36 #include "runtime/stubRoutines.hpp"
  37 
  38 void C1_MacroAssembler::inline_cache_check(Register receiver, Register iCache) {
  39   Label L;
  40   const Register temp_reg = G3_scratch;
  41   // Note: needs more testing of out-of-line vs. inline slow case
  42   verify_oop(receiver);
  43   load_klass(receiver, temp_reg);
  44   cmp(temp_reg, iCache);
  45   brx(Assembler::equal, true, Assembler::pt, L);
  46   delayed()->nop();
  47   AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub());
  48   jump_to(ic_miss, temp_reg);
  49   delayed()->nop();
  50   align(CodeEntryAlignment);
  51   bind(L);
  52 }
  53 
  54 
  55 void C1_MacroAssembler::explicit_null_check(Register base) {
  56   Unimplemented();
  57 }
  58 
  59 
  60 void C1_MacroAssembler::build_frame(int frame_size_in_bytes) {
  61 
  62   generate_stack_overflow_check(frame_size_in_bytes);
  63   // Create the frame.


 168   int      con_size_in_bytes,          // object size in bytes if   known at compile time
 169   Register t1,                         // temp register
 170   Register t2,                         // temp register
 171   Label&   slow_case                   // continuation point if fast allocation fails
 172 ) {
 173   if (UseTLAB) {
 174     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
 175   } else {
 176     eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
 177   }
 178 }
 179 
 180 
 181 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
 182   assert_different_registers(obj, klass, len, t1, t2);
 183   if (UseBiasedLocking && !len->is_valid()) {
 184     ld_ptr(klass, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes(), t1);
 185   } else {
 186     set((intx)markOopDesc::prototype(), t1);
 187   }
 188   st_ptr(t1, obj, oopDesc::mark_offset_in_bytes());
 189   if (UseCompressedOops) {
 190     // Save klass
 191     mov(klass, t1);
 192     encode_heap_oop_not_null(t1);
 193     stw(t1, obj, oopDesc::klass_offset_in_bytes());
 194   } else {
 195     st_ptr(klass, obj, oopDesc::klass_offset_in_bytes());
 196   }
 197   if (len->is_valid()) st(len, obj, arrayOopDesc::length_offset_in_bytes());
 198   else if (UseCompressedOops) {
 199     store_klass_gap(G0, obj);
 200   }
 201 }
 202 
 203 
 204 void C1_MacroAssembler::initialize_body(Register base, Register index) {
 205   assert_different_registers(base, index);
 206   Label loop;
 207   bind(loop);
 208   subcc(index, HeapWordSize, index);
 209   brx(Assembler::greaterEqual, true, Assembler::pt, loop);
 210   delayed()->st_ptr(G0, base, index);
 211 }
 212 
 213 
 214 void C1_MacroAssembler::allocate_object(
 215   Register obj,                        // result: pointer to object after successful allocation
 216   Register t1,                         // temp register
 217   Register t2,                         // temp register
 218   Register t3,                         // temp register
 219   int      hdr_size,                   // object header size in words
 220   int      obj_size,                   // object size in words


 228   if (!is_simm13(obj_size * wordSize)) {
 229     // would need to use extra register to load
 230     // object size => go the slow case for now
 231     br(Assembler::always, false, Assembler::pt, slow_case);
 232     delayed()->nop();
 233     return;
 234   }
 235   try_allocate(obj, noreg, obj_size * wordSize, t2, t3, slow_case);
 236 
 237   initialize_object(obj, klass, noreg, obj_size * HeapWordSize, t1, t2);
 238 }
 239 
 240 void C1_MacroAssembler::initialize_object(
 241   Register obj,                        // result: pointer to object after successful allocation
 242   Register klass,                      // object klass
 243   Register var_size_in_bytes,          // object size in bytes if unknown at compile time; invalid otherwise
 244   int      con_size_in_bytes,          // object size in bytes if   known at compile time
 245   Register t1,                         // temp register
 246   Register t2                          // temp register
 247   ) {
 248   const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
 249 
 250   initialize_header(obj, klass, noreg, t1, t2);
 251 
 252 #ifdef ASSERT
 253   {
 254     Label ok;
 255     ld(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), t1);
 256     if (var_size_in_bytes != noreg) {
 257       cmp(t1, var_size_in_bytes);
 258     } else {
 259       cmp(t1, con_size_in_bytes);
 260     }
 261     brx(Assembler::equal, false, Assembler::pt, ok);
 262     delayed()->nop();
 263     stop("bad size in initialize_object");
 264     should_not_reach_here();
 265 
 266     bind(ok);
 267   }
 268 


src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File