src/share/vm/oops/oop.cpp

Thu, 14 Jun 2018 09:15:08 -0700

author
kevinw
date
Thu, 14 Jun 2018 09:15:08 -0700
changeset 9327
f96fcd9e1e1b
parent 6680
78bbf4d43a14
child 9448
73d689add964
child 10008
fd3484fadbe3
permissions
-rw-r--r--

8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
Summary: Need to add a space between macro identifier and string literal
Reviewed-by: bpittore, stefank, dholmes, kbarrett

duke@435 1 /*
minqi@6351 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
coleenp@4037 26 #include "classfile/altHashing.hpp"
stefank@2314 27 #include "classfile/javaClasses.hpp"
stefank@2314 28 #include "oops/oop.inline.hpp"
stefank@2314 29 #include "runtime/handles.inline.hpp"
stefank@4299 30 #include "runtime/thread.inline.hpp"
stefank@2314 31 #include "utilities/copy.hpp"
duke@435 32
drchase@6680 33 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
drchase@6680 34
duke@435 35 bool always_do_update_barrier = false;
duke@435 36
duke@435 37 BarrierSet* oopDesc::_bs = NULL;
duke@435 38
duke@435 39 void oopDesc::print_on(outputStream* st) const {
duke@435 40 if (this == NULL) {
duke@435 41 st->print_cr("NULL");
duke@435 42 } else {
coleenp@4037 43 klass()->oop_print_on(oop(this), st);
duke@435 44 }
duke@435 45 }
duke@435 46
duke@435 47 void oopDesc::print_address_on(outputStream* st) const {
duke@435 48 if (PrintOopAddress) {
kevinw@9327 49 st->print("{" INTPTR_FORMAT "}", this);
duke@435 50 }
duke@435 51 }
duke@435 52
duke@435 53 void oopDesc::print() { print_on(tty); }
duke@435 54
duke@435 55 void oopDesc::print_address() { print_address_on(tty); }
duke@435 56
duke@435 57 char* oopDesc::print_string() {
jrose@1590 58 stringStream st;
jrose@1590 59 print_on(&st);
jrose@1590 60 return st.as_string();
jrose@1590 61 }
jrose@1590 62
jrose@1590 63 void oopDesc::print_value() {
jrose@1590 64 print_value_on(tty);
duke@435 65 }
duke@435 66
duke@435 67 char* oopDesc::print_value_string() {
jrose@1590 68 char buf[100];
jrose@1590 69 stringStream st(buf, sizeof(buf));
jrose@1590 70 print_value_on(&st);
jrose@1590 71 return st.as_string();
duke@435 72 }
duke@435 73
jrose@1590 74 void oopDesc::print_value_on(outputStream* st) const {
jrose@1590 75 oop obj = oop(this);
jrose@1590 76 if (this == NULL) {
jrose@1590 77 st->print("NULL");
jrose@1590 78 } else if (java_lang_String::is_instance(obj)) {
jrose@1590 79 java_lang_String::print(obj, st);
jrose@1590 80 if (PrintOopAddress) print_address_on(st);
jrose@1590 81 } else {
coleenp@4037 82 klass()->oop_print_value_on(obj, st);
jrose@1590 83 }
jrose@1590 84 }
jrose@1590 85
duke@435 86
duke@435 87 void oopDesc::verify_on(outputStream* st) {
duke@435 88 if (this != NULL) {
coleenp@4037 89 klass()->oop_verify_on(this, st);
duke@435 90 }
duke@435 91 }
duke@435 92
duke@435 93
duke@435 94 void oopDesc::verify() {
duke@435 95 verify_on(tty);
duke@435 96 }
duke@435 97
duke@435 98 intptr_t oopDesc::slow_identity_hash() {
duke@435 99 // slow case; we have to acquire the micro lock in order to locate the header
duke@435 100 ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
duke@435 101 HandleMark hm;
coleenp@4037 102 Handle object(this);
duke@435 103 return ObjectSynchronizer::identity_hash_value_for(object);
duke@435 104 }
duke@435 105
coleenp@4037 106 // When String table needs to rehash
minqi@6351 107 unsigned int oopDesc::new_hash(juint seed) {
hseigel@4987 108 EXCEPTION_MARK;
coleenp@4037 109 ResourceMark rm;
coleenp@4037 110 int length;
hseigel@4987 111 jchar* chars = java_lang_String::as_unicode_string(this, length, THREAD);
hseigel@4987 112 if (chars != NULL) {
hseigel@4987 113 // Use alternate hashing algorithm on the string
hseigel@4987 114 return AltHashing::murmur3_32(seed, chars, length);
hseigel@4987 115 } else {
ccheung@4993 116 vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "unable to create Unicode strings for String table rehash");
hseigel@4987 117 return 0;
hseigel@4987 118 }
coleenp@4037 119 }
coleenp@4037 120
duke@435 121 VerifyOopClosure VerifyOopClosure::verify_oop;
coleenp@548 122
coleenp@548 123 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
coleenp@548 124 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }

mercurial