1 /* |
1 /* |
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
3 * Copyright 2012, 2014 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
319 } else { |
319 } else { |
320 ld(d, offs, s1); |
320 ld(d, offs, s1); |
321 } |
321 } |
322 } |
322 } |
323 |
323 |
|
324 inline void MacroAssembler::store_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1, Register tmp) { |
|
325 if (UseCompressedOops) { |
|
326 Register compressedOop = encode_heap_oop_not_null((tmp != noreg) ? tmp : d, d); |
|
327 stw(compressedOop, offs, s1); |
|
328 } else { |
|
329 std(d, offs, s1); |
|
330 } |
|
331 } |
|
332 |
324 inline void MacroAssembler::load_heap_oop(Register d, RegisterOrConstant offs, Register s1) { |
333 inline void MacroAssembler::load_heap_oop(Register d, RegisterOrConstant offs, Register s1) { |
325 if (UseCompressedOops) { |
334 if (UseCompressedOops) { |
326 lwz(d, offs, s1); |
335 lwz(d, offs, s1); |
327 decode_heap_oop(d); |
336 decode_heap_oop(d); |
328 } else { |
337 } else { |
329 ld(d, offs, s1); |
338 ld(d, offs, s1); |
330 } |
339 } |
331 } |
340 } |
332 |
341 |
333 inline void MacroAssembler::encode_heap_oop_not_null(Register d) { |
342 inline Register MacroAssembler::encode_heap_oop_not_null(Register d, Register src) { |
|
343 Register current = (src!=noreg) ? src : d; // Compressed oop is in d if no src provided. |
334 if (Universe::narrow_oop_base() != NULL) { |
344 if (Universe::narrow_oop_base() != NULL) { |
335 sub(d, d, R30); |
345 sub(d, current, R30); |
|
346 current = d; |
336 } |
347 } |
337 if (Universe::narrow_oop_shift() != 0) { |
348 if (Universe::narrow_oop_shift() != 0) { |
338 srdi(d, d, LogMinObjAlignmentInBytes); |
349 srdi(d, current, LogMinObjAlignmentInBytes); |
339 } |
350 current = d; |
|
351 } |
|
352 return current; // Encoded oop is in this register. |
340 } |
353 } |
341 |
354 |
342 inline void MacroAssembler::decode_heap_oop_not_null(Register d) { |
355 inline void MacroAssembler::decode_heap_oop_not_null(Register d) { |
343 if (Universe::narrow_oop_shift() != 0) { |
356 if (Universe::narrow_oop_shift() != 0) { |
344 assert (LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong"); |
357 assert (LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong"); |