1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
161 #define HAS_VALID_MEMORY_TYPE(flags)((flags & mt_masks) != mtNone)
162 #define FLAGS_TO_MEMORY_TYPE(flags) (flags & mt_masks)
163
164 #define IS_ARENA_OBJ(flags) ((flags & ot_masks) == otArena)
165 #define IS_NMT_RECORDER(flags) ((flags & ot_masks) == otNMTRecorder)
166 #define NMT_CAN_TRACK(flags) (!IS_NMT_RECORDER(flags) && !(IS_MEMORY_TYPE(flags, mtDontTrack)))
167
168 typedef unsigned short MEMFLAGS;
169
170 #if INCLUDE_NMT
171
172 extern bool NMT_track_callsite;
173
174 #else
175
176 const bool NMT_track_callsite = false;
177
178 #endif // INCLUDE_NMT
179
180 // debug build does not inline
181 #if defined(_DEBUG_)
182 #define CURRENT_PC (NMT_track_callsite ? os::get_caller_pc(1) : 0)
183 #define CALLER_PC (NMT_track_callsite ? os::get_caller_pc(2) : 0)
184 #define CALLER_CALLER_PC (NMT_track_callsite ? os::get_caller_pc(3) : 0)
185 #else
186 #define CURRENT_PC (NMT_track_callsite? os::get_caller_pc(0) : 0)
187 #define CALLER_PC (NMT_track_callsite ? os::get_caller_pc(1) : 0)
188 #define CALLER_CALLER_PC (NMT_track_callsite ? os::get_caller_pc(2) : 0)
189 #endif
190
191
192
193 template <MEMFLAGS F> class CHeapObj ALLOCATION_SUPER_CLASS_SPEC {
194 public:
195 _NOINLINE_ void* operator new(size_t size, address caller_pc = 0);
196 _NOINLINE_ void* operator new (size_t size, const std::nothrow_t& nothrow_constant,
197 address caller_pc = 0);
198
199 void operator delete(void* p);
200 };
201
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
161 #define HAS_VALID_MEMORY_TYPE(flags)((flags & mt_masks) != mtNone)
162 #define FLAGS_TO_MEMORY_TYPE(flags) (flags & mt_masks)
163
164 #define IS_ARENA_OBJ(flags) ((flags & ot_masks) == otArena)
165 #define IS_NMT_RECORDER(flags) ((flags & ot_masks) == otNMTRecorder)
166 #define NMT_CAN_TRACK(flags) (!IS_NMT_RECORDER(flags) && !(IS_MEMORY_TYPE(flags, mtDontTrack)))
167
168 typedef unsigned short MEMFLAGS;
169
170 #if INCLUDE_NMT
171
172 extern bool NMT_track_callsite;
173
174 #else
175
176 const bool NMT_track_callsite = false;
177
178 #endif // INCLUDE_NMT
179
180 // debug build does not inline
181 #if defined(_NMT_NOINLINE_)
182 #define CURRENT_PC (NMT_track_callsite ? os::get_caller_pc(1) : 0)
183 #define CALLER_PC (NMT_track_callsite ? os::get_caller_pc(2) : 0)
184 #define CALLER_CALLER_PC (NMT_track_callsite ? os::get_caller_pc(3) : 0)
185 #else
186 #define CURRENT_PC (NMT_track_callsite? os::get_caller_pc(0) : 0)
187 #define CALLER_PC (NMT_track_callsite ? os::get_caller_pc(1) : 0)
188 #define CALLER_CALLER_PC (NMT_track_callsite ? os::get_caller_pc(2) : 0)
189 #endif
190
191
192
193 template <MEMFLAGS F> class CHeapObj ALLOCATION_SUPER_CLASS_SPEC {
194 public:
195 _NOINLINE_ void* operator new(size_t size, address caller_pc = 0);
196 _NOINLINE_ void* operator new (size_t size, const std::nothrow_t& nothrow_constant,
197 address caller_pc = 0);
198
199 void operator delete(void* p);
200 };
201
|