mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-26 22:31:14 +00:00
return unchanged if linker result is same
This commit is contained in:
parent
2f2e469110
commit
0ca98f5e7f
@ -91,6 +91,7 @@ window methods:
|
||||
- global symbols
|
||||
- pixel editor / find comment (openBitmapEditorAtCursor)
|
||||
- update debug window (200 ms)
|
||||
- inspect variable
|
||||
|
||||
file store mirrors that on worker
|
||||
|
||||
|
@ -6,7 +6,6 @@ function installErrorHandler() {
|
||||
window.onerror = function (msgevent, url, line, col, error) {
|
||||
console.log(msgevent, url, line, col);
|
||||
console.log(error);
|
||||
//$("#editor").hide();
|
||||
if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
ga('send', 'exception', {
|
||||
'exDescription': msgevent + " " + url + " " + " " + line + ":" + col + ", " + error,
|
||||
@ -388,12 +387,6 @@ function updateSelector() {
|
||||
sel.off('change').change(function(e) {
|
||||
gotoPresetNamed($(this).val());
|
||||
});
|
||||
$("#preset_prev").off('click').click(function() {
|
||||
gotoPresetAt(current_preset_index - 1);
|
||||
});
|
||||
$("#preset_next").off('click').click(function() {
|
||||
gotoPresetAt(current_preset_index + 1);
|
||||
});
|
||||
}
|
||||
|
||||
function loadFileDependencies(text, callback) {
|
||||
@ -493,6 +486,7 @@ function setCompileOutput(data) {
|
||||
current_output = null;
|
||||
} else {
|
||||
// load ROM
|
||||
// TODO: don't have to compare anymore; worker does it
|
||||
var rom = data.output;
|
||||
var rom_changed = false;
|
||||
if (rom && rom.code)
|
||||
@ -1256,6 +1250,7 @@ var qs = (function (a) {
|
||||
return b;
|
||||
})(window.location.search.substr(1).split('&'));
|
||||
|
||||
// TODO: what if multiple files/tools?
|
||||
function preloadWorker(fileid) {
|
||||
var tool = platform.getToolForFilename(fileid);
|
||||
if (tool) worker.postMessage({preload:tool, platform:platform_id});
|
||||
|
@ -131,8 +131,9 @@ function endtime(msg) { _t2 = new Date(); console.log(msg, _t2.getTime() - _t1.g
|
||||
/// working file store and build steps
|
||||
|
||||
var buildsteps = [];
|
||||
var buildstartseq = 0;
|
||||
var workfs = {};
|
||||
var workerseq = 1;
|
||||
var workerseq = 0;
|
||||
|
||||
function compareData(a,b) {
|
||||
if (a.length != b.length) return false;
|
||||
@ -151,12 +152,23 @@ function putWorkFile(path, data) {
|
||||
var encoding = (typeof data === 'string') ? 'utf8' : 'binary';
|
||||
var entry = workfs[path];
|
||||
if (!entry || !compareData(entry.data, data) || entry.encoding != encoding) {
|
||||
workfs[path] = entry = {path:path, data:data, encoding:encoding, ts:workerseq++};
|
||||
workfs[path] = entry = {path:path, data:data, encoding:encoding, ts:++workerseq};
|
||||
console.log('+++', entry.path, entry.encoding, entry.data.length, entry.ts);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
// returns true if file changed during this build step
|
||||
function wasChanged(entry) {
|
||||
return entry.ts > buildstartseq;
|
||||
}
|
||||
|
||||
/*function anyFilesChanged() {
|
||||
for (var key in workfs)
|
||||
if (wasChanged(workfs[key])) return true;
|
||||
return false;
|
||||
}*/
|
||||
|
||||
function populateEntry(fs, path, entry) {
|
||||
fs.writeFile(path, entry.data, {encoding:entry.encoding});
|
||||
fs.utime(path, entry.ts, entry.ts);
|
||||
@ -207,6 +219,7 @@ function populateFiles(step, fs, options) {
|
||||
|
||||
function staleFiles(step, targets) {
|
||||
if (!step.maxts) throw "call populateFiles() first";
|
||||
// see if any target files are more recent than inputs
|
||||
for (var i=0; i<targets.length; i++) {
|
||||
var entry = workfs[targets[i]];
|
||||
if (!entry || step.maxts > entry.ts)
|
||||
@ -606,6 +619,12 @@ function linkLD65(step) {
|
||||
var aout = FS.readFile("main", {encoding:'binary'});
|
||||
var mapout = FS.readFile("main.map", {encoding:'utf8'});
|
||||
var viceout = FS.readFile("main.vice", {encoding:'utf8'});
|
||||
putWorkFile("main", aout);
|
||||
putWorkFile("main.map", mapout);
|
||||
putWorkFile("main.vice", viceout);
|
||||
// return unchanged if no files changed
|
||||
if (!staleFiles(step, ["main", "main.map", "main.vice"]))
|
||||
return;
|
||||
// parse symbol map (TODO: omit segments, constants)
|
||||
var symbolmap = {};
|
||||
for (var s of viceout.split("\n")) {
|
||||
@ -629,9 +648,6 @@ function linkLD65(step) {
|
||||
};
|
||||
}
|
||||
}
|
||||
putWorkFile("main", aout);
|
||||
putWorkFile("main.map", mapout);
|
||||
putWorkFile("main.vice", viceout);
|
||||
return {
|
||||
output:aout, //.slice(0),
|
||||
listings:listings,
|
||||
@ -811,6 +827,12 @@ function linkSDLDZ80(step)
|
||||
execMain(step, LDZ80, args);
|
||||
var hexout = FS.readFile("main.ihx", {encoding:'utf8'});
|
||||
var mapout = FS.readFile("main.noi", {encoding:'utf8'});
|
||||
putWorkFile("main.ihx", hexout);
|
||||
putWorkFile("main.noi", mapout);
|
||||
// return unchanged if no files changed
|
||||
if (!staleFiles(step, ["main.ihx", "main.noi"]))
|
||||
return;
|
||||
|
||||
var listings = {};
|
||||
for (var fn of step.files) {
|
||||
if (fn.endsWith('.lst')) {
|
||||
@ -834,7 +856,6 @@ function linkSDLDZ80(step)
|
||||
symbolmap[toks[1]] = parseInt(toks[2], 16);
|
||||
}
|
||||
}
|
||||
putWorkFile("main.ihx", hexout);
|
||||
return {
|
||||
output:parseIHX(hexout, params.rom_start?params.rom_start:params.code_start, params.rom_size),
|
||||
listings:listings,
|
||||
@ -1218,6 +1239,7 @@ var TOOL_PRELOADFS = {
|
||||
}
|
||||
|
||||
function executeBuildSteps() {
|
||||
buildstartseq = workerseq;
|
||||
while (buildsteps.length) {
|
||||
var step = buildsteps.shift(); // get top of array
|
||||
var code = step.code;
|
||||
|
Loading…
Reference in New Issue
Block a user