⚡ update doc & notes, optimize code
This commit is contained in:
parent
007b83bed5
commit
692f8ccefe
|
@ -10,7 +10,7 @@
|
|||
|
||||

|
||||

|
||||

|
||||

|
||||
[](../LICENSE)
|
||||
|
||||
> 这篇文档包含多种语言版本: [__中文__](../doc/README_zh.md) | [__English__](../README.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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
6
main.cpp
6
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;
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue