Thu, 20 Nov 2008 16:56:09 -0800
6684579: SoftReference processing can be made more efficient
Summary: For current soft-ref clearing policies, we can decide at marking time if a soft-reference will definitely not be cleared, postponing the decision of whether it will definitely be cleared to the final reference processing phase. This can be especially beneficial in the case of concurrent collectors where the marking is usually concurrent but reference processing is usually not.
Reviewed-by: jmasa
1 /*
2 * Copyright 2003-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
26 class VM_ReportJavaOutOfMemory;
28 class VMError : public StackObj {
29 friend class VM_ReportJavaOutOfMemory;
31 enum ErrorType {
32 internal_error = 0xe0000000,
33 oom_error = 0xe0000001
34 };
35 int _id; // Solaris/Linux signals: 0 - SIGRTMAX
36 // Windows exceptions: 0xCxxxxxxx system errors
37 // 0x8xxxxxxx system warnings
39 const char * _message;
41 Thread * _thread; // NULL if it's native thread
44 // additional info for crashes
45 address _pc; // faulting PC
46 void * _siginfo; // ExceptionRecord on Windows,
47 // siginfo_t on Solaris/Linux
48 void * _context; // ContextRecord on Windows,
49 // ucontext_t on Solaris/Linux
51 // additional info for VM internal errors
52 const char * _filename;
53 int _lineno;
55 // used by fatal error handler
56 int _current_step;
57 const char * _current_step_info;
58 int _verbose;
60 // used by reporting about OOM
61 size_t _size;
63 // set signal handlers on Solaris/Linux or the default exception filter
64 // on Windows, to handle recursive crashes.
65 void reset_signal_handlers();
67 // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
68 void show_message_box(char* buf, int buflen);
70 // generate an error report
71 void report(outputStream* st);
73 // accessor
74 const char* message() { return _message; }
76 public:
77 // Constructor for crashes
78 VMError(Thread* thread, int sig, address pc, void* siginfo, void* context);
79 // Constructor for VM internal errors
80 VMError(Thread* thread, const char* message, const char* filename, int lineno);
82 // Constructors for VM OOM errors
83 VMError(Thread* thread, size_t size, const char* message, const char* filename, int lineno);
84 // Constructor for non-fatal errors
85 VMError(const char* message);
87 // return a string to describe the error
88 char *error_string(char* buf, int buflen);
90 // main error reporting function
91 void report_and_die();
93 // reporting OutOfMemoryError
94 void report_java_out_of_memory();
96 // returns original flags for signal, if it was resetted, or -1 if
97 // signal was not changed by error reporter
98 static int get_resetted_sigflags(int sig);
100 // returns original handler for signal, if it was resetted, or NULL if
101 // signal was not changed by error reporter
102 static address get_resetted_sighandler(int sig);
103 };