1 /*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 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.
354 const int off_in_DW = (8-1) - (1+byte_no);
355 assert(ConstantPoolCacheEntry::bytecode_1_mask == ConstantPoolCacheEntry::bytecode_2_mask, "common mask");
356 assert(ConstantPoolCacheEntry::bytecode_1_mask == 0xff, "");
357 load_sized_value(bytecode, Address(cache, cpe_offset, base_ix_off+off_in_DW), 1, false /*signed*/);
358
359 BLOCK_COMMENT("}");
360 }
361
362 // Load object from cpool->resolved_references(index).
363 void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index) {
364 assert_different_registers(result, index);
365 get_constant_pool(result);
366
367 // Convert
368 // - from field index to resolved_references() index and
369 // - from word index to byte offset.
370 // Since this is a java object, it is potentially compressed.
371 Register tmp = index; // reuse
372 z_sllg(index, index, LogBytesPerHeapOop); // Offset into resolved references array.
373 // Load pointer for resolved_references[] objArray.
374 z_lg(result, ConstantPool::resolved_references_offset_in_bytes(), result);
375 // JNIHandles::resolve(result)
376 z_lg(result, 0, result); // Load resolved references array itself.
377 #ifdef ASSERT
378 NearLabel index_ok;
379 z_lgf(Z_R0, Address(result, arrayOopDesc::length_offset_in_bytes()));
380 z_sllg(Z_R0, Z_R0, LogBytesPerHeapOop);
381 compare64_and_branch(tmp, Z_R0, Assembler::bcondLow, index_ok);
382 stop("resolved reference index out of bounds", 0x09256);
383 bind(index_ok);
384 #endif
385 z_agr(result, index); // Address of indexed array element.
386 load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result);
387 }
388
389 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache,
390 Register tmp,
391 int bcp_offset,
392 size_t index_size) {
393 BLOCK_COMMENT("get_cache_entry_pointer_at_bcp {");
394 get_cache_and_index_at_bcp(cache, tmp, bcp_offset, index_size);
|
1 /*
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 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.
354 const int off_in_DW = (8-1) - (1+byte_no);
355 assert(ConstantPoolCacheEntry::bytecode_1_mask == ConstantPoolCacheEntry::bytecode_2_mask, "common mask");
356 assert(ConstantPoolCacheEntry::bytecode_1_mask == 0xff, "");
357 load_sized_value(bytecode, Address(cache, cpe_offset, base_ix_off+off_in_DW), 1, false /*signed*/);
358
359 BLOCK_COMMENT("}");
360 }
361
362 // Load object from cpool->resolved_references(index).
363 void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index) {
364 assert_different_registers(result, index);
365 get_constant_pool(result);
366
367 // Convert
368 // - from field index to resolved_references() index and
369 // - from word index to byte offset.
370 // Since this is a java object, it is potentially compressed.
371 Register tmp = index; // reuse
372 z_sllg(index, index, LogBytesPerHeapOop); // Offset into resolved references array.
373 // Load pointer for resolved_references[] objArray.
374 z_lg(result, ConstantPool::cache_offset_in_bytes(), result);
375 z_lg(result, ConstantPoolCache::resolved_references_offset_in_bytes(), result);
376 // JNIHandles::resolve(result)
377 z_lg(result, 0, result); // Load resolved references array itself.
378 #ifdef ASSERT
379 NearLabel index_ok;
380 z_lgf(Z_R0, Address(result, arrayOopDesc::length_offset_in_bytes()));
381 z_sllg(Z_R0, Z_R0, LogBytesPerHeapOop);
382 compare64_and_branch(tmp, Z_R0, Assembler::bcondLow, index_ok);
383 stop("resolved reference index out of bounds", 0x09256);
384 bind(index_ok);
385 #endif
386 z_agr(result, index); // Address of indexed array element.
387 load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result);
388 }
389
390 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache,
391 Register tmp,
392 int bcp_offset,
393 size_t index_size) {
394 BLOCK_COMMENT("get_cache_entry_pointer_at_bcp {");
395 get_cache_and_index_at_bcp(cache, tmp, bcp_offset, index_size);
|