equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, 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. |
24 |
24 |
25 |
25 |
26 #include "precompiled.hpp" |
26 #include "precompiled.hpp" |
27 #include "classfile/altHashing.hpp" |
27 #include "classfile/altHashing.hpp" |
28 #include "classfile/classLoaderData.hpp" |
28 #include "classfile/classLoaderData.hpp" |
|
29 #include "logging/log.hpp" |
|
30 #include "logging/logStream.hpp" |
29 #include "memory/allocation.inline.hpp" |
31 #include "memory/allocation.inline.hpp" |
30 #include "memory/resourceArea.hpp" |
32 #include "memory/resourceArea.hpp" |
31 #include "oops/symbol.hpp" |
33 #include "oops/symbol.hpp" |
32 #include "runtime/atomic.hpp" |
34 #include "runtime/atomic.hpp" |
33 #include "runtime/os.hpp" |
35 #include "runtime/os.hpp" |
48 } |
50 } |
49 |
51 |
50 void* Symbol::operator new(size_t sz, int len, Arena* arena, TRAPS) throw() { |
52 void* Symbol::operator new(size_t sz, int len, Arena* arena, TRAPS) throw() { |
51 int alloc_size = size(len)*wordSize; |
53 int alloc_size = size(len)*wordSize; |
52 address res = (address)arena->Amalloc_4(alloc_size); |
54 address res = (address)arena->Amalloc_4(alloc_size); |
53 return res; |
|
54 } |
|
55 |
|
56 void* Symbol::operator new(size_t sz, int len, ClassLoaderData* loader_data, TRAPS) throw() { |
|
57 address res; |
|
58 res = (address) Metaspace::allocate(loader_data, size(len), true, |
|
59 MetaspaceObj::SymbolType, CHECK_NULL); |
|
60 return res; |
55 return res; |
61 } |
56 } |
62 |
57 |
63 void Symbol::operator delete(void *p) { |
58 void Symbol::operator delete(void *p) { |
64 assert(((Symbol*)p)->refcount() == 0, "should not call this"); |
59 assert(((Symbol*)p)->refcount() == 0, "should not call this"); |
233 #endif |
228 #endif |
234 (void)new_value; |
229 (void)new_value; |
235 } |
230 } |
236 } |
231 } |
237 |
232 |
|
233 void Symbol::metaspace_pointers_do(MetaspaceClosure* it) { |
|
234 if (log_is_enabled(Trace, cds)) { |
|
235 LogStream trace_stream(Log(cds)::trace()); |
|
236 trace_stream.print("Iter(Symbol): %p ", this); |
|
237 print_value_on(&trace_stream); |
|
238 trace_stream.cr(); |
|
239 } |
|
240 } |
|
241 |
238 void Symbol::print_on(outputStream* st) const { |
242 void Symbol::print_on(outputStream* st) const { |
239 if (this == NULL) { |
243 if (this == NULL) { |
240 st->print_cr("NULL"); |
244 st->print_cr("NULL"); |
241 } else { |
245 } else { |
242 st->print("Symbol: '"); |
246 st->print("Symbol: '"); |