From 692f8ccefe7f9d1b69f90f854ac0f655afa74dca Mon Sep 17 00:00:00 2001 From: ValKmjolnir Date: Thu, 18 Aug 2022 20:41:33 +0800 Subject: [PATCH] :zap: update doc & notes, optimize code --- doc/README_zh.md | 2 +- doc/dev.md | 2 +- doc/dev_zh.md | 2 +- main.cpp | 6 +++--- nasal_gc.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/README_zh.md b/doc/README_zh.md index d4279ff..5ab89e1 100644 --- a/doc/README_zh.md +++ b/doc/README_zh.md @@ -10,7 +10,7 @@ ![GitHub code size](https://img.shields.io/github/languages/code-size/ValKmjolnir/Nasal-Interpreter?style=flat-square&logo=github) ![GitHub release(latest by date)](https://img.shields.io/github/v/release/ValKmjolnir/Nasal-Interpreter?style=flat-square&logo=github) -![in dev](https://img.shields.io/badge/dev-v10.0-blue?style=flat-square&logo=github) +![in dev](https://img.shields.io/badge/dev-v10.1-blue?style=flat-square&logo=github) [![license](https://img.shields.io/badge/license-MIT-green?style=flat-square&logo=github)](../LICENSE) > 这篇文档包含多种语言版本: [__中文__](../doc/README_zh.md) | [__English__](../README.md) diff --git a/doc/dev.md b/doc/dev.md index f6b2551..f2a1fb6 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -336,7 +336,7 @@ As you could see from the bytecode above, And because of the new structure of `mcall`, `addr_stack`, a stack used to store the memory address, is deleted from `nasal_vm`, -and now `nasal_vm` use `nasal_val** mem_addr` to store the memory address. +and now `nasal_vm` use `nas_val** mem_addr` to store the memory address. This will not cause fatal errors because the memory address is used __immediately__ after getting it. ### version 7.0 vm (last update 2021/10/8) diff --git a/doc/dev_zh.md b/doc/dev_zh.md index 094c7e7..66670ec 100644 --- a/doc/dev_zh.md +++ b/doc/dev_zh.md @@ -303,7 +303,7 @@ m(0)._=m(1)._=10; 从上面这些字节码可以看出,`mcall`/`mcallv`/`mcallh`指令的使用频率比以前减小了一些,而`call`/`callv`/`callh`/`callfv`/`callfh`则相反。 -并且因为新的数据结构,`mcall`指令以及`addr_stack`,一个曾用来存储指针的栈,从`nasal_vm`中被移除。现在`nasal_vm`使用`nasal_val** mem_addr`来暂存获取的内存地址。这不会导致严重的问题,因为内存空间是 __获取即使用__ 的。 +并且因为新的数据结构,`mcall`指令以及`addr_stack`,一个曾用来存储指针的栈,从`nasal_vm`中被移除。现在`nasal_vm`使用`nas_val** mem_addr`来暂存获取的内存地址。这不会导致严重的问题,因为内存空间是 __获取即使用__ 的。 ### version 7.0 vm (last update 2021/10/8) diff --git a/main.cpp b/main.cpp index 660a9d1..a7d9934 100644 --- a/main.cpp +++ b/main.cpp @@ -141,12 +141,12 @@ i32 main(i32 argc,const char* argv[]) {"--ast",VM_ASTINFO},{"-a",VM_ASTINFO}, {"--code",VM_CODEINFO},{"-c",VM_CODEINFO}, {"--exec",VM_EXEC},{"-e",VM_EXEC}, - {"--opcnt",VM_OPCALLNUM|VM_EXEC},{"-o",VM_OPCALLNUM|VM_EXEC}, + {"--opcnt",VM_OPCALLNUM},{"-o",VM_OPCALLNUM}, {"--time",VM_EXECTIME|VM_EXEC},{"-t",VM_EXECTIME|VM_EXEC}, {"--detail",VM_DBGINFO|VM_EXEC},{"-d",VM_DBGINFO|VM_EXEC}, {"--optimize",VM_OPTIMIZE},{"-op",VM_OPTIMIZE}, {"--debug",VM_DEBUG},{"-dbg",VM_DEBUG}, - {"--chkpath",VM_SHOWPATH|VM_EXEC},{"-cp",VM_SHOWPATH|VM_EXEC} + {"--chkpath",VM_SHOWPATH},{"-cp",VM_SHOWPATH} // this could be merged to -d }; u32 cmd=0; string filename; @@ -162,6 +162,6 @@ i32 main(i32 argc,const char* argv[]) } if(!filename.length()) err(); - execute(filename,vm_argv,cmd?cmd:cmd|VM_EXEC); + execute(filename,vm_argv,cmd?cmd:VM_EXEC); return 0; } \ No newline at end of file diff --git a/nasal_gc.h b/nasal_gc.h index 5e5e7e3..2b4a616 100644 --- a/nasal_gc.h +++ b/nasal_gc.h @@ -49,7 +49,7 @@ struct nas_func; // function(lambda) struct nas_upval;// upvalue struct nas_obj; // special objects struct nas_co; // coroutine -struct nas_val; // nasal_val includes gc-managed types +struct nas_val; // nas_val includes gc-managed types struct nas_ref { @@ -498,7 +498,7 @@ void nasal_gc::mark() // scan coroutine process stack when coroutine ptr is not null // scan main process stack when coroutine ptr is null // this scan process must execute because when running coroutine, - // the nasal_co related to it will not update it's context(like `top`) until the coroutine suspends or exits. + // the nas_co related to it will not update it's context(like `top`) until the coroutine suspends or exits. for(nas_ref* i=stack;i<=top;++i) bfs.push(*i); bfs.push(funcr);