32 #include "runtime/os.hpp"
33
34 CompileLog* CompileLog::_first = nullptr;
35
36 // ------------------------------------------------------------------
37 // CompileLog::CompileLog
38 CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
39 : _context(_context_buffer, sizeof(_context_buffer))
40 {
41 initialize(new(mtCompiler) fileStream(fp, true));
42 _file_end = 0;
43 _thread_id = thread_id;
44
45 _identities_limit = 0;
46 _identities_capacity = 400;
47 _identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler);
48 _file = NEW_C_HEAP_ARRAY(char, strlen(file_name)+1, mtCompiler);
49 strcpy((char*)_file, file_name);
50
51 // link into the global list
52 { MutexLocker locker(CompileTaskAlloc_lock);
53 _next = _first;
54 _first = this;
55 }
56 }
57
58 CompileLog::~CompileLog() {
59 delete _out; // Close fd in fileStream::~fileStream()
60 _out = nullptr;
61 // Remove partial file after merging in CompileLog::finish_log_on_error
62 unlink(_file);
63 FREE_C_HEAP_ARRAY(char, _identities);
64 FREE_C_HEAP_ARRAY(char, _file);
65 }
66
67
68 // see_tag, pop_tag: Override the default do-nothing methods on xmlStream.
69 // These methods provide a hook for managing the extra context markup.
70 void CompileLog::see_tag(const char* tag, bool push) {
71 if (_context.size() > 0 && _out != nullptr) {
72 _out->write(_context.base(), _context.size());
|
32 #include "runtime/os.hpp"
33
34 CompileLog* CompileLog::_first = nullptr;
35
36 // ------------------------------------------------------------------
37 // CompileLog::CompileLog
38 CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
39 : _context(_context_buffer, sizeof(_context_buffer))
40 {
41 initialize(new(mtCompiler) fileStream(fp, true));
42 _file_end = 0;
43 _thread_id = thread_id;
44
45 _identities_limit = 0;
46 _identities_capacity = 400;
47 _identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler);
48 _file = NEW_C_HEAP_ARRAY(char, strlen(file_name)+1, mtCompiler);
49 strcpy((char*)_file, file_name);
50
51 // link into the global list
52 { MonitorLocker locker(CompileTaskAlloc_lock);
53 _next = _first;
54 _first = this;
55 }
56 }
57
58 CompileLog::~CompileLog() {
59 delete _out; // Close fd in fileStream::~fileStream()
60 _out = nullptr;
61 // Remove partial file after merging in CompileLog::finish_log_on_error
62 unlink(_file);
63 FREE_C_HEAP_ARRAY(char, _identities);
64 FREE_C_HEAP_ARRAY(char, _file);
65 }
66
67
68 // see_tag, pop_tag: Override the default do-nothing methods on xmlStream.
69 // These methods provide a hook for managing the extra context markup.
70 void CompileLog::see_tag(const char* tag, bool push) {
71 if (_context.size() > 0 && _out != nullptr) {
72 _out->write(_context.base(), _context.size());
|