1 /* |
1 /* |
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2013, 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. |
64 virtual int oop_size(oop obj) const; |
64 virtual int oop_size(oop obj) const; |
65 |
65 |
66 // Static field offset is an offset into the Heap, should be converted by |
66 // Static field offset is an offset into the Heap, should be converted by |
67 // based on UseCompressedOop for traversal |
67 // based on UseCompressedOop for traversal |
68 static HeapWord* start_of_static_fields(oop obj) { |
68 static HeapWord* start_of_static_fields(oop obj) { |
69 return (HeapWord*)((intptr_t)obj + offset_of_static_fields()); |
69 return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields()); |
70 } |
70 } |
71 |
71 |
72 static void init_offset_of_static_fields() { |
72 static void init_offset_of_static_fields() { |
73 // Cache the offset of the static fields in the Class instance |
73 // Cache the offset of the static fields in the Class instance |
74 assert(_offset_of_static_fields == 0, "once"); |
74 assert(_offset_of_static_fields == 0, "once"); |