mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8008314: Unimplemented() Atomic::load breaks the applications
Jlong atomics isn't fully implemented om all 32-bit platforms so we try to avoid it. In this case the atomic add wasn't needed. Reviewed-by: dholmes, dlong
This commit is contained in:
parent
1d1641be2f
commit
ceb2baae92
3 changed files with 22 additions and 10 deletions
|
@ -431,7 +431,7 @@ rotatingFileStream::~rotatingFileStream() {
|
|||
|
||||
rotatingFileStream::rotatingFileStream(const char* file_name) {
|
||||
_cur_file_num = 0;
|
||||
_bytes_writen = 0L;
|
||||
_bytes_written = 0L;
|
||||
_file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal);
|
||||
jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num);
|
||||
_file = fopen(_file_name, "w");
|
||||
|
@ -440,7 +440,7 @@ rotatingFileStream::rotatingFileStream(const char* file_name) {
|
|||
|
||||
rotatingFileStream::rotatingFileStream(const char* file_name, const char* opentype) {
|
||||
_cur_file_num = 0;
|
||||
_bytes_writen = 0L;
|
||||
_bytes_written = 0L;
|
||||
_file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal);
|
||||
jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num);
|
||||
_file = fopen(_file_name, opentype);
|
||||
|
@ -448,10 +448,9 @@ rotatingFileStream::rotatingFileStream(const char* file_name, const char* openty
|
|||
}
|
||||
|
||||
void rotatingFileStream::write(const char* s, size_t len) {
|
||||
if (_file != NULL) {
|
||||
// Make an unused local variable to avoid warning from gcc 4.x compiler.
|
||||
if (_file != NULL) {
|
||||
size_t count = fwrite(s, 1, len, _file);
|
||||
Atomic::add((jlong)count, &_bytes_writen);
|
||||
_bytes_written += count;
|
||||
}
|
||||
update_position(s, len);
|
||||
}
|
||||
|
@ -465,7 +464,10 @@ void rotatingFileStream::write(const char* s, size_t len) {
|
|||
// concurrent GC threads to run parallel with VMThread at safepoint, write and rotate_log
|
||||
// must be synchronized.
|
||||
void rotatingFileStream::rotate_log() {
|
||||
if (_bytes_writen < (jlong)GCLogFileSize) return;
|
||||
if (_bytes_written < (jlong)GCLogFileSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
Thread *thread = Thread::current();
|
||||
assert(thread == NULL ||
|
||||
|
@ -475,7 +477,7 @@ void rotatingFileStream::rotate_log() {
|
|||
if (NumberOfGCLogFiles == 1) {
|
||||
// rotate in same file
|
||||
rewind();
|
||||
_bytes_writen = 0L;
|
||||
_bytes_written = 0L;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -491,7 +493,7 @@ void rotatingFileStream::rotate_log() {
|
|||
}
|
||||
_file = fopen(_file_name, "w");
|
||||
if (_file != NULL) {
|
||||
_bytes_writen = 0L;
|
||||
_bytes_written = 0L;
|
||||
_need_close = true;
|
||||
} else {
|
||||
tty->print_cr("failed to open rotation log file %s due to %s\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue