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 *
25 #include "precompiled.hpp"
26 #include "prims/jvm.h"
27 #include "runtime/os.hpp"
28 #include "utilities/decoder.hpp"
29 #include "utilities/vmError.hpp"
30
31 #if defined(_WINDOWS)
32 #include "decoder_windows.hpp"
33 #elif defined(__APPLE__)
34 #include "decoder_machO.hpp"
35 #elif defined(AIX)
36 #include "decoder_aix.hpp"
37 #else
38 #include "decoder_elf.hpp"
39 #endif
40
41 AbstractDecoder* Decoder::_shared_decoder = NULL;
42 AbstractDecoder* Decoder::_error_handler_decoder = NULL;
43 NullDecoder Decoder::_do_nothing_decoder;
44 Mutex* Decoder::_shared_decoder_lock = new Mutex(Mutex::native,
45 "SharedDecoderLock");
46
47 AbstractDecoder* Decoder::get_shared_instance() {
48 assert(_shared_decoder_lock != NULL && _shared_decoder_lock->owned_by_self(),
49 "Require DecoderLock to enter");
50
51 if (_shared_decoder == NULL) {
52 _shared_decoder = create_decoder();
53 }
54 return _shared_decoder;
55 }
56
57 AbstractDecoder* Decoder::get_error_handler_instance() {
58 if (_error_handler_decoder == NULL) {
59 _error_handler_decoder = create_decoder();
60 }
61 return _error_handler_decoder;
62 }
63
64
65 AbstractDecoder* Decoder::create_decoder() {
|
1 /*
2 * Copyright (c) 1997, 2014, 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 *
25 #include "precompiled.hpp"
26 #include "prims/jvm.h"
27 #include "runtime/os.hpp"
28 #include "utilities/decoder.hpp"
29 #include "utilities/vmError.hpp"
30
31 #if defined(_WINDOWS)
32 #include "decoder_windows.hpp"
33 #elif defined(__APPLE__)
34 #include "decoder_machO.hpp"
35 #elif defined(AIX)
36 #include "decoder_aix.hpp"
37 #else
38 #include "decoder_elf.hpp"
39 #endif
40
41 AbstractDecoder* Decoder::_shared_decoder = NULL;
42 AbstractDecoder* Decoder::_error_handler_decoder = NULL;
43 NullDecoder Decoder::_do_nothing_decoder;
44 Mutex* Decoder::_shared_decoder_lock = new Mutex(Mutex::native,
45 "SharedDecoderLock",
46 false,
47 Monitor::_safepoint_check_never);
48
49 AbstractDecoder* Decoder::get_shared_instance() {
50 assert(_shared_decoder_lock != NULL && _shared_decoder_lock->owned_by_self(),
51 "Require DecoderLock to enter");
52
53 if (_shared_decoder == NULL) {
54 _shared_decoder = create_decoder();
55 }
56 return _shared_decoder;
57 }
58
59 AbstractDecoder* Decoder::get_error_handler_instance() {
60 if (_error_handler_decoder == NULL) {
61 _error_handler_decoder = create_decoder();
62 }
63 return _error_handler_decoder;
64 }
65
66
67 AbstractDecoder* Decoder::create_decoder() {
|