🔥 change nasal_gc to gc

This commit is contained in:
ValKmjolnir
2022-10-23 01:29:20 +08:00
parent 3fd1b25f79
commit 3ef8effe9a
8 changed files with 65 additions and 63 deletions
+6 -6
View File
@@ -59,7 +59,7 @@ var f=func(x,y,z){return x+y+z};
### version 1.0 parser (last update 2019/10/14)
First fully functional version of nasal_parser.
First fully functional version of parser.
Before version 1.0,i tried many times to create a correct parser.
@@ -266,8 +266,8 @@ parser will check this left-value and tells that these kinds of left-value are n
But now it can work.
And you could see its use by reading the code above.
To make sure this assignment works correctly,
codegen will generate byte code by `nasal_codegen::call_gen()` instead of `nasal_codegen::mcall_gen()`,
and the last child of the ast will be generated by `nasal_codegen::mcall_gen()`.
codegen will generate byte code by `codegen::call_gen()` instead of `codegen::mcall_gen()`,
and the last child of the ast will be generated by `codegen::mcall_gen()`.
So the bytecode is totally different now:
```x86asm
@@ -357,7 +357,7 @@ This version uses g++ extension "labels as values",
which is also supported by clang++.
(But i don't know if MSVC supports this)
There is also a change in nasal_gc:
There is also a change in `gc`:
`std::vector` global is deleted,
now the global values are all stored on stack(from `val_stack+0` to `val_stack+intg-1`).
@@ -415,7 +415,7 @@ a=b=0;
2021/10/8 update:
In this version vm_nil and vm_num now is not managed by `nasal_gc`,
In this version vm_nil and vm_num now is not managed by `gc`,
this will decrease the usage of `gc::alloc` and increase the efficiency of execution.
New value type is added: `vm_obj`.
@@ -471,7 +471,7 @@ Both of them are meaningless and will be replaced by `op_pnum`.
Local values now are __stored on stack__.
So function calling will be faster than before.
Because in v8.0 when calling a function,
new `vm_vec` will be allocated by `nasal_gc`, this makes gc doing mark-sweep too many times and spends a quite lot of time.
new `vm_vec` will be allocated by `gc`, this makes gc doing mark-sweep too many times and spends a quite lot of time.
In test file `test/bf.nas`, it takes too much time to test the file because this file has too many function calls(see test data below in table `version 8.0 (R9-5900HX ubuntu-WSL 2022/1/23)`).
Upvalue now is generated when creating first new function in the local scope, using `vm_vec`.