< prev index next >

src/hotspot/share/oops/instanceRefKlass.cpp

Print this page
rev 50093 : [mq]: pp2_work

*** 1,7 **** /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 28,41 **** #include "oops/instanceRefKlass.inline.hpp" #include "oops/oop.inline.hpp" void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) { // Clear the nonstatic oop-map entries corresponding to referent ! // and nextPending field. They are treated specially by the // garbage collector. - // The discovered field is used only by the garbage collector - // and is also treated specially. InstanceKlass* ik = InstanceKlass::cast(k); // Check that we have the right class debug_only(static bool first_time = true); assert(k == SystemDictionary::Reference_klass() && first_time, --- 28,39 ---- #include "oops/instanceRefKlass.inline.hpp" #include "oops/oop.inline.hpp" void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) { // Clear the nonstatic oop-map entries corresponding to referent ! // and discovered fields. They are treated specially by the // garbage collector. InstanceKlass* ik = InstanceKlass::cast(k); // Check that we have the right class debug_only(static bool first_time = true); assert(k == SystemDictionary::Reference_klass() && first_time,
*** 43,68 **** debug_only(first_time = false); assert(ik->nonstatic_oop_map_count() == 1, "just checking"); OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); ! // Check that the current map is (2,4) - currently points at field with ! // offset 2 (words) and has 4 map entries. ! debug_only(int offset = java_lang_ref_Reference::referent_offset); ! debug_only(unsigned int count = ((java_lang_ref_Reference::discovered_offset - ! java_lang_ref_Reference::referent_offset)/heapOopSize) + 1); if (UseSharedSpaces) { ! assert(map->offset() == java_lang_ref_Reference::queue_offset && ! map->count() == 1, "just checking"); } else { ! assert(map->offset() == offset && map->count() == count, ! "just checking"); ! ! // Update map to (3,1) - point to offset of 3 (words) with 1 map entry. ! map->set_offset(java_lang_ref_Reference::queue_offset); ! map->set_count(1); } } // Verification --- 41,77 ---- debug_only(first_time = false); assert(ik->nonstatic_oop_map_count() == 1, "just checking"); OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); ! #ifdef ASSERT ! // Verify fields are in the expected places. ! int referent_offset = java_lang_ref_Reference::referent_offset; ! int queue_offset = java_lang_ref_Reference::queue_offset; ! int next_offset = java_lang_ref_Reference::next_offset; ! int discovered_offset = java_lang_ref_Reference::discovered_offset; ! assert(referent_offset < queue_offset, "just checking"); ! assert(queue_offset < next_offset, "just checking"); ! assert(next_offset < discovered_offset, "just checking"); ! const unsigned int count = ! 1 + ((discovered_offset - referent_offset) / heapOopSize); ! assert(count == 4, "just checking"); ! #endif // ASSERT ! ! // Updated map starts at "queue", covers "queue" and "next". ! const int new_offset = java_lang_ref_Reference::queue_offset; ! const unsigned int new_count = 2; // queue and next + // Verify existing map is as expected, and update if needed. if (UseSharedSpaces) { ! assert(map->offset() == new_offset, "just checking"); ! assert(map->count() == new_count, "just checking"); } else { ! assert(map->offset() == referent_offset, "just checking"); ! assert(map->count() == count, "just checking"); ! map->set_offset(new_offset); ! map->set_count(new_count); } } // Verification
*** 72,82 **** // Verify referent field oop referent = java_lang_ref_Reference::referent(obj); if (referent != NULL) { guarantee(oopDesc::is_oop(referent), "referent field heap failed"); } ! // Verify next field oop next = java_lang_ref_Reference::next(obj); if (next != NULL) { guarantee(oopDesc::is_oop(next), "next field should be an oop"); guarantee(next->is_instance(), "next field should be an instance"); guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed"); --- 81,91 ---- // Verify referent field oop referent = java_lang_ref_Reference::referent(obj); if (referent != NULL) { guarantee(oopDesc::is_oop(referent), "referent field heap failed"); } ! // Additional verification for next field, which must be a Reference or null oop next = java_lang_ref_Reference::next(obj); if (next != NULL) { guarantee(oopDesc::is_oop(next), "next field should be an oop"); guarantee(next->is_instance(), "next field should be an instance"); guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed");
< prev index next >