1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
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
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
437 }
438 #else
439 if (is_signed == Signed) {
440 lwa(Rdst, offset, Rsrc);
441 } else {
442 lwz(Rdst, offset, Rsrc);
443 }
444 #endif
445 }
446
447 // Load object from cpool->resolved_references(index).
448 void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index, Label *is_null) {
449 assert_different_registers(result, index);
450 get_constant_pool(result);
451
452 // Convert from field index to resolved_references() index and from
453 // word index to byte offset. Since this is a java object, it can be compressed.
454 Register tmp = index; // reuse
455 sldi(tmp, index, LogBytesPerHeapOop);
456 // Load pointer for resolved_references[] objArray.
457 ld(result, ConstantPool::resolved_references_offset_in_bytes(), result);
458 // JNIHandles::resolve(result)
459 ld(result, 0, result);
460 #ifdef ASSERT
461 Label index_ok;
462 lwa(R0, arrayOopDesc::length_offset_in_bytes(), result);
463 sldi(R0, R0, LogBytesPerHeapOop);
464 cmpd(CCR0, tmp, R0);
465 blt(CCR0, index_ok);
466 stop("resolved reference index out of bounds", 0x09256);
467 bind(index_ok);
468 #endif
469 // Add in the index.
470 add(result, tmp, result);
471 load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result, is_null);
472 }
473
474 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
475 // a subtype of super_klass. Blows registers Rsub_klass, tmp1, tmp2.
476 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass, Register Rtmp1,
477 Register Rtmp2, Register Rtmp3, Label &ok_is_subtype) {
|
1 /*
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
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
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
437 }
438 #else
439 if (is_signed == Signed) {
440 lwa(Rdst, offset, Rsrc);
441 } else {
442 lwz(Rdst, offset, Rsrc);
443 }
444 #endif
445 }
446
447 // Load object from cpool->resolved_references(index).
448 void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index, Label *is_null) {
449 assert_different_registers(result, index);
450 get_constant_pool(result);
451
452 // Convert from field index to resolved_references() index and from
453 // word index to byte offset. Since this is a java object, it can be compressed.
454 Register tmp = index; // reuse
455 sldi(tmp, index, LogBytesPerHeapOop);
456 // Load pointer for resolved_references[] objArray.
457 ld(result, ConstantPool::cache_offset_in_bytes(), result);
458 ld(result, ConstantPoolCache::resolved_references_offset_in_bytes(), result);
459 // JNIHandles::resolve(result)
460 ld(result, 0, result);
461 #ifdef ASSERT
462 Label index_ok;
463 lwa(R0, arrayOopDesc::length_offset_in_bytes(), result);
464 sldi(R0, R0, LogBytesPerHeapOop);
465 cmpd(CCR0, tmp, R0);
466 blt(CCR0, index_ok);
467 stop("resolved reference index out of bounds", 0x09256);
468 bind(index_ok);
469 #endif
470 // Add in the index.
471 add(result, tmp, result);
472 load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result, is_null);
473 }
474
475 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
476 // a subtype of super_klass. Blows registers Rsub_klass, tmp1, tmp2.
477 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass, Register Rtmp1,
478 Register Rtmp2, Register Rtmp3, Label &ok_is_subtype) {
|