Fixing web finish.

This commit is contained in:
Brad Nelson
2022-07-14 16:51:21 -07:00
parent 5dbf1cf8d4
commit 50e77e3b3d
5 changed files with 20 additions and 10 deletions

View File

@ -556,6 +556,9 @@ deploy: all
cd out/deploy && gcloud app deploy -q --project esp32forth *.yaml cd out/deploy && gcloud app deploy -q --project esp32forth *.yaml
cd out/deploy && gcloud app deploy -q --project eforth *.yaml cd out/deploy && gcloud app deploy -q --project eforth *.yaml
d8:
${HOME}/src/v8/v8/out/x64.release/d8 out/web/ueforth.js
# ---- INSTALL ---- # ---- INSTALL ----
install: $(POSIX)/ueforth install: $(POSIX)/ueforth

View File

@ -21,4 +21,3 @@
: >params ( xt -- n ) >flags& 2 + sw@ $ffff and ; : >params ( xt -- n ) >flags& 2 + sw@ $ffff and ;
: >size ( xt -- n ) dup >params cells swap >name-length aligned + 3 cells + ; : >size ( xt -- n ) dup >params cells swap >name-length aligned + 3 cells + ;
: >link& ( xt -- a ) 2 cells - ; : >link ( xt -- a ) >link& @ ; : >link& ( xt -- a ) 2 cells - ; : >link ( xt -- a ) >link& @ ;
: >name ( xt -- a n ) dup >name-length swap >link& over aligned - swap ;

View File

@ -12,4 +12,12 @@
\ See the License for the specific language governing permissions and \ See the License for the specific language governing permissions and
\ limitations under the License. \ limitations under the License.
: >name ( xt -- a n )
dup >flags 8 and if
dup >link swap >name-length
else
dup >name-length swap >link& over aligned - swap
then
;
: fill32 ( a n v ) swap >r swap r> 0 ?do 2dup ! cell+ loop 2drop ; : fill32 ( a n v ) swap >r swap r> 0 ?do 2dup ! cell+ loop 2drop ;

View File

@ -76,7 +76,7 @@ r|
return sp; return sp;
}) })
| 2 jseval! | 2 jseval!
: web-type ( a n -- ) 2 call ; : web-type ( a n -- ) 2 call yield ;
' web-type is type ' web-type is type
r| r|

View File

@ -67,7 +67,6 @@ function GetString(a, n) {
return ret; return ret;
} }
function CELL_ALIGNED(n) { return (n + 3) & ~3; } function CELL_ALIGNED(n) { return (n + 3) & ~3; }
function UPPER(ch) { function UPPER(ch) {
return ch >= 'a'.charCodeAt(0) && ch <= 'z'.charCodeAt(0) ? (ch & 0x5F) : ch; return ch >= 'a'.charCodeAt(0) && ch <= 'z'.charCodeAt(0) ? (ch & 0x5F) : ch;
@ -79,8 +78,8 @@ function TOPARAMS(xt) { return TOFLAGS(xt) + 2; }
function TOSIZE(xt) { return CELL_ALIGNED(u8[TONAMELEN(xt)>>2]) + 4 * i32[TOPARAMS(xt)>>2]; } function TOSIZE(xt) { return CELL_ALIGNED(u8[TONAMELEN(xt)>>2]) + 4 * i32[TOPARAMS(xt)>>2]; }
function TOLINK(xt) { return xt - 2 * 4; } function TOLINK(xt) { return xt - 2 * 4; }
function TONAME(xt) { function TONAME(xt) {
return (i32[TOFLAGS(xt)>>2] & BUILTIN_MARK) return (u8[TOFLAGS(xt)>>2] & BUILTIN_MARK)
? u8[TOLINK(xt)] : TOLINK(xt) - CELL_ALIGNED(u8[TONAMELEN(xt)]); ? i32[TOLINK(xt)] : TOLINK(xt) - CELL_ALIGNED(u8[TONAMELEN(xt)]);
} }
function TOBODY(xt) { function TOBODY(xt) {
return xt + (i32[xt>>2] === OP_DOCREATE || i32[xt>>2] === OP_DODOES ? 2 : 1) * 4; return xt + (i32[xt>>2] === OP_DOCREATE || i32[xt>>2] === OP_DODOES ? 2 : 1) * 4;
@ -184,10 +183,11 @@ function SSMOD(sp) {
} }
function Finish() { function Finish() {
if (i32[g_sys_latestxt>>2] && !i32[TOPARAMS(i32[g_sys_latestxt>>2])>>2]) { if (i32[g_sys_latestxt>>2] && !u16[TOPARAMS(i32[g_sys_latestxt>>2])>>1]) {
var sz = i32[g_sys_heap>>2] - (g_sys_latestxt + 4); var sz = i32[g_sys_heap>>2] - (i32[g_sys_latestxt>>2] + 4);
sz /= 4;
if (sz < 0 || sz > 0xffff) { sz = 0xffff; } if (sz < 0 || sz > 0xffff) { sz = 0xffff; }
i32[TOPARAMS(i32[g_sys_latestxt>>2])>>2] = sz; u16[TOPARAMS(i32[g_sys_latestxt>>2])>>1] = sz;
} }
} }
@ -577,8 +577,8 @@ var module = VM(globalObj, ffi, heap);
Init(); Init();
function run() { function run() {
module.run(); module.run();
setTimeout(run, 1); setTimeout(run, 0);
} }
setTimeout(run, 1); setTimeout(run, 0);
})(); })();