src/cpu/x86/vm/c1_MacroAssembler_x86.cpp

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #include "precompiled.hpp"
aoqi@0 26 #include "c1/c1_MacroAssembler.hpp"
aoqi@0 27 #include "c1/c1_Runtime1.hpp"
aoqi@0 28 #include "classfile/systemDictionary.hpp"
aoqi@0 29 #include "gc_interface/collectedHeap.hpp"
aoqi@0 30 #include "interpreter/interpreter.hpp"
aoqi@0 31 #include "oops/arrayOop.hpp"
aoqi@0 32 #include "oops/markOop.hpp"
aoqi@0 33 #include "runtime/basicLock.hpp"
aoqi@0 34 #include "runtime/biasedLocking.hpp"
aoqi@0 35 #include "runtime/os.hpp"
aoqi@0 36 #include "runtime/stubRoutines.hpp"
aoqi@0 37
aoqi@0 38 int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register scratch, Label& slow_case) {
aoqi@0 39 const int aligned_mask = BytesPerWord -1;
aoqi@0 40 const int hdr_offset = oopDesc::mark_offset_in_bytes();
aoqi@0 41 assert(hdr == rax, "hdr must be rax, for the cmpxchg instruction");
aoqi@0 42 assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");
aoqi@0 43 Label done;
aoqi@0 44 int null_check_offset = -1;
aoqi@0 45
aoqi@0 46 verify_oop(obj);
aoqi@0 47
aoqi@0 48 // save object being locked into the BasicObjectLock
aoqi@0 49 movptr(Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()), obj);
aoqi@0 50
aoqi@0 51 if (UseBiasedLocking) {
aoqi@0 52 assert(scratch != noreg, "should have scratch register at this point");
aoqi@0 53 null_check_offset = biased_locking_enter(disp_hdr, obj, hdr, scratch, false, done, &slow_case);
aoqi@0 54 } else {
aoqi@0 55 null_check_offset = offset();
aoqi@0 56 }
aoqi@0 57
aoqi@0 58 // Load object header
aoqi@0 59 movptr(hdr, Address(obj, hdr_offset));
aoqi@0 60 // and mark it as unlocked
aoqi@0 61 orptr(hdr, markOopDesc::unlocked_value);
aoqi@0 62 // save unlocked object header into the displaced header location on the stack
aoqi@0 63 movptr(Address(disp_hdr, 0), hdr);
aoqi@0 64 // test if object header is still the same (i.e. unlocked), and if so, store the
aoqi@0 65 // displaced header address in the object header - if it is not the same, get the
aoqi@0 66 // object header instead
aoqi@0 67 if (os::is_MP()) MacroAssembler::lock(); // must be immediately before cmpxchg!
aoqi@0 68 cmpxchgptr(disp_hdr, Address(obj, hdr_offset));
aoqi@0 69 // if the object header was the same, we're done
aoqi@0 70 if (PrintBiasedLockingStatistics) {
aoqi@0 71 cond_inc32(Assembler::equal,
aoqi@0 72 ExternalAddress((address)BiasedLocking::fast_path_entry_count_addr()));
aoqi@0 73 }
aoqi@0 74 jcc(Assembler::equal, done);
aoqi@0 75 // if the object header was not the same, it is now in the hdr register
aoqi@0 76 // => test if it is a stack pointer into the same stack (recursive locking), i.e.:
aoqi@0 77 //
aoqi@0 78 // 1) (hdr & aligned_mask) == 0
aoqi@0 79 // 2) rsp <= hdr
aoqi@0 80 // 3) hdr <= rsp + page_size
aoqi@0 81 //
aoqi@0 82 // these 3 tests can be done by evaluating the following expression:
aoqi@0 83 //
aoqi@0 84 // (hdr - rsp) & (aligned_mask - page_size)
aoqi@0 85 //
aoqi@0 86 // assuming both the stack pointer and page_size have their least
aoqi@0 87 // significant 2 bits cleared and page_size is a power of 2
aoqi@0 88 subptr(hdr, rsp);
aoqi@0 89 andptr(hdr, aligned_mask - os::vm_page_size());
aoqi@0 90 // for recursive locking, the result is zero => save it in the displaced header
aoqi@0 91 // location (NULL in the displaced hdr location indicates recursive locking)
aoqi@0 92 movptr(Address(disp_hdr, 0), hdr);
aoqi@0 93 // otherwise we don't care about the result and handle locking via runtime call
aoqi@0 94 jcc(Assembler::notZero, slow_case);
aoqi@0 95 // done
aoqi@0 96 bind(done);
aoqi@0 97 return null_check_offset;
aoqi@0 98 }
aoqi@0 99
aoqi@0 100
aoqi@0 101 void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
aoqi@0 102 const int aligned_mask = BytesPerWord -1;
aoqi@0 103 const int hdr_offset = oopDesc::mark_offset_in_bytes();
aoqi@0 104 assert(disp_hdr == rax, "disp_hdr must be rax, for the cmpxchg instruction");
aoqi@0 105 assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");
aoqi@0 106 Label done;
aoqi@0 107
aoqi@0 108 if (UseBiasedLocking) {
aoqi@0 109 // load object
aoqi@0 110 movptr(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
aoqi@0 111 biased_locking_exit(obj, hdr, done);
aoqi@0 112 }
aoqi@0 113
aoqi@0 114 // load displaced header
aoqi@0 115 movptr(hdr, Address(disp_hdr, 0));
aoqi@0 116 // if the loaded hdr is NULL we had recursive locking
aoqi@0 117 testptr(hdr, hdr);
aoqi@0 118 // if we had recursive locking, we are done
aoqi@0 119 jcc(Assembler::zero, done);
aoqi@0 120 if (!UseBiasedLocking) {
aoqi@0 121 // load object
aoqi@0 122 movptr(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
aoqi@0 123 }
aoqi@0 124 verify_oop(obj);
aoqi@0 125 // test if object header is pointing to the displaced header, and if so, restore
aoqi@0 126 // the displaced header in the object - if the object header is not pointing to
aoqi@0 127 // the displaced header, get the object header instead
aoqi@0 128 if (os::is_MP()) MacroAssembler::lock(); // must be immediately before cmpxchg!
aoqi@0 129 cmpxchgptr(hdr, Address(obj, hdr_offset));
aoqi@0 130 // if the object header was not pointing to the displaced header,
aoqi@0 131 // we do unlocking via runtime call
aoqi@0 132 jcc(Assembler::notEqual, slow_case);
aoqi@0 133 // done
aoqi@0 134 bind(done);
aoqi@0 135 }
aoqi@0 136
aoqi@0 137
aoqi@0 138 // Defines obj, preserves var_size_in_bytes
aoqi@0 139 void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, Label& slow_case) {
aoqi@0 140 if (UseTLAB) {
aoqi@0 141 tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
aoqi@0 142 } else {
aoqi@0 143 eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
aoqi@0 144 incr_allocated_bytes(noreg, var_size_in_bytes, con_size_in_bytes, t1);
aoqi@0 145 }
aoqi@0 146 }
aoqi@0 147
aoqi@0 148
aoqi@0 149 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
aoqi@0 150 assert_different_registers(obj, klass, len);
aoqi@0 151 if (UseBiasedLocking && !len->is_valid()) {
aoqi@0 152 assert_different_registers(obj, klass, len, t1, t2);
aoqi@0 153 movptr(t1, Address(klass, Klass::prototype_header_offset()));
aoqi@0 154 movptr(Address(obj, oopDesc::mark_offset_in_bytes()), t1);
aoqi@0 155 } else {
aoqi@0 156 // This assumes that all prototype bits fit in an int32_t
aoqi@0 157 movptr(Address(obj, oopDesc::mark_offset_in_bytes ()), (int32_t)(intptr_t)markOopDesc::prototype());
aoqi@0 158 }
aoqi@0 159 #ifdef _LP64
aoqi@0 160 if (UseCompressedClassPointers) { // Take care not to kill klass
aoqi@0 161 movptr(t1, klass);
aoqi@0 162 encode_klass_not_null(t1);
aoqi@0 163 movl(Address(obj, oopDesc::klass_offset_in_bytes()), t1);
aoqi@0 164 } else
aoqi@0 165 #endif
aoqi@0 166 {
aoqi@0 167 movptr(Address(obj, oopDesc::klass_offset_in_bytes()), klass);
aoqi@0 168 }
aoqi@0 169
aoqi@0 170 if (len->is_valid()) {
aoqi@0 171 movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len);
aoqi@0 172 }
aoqi@0 173 #ifdef _LP64
aoqi@0 174 else if (UseCompressedClassPointers) {
aoqi@0 175 xorptr(t1, t1);
aoqi@0 176 store_klass_gap(obj, t1);
aoqi@0 177 }
aoqi@0 178 #endif
aoqi@0 179 }
aoqi@0 180
aoqi@0 181
aoqi@0 182 // preserves obj, destroys len_in_bytes
aoqi@0 183 void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1) {
aoqi@0 184 Label done;
aoqi@0 185 assert(obj != len_in_bytes && obj != t1 && t1 != len_in_bytes, "registers must be different");
aoqi@0 186 assert((hdr_size_in_bytes & (BytesPerWord - 1)) == 0, "header size is not a multiple of BytesPerWord");
aoqi@0 187 Register index = len_in_bytes;
aoqi@0 188 // index is positive and ptr sized
aoqi@0 189 subptr(index, hdr_size_in_bytes);
aoqi@0 190 jcc(Assembler::zero, done);
aoqi@0 191 // initialize topmost word, divide index by 2, check if odd and test if zero
aoqi@0 192 // note: for the remaining code to work, index must be a multiple of BytesPerWord
aoqi@0 193 #ifdef ASSERT
aoqi@0 194 { Label L;
aoqi@0 195 testptr(index, BytesPerWord - 1);
aoqi@0 196 jcc(Assembler::zero, L);
aoqi@0 197 stop("index is not a multiple of BytesPerWord");
aoqi@0 198 bind(L);
aoqi@0 199 }
aoqi@0 200 #endif
aoqi@0 201 xorptr(t1, t1); // use _zero reg to clear memory (shorter code)
aoqi@0 202 if (UseIncDec) {
aoqi@0 203 shrptr(index, 3); // divide by 8/16 and set carry flag if bit 2 was set
aoqi@0 204 } else {
aoqi@0 205 shrptr(index, 2); // use 2 instructions to avoid partial flag stall
aoqi@0 206 shrptr(index, 1);
aoqi@0 207 }
aoqi@0 208 #ifndef _LP64
aoqi@0 209 // index could have been not a multiple of 8 (i.e., bit 2 was set)
aoqi@0 210 { Label even;
aoqi@0 211 // note: if index was a multiple of 8, than it cannot
aoqi@0 212 // be 0 now otherwise it must have been 0 before
aoqi@0 213 // => if it is even, we don't need to check for 0 again
aoqi@0 214 jcc(Assembler::carryClear, even);
aoqi@0 215 // clear topmost word (no jump needed if conditional assignment would work here)
aoqi@0 216 movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - 0*BytesPerWord), t1);
aoqi@0 217 // index could be 0 now, need to check again
aoqi@0 218 jcc(Assembler::zero, done);
aoqi@0 219 bind(even);
aoqi@0 220 }
aoqi@0 221 #endif // !_LP64
aoqi@0 222 // initialize remaining object fields: rdx is a multiple of 2 now
aoqi@0 223 { Label loop;
aoqi@0 224 bind(loop);
aoqi@0 225 movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - 1*BytesPerWord), t1);
aoqi@0 226 NOT_LP64(movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - 2*BytesPerWord), t1);)
aoqi@0 227 decrement(index);
aoqi@0 228 jcc(Assembler::notZero, loop);
aoqi@0 229 }
aoqi@0 230
aoqi@0 231 // done
aoqi@0 232 bind(done);
aoqi@0 233 }
aoqi@0 234
aoqi@0 235
aoqi@0 236 void C1_MacroAssembler::allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case) {
aoqi@0 237 assert(obj == rax, "obj must be in rax, for cmpxchg");
aoqi@0 238 assert_different_registers(obj, t1, t2); // XXX really?
aoqi@0 239 assert(header_size >= 0 && object_size >= header_size, "illegal sizes");
aoqi@0 240
aoqi@0 241 try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case);
aoqi@0 242
aoqi@0 243 initialize_object(obj, klass, noreg, object_size * HeapWordSize, t1, t2);
aoqi@0 244 }
aoqi@0 245
aoqi@0 246 void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2) {
aoqi@0 247 assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0,
aoqi@0 248 "con_size_in_bytes is not multiple of alignment");
aoqi@0 249 const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
aoqi@0 250
aoqi@0 251 initialize_header(obj, klass, noreg, t1, t2);
aoqi@0 252
aoqi@0 253 // clear rest of allocated space
aoqi@0 254 const Register t1_zero = t1;
aoqi@0 255 const Register index = t2;
aoqi@0 256 const int threshold = 6 * BytesPerWord; // approximate break even point for code size (see comments below)
aoqi@0 257 if (var_size_in_bytes != noreg) {
aoqi@0 258 mov(index, var_size_in_bytes);
aoqi@0 259 initialize_body(obj, index, hdr_size_in_bytes, t1_zero);
aoqi@0 260 } else if (con_size_in_bytes <= threshold) {
aoqi@0 261 // use explicit null stores
aoqi@0 262 // code size = 2 + 3*n bytes (n = number of fields to clear)
aoqi@0 263 xorptr(t1_zero, t1_zero); // use t1_zero reg to clear memory (shorter code)
aoqi@0 264 for (int i = hdr_size_in_bytes; i < con_size_in_bytes; i += BytesPerWord)
aoqi@0 265 movptr(Address(obj, i), t1_zero);
aoqi@0 266 } else if (con_size_in_bytes > hdr_size_in_bytes) {
aoqi@0 267 // use loop to null out the fields
aoqi@0 268 // code size = 16 bytes for even n (n = number of fields to clear)
aoqi@0 269 // initialize last object field first if odd number of fields
aoqi@0 270 xorptr(t1_zero, t1_zero); // use t1_zero reg to clear memory (shorter code)
aoqi@0 271 movptr(index, (con_size_in_bytes - hdr_size_in_bytes) >> 3);
aoqi@0 272 // initialize last object field if constant size is odd
aoqi@0 273 if (((con_size_in_bytes - hdr_size_in_bytes) & 4) != 0)
aoqi@0 274 movptr(Address(obj, con_size_in_bytes - (1*BytesPerWord)), t1_zero);
aoqi@0 275 // initialize remaining object fields: rdx is a multiple of 2
aoqi@0 276 { Label loop;
aoqi@0 277 bind(loop);
aoqi@0 278 movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - (1*BytesPerWord)),
aoqi@0 279 t1_zero);
aoqi@0 280 NOT_LP64(movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - (2*BytesPerWord)),
aoqi@0 281 t1_zero);)
aoqi@0 282 decrement(index);
aoqi@0 283 jcc(Assembler::notZero, loop);
aoqi@0 284 }
aoqi@0 285 }
aoqi@0 286
aoqi@0 287 if (CURRENT_ENV->dtrace_alloc_probes()) {
aoqi@0 288 assert(obj == rax, "must be");
aoqi@0 289 call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
aoqi@0 290 }
aoqi@0 291
aoqi@0 292 verify_oop(obj);
aoqi@0 293 }
aoqi@0 294
aoqi@0 295 void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case) {
aoqi@0 296 assert(obj == rax, "obj must be in rax, for cmpxchg");
aoqi@0 297 assert_different_registers(obj, len, t1, t2, klass);
aoqi@0 298
aoqi@0 299 // determine alignment mask
aoqi@0 300 assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
aoqi@0 301
aoqi@0 302 // check for negative or excessive length
aoqi@0 303 cmpptr(len, (int32_t)max_array_allocation_length);
aoqi@0 304 jcc(Assembler::above, slow_case);
aoqi@0 305
aoqi@0 306 const Register arr_size = t2; // okay to be the same
aoqi@0 307 // align object end
aoqi@0 308 movptr(arr_size, (int32_t)header_size * BytesPerWord + MinObjAlignmentInBytesMask);
aoqi@0 309 lea(arr_size, Address(arr_size, len, f));
aoqi@0 310 andptr(arr_size, ~MinObjAlignmentInBytesMask);
aoqi@0 311
aoqi@0 312 try_allocate(obj, arr_size, 0, t1, t2, slow_case);
aoqi@0 313
aoqi@0 314 initialize_header(obj, klass, len, t1, t2);
aoqi@0 315
aoqi@0 316 // clear rest of allocated space
aoqi@0 317 const Register len_zero = len;
aoqi@0 318 initialize_body(obj, arr_size, header_size * BytesPerWord, len_zero);
aoqi@0 319
aoqi@0 320 if (CURRENT_ENV->dtrace_alloc_probes()) {
aoqi@0 321 assert(obj == rax, "must be");
aoqi@0 322 call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
aoqi@0 323 }
aoqi@0 324
aoqi@0 325 verify_oop(obj);
aoqi@0 326 }
aoqi@0 327
aoqi@0 328
aoqi@0 329
aoqi@0 330 void C1_MacroAssembler::inline_cache_check(Register receiver, Register iCache) {
aoqi@0 331 verify_oop(receiver);
aoqi@0 332 // explicit NULL check not needed since load from [klass_offset] causes a trap
aoqi@0 333 // check against inline cache
aoqi@0 334 assert(!MacroAssembler::needs_explicit_null_check(oopDesc::klass_offset_in_bytes()), "must add explicit null check");
aoqi@0 335 int start_offset = offset();
aoqi@0 336
aoqi@0 337 if (UseCompressedClassPointers) {
aoqi@0 338 load_klass(rscratch1, receiver);
aoqi@0 339 cmpptr(rscratch1, iCache);
aoqi@0 340 } else {
aoqi@0 341 cmpptr(iCache, Address(receiver, oopDesc::klass_offset_in_bytes()));
aoqi@0 342 }
aoqi@0 343 // if icache check fails, then jump to runtime routine
aoqi@0 344 // Note: RECEIVER must still contain the receiver!
aoqi@0 345 jump_cc(Assembler::notEqual,
aoqi@0 346 RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
aoqi@0 347 const int ic_cmp_size = LP64_ONLY(10) NOT_LP64(9);
aoqi@0 348 assert(UseCompressedClassPointers || offset() - start_offset == ic_cmp_size, "check alignment in emit_method_entry");
aoqi@0 349 }
aoqi@0 350
aoqi@0 351
aoqi@0 352 void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes) {
aoqi@0 353 assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
aoqi@0 354 // Make sure there is enough stack space for this method's activation.
aoqi@0 355 // Note that we do this before doing an enter(). This matches the
aoqi@0 356 // ordering of C2's stack overflow check / rsp decrement and allows
aoqi@0 357 // the SharedRuntime stack overflow handling to be consistent
aoqi@0 358 // between the two compilers.
aoqi@0 359 generate_stack_overflow_check(bang_size_in_bytes);
aoqi@0 360
aoqi@0 361 push(rbp);
aoqi@0 362 #ifdef TIERED
aoqi@0 363 // c2 leaves fpu stack dirty. Clean it on entry
aoqi@0 364 if (UseSSE < 2 ) {
aoqi@0 365 empty_FPU_stack();
aoqi@0 366 }
aoqi@0 367 #endif // TIERED
aoqi@0 368 decrement(rsp, frame_size_in_bytes); // does not emit code for frame_size == 0
aoqi@0 369 }
aoqi@0 370
aoqi@0 371
aoqi@0 372 void C1_MacroAssembler::remove_frame(int frame_size_in_bytes) {
aoqi@0 373 increment(rsp, frame_size_in_bytes); // Does not emit code for frame_size == 0
aoqi@0 374 pop(rbp);
aoqi@0 375 }
aoqi@0 376
aoqi@0 377
aoqi@0 378 void C1_MacroAssembler::unverified_entry(Register receiver, Register ic_klass) {
aoqi@0 379 if (C1Breakpoint) int3();
aoqi@0 380 inline_cache_check(receiver, ic_klass);
aoqi@0 381 }
aoqi@0 382
aoqi@0 383
aoqi@0 384 void C1_MacroAssembler::verified_entry() {
aoqi@0 385 if (C1Breakpoint || VerifyFPU || !UseStackBanging) {
aoqi@0 386 // Verified Entry first instruction should be 5 bytes long for correct
aoqi@0 387 // patching by patch_verified_entry().
aoqi@0 388 //
aoqi@0 389 // C1Breakpoint and VerifyFPU have one byte first instruction.
aoqi@0 390 // Also first instruction will be one byte "push(rbp)" if stack banging
aoqi@0 391 // code is not generated (see build_frame() above).
aoqi@0 392 // For all these cases generate long instruction first.
aoqi@0 393 fat_nop();
aoqi@0 394 }
aoqi@0 395 if (C1Breakpoint)int3();
aoqi@0 396 // build frame
aoqi@0 397 verify_FPU(0, "method_entry");
aoqi@0 398 }
aoqi@0 399
aoqi@0 400
aoqi@0 401 #ifndef PRODUCT
aoqi@0 402
aoqi@0 403 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
aoqi@0 404 if (!VerifyOops) return;
aoqi@0 405 verify_oop_addr(Address(rsp, stack_offset));
aoqi@0 406 }
aoqi@0 407
aoqi@0 408 void C1_MacroAssembler::verify_not_null_oop(Register r) {
aoqi@0 409 if (!VerifyOops) return;
aoqi@0 410 Label not_null;
aoqi@0 411 testptr(r, r);
aoqi@0 412 jcc(Assembler::notZero, not_null);
aoqi@0 413 stop("non-null oop required");
aoqi@0 414 bind(not_null);
aoqi@0 415 verify_oop(r);
aoqi@0 416 }
aoqi@0 417
aoqi@0 418 void C1_MacroAssembler::invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) {
aoqi@0 419 #ifdef ASSERT
aoqi@0 420 if (inv_rax) movptr(rax, 0xDEAD);
aoqi@0 421 if (inv_rbx) movptr(rbx, 0xDEAD);
aoqi@0 422 if (inv_rcx) movptr(rcx, 0xDEAD);
aoqi@0 423 if (inv_rdx) movptr(rdx, 0xDEAD);
aoqi@0 424 if (inv_rsi) movptr(rsi, 0xDEAD);
aoqi@0 425 if (inv_rdi) movptr(rdi, 0xDEAD);
aoqi@0 426 #endif
aoqi@0 427 }
aoqi@0 428
aoqi@0 429 #endif // ifndef PRODUCT

mercurial