Skip to content

Commit

Permalink
fix: fix a bug where it crashes when loading some gem5 traces
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyadan committed Feb 25, 2020
1 parent ebade7a commit ea028f9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions op_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class OpListPage {
/** @type {Buffer} */
this.compressedData_ = null;
this.isCompressed_ = false;

}

getOp(id) {
Expand Down Expand Up @@ -237,9 +236,14 @@ class OpList {
let head = pageIndexToID(pageIndex);
for (let i = 0; i < PAGE_SIZE; i += CACHE_RESOLUTION) {
let op = this.getParsedOp(head + i);
// 一回 JSON にして戻すとかなり容量が減るため
op = JSON.parse(JSON.stringify(op));
this.cache_[head + i] = op;
if (op) {
// GEM5 の場合,まれに歯抜けになっていることがある
// 中身がからの場合,JSON にできずにエラーになる

// 一回 JSON にして戻すとかなり容量が減るため
op = JSON.parse(JSON.stringify(op));
this.cache_[head + i] = op;
}
}
}
this.opPages_[pageIndex].compress();
Expand Down

0 comments on commit ea028f9

Please sign in to comment.