< prev index next >

src/cpu/s390/vm/interp_masm_s390.cpp

Print this page
rev 12860 : imported patch 8171392_constantpool_ro.v3.patch
rev 12861 : ppc64 addons for 8171392: make contant pool read-only
   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.
  23  *


 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);
 396     add2reg_with_index(cache, in_bytes(ConstantPoolCache::base_offset()), tmp, cache);
 397   BLOCK_COMMENT("}");
 398 }
 399 
 400 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
 401 // a subtype of super_klass. Blows registers Rsuper_klass, Rsub_klass, tmp1, tmp2.
 402 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
 403                                                   Register Rsuper_klass,
 404                                                   Register Rtmp1,
 405                                                   Register Rtmp2,
 406                                                   Label &ok_is_subtype) {
 407   // Profile the not-null value's klass.


   1 /*
   2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016, 2017 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.
  23  *


 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 // load cpool->resolved_klass_at(index)
 391 void InterpreterMacroAssembler::load_resolved_klass_at_offset(Register cpool, Register offset, Register iklass) {
 392   // int value = *(Rcpool->int_at_addr(which));
 393   // int resolved_klass_index = extract_low_short_from_int(value);
 394   z_llgh(offset, Address(cpool, offset, sizeof(ConstantPool) + 2)); // offset = resolved_klass_index (s390 is big-endian)
 395   z_sllg(offset, offset, LogBytesPerWord);                          // Convert 'index' to 'offset'
 396   z_lg(iklass, Address(cpool, ConstantPool::resolved_klasses_offset_in_bytes())); // iklass = cpool->_resolved_klasses
 397   z_lg(iklass, Address(iklass, offset, Array<Klass*>::base_offset_in_bytes()));
 398 }
 399 
 400 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache,
 401                                                                Register tmp,
 402                                                                int bcp_offset,
 403                                                                size_t index_size) {
 404   BLOCK_COMMENT("get_cache_entry_pointer_at_bcp {");
 405     get_cache_and_index_at_bcp(cache, tmp, bcp_offset, index_size);
 406     add2reg_with_index(cache, in_bytes(ConstantPoolCache::base_offset()), tmp, cache);
 407   BLOCK_COMMENT("}");
 408 }
 409 
 410 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
 411 // a subtype of super_klass. Blows registers Rsuper_klass, Rsub_klass, tmp1, tmp2.
 412 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
 413                                                   Register Rsuper_klass,
 414                                                   Register Rtmp1,
 415                                                   Register Rtmp2,
 416                                                   Label &ok_is_subtype) {
 417   // Profile the not-null value's klass.


< prev index next >