diff --git a/LICENSE b/LICENSE index ad258387..d169d3a0 100644 --- a/LICENSE +++ b/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md index ce594cd8..475f2305 100644 --- a/README.md +++ b/README.md @@ -184,3 +184,4 @@ Check our [Coding Style Guide](https://pocketpy.dev/coding_style_guide/) if you ## License PocketPy is licensed under the [MIT License](http://opensource.org/licenses/MIT). + diff --git a/README_zh.md b/README_zh.md index 4c018b09..ef38788b 100644 --- a/README_zh.md +++ b/README_zh.md @@ -154,4 +154,5 @@ flutter pub add pocketpy ## 开源协议 -MIT License \ No newline at end of file +MIT License + diff --git a/amalgamate.py b/amalgamate.py index 2f8c6e41..7c78c0a6 100644 --- a/amalgamate.py +++ b/amalgamate.py @@ -77,4 +77,4 @@ if os.path.exists("plugins/godot/godot-cpp/pocketpy"): if os.path.exists("/mnt/e/PainterEngine/project/pocketpy.h"): shutil.copy("amalgamated/pocketpy.h", "/mnt/e/PainterEngine/project/pocketpy.h") -print("amalgamated/pocketpy.h") \ No newline at end of file +print("amalgamated/pocketpy.h") diff --git a/build.py b/build.py index f186572f..e6ec1402 100644 --- a/build.py +++ b/build.py @@ -52,4 +52,5 @@ rm -rf web/lib/ mkdir -p web/lib/ em++ src/main.cpp -fno-rtti -fexceptions -O3 -sEXPORTED_FUNCTIONS=_pkpy_delete,_pkpy_setup_callbacks,_pkpy_new_repl,_pkpy_repl_input,_pkpy_new_vm,_pkpy_vm_add_module,_pkpy_vm_bind,_pkpy_vm_eval,_pkpy_vm_exec,_pkpy_vm_get_global,_pkpy_vm_read_output -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js ''') - DONE() \ No newline at end of file + DONE() + diff --git a/compile_flags.txt b/compile_flags.txt index eece4aaf..c291a58c 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -2,4 +2,4 @@ -Wall -W* -std=c++17 --stdlib=libc++ \ No newline at end of file +-stdlib=libc++ diff --git a/preprocess.py b/preprocess.py index 23ac599e..d4fc1119 100644 --- a/preprocess.py +++ b/preprocess.py @@ -33,4 +33,4 @@ namespace pkpy{ return header with open("src/_generated.h", "w", encoding='utf-8') as f: - f.write(generate_python_sources()) \ No newline at end of file + f.write(generate_python_sources()) diff --git a/run_profile.sh b/run_profile.sh index c7bea6c3..559f34d5 100644 --- a/run_profile.sh +++ b/run_profile.sh @@ -2,4 +2,4 @@ clang++ -pg -O2 -std=c++17 -fno-rtti -stdlib=libc++ -Wall -o pocketpy src/main.c time ./pocketpy benchmarks/fib.py mv benchmarks/gmon.out . gprof pocketpy gmon.out > gprof.txt -rm gmon.out \ No newline at end of file +rm gmon.out diff --git a/run_profile_test.sh b/run_profile_test.sh index 9d7ccc71..454b3d8e 100644 --- a/run_profile_test.sh +++ b/run_profile_test.sh @@ -5,6 +5,3 @@ mkdir -p .coverage llvm-cov-15 gcov main.gc -r -s src/ >> .coverage/coverage.txt mv *.gcov .coverage rm main.gc* - -# -fprofile-instr-generate -fcoverage-mapping -# llvm-cov-15 show main.gc -instr-profile=default.profraw -format=html -output-dir .coverage \ No newline at end of file diff --git a/run_tests.sh b/run_tests.sh index f78eae36..b2b79876 100644 --- a/run_tests.sh +++ b/run_tests.sh @@ -5,6 +5,3 @@ mkdir -p .coverage llvm-cov-15 gcov main.gc -r -s src/ >> .coverage/coverage.txt mv *.gcov .coverage rm main.gc* - -# -fprofile-instr-generate -fcoverage-mapping -# llvm-cov-15 show main.gc -instr-profile=default.profraw -format=html -output-dir .coverage \ No newline at end of file diff --git a/src/vm.h b/src/vm.h index 6cfbcd60..c79d8c08 100644 --- a/src/vm.h +++ b/src/vm.h @@ -108,7 +108,7 @@ public: this->vm = this; this->_stdout = use_stdio ? &std::cout : &_stdout_buffer; this->_stderr = use_stdio ? &std::cerr : &_stderr_buffer; - callstack.data().reserve(8); + callstack.reserve(8); init_builtin_types(); } @@ -357,6 +357,7 @@ public: ~VM() { callstack.clear(); + s_data.clear(); _all_types.clear(); _modules.clear(); _lazy_modules.clear(); @@ -967,7 +968,7 @@ inline void VM::_error(Exception e){ e.is_re = false; throw e; } - s_data.push(VAR(e)); + PUSH(VAR(e)); _raise(); }