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
49 // link into the global list
50 { MutexLocker locker(CompileTaskAlloc_lock);
51 _next = _first;
52 _first = this;
53 }
54 }
55
56 CompileLog::~CompileLog() {
57 delete _out;
58 _out = NULL;
59 FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
60 }
61
62
63 // Advance kind up to a null or space, return this tail.
64 // Make sure kind is null-terminated, not space-terminated.
65 // Use the buffer if necessary.
66 static const char* split_attrs(const char* &kind, char* buffer) {
67 const char* attrs = strchr(kind, ' ');
68 // Tease apart the first word from the rest:
69 if (attrs == NULL) {
70 return ""; // no attrs, no split
71 } else if (kind == buffer) {
72 ((char*) attrs)[-1] = 0;
73 return attrs;
74 } else {
75 // park it in the buffer, so we can put a null on the end
76 assert(!(kind >= buffer && kind < buffer+100), "not obviously in buffer");
77 int klen = attrs - kind;
78 strncpy(buffer, kind, klen);
79 buffer[klen] = 0;
80 kind = buffer; // return by reference
81 return attrs;
82 }
83 }
84
85 // see_tag, pop_tag: Override the default do-nothing methods on xmlStream.
86 // These methods provide a hook for managing the the extra context markup.
87 void CompileLog::see_tag(const char* tag, bool push) {
88 if (_context.size() > 0 && _out != NULL) {
89 _out->write(_context.base(), _context.size());
90 _context.reset();
91 }
92 xmlStream::see_tag(tag, push);
93 }
94 void CompileLog::pop_tag(const char* tag) {
95 _context.reset(); // toss any context info.
96 xmlStream::pop_tag(tag);
97 }
98
99
100 // ------------------------------------------------------------------
101 // CompileLog::identify
102 int CompileLog::identify(ciBaseObject* obj) {
103 if (obj == NULL) return 0;
104 int id = obj->ident();
|
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
49 // link into the global list
50 { MutexLocker locker(CompileTaskAlloc_lock);
51 _next = _first;
52 _first = this;
53 }
54 }
55
56 CompileLog::~CompileLog() {
57 delete _out;
58 _out = NULL;
59 FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
60 }
61
62
63 // see_tag, pop_tag: Override the default do-nothing methods on xmlStream.
64 // These methods provide a hook for managing the the extra context markup.
65 void CompileLog::see_tag(const char* tag, bool push) {
66 if (_context.size() > 0 && _out != NULL) {
67 _out->write(_context.base(), _context.size());
68 _context.reset();
69 }
70 xmlStream::see_tag(tag, push);
71 }
72 void CompileLog::pop_tag(const char* tag) {
73 _context.reset(); // toss any context info.
74 xmlStream::pop_tag(tag);
75 }
76
77
78 // ------------------------------------------------------------------
79 // CompileLog::identify
80 int CompileLog::identify(ciBaseObject* obj) {
81 if (obj == NULL) return 0;
82 int id = obj->ident();
|