| 930 | } |
| 931 | |
| 932 | void writeStackTraces(Buffer* buf, Lookup* lookup) { |
| 933 | std::map<u32, CallTrace*> traces; |
| 934 | Profiler::instance()->_call_trace_storage.collectTraces(traces); |
| 935 | |
| 936 | writePoolHeader(buf, T_STACK_TRACE, traces.size()); |
| 937 | for (std::map<u32, CallTrace*>::const_iterator it = traces.begin(); it != traces.end(); ++it) { |
| 938 | CallTrace* trace = it->second; |
| 939 | buf->putVar32(it->first); |
| 940 | buf->putVar32(0); // truncated |
| 941 | buf->putVar32(trace->num_frames); |
| 942 | for (int i = 0; i < trace->num_frames; i++) { |
| 943 | MethodInfo* mi = lookup->resolveMethod(trace->frames[i]); |
| 944 | buf->putVar32(mi->_key); |
| 945 | if (mi->_type == FRAME_INTERPRETED) { |
| 946 | jint bci = trace->frames[i].bci; |
| 947 | FrameTypeId type = FrameType::decode(bci); |
| 948 | bci = (bci & 0x10000) ? 0 : (bci & 0xffff); |
| 949 | buf->putVar32(mi->getLineNumber(bci)); |
| 950 | buf->putVar32(bci); |
| 951 | buf->put8(type); |
| 952 | } else { |
| 953 | buf->put8(0); |
| 954 | buf->put8(0); |
| 955 | buf->put8(mi->_type); |
| 956 | } |
| 957 | flushIfNeeded(buf); |
| 958 | } |
| 959 | flushIfNeeded(buf); |
| 960 | } |
| 961 | } |
| 962 | |
| 963 | void writeMethods(Buffer* buf, Lookup* lookup) { |
| 964 | MethodMap* method_map = lookup->_method_map; |
nothing calls this directly
no test coverage detected