src/hotspot/share/prims/unsafe.cpp
changeset 49041 44122f767467
parent 49036 bc92debe57e4
child 49192 6734eeef4283
equal deleted inserted replaced
49040:079d100b3d0e 49041:44122f767467
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   107 
   107 
   108   if (p != NULL) {
   108   if (p != NULL) {
   109     assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset");
   109     assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset");
   110     if (byte_offset == (jint)byte_offset) {
   110     if (byte_offset == (jint)byte_offset) {
   111       void* ptr_plus_disp = (address)p + byte_offset;
   111       void* ptr_plus_disp = (address)p + byte_offset;
   112       assert((void*)p->obj_field_addr<oop>((jint)byte_offset) == ptr_plus_disp,
   112       assert(p->field_addr_raw((jint)byte_offset) == ptr_plus_disp,
   113              "raw [ptr+disp] must be consistent with oop::field_base");
   113              "raw [ptr+disp] must be consistent with oop::field_addr_raw");
   114     }
   114     }
   115     jlong p_size = HeapWordSize * (jlong)(p->size());
   115     jlong p_size = HeapWordSize * (jlong)(p->size());
   116     assert(byte_offset < p_size, "Unsafe access: offset " INT64_FORMAT " > object's size " INT64_FORMAT, (int64_t)byte_offset, (int64_t)p_size);
   116     assert(byte_offset < p_size, "Unsafe access: offset " INT64_FORMAT " > object's size " INT64_FORMAT, (int64_t)byte_offset, (int64_t)p_size);
   117   }
   117   }
   118 #endif
   118 #endif