From 34c90fd62923b9401d74823fc39a8c54a6da4fcf Mon Sep 17 00:00:00 2001
From: pikastech
Date: Thu, 2 Mar 2023 11:07:23 +0800
Subject: [PATCH 01/41] more comtributor log
---
README.md | 7 +++++++
README_zh.md | 7 +++++++
assets/contributor2022.mdpp | 1 +
assets/contributor2023.mdpp | 8 +++++++-
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 8ff626bfd..2e3dac994 100644
--- a/README.md
+++ b/README.md
@@ -645,7 +645,13 @@ In addition to device drivers, developing custom Python modules for MCU is very
| Contribute log | Contributer |
| --- | --- |
+|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
+|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
+|Fix Typo on PikaVM.c|Ikko Eltociear Ashimine(https://gitee.com/eltociear)|
+|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
+|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
| hmac hashlib base64 aes modules | [梦程MI](https://gitee.com/dreamcmi) |
+|fix pikaCompiler build error on macos|[梦程MI](https://gitee.com/dreamcmi) |
Contribute Log On 2022
| Contribute log | Contributer |
@@ -656,6 +662,7 @@ In addition to device drivers, developing custom Python modules for MCU is very
| Donate:500¥ | [edmund_wz](https://gitee.com/edmund_wz) |
| Donate:500¥ | [Meco Jianting Man](https://github.com/mysterywolf) |
| Donate:500¥ | [hardsofttech](https://gitee.com/hardsofttech) |
+|PikaNN module| [Renzhihan](https://github.com/Renzhihan) |
| re module | [eglwang](https://gitee.com/eglwang) |
| PikaMath.Quaternion() | [purewind7](https://gitee.com/purewind7) |
| contrubute to PikaCV | [purewind7](https://gitee.com/purewind7) |
diff --git a/README_zh.md b/README_zh.md
index acc76a24d..08c8a2721 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -660,7 +660,13 @@ while True:
| 贡献记录 | 贡献者 |
| --- | --- |
+|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
+|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
+|Fix Typo on PikaVM.c|Ikko Eltociear Ashimine(https://gitee.com/eltociear)|
+|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
+|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
| hmac hashlib base64 aes modules | [梦程MI](https://gitee.com/dreamcmi) |
+|fix pikaCompiler build error on macos|[梦程MI](https://gitee.com/dreamcmi) |
贡献记录 (2022 年)
@@ -672,6 +678,7 @@ while True:
| Donate:500¥ | [edmund_wz](https://gitee.com/edmund_wz) |
| Donate:500¥ | [Meco Jianting Man](https://github.com/mysterywolf) |
| Donate:500¥ | [hardsofttech](https://gitee.com/hardsofttech) |
+|PikaNN module| [Renzhihan](https://github.com/Renzhihan) |
| re module | [eglwang](https://gitee.com/eglwang) |
| PikaMath.Quaternion() | [purewind7](https://gitee.com/purewind7) |
| contrubute to PikaCV | [purewind7](https://gitee.com/purewind7) |
diff --git a/assets/contributor2022.mdpp b/assets/contributor2022.mdpp
index 502d730d5..76cef1453 100644
--- a/assets/contributor2022.mdpp
+++ b/assets/contributor2022.mdpp
@@ -4,6 +4,7 @@
| Donate:500¥ | [edmund_wz](https://gitee.com/edmund_wz) |
| Donate:500¥ | [Meco Jianting Man](https://github.com/mysterywolf) |
| Donate:500¥ | [hardsofttech](https://gitee.com/hardsofttech) |
+|PikaNN module| [Renzhihan](https://github.com/Renzhihan) |
| re module | [eglwang](https://gitee.com/eglwang) |
| PikaMath.Quaternion() | [purewind7](https://gitee.com/purewind7) |
| contrubute to PikaCV | [purewind7](https://gitee.com/purewind7) |
diff --git a/assets/contributor2023.mdpp b/assets/contributor2023.mdpp
index 3d9bc165f..6d1833b99 100644
--- a/assets/contributor2023.mdpp
+++ b/assets/contributor2023.mdpp
@@ -1 +1,7 @@
-| hmac hashlib base64 aes modules | [梦程MI](https://gitee.com/dreamcmi) |
\ No newline at end of file
+|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
+|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
+|Fix Typo on PikaVM.c|Ikko Eltociear Ashimine(https://gitee.com/eltociear)|
+|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
+|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
+| hmac hashlib base64 aes modules | [梦程MI](https://gitee.com/dreamcmi) |
+|fix pikaCompiler build error on macos|[梦程MI](https://gitee.com/dreamcmi) |
\ No newline at end of file
From c3475b111e528daf529b5713e1b963c1ead5f5f9 Mon Sep 17 00:00:00 2001
From: pikastech
Date: Thu, 2 Mar 2023 11:09:01 +0800
Subject: [PATCH 02/41] fix typo
---
README.md | 2 +-
README_zh.md | 2 +-
assets/contributor2023.mdpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 2e3dac994..42224af18 100644
--- a/README.md
+++ b/README.md
@@ -647,7 +647,7 @@ In addition to device drivers, developing custom Python modules for MCU is very
| --- | --- |
|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
-|Fix Typo on PikaVM.c|Ikko Eltociear Ashimine(https://gitee.com/eltociear)|
+|Fix Typo on PikaVM.c|[Ikko Eltociear Ashimine](https://gitee.com/eltociear)|
|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
| hmac hashlib base64 aes modules | [梦程MI](https://gitee.com/dreamcmi) |
diff --git a/README_zh.md b/README_zh.md
index 08c8a2721..e5272d80f 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -662,7 +662,7 @@ while True:
| --- | --- |
|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
-|Fix Typo on PikaVM.c|Ikko Eltociear Ashimine(https://gitee.com/eltociear)|
+|Fix Typo on PikaVM.c|[Ikko Eltociear Ashimine](https://gitee.com/eltociear)|
|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
| hmac hashlib base64 aes modules | [梦程MI](https://gitee.com/dreamcmi) |
diff --git a/assets/contributor2023.mdpp b/assets/contributor2023.mdpp
index 6d1833b99..574f374f6 100644
--- a/assets/contributor2023.mdpp
+++ b/assets/contributor2023.mdpp
@@ -1,6 +1,6 @@
|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
-|Fix Typo on PikaVM.c|Ikko Eltociear Ashimine(https://gitee.com/eltociear)|
+|Fix Typo on PikaVM.c|[Ikko Eltociear Ashimine](https://gitee.com/eltociear)|
|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
| hmac hashlib base64 aes modules | [梦程MI](https://gitee.com/dreamcmi) |
From 689deb4986c22ea645e510feb95bda4f9ed68e2b Mon Sep 17 00:00:00 2001
From: pikastech
Date: Thu, 2 Mar 2023 11:10:40 +0800
Subject: [PATCH 03/41] update contribute log
---
README.md | 1 +
README_zh.md | 1 +
assets/contributor2023.mdpp | 1 +
3 files changed, 3 insertions(+)
diff --git a/README.md b/README.md
index 42224af18..f8aa590f9 100644
--- a/README.md
+++ b/README.md
@@ -647,6 +647,7 @@ In addition to device drivers, developing custom Python modules for MCU is very
| --- | --- |
|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
+|support GPIO pika_hal for BLMCU|[codercmd](https://gitee.com/codercmd)|
|Fix Typo on PikaVM.c|[Ikko Eltociear Ashimine](https://gitee.com/eltociear)|
|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
diff --git a/README_zh.md b/README_zh.md
index e5272d80f..6aa2516e9 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -662,6 +662,7 @@ while True:
| --- | --- |
|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
+|support GPIO pika_hal for BLMCU|[codercmd](https://gitee.com/codercmd)|
|Fix Typo on PikaVM.c|[Ikko Eltociear Ashimine](https://gitee.com/eltociear)|
|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
diff --git a/assets/contributor2023.mdpp b/assets/contributor2023.mdpp
index 574f374f6..ab6974d2f 100644
--- a/assets/contributor2023.mdpp
+++ b/assets/contributor2023.mdpp
@@ -1,5 +1,6 @@
|implement shell filter | [GorgonMeducer](https://github.com/GorgonMeducer) |
|修复socket模块在lwip中fcntl的参数数量错误|[梦程MI](https://gitee.com/dreamcmi) |
+|support GPIO pika_hal for BLMCU|[codercmd](https://gitee.com/codercmd)|
|Fix Typo on PikaVM.c|[Ikko Eltociear Ashimine](https://gitee.com/eltociear)|
|Fix type assert on dataArgs.c|[itschina](https://gitee.com/itschina)|
|add examples/Device/KEY_POLL.PY|[codercmd](https://gitee.com/codercmd)|
From 1d8e1cfb7948e143766585501a68b743262c41b6 Mon Sep 17 00:00:00 2001
From: pikastech
Date: Thu, 2 Mar 2023 18:08:07 +0800
Subject: [PATCH 04/41] add EVENT_THREAD_ENABLE config
---
src/PikaObj.c | 2 ++
src/pika_config_valid.h | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/src/PikaObj.c b/src/PikaObj.c
index 4bfa00b96..729760210 100644
--- a/src/PikaObj.c
+++ b/src/PikaObj.c
@@ -1944,6 +1944,7 @@ void _do_pks_eventListener_send(PikaEventListener* self,
_VMEvent_pickupEvent();
}
}
+#if PIKA_EVENT_THREAD_ENABLE
if (PikaVMSignal.event_thread_inited) {
return;
}
@@ -1956,6 +1957,7 @@ void _do_pks_eventListener_send(PikaEventListener* self,
PikaVMSignal.event_thread_inited = 1;
}
#endif
+#endif
}
void pks_eventListener_send(PikaEventListener* self,
diff --git a/src/pika_config_valid.h b/src/pika_config_valid.h
index 1c4f7284b..6a9bdeb27 100644
--- a/src/pika_config_valid.h
+++ b/src/pika_config_valid.h
@@ -76,6 +76,11 @@
#ifdef PIKA_TYPE_FULL_FEATURE_ENABLE
#define PIKA_TYPE_FULL_FEATURE_ENABLE 0
#endif
+
+ #ifndef PIKA_EVENT_THREAD_ENABLE
+ #define PIKA_EVENT_THREAD_ENABLE 0
+ #endif
+
#endif
/* default optimize */
@@ -418,6 +423,10 @@
#define PIKA_TYPE_FULL_FEATURE_ENABLE 1
#endif
+ #ifndef PIKA_EVENT_THREAD_ENABLE
+ #define PIKA_EVENT_THREAD_ENABLE 1
+ #endif
+
/* configuration validation */
#endif
From 3f1ebc12eb265df5c01e6933392e3f90b80478b3 Mon Sep 17 00:00:00 2001
From: pikastech
Date: Thu, 2 Mar 2023 18:43:25 +0800
Subject: [PATCH 05/41] check pos arguments for fun with pos and vars
---
src/PikaVM.c | 42 ++++++++++++++++++++++--------
test/VM-test.cpp | 24 ++++++++++++++---
test/python/builtin/fn_pos_vars.py | 7 +++++
3 files changed, 59 insertions(+), 14 deletions(-)
create mode 100644 test/python/builtin/fn_pos_vars.py
diff --git a/src/PikaVM.c b/src/PikaVM.c
index 24e74a26a..9726b2c34 100644
--- a/src/PikaVM.c
+++ b/src/PikaVM.c
@@ -1347,40 +1347,60 @@ static int VMState_loadArgsFromMethodArg(VMState* vm,
f.n_input = _get_n_input_with_unpack(vm, n_used);
- /* check arg num */
- if (f.method_type == ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR ||
- f.method_type == ARG_TYPE_METHOD_CONSTRUCTOR ||
- f.is_vars == PIKA_TRUE || n_used != 0) {
- /* skip for constrctor */
- /* skip for variable args */
- /* n_used != 0 means it is a factory method */
- } else {
+ do {
+ /* check arg num */
+ if (f.method_type == ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR ||
+ f.method_type == ARG_TYPE_METHOD_CONSTRUCTOR || n_used != 0) {
+ /* skip for constrctor */
+ /* skip for variable args */
+ /* n_used != 0 means it is a factory method */
+ break;
+ }
/* check position arg num */
if (!vars_or_keys_or_default) {
if (f.n_positional != f.n_input) {
VMState_setErrorCode(vm, PIKA_RES_ERR_INVALID_PARAM);
pika_platform_printf(
- "TypeError: %s() takes %d positional argument but %d were "
+ "TypeError: %s() takes %d positional argument but %d "
+ "were "
"given\r\n",
method_name, f.n_positional, f.n_input);
goto exit;
}
+ break;
}
#if !PIKA_NANO_ENABLE
+ if (f.is_keys) {
+ break;
+ }
+ if (f.is_vars) {
+ if (f.n_input < f.n_positional) {
+ VMState_setErrorCode(vm, PIKA_RES_ERR_INVALID_PARAM);
+ pika_platform_printf(
+ "TypeError: %s() takes %d positional argument but "
+ "%d "
+ "were "
+ "given\r\n",
+ method_name, f.n_positional, f.n_input);
+ goto exit;
+ }
+ break;
+ }
if (f.is_default) {
int8_t n_min = f.n_positional;
int8_t n_max = f.n_positional + f.n_default;
if (f.n_input < n_min || f.n_input > n_max) {
VMState_setErrorCode(vm, PIKA_RES_ERR_INVALID_PARAM);
pika_platform_printf(
- "TypeError: %s() takes from %d to %d positional arguments "
+ "TypeError: %s() takes from %d to %d positional "
+ "arguments "
"but %d were given\r\n",
method_name, n_min, n_max, f.n_input);
goto exit;
}
}
#endif
- }
+ } while (0);
if (vars_or_keys_or_default) {
f.n_arg = f.n_input;
diff --git a/test/VM-test.cpp b/test/VM-test.cpp
index befc6cc05..70223cb38 100644
--- a/test/VM-test.cpp
+++ b/test/VM-test.cpp
@@ -2694,7 +2694,7 @@ TEST(vm, class_getattr) {
EXPECT_EQ(pikaMemNow(), 0);
}
-TEST(vm, type_fullfealure){
+TEST(vm, type_fullfealure) {
/* init */
pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
@@ -2712,8 +2712,7 @@ TEST(vm, type_fullfealure){
EXPECT_EQ(pikaMemNow(), 0);
}
-
-TEST(vm, dir_print_arg){
+TEST(vm, dir_print_arg) {
/* init */
pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
@@ -2730,6 +2729,25 @@ TEST(vm, dir_print_arg){
EXPECT_EQ(pikaMemNow(), 0);
}
+TEST(vm, fn_pos_vars) {
+ /* init */
+ pikaMemInfo.heapUsedMax = 0;
+ PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
+ extern unsigned char pikaModules_py_a[];
+ obj_linkLibrary(pikaMain, pikaModules_py_a);
+ /* run */
+ __platform_printf("BEGIN\r\n");
+ pikaVM_runSingleFile(pikaMain, "test/python/builtin/fn_pos_vars.py");
+ /* collect */
+ /* assert */
+ EXPECT_STREQ(
+ log_buff[4],
+ "TypeError: log() takes 2 positional argument but 1 were given\r\n");
+ /* deinit */
+ obj_deinit(pikaMain);
+ EXPECT_EQ(pikaMemNow(), 0);
+}
+
#endif
TEST_END
\ No newline at end of file
diff --git a/test/python/builtin/fn_pos_vars.py b/test/python/builtin/fn_pos_vars.py
new file mode 100644
index 000000000..76fe1b039
--- /dev/null
+++ b/test/python/builtin/fn_pos_vars.py
@@ -0,0 +1,7 @@
+
+def log(level: str, title: str, *var):
+ print('--------- ', title, ' ---------')
+ for i in var:
+ print('[%r]' % level, i)
+
+log("test")
From 091ed03eb86808f0fad51dab44fdda35da008bc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E6=98=82?=
Date: Thu, 2 Mar 2023 15:17:56 +0000
Subject: [PATCH 06/41] cancel code server
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 李昂
---
docker/Dockerfile | 7 -------
1 file changed, 7 deletions(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index d4e75349a..079a82dd8 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -74,14 +74,7 @@ RUN apt-get install -y liblua5.3-dev
RUN apt-get install -y lcov
RUN apt-get install -y wget
-RUN wget https://gitee.com/Lyon1998/pikascript/attach_files/1213873/download -O code-server.deb
-RUN dpkg -i code-server.deb
-ADD code-server-config.yaml /root/.config/code-server/config.yaml
RUN cd root/pikascript && git remote add github https://github.com/pikastech/pikascript
-# RUN code-server --install-extension ms-python.python
-RUN code-server --install-extension llvm-vs-code-extensions.vscode-clangd
-RUN code-server --install-extension vscodevim.vim
-RUN code-server --install-extension zhuangtongfa.material-theme
RUN apt-get install clangd -y
RUN apt-get install libmbedtls-dev -y
RUN pip install -r /root/pikascript/docker/requirements.txt
From cfa3acba3beda9461bd88202d6dcef14166957be Mon Sep 17 00:00:00 2001
From: lyon
Date: Fri, 3 Mar 2023 00:24:04 +0800
Subject: [PATCH 07/41] add more comments for modbus example
---
examples/modbus/rtu_master.py | 12 ++++++++++++
test/python/modbus/rtu_master.py | 12 ++++++++++++
2 files changed, 24 insertions(+)
diff --git a/examples/modbus/rtu_master.py b/examples/modbus/rtu_master.py
index 9bd14166e..891470388 100644
--- a/examples/modbus/rtu_master.py
+++ b/examples/modbus/rtu_master.py
@@ -1,22 +1,34 @@
+# Import modbus module
import modbus
+# Create a ModBusRTU object, specify the send buffer and receive buffer size as 128 bytes
mb = modbus.ModBusRTU(128, 128)
+
+# Set slave address to 1
mb.setSlave(1)
+# Generate a request frame for reading registers, specify the start address as 0 and the quantity as 10
send_buff = mb.serializeReadRegisters(0, 10)
+
+# Print the byte string of the request frame
print(send_buff)
+# Parse a response frame for reading registers, return a list containing the values of the registers
host_regists = mb.deserializeReadRegisters(
b'\x01\x03\x14\x00\x00\x00\x00\x04\xD2\x00\x00\x00\x00\x00\x7B\x00\x00\x00\x00\x00\x00\x00\x00\xE5\x0B'
)
print(host_regists)
+# Generate a request frame for reading input registers, specify the start address as 0 and the quantity as 2
mb.serializeReadInputRegisters(0, 2)
+# Parse a response frame for reading input registers, return a list containing the values of the input registers
+
mb.deserializeReadInputRegisters(b'\x01\x04\x04\x00\x00\x08\xE6\x7D\xCE')
+# Generate a request frame for writing a single register, specify the register address as 0 and the value as 0x1234
send_buff = mb.serializeWriteRegister(0, 0x1234)
print(send_buff)
diff --git a/test/python/modbus/rtu_master.py b/test/python/modbus/rtu_master.py
index 9bd14166e..891470388 100644
--- a/test/python/modbus/rtu_master.py
+++ b/test/python/modbus/rtu_master.py
@@ -1,22 +1,34 @@
+# Import modbus module
import modbus
+# Create a ModBusRTU object, specify the send buffer and receive buffer size as 128 bytes
mb = modbus.ModBusRTU(128, 128)
+
+# Set slave address to 1
mb.setSlave(1)
+# Generate a request frame for reading registers, specify the start address as 0 and the quantity as 10
send_buff = mb.serializeReadRegisters(0, 10)
+
+# Print the byte string of the request frame
print(send_buff)
+# Parse a response frame for reading registers, return a list containing the values of the registers
host_regists = mb.deserializeReadRegisters(
b'\x01\x03\x14\x00\x00\x00\x00\x04\xD2\x00\x00\x00\x00\x00\x7B\x00\x00\x00\x00\x00\x00\x00\x00\xE5\x0B'
)
print(host_regists)
+# Generate a request frame for reading input registers, specify the start address as 0 and the quantity as 2
mb.serializeReadInputRegisters(0, 2)
+# Parse a response frame for reading input registers, return a list containing the values of the input registers
+
mb.deserializeReadInputRegisters(b'\x01\x04\x04\x00\x00\x08\xE6\x7D\xCE')
+# Generate a request frame for writing a single register, specify the register address as 0 and the value as 0x1234
send_buff = mb.serializeWriteRegister(0, 0x1234)
print(send_buff)
From 38388625ca09c0e42ff6c92187fa255c620f49f6 Mon Sep 17 00:00:00 2001
From: lyon
Date: Fri, 3 Mar 2023 11:07:25 +0800
Subject: [PATCH 08/41] support mark-sweep gc
change project name and url on kernal sources
rename global Value
format name
use g_PikaObjState
add gc chain
add gc_mark()
add printCanFree
add sub locals init
try use mark-sweep to solve circle-ref
use mark sweep to collect circle ref succeed
import mark-sweep GC
config_default
update
---
port/linux/.vscode/launch.json | 2 +-
port/linux/.vscode/settings.json | 5 +-
port/linux/boot/banchmark/main.c | 2 +-
port/linux/config/pika_config_default.h | 3 +-
...oogletest-param-test-invalid-name2-test.py | 66 ++--
port/linux/package/pikascript/main.py | 2 +-
port/linux/performance/main.c | 8 +-
src/BaseObj.c | 4 +-
src/BaseObj.h | 4 +-
src/PikaCompiler.c | 4 +-
src/PikaObj.c | 223 ++++++++++--
src/PikaObj.h | 58 +++-
src/PikaParser.c | 4 +-
src/PikaParser.h | 4 +-
src/PikaPlatform.c | 4 +-
src/PikaPlatform.h | 6 +-
src/PikaVM.c | 131 +++----
src/PikaVM.h | 2 +-
src/TinyObj.c | 4 +-
src/TinyObj.h | 4 +-
src/__default_filter_msg_def.h | 4 +-
src/__default_filter_msg_table.h | 4 +-
src/__instruction_def.h | 4 +-
src/__instruction_table.h | 4 +-
src/__pika_ooc.h | 4 +-
src/dataArg.c | 38 +-
src/dataArg.h | 4 +-
src/dataArgs.c | 4 +-
src/dataArgs.h | 4 +-
src/dataLink.c | 4 +-
src/dataLink.h | 4 +-
src/dataLinkNode.c | 4 +-
src/dataLinkNode.h | 4 +-
src/dataMemory.c | 32 +-
src/dataMemory.h | 6 +-
src/dataQueue.c | 4 +-
src/dataQueue.h | 4 +-
src/dataQueueObj.c | 4 +-
src/dataQueueObj.h | 4 +-
src/dataStack.c | 4 +-
src/dataStack.h | 4 +-
src/dataString.c | 4 +-
src/dataString.h | 4 +-
src/dataStrs.c | 4 +-
src/dataStrs.h | 4 +-
src/pika_config_valid.h | 8 +-
test/PikaCV-test.cpp | 22 +-
test/PikaMath-test.cpp | 20 +-
test/PikaNN-test.cpp | 2 +-
test/VM-test.cpp | 132 +++----
test/builtin-test.cpp | 18 +-
test/cJSON-test.cpp | 30 +-
test/chinese-test.cpp | 2 +-
test/class-test.cpp | 8 +-
test/cmodule-test.cpp | 2 +-
test/configparser-test.cpp | 4 +-
test/ctypes-test.cpp | 4 +-
test/except-test.cpp | 20 +-
test/gc-test.cpp | 22 ++
test/hashlib-test.cpp | 2 +-
test/json-test.cpp | 4 +-
test/main.cpp | 8 +-
test/module-test.cpp | 56 +--
test/network-test.cpp | 6 +-
test/parse-test.cpp | 328 +++++++++---------
test/pikaMain-test.cpp | 276 +++++++--------
test/pikaui-test.cpp | 2 +-
test/python/gc/gc_circle.py | 11 +
test/stddata-test.cpp | 60 ++--
test/string-test.cpp | 30 +-
test/strs-test.cpp | 6 +-
test/sysObj-test.cpp | 4 +-
test/test_common.h | 2 +-
test/thread-test.cpp | 4 +-
test/unix-time-test.cpp | 8 +-
75 files changed, 1012 insertions(+), 793 deletions(-)
create mode 100644 test/python/gc/gc_circle.py
diff --git a/port/linux/.vscode/launch.json b/port/linux/.vscode/launch.json
index af2c7f8b8..3af65c070 100644
--- a/port/linux/.vscode/launch.json
+++ b/port/linux/.vscode/launch.json
@@ -11,7 +11,7 @@
"program": "${workspaceFolder}/build/test/pikascript_test",
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
- "--gtest_filter=vm.dir_print_arg"
+ "--gtest_filter=gc.circle"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
diff --git a/port/linux/.vscode/settings.json b/port/linux/.vscode/settings.json
index 5058dc926..1185b90df 100644
--- a/port/linux/.vscode/settings.json
+++ b/port/linux/.vscode/settings.json
@@ -112,7 +112,10 @@
"pthread.h": "c",
"deque": "c",
"list": "c",
- "vector": "c"
+ "vector": "c",
+ "datastrs.h": "c",
+ "__instruction_table.h": "c",
+ "assert.h": "c"
},
"python.formatting.provider": "autopep8",
}
\ No newline at end of file
diff --git a/port/linux/boot/banchmark/main.c b/port/linux/boot/banchmark/main.c
index 92e954f9b..2898198ed 100644
--- a/port/linux/boot/banchmark/main.c
+++ b/port/linux/boot/banchmark/main.c
@@ -28,7 +28,7 @@ void checker_memInfo(void)
{
printf("---------------------------\r\n");
printf("Memory pool info:\r\n");
- checker_printMem(" mem state size = ", sizeof(PikaMemInfo));
+ checker_printMem(" mem state size = ", sizeof(pikaMemInfo));
printf("---------------------------\r\n");
}
void checker_assertMemFree()
diff --git a/port/linux/config/pika_config_default.h b/port/linux/config/pika_config_default.h
index 02c22d141..bff8f482c 100644
--- a/port/linux/config/pika_config_default.h
+++ b/port/linux/config/pika_config_default.h
@@ -5,4 +5,5 @@
#define PIKA_READ_FILE_BUFF_SIZE 1024 * 40
#define PIKA_INSTRUCT_HOOK_ENABLE 1
#define PIKA_INSTRUCT_HOOK_PERIOD 1
-#define PIKA_SHELL_FILTER_ENABLE 1
\ No newline at end of file
+#define PIKA_SHELL_FILTER_ENABLE 1
+#define PIKA_GC_MARK_SWEIP_ENABLE 1
\ No newline at end of file
diff --git a/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py b/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py
index c5914b043..c49b178d7 100644
--- a/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py
+++ b/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py
@@ -337,9 +337,9 @@ stack_init(&bs);
EXPECT_EQ(pikaMemNow(), 0);
}
-extern PikaMemInfo pikaMemInfo;
+extern pikaMemInfo g_pikaMemInfo;
TEST(parser, while_true_if_false_both_exit) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* bf = New_strBuff();
Stack bs;
stack_init(&bs);
@@ -377,7 +377,7 @@ stack_init(&bs);
}
TEST(parser, multiLine) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"while true:\n"
@@ -414,7 +414,7 @@ TEST(parser, multiLine) {
}
TEST(parser, pikaPi) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
const char lines[] =
@@ -533,7 +533,7 @@ TEST(parser, pikaPi) {
}
TEST(parser, add) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 + 1\n";
printf("%s", lines);
@@ -550,7 +550,7 @@ TEST(parser, add) {
}
TEST(parser, add_3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 + 2 + 3\n";
printf("%s", lines);
@@ -569,7 +569,7 @@ TEST(parser, add_3) {
}
TEST(parser, add_a_pp) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = a + 1\n";
printf("%s", lines);
@@ -586,7 +586,7 @@ TEST(parser, add_a_pp) {
}
TEST(parser, while_a_pp) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"while a < 10:\n"
@@ -618,7 +618,7 @@ TEST(parser, while_a_pp) {
}
TEST(parser, add_m2p3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 * 2 + 3\n";
printf("%s", lines);
@@ -637,7 +637,7 @@ TEST(parser, add_m2p3) {
}
TEST(parser, add_m2p3_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 * (2 + 3)\n";
printf("%s", lines);
@@ -657,7 +657,7 @@ TEST(parser, add_m2p3_) {
}
TEST(parser, add_m12p3_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = (1 + 2) * 3\n";
printf("%s", lines);
@@ -677,7 +677,7 @@ TEST(parser, add_m12p3_) {
}
TEST(parser, method_equ) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"if right.read() == 1:\n";
printf("%s", lines);
@@ -694,7 +694,7 @@ TEST(parser, method_equ) {
}
TEST(parser, equ_method) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"if 1 == right.read() :\n";
printf("%s", lines);
@@ -711,7 +711,7 @@ TEST(parser, equ_method) {
}
TEST(parser, def_add) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -737,7 +737,7 @@ TEST(parser, def_add) {
}
TEST(parser, def_add_return) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -764,7 +764,7 @@ TEST(parser, def_add_return) {
}
TEST(parser, def_while_return) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -797,7 +797,7 @@ TEST(parser, def_while_return) {
}
TEST(parser, def_while_return_void) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -827,7 +827,7 @@ TEST(parser, def_while_return_void) {
}
TEST(parser, signed_num) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = -1\n";
printf("%s", lines);
@@ -843,7 +843,7 @@ TEST(parser, signed_num) {
}
TEST(parser, comp_signed_num) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"if a > -1:\n";
printf("%s", lines);
@@ -862,7 +862,7 @@ TEST(parser, comp_signed_num) {
TEST(lexser, symbol_add) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -881,7 +881,7 @@ TEST(lexser, symbol_add) {
TEST(lexser, symbol_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -899,7 +899,7 @@ TEST(lexser, symbol_1) {
TEST(lexser, operator_not) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -917,7 +917,7 @@ TEST(lexser, operator_not) {
TEST(lexser, symbol_Nag) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -935,7 +935,7 @@ TEST(lexser, symbol_Nag) {
TEST(lexser, operator_all) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -967,7 +967,7 @@ TEST(lexser, operator_all) {
TEST(lexser, symbol_2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -987,7 +987,7 @@ TEST(lexser, symbol_2) {
TEST(lexser, symbol_and) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1007,7 +1007,7 @@ TEST(lexser, symbol_and) {
TEST(lexser, sting) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1025,7 +1025,7 @@ TEST(lexser, sting) {
TEST(lexser, num_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1043,7 +1043,7 @@ TEST(lexser, num_1) {
TEST(lexser, jjcc) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1074,7 +1074,7 @@ TEST(parser, pop_by_str) {
}
TEST(parser, mm) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = a ** -1\n";
printf("%s", lines);
@@ -1092,7 +1092,7 @@ TEST(parser, mm) {
}
TEST(parser, self_inc) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"a += -1\n"
@@ -1156,7 +1156,7 @@ TEST(parser, self_inc) {
}
TEST(parser, n_n1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = ~-1\n";
printf("%s", lines);
@@ -1173,7 +1173,7 @@ TEST(parser, n_n1) {
}
TEST(parser, or_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"( a>1) or (b<= 3)\n";
printf("%s", lines);
diff --git a/port/linux/package/pikascript/main.py b/port/linux/package/pikascript/main.py
index 8ca50f3a8..a200a657c 100644
--- a/port/linux/package/pikascript/main.py
+++ b/port/linux/package/pikascript/main.py
@@ -5,7 +5,7 @@ import GTestTask, TempDevTest
import cb_test
import configparser, network
import test_module1, test_cmodule, test_module4, import_test
-import hashlib, hmac, aes, base64, time
+import hashlib, hmac, aes, base64, time, gc
import _thread, weakref
mem = PikaStdLib.MemChecker()
diff --git a/port/linux/performance/main.c b/port/linux/performance/main.c
index 954635c7a..d39e4ea0c 100644
--- a/port/linux/performance/main.c
+++ b/port/linux/performance/main.c
@@ -29,11 +29,11 @@ int main(void) {
/* deinit */
obj_deinit(pikaMain);
#if PIKA_ARG_CACHE_ENABLE
- extern PikaMemInfo pikaMemInfo;
+ extern pikaMemInfo g_pikaMemInfo;
printf("[ Info]: alloc times: %d, cached times: %d (%0.2f%%)\r\n",
- pikaMemInfo.alloc_times, pikaMemInfo.alloc_times_cache,
- ((float)pikaMemInfo.alloc_times_cache /
- (float)pikaMemInfo.alloc_times) *
+ g_pikaMemInfo.alloc_times, g_pikaMemInfo.alloc_times_cache,
+ ((float)g_pikaMemInfo.alloc_times_cache /
+ (float)g_pikaMemInfo.alloc_times) *
100.0);
#endif
printf("[ Info]: time elapsed: %lfs\r\n",
diff --git a/src/BaseObj.c b/src/BaseObj.c
index bf47a06c2..7f60ac1ed 100644
--- a/src/BaseObj.c
+++ b/src/BaseObj.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/BaseObj.h b/src/BaseObj.h
index dd954df4f..7ed7c51f6 100644
--- a/src/BaseObj.h
+++ b/src/BaseObj.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/PikaCompiler.c b/src/PikaCompiler.c
index 720e72fa3..89b7588a8 100644
--- a/src/PikaCompiler.c
+++ b/src/PikaCompiler.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/PikaObj.c b/src/PikaObj.c
index 729760210..df1a0ac4d 100644
--- a/src/PikaObj.c
+++ b/src/PikaObj.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -37,9 +37,12 @@
#include "dataString.h"
#include "dataStrs.h"
-extern volatile VMSignal PikaVMSignal;
-static volatile Arg* _help_modules_cmodule = NULL;
-static volatile PIKA_BOOL in_root_obj = PIKA_FALSE;
+extern volatile VMSignal g_PikaVMSignal;
+static volatile PikaObjState g_PikaObjState = {
+ .helpModulesCmodule = NULL,
+ .inRootObj = PIKA_FALSE,
+ .gcChain = NULL,
+};
static enum shellCTRL __obj_shellLineHandler_REPL(PikaObj* self,
char* input_line,
@@ -110,13 +113,22 @@ char* fast_itoa(char* buf, uint32_t val) {
static int32_t obj_deinit_no_del(PikaObj* self) {
/* free the list */
args_deinit(self->list);
+ extern volatile PikaObj* __pikaMain;
+ /* remove self from gc chain */
+ pikaGC_remove(self);
/* free the pointer */
pikaFree(self, sizeof(PikaObj));
self = NULL;
+ if (self == (PikaObj*)__pikaMain) {
+ __pikaMain = NULL;
+ }
return 0;
}
int obj_GC(PikaObj* self) {
+ if (!pikaGC_checkAlive(self)) {
+ return 0;
+ }
obj_refcntDec(self);
int ref_cnt = obj_refcntNow(self);
if (ref_cnt <= 0) {
@@ -146,11 +158,10 @@ int32_t obj_deinit(PikaObj* self) {
#if PIKA_EVENT_ENABLE
_VMEvent_deinit();
#endif
- if (NULL != _help_modules_cmodule) {
- arg_deinit((Arg*)_help_modules_cmodule);
- _help_modules_cmodule = NULL;
+ if (NULL != g_PikaObjState.helpModulesCmodule) {
+ arg_deinit(g_PikaObjState.helpModulesCmodule);
+ g_PikaObjState.helpModulesCmodule = NULL;
}
- __pikaMain = NULL;
}
return obj_deinit_no_del(self);
}
@@ -356,14 +367,12 @@ char* obj_getStr(PikaObj* self, char* argPath) {
return res;
}
-PikaObj* obj_getClassObjByNewFun(PikaObj* context,
- char* name,
- NewFun newClassFun) {
- Args* initArgs = New_args(NULL);
- PikaObj* thisClass = newClassFun(initArgs);
- thisClass->constructor = newClassFun;
+PikaObj* obj_newObjFromConstructor(PikaObj* context,
+ char* name,
+ NewFun constructor) {
+ PikaObj* thisClass = constructor(NULL);
+ thisClass->constructor = constructor;
thisClass->refcnt = 0;
- args_deinit(initArgs);
return thisClass;
}
@@ -458,7 +467,7 @@ PikaObj* obj_getClassObj(PikaObj* obj) {
if (NULL == classPtr) {
return NULL;
}
- PikaObj* classObj = obj_getClassObjByNewFun(obj, "", classPtr);
+ PikaObj* classObj = obj_newObjFromConstructor(obj, "", classPtr);
return classObj;
}
@@ -478,7 +487,7 @@ PikaObj* removeMethodInfo(PikaObj* thisClass) {
}
PikaObj* newNormalObj(NewFun newObjFun) {
- PikaObj* thisClass = obj_getClassObjByNewFun(NULL, "", newObjFun);
+ PikaObj* thisClass = obj_newObjFromConstructor(NULL, "", newObjFun);
obj_refcntInc(thisClass);
obj_setFlag(thisClass, OBJ_FLAG_ALREADY_INIT);
return removeMethodInfo(thisClass);
@@ -517,7 +526,7 @@ static volatile uint8_t logo_printed = 0;
extern volatile PikaObj* __pikaMain;
PikaObj* newRootObj(char* name, NewFun newObjFun) {
- in_root_obj = PIKA_TRUE;
+ g_PikaObjState.inRootObj = PIKA_TRUE;
#if PIKA_POOL_ENABLE
mem_pool_init();
#endif
@@ -533,7 +542,7 @@ PikaObj* newRootObj(char* name, NewFun newObjFun) {
pika_platform_printf("~~~~~~~~~~~~~~~~~~~~\r\n");
}
__pikaMain = newObj;
- in_root_obj = PIKA_FALSE;
+ g_PikaObjState.inRootObj = PIKA_FALSE;
return newObj;
}
@@ -554,7 +563,7 @@ Arg* obj_newObjInPackage(NewFun new_obj_fun) {
return arg_newDirectObj(new_obj_fun);
}
-static PikaObj* __obj_initSubObj(PikaObj* obj, char* name) {
+static PikaObj* _obj_initMetaObj(PikaObj* obj, char* name) {
PikaObj* res = NULL;
NewFun constructor = (NewFun)getNewClassObjFunByName(obj, name);
Args buffs = {0};
@@ -565,7 +574,7 @@ static PikaObj* __obj_initSubObj(PikaObj* obj, char* name) {
res = NULL;
goto exit;
}
- thisClass = obj_getClassObjByNewFun(obj, name, constructor);
+ thisClass = obj_newObjFromConstructor(obj, name, constructor);
new_obj = removeMethodInfo(thisClass);
obj_refcntInc(new_obj);
obj_runNativeMethod(new_obj, "__init__", NULL);
@@ -626,7 +635,7 @@ static PikaObj* __obj_getObjDirect(PikaObj* self,
type = arg_getType(arg_obj);
/* found meta Object */
if (type == ARG_TYPE_OBJECT_META) {
- return __obj_initSubObj(self, name);
+ return _obj_initMetaObj(self, name);
}
/* found Objcet */
if (argType_isObject(type)) {
@@ -1337,8 +1346,8 @@ enum shellCTRL _do_obj_runChar(PikaObj* self,
int16_t n = byte_count;
while (n--) {
- PIKA_BOOL result = byteQueue_readOne(queue, (uint8_t*)&inputChar);
- pika_assert(result != PIKA_FALSE);
+ pika_assert(PIKA_FALSE !=
+ byteQueue_readOne(queue, (uint8_t*)&inputChar));
if (SHELL_CTRL_EXIT ==
_inner_do_obj_runChar(self, inputChar, shell)) {
@@ -1654,6 +1663,145 @@ char* method_getStr(Args* args, char* argName) {
return args_getStr(args, argName);
}
+void pikaGC_append(PikaObj* self) {
+ /* gc single chain */
+ if (NULL == g_PikaObjState.gcChain) {
+ g_PikaObjState.gcChain = self;
+ return;
+ }
+ /* append to head of gc chain */
+ self->gcNext = g_PikaObjState.gcChain;
+ g_PikaObjState.gcChain = self;
+}
+
+PikaObj* pikaGC_getLast(PikaObj* self) {
+ PikaObj* obj = g_PikaObjState.gcChain;
+ PikaObj* last = NULL;
+ while (NULL != obj) {
+ if (obj == self) {
+ return last;
+ }
+ last = obj;
+ obj = obj->gcNext;
+ }
+ return NULL;
+}
+
+void pikaGC_remove(PikaObj* self) {
+ PikaObj* last = pikaGC_getLast(self);
+ if (NULL == last) {
+ /* remove head */
+ g_PikaObjState.gcChain = self->gcNext;
+ return;
+ }
+ last->gcNext = self->gcNext;
+}
+
+uint32_t pikaGC_count(void) {
+ uint32_t count = 0;
+ PikaObj* obj = g_PikaObjState.gcChain;
+ while (NULL != obj) {
+ count++;
+ obj = obj->gcNext;
+ }
+ return count;
+}
+
+PIKA_BOOL pikaGC_checkAlive(PikaObj* self) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return PIKA_TRUE;
+#else
+ PikaObj* obj = g_PikaObjState.gcChain;
+ while (NULL != obj) {
+ if (obj == self) {
+ return PIKA_TRUE;
+ }
+ obj = obj->gcNext;
+ }
+ return PIKA_FALSE;
+#endif
+}
+
+uint32_t pikaGC_countMarked(void) {
+ uint32_t count = 0;
+ PikaObj* obj = g_PikaObjState.gcChain;
+ while (NULL != obj) {
+ if (obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
+ count++;
+ }
+ obj = obj->gcNext;
+ }
+ return count;
+}
+
+uint32_t pikaGC_printCanFree(void) {
+ uint32_t count = 0;
+ PikaObj* obj = g_PikaObjState.gcChain;
+ while (NULL != obj) {
+ if (!obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
+ count++;
+ pika_platform_printf("gc free: %p\r\n", obj);
+ }
+ obj = obj->gcNext;
+ }
+ return count;
+}
+
+uint32_t pikaGC_FreeOnce(void) {
+ pikaGC_markRoot();
+ pika_platform_printf("-----\r\n");
+ pikaGC_printCanFree();
+ uint32_t count = 0;
+ PikaObj* obj = g_PikaObjState.gcChain;
+ while (NULL != obj) {
+ if (!obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
+ count++;
+ obj_GC(obj);
+ return count;
+ }
+ obj = obj->gcNext;
+ }
+ return count;
+}
+
+uint32_t pikaGC_markSweep(void) {
+ uint32_t count = 0;
+ while (pikaGC_FreeOnce() != 0) {
+ count++;
+ };
+ return count;
+}
+
+int32_t pikaGC_markHandler(Arg* argEach, Args* context) {
+ if (arg_isObject(argEach)) {
+ PikaObj* obj = (PikaObj*)arg_getPtr(argEach);
+ pikaGC_mark(obj);
+ }
+ return 0;
+}
+
+void pikaGC_mark(PikaObj* self) {
+ if (obj_getFlag(self, OBJ_FLAG_GC_MARKED)) {
+ return;
+ }
+ obj_setFlag(self, OBJ_FLAG_GC_MARKED);
+ args_foreach(self->list, pikaGC_markHandler, NULL);
+}
+
+void pikaGC_cleanMark(void) {
+ PikaObj* obj = g_PikaObjState.gcChain;
+ while (NULL != obj) {
+ obj_clearFlag(obj, OBJ_FLAG_GC_MARKED);
+ obj = obj->gcNext;
+ }
+}
+
+void pikaGC_markRoot() {
+ pikaGC_cleanMark();
+ PikaObj* root = (PikaObj*)__pikaMain;
+ pikaGC_mark(root);
+}
+
PikaObj* New_PikaObj(void) {
PikaObj* self = pikaMalloc(sizeof(PikaObj));
/* List */
@@ -1661,6 +1809,9 @@ PikaObj* New_PikaObj(void) {
self->refcnt = 0;
self->constructor = NULL;
self->flag = 0;
+ self->gcNext = NULL;
+ /* append to gc chain */
+ pikaGC_append(self);
return self;
}
@@ -1691,13 +1842,13 @@ int32_t obj_newMetaObj(PikaObj* self, char* objName, NewFun newFunPtr) {
}
static void _append_help(char* name) {
- if (NULL == _help_modules_cmodule) {
- _help_modules_cmodule = (volatile Arg*)arg_newStr("");
+ if (NULL == g_PikaObjState.helpModulesCmodule) {
+ g_PikaObjState.helpModulesCmodule = arg_newStr("");
}
- Arg* _help = (Arg*)_help_modules_cmodule;
+ Arg* _help = g_PikaObjState.helpModulesCmodule;
_help = arg_strAppend(_help, name);
_help = arg_strAppend(_help, "\r\n");
- _help_modules_cmodule = (volatile Arg*)_help;
+ g_PikaObjState.helpModulesCmodule = _help;
}
int32_t obj_newObj(PikaObj* self,
@@ -1705,7 +1856,7 @@ int32_t obj_newObj(PikaObj* self,
char* className,
NewFun newFunPtr) {
/* before init root object */
- if (in_root_obj) {
+ if (g_PikaObjState.inRootObj) {
_append_help(objName);
}
return obj_newMetaObj(self, objName, newFunPtr);
@@ -1759,7 +1910,7 @@ PikaObj* obj_linkLibrary(PikaObj* self, uint8_t* library_bytes) {
void obj_printModules(PikaObj* self) {
LibObj* lib = obj_getObj(self, "@lib");
- pika_platform_printf(arg_getStr((Arg*)_help_modules_cmodule));
+ pika_platform_printf(arg_getStr((Arg*)g_PikaObjState.helpModulesCmodule));
LibObj_printModules(lib);
}
@@ -1945,7 +2096,7 @@ void _do_pks_eventListener_send(PikaEventListener* self,
}
}
#if PIKA_EVENT_THREAD_ENABLE
- if (PikaVMSignal.event_thread_inited) {
+ if (g_PikaVMSignal.event_thread_inited) {
return;
}
/* using multi thread */
@@ -1954,7 +2105,7 @@ void _do_pks_eventListener_send(PikaEventListener* self,
PIKA_THREAD_STACK_SIZE, PIKA_THREAD_PRIO,
PIKA_THREAD_TICK);
pika_debug("event thread init");
- PikaVMSignal.event_thread_inited = 1;
+ g_PikaVMSignal.event_thread_inited = 1;
}
#endif
#endif
@@ -1983,11 +2134,11 @@ Arg* pks_eventListener_sendSignalAwaitResult(PikaEventListener* self,
while (1) {
};
#else
- extern volatile VMSignal PikaVMSignal;
- int tail = PikaVMSignal.cq.tail;
+ extern volatile VMSignal g_PikaVMSignal;
+ int tail = g_PikaVMSignal.cq.tail;
pks_eventListener_sendSignal(self, eventId, eventSignal);
while (1) {
- Arg* res = PikaVMSignal.cq.res[tail];
+ Arg* res = g_PikaVMSignal.cq.res[tail];
pika_platform_thread_delay();
if (NULL != res) {
return res;
diff --git a/src/PikaObj.h b/src/PikaObj.h
index 8d6189d52..dc9414b81 100644
--- a/src/PikaObj.h
+++ b/src/PikaObj.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -32,8 +32,8 @@
#include "dataArgs.h"
#include "dataLink.h"
#include "dataMemory.h"
-#include "dataStrs.h"
#include "dataQueue.h"
+#include "dataStrs.h"
typedef struct InstructUnit InstructUnit;
struct InstructUnit {
@@ -78,8 +78,9 @@ struct NativeProperty {
typedef struct PikaObj PikaObj;
struct PikaObj {
Args* list;
- uint8_t refcnt;
void* constructor;
+ PikaObj* gcNext;
+ uint8_t refcnt;
uint8_t flag;
};
@@ -91,12 +92,20 @@ struct RangeData {
int64_t i;
};
+typedef struct PikaObjState PikaObjState;
+struct PikaObjState {
+ Arg* helpModulesCmodule;
+ PIKA_BOOL inRootObj;
+ PikaObj* gcChain;
+};
+
#define OBJ_FLAG_PROXY_GETATTRIBUTE 0x01
#define OBJ_FLAG_PROXY_GETATTR 0x02
#define OBJ_FLAG_PROXY_SETATTR 0x04
#define OBJ_FLAG_ALREADY_INIT 0x08
#define OBJ_FLAG_RUN_AS 0x16
#define OBJ_FLAG_GLOBALS 0x32
+#define OBJ_FLAG_GC_MARKED 0x64
#define KEY_UP 0x41
#define KEY_DOWN 0x42
@@ -228,7 +237,9 @@ int32_t class_defineRunTimeConstructor(PikaObj* self,
int32_t obj_removeArg(PikaObj* self, char* argPath);
int32_t obj_isArgExist(PikaObj* self, char* argPath);
-PikaObj* obj_getClassObjByNewFun(PikaObj* self, char* name, NewFun newClassFun);
+PikaObj* obj_newObjFromConstructor(PikaObj* self,
+ char* name,
+ NewFun newClassFun);
PikaObj* newRootObj(char* name, NewFun newObjFun);
PikaObj* obj_getClassObj(PikaObj* obj);
Arg* obj_getMethodArg(PikaObj* obj, char* methodPath);
@@ -281,7 +292,6 @@ typedef struct ShellConfig ShellConfig;
typedef enum shellCTRL (*sh_handler)(PikaObj*, char*, ShellConfig*);
typedef char (*sh_getchar)(void);
-
#if PIKA_SHELL_FILTER_ENABLE
typedef struct FilterFIFO {
ByteQueue queue;
@@ -291,19 +301,19 @@ typedef struct FilterFIFO {
typedef struct FilterItem FilterItem;
-typedef PIKA_BOOL FilterMessageHandler( FilterItem *msg,
- PikaObj* self,
- ShellConfig* shell);
+typedef PIKA_BOOL FilterMessageHandler(FilterItem* msg,
+ PikaObj* self,
+ ShellConfig* shell);
struct FilterItem {
- FilterMessageHandler *handler;
- const uint8_t *message;
- uint16_t size;
- uint8_t is_visible : 1;
- uint8_t is_case_insensitive : 1;
- uint8_t : 6;
- uint8_t ignore_mask;
- uintptr_t target;
+ FilterMessageHandler* handler;
+ const uint8_t* message;
+ uint16_t size;
+ uint8_t is_visible : 1;
+ uint8_t is_case_insensitive : 1;
+ uint8_t : 6;
+ uint8_t ignore_mask;
+ uintptr_t target;
};
#endif
@@ -311,9 +321,9 @@ struct FilterItem {
struct ShellConfig {
#if PIKA_SHELL_FILTER_ENABLE
FilterFIFO filter_fifo;
- FilterItem *messages;
+ FilterItem* messages;
uint16_t message_count;
- uint16_t : 16; /* padding to suppress warning*/
+ uint16_t : 16; /* padding to suppress warning*/
#endif
char* prefix;
sh_handler handler;
@@ -566,6 +576,16 @@ void obj_printModules(PikaObj* self);
} while (0)
#endif
+void pikaGC_append(PikaObj* self);
+uint32_t pikaGC_count(void);
+void pikaGC_remove(PikaObj* self);
+void pikaGC_mark(PikaObj* self);
+void pikaGC_markRoot(void);
+uint32_t pikaGC_countMarked(void);
+uint32_t pikaGC_printCanFree(void);
+uint32_t pikaGC_markSweep(void);
+PIKA_BOOL pikaGC_checkAlive(PikaObj* self);
+
int pika_GIL_EXIT(void);
int pika_GIL_ENTER(void);
diff --git a/src/PikaParser.c b/src/PikaParser.c
index d71ca4d88..816ba5979 100644
--- a/src/PikaParser.c
+++ b/src/PikaParser.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/PikaParser.h b/src/PikaParser.h
index aa227acc8..b1e19811d 100644
--- a/src/PikaParser.h
+++ b/src/PikaParser.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/PikaPlatform.c b/src/PikaPlatform.c
index 0188e21ba..37017a545 100644
--- a/src/PikaPlatform.c
+++ b/src/PikaPlatform.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/PikaPlatform.h b/src/PikaPlatform.h
index eca30986e..8213d119b 100644
--- a/src/PikaPlatform.h
+++ b/src/PikaPlatform.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -48,7 +48,7 @@
abort(); \
}
#else
- #define pika_assert(...)
+ #define pika_assert(...) (void)0;
#endif
/* clang-format on */
diff --git a/src/PikaVM.c b/src/PikaVM.c
index 9726b2c34..c5d352493 100644
--- a/src/PikaVM.c
+++ b/src/PikaVM.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -36,67 +36,67 @@
#include
#endif
-volatile VMSignal PikaVMSignal = {.signal_ctrl = VM_SIGNAL_CTRL_NONE,
- .vm_cnt = 0,
+static pika_platform_thread_mutex_t g_pikaGIL = {0};
+volatile VMSignal g_PikaVMSignal = {.signal_ctrl = VM_SIGNAL_CTRL_NONE,
+
+ .vm_cnt = 0,
#if PIKA_EVENT_ENABLE
- .cq =
- {
- .head = 0,
- .tail = 0,
- .res = {0},
- },
- .event_pickup_cnt = 0,
- .event_thread_inited = 0
+ .cq =
+ {
+ .head = 0,
+ .tail = 0,
+ .res = {0},
+ },
+ .event_pickup_cnt = 0,
+ .event_thread_inited = 0
#endif
};
-static pika_platform_thread_mutex_t pikavm_global_lock = {0};
-
int pika_GIL_ENTER(void) {
- if (!pikavm_global_lock.is_init) {
+ if (!g_pikaGIL.is_init) {
return 0;
}
- int ret = pika_platform_thread_mutex_lock(&pikavm_global_lock);
+ int ret = pika_platform_thread_mutex_lock(&g_pikaGIL);
// pika_debug("pika_GIL_ENTER");
- if (!pikavm_global_lock.is_first_lock) {
- pikavm_global_lock.is_first_lock = 1;
+ if (!g_pikaGIL.is_first_lock) {
+ g_pikaGIL.is_first_lock = 1;
}
return ret;
}
int pika_GIL_EXIT(void) {
- if (!pikavm_global_lock.is_init) {
+ if (!g_pikaGIL.is_init) {
return 0;
}
// pika_debug("pika_GIL_EXIT");
- return pika_platform_thread_mutex_unlock(&pikavm_global_lock);
+ return pika_platform_thread_mutex_unlock(&g_pikaGIL);
}
int _VM_lock_init(void) {
- if (pikavm_global_lock.is_init) {
+ if (g_pikaGIL.is_init) {
return 0;
}
- int ret = pika_platform_thread_mutex_init(&pikavm_global_lock);
+ int ret = pika_platform_thread_mutex_init(&g_pikaGIL);
if (0 == ret) {
- pikavm_global_lock.is_init = 1;
+ g_pikaGIL.is_init = 1;
}
return ret;
}
int _VM_is_first_lock(void) {
- return pikavm_global_lock.is_first_lock;
+ return g_pikaGIL.is_first_lock;
}
int _VMEvent_getVMCnt(void) {
- return PikaVMSignal.vm_cnt;
+ return g_PikaVMSignal.vm_cnt;
}
int _VMEvent_getEventPickupCnt(void) {
#if !PIKA_EVENT_ENABLE
return -1;
#else
- return PikaVMSignal.event_pickup_cnt;
+ return g_PikaVMSignal.event_pickup_cnt;
#endif
}
@@ -171,13 +171,13 @@ void _VMEvent_deinit(void) {
pika_platform_panic_handle();
#else
for (int i = 0; i < PIKA_EVENT_LIST_SIZE; i++) {
- if (NULL != PikaVMSignal.cq.res[i]) {
- arg_deinit(PikaVMSignal.cq.res[i]);
- PikaVMSignal.cq.res[i] = NULL;
+ if (NULL != g_PikaVMSignal.cq.res[i]) {
+ arg_deinit(g_PikaVMSignal.cq.res[i]);
+ g_PikaVMSignal.cq.res[i] = NULL;
}
- if (NULL != PikaVMSignal.cq.data[i]) {
- arg_deinit(PikaVMSignal.cq.data[i]);
- PikaVMSignal.cq.data[i] = NULL;
+ if (NULL != g_PikaVMSignal.cq.data[i]) {
+ arg_deinit(g_PikaVMSignal.cq.data[i]);
+ g_PikaVMSignal.cq.data[i] = NULL;
}
}
#endif
@@ -192,25 +192,26 @@ PIKA_RES __eventListener_pushEvent(PikaEventListener* lisener,
return PIKA_RES_ERR_OPERATION_FAILED;
#else
/* push to event_cq_buff */
- if (_ecq_isFull(&PikaVMSignal.cq)) {
+ if (_ecq_isFull(&g_PikaVMSignal.cq)) {
arg_deinit(eventData);
return PIKA_RES_ERR_SIGNAL_EVENT_FULL;
}
if (arg_getType(eventData) == ARG_TYPE_OBJECT_NEW) {
arg_setType(eventData, ARG_TYPE_OBJECT);
}
- if (PikaVMSignal.cq.res[PikaVMSignal.cq.tail] != NULL) {
- arg_deinit(PikaVMSignal.cq.res[PikaVMSignal.cq.tail]);
- PikaVMSignal.cq.res[PikaVMSignal.cq.tail] = NULL;
+ if (g_PikaVMSignal.cq.res[g_PikaVMSignal.cq.tail] != NULL) {
+ arg_deinit(g_PikaVMSignal.cq.res[g_PikaVMSignal.cq.tail]);
+ g_PikaVMSignal.cq.res[g_PikaVMSignal.cq.tail] = NULL;
}
- if (PikaVMSignal.cq.data[PikaVMSignal.cq.tail] != NULL) {
- arg_deinit(PikaVMSignal.cq.data[PikaVMSignal.cq.tail]);
- PikaVMSignal.cq.data[PikaVMSignal.cq.tail] = NULL;
+ if (g_PikaVMSignal.cq.data[g_PikaVMSignal.cq.tail] != NULL) {
+ arg_deinit(g_PikaVMSignal.cq.data[g_PikaVMSignal.cq.tail]);
+ g_PikaVMSignal.cq.data[g_PikaVMSignal.cq.tail] = NULL;
}
- PikaVMSignal.cq.id[PikaVMSignal.cq.tail] = eventId;
- PikaVMSignal.cq.data[PikaVMSignal.cq.tail] = eventData;
- PikaVMSignal.cq.lisener[PikaVMSignal.cq.tail] = lisener;
- PikaVMSignal.cq.tail = (PikaVMSignal.cq.tail + 1) % PIKA_EVENT_LIST_SIZE;
+ g_PikaVMSignal.cq.id[g_PikaVMSignal.cq.tail] = eventId;
+ g_PikaVMSignal.cq.data[g_PikaVMSignal.cq.tail] = eventData;
+ g_PikaVMSignal.cq.lisener[g_PikaVMSignal.cq.tail] = lisener;
+ g_PikaVMSignal.cq.tail =
+ (g_PikaVMSignal.cq.tail + 1) % PIKA_EVENT_LIST_SIZE;
return PIKA_RES_OK;
#endif
}
@@ -225,14 +226,15 @@ PIKA_RES __eventListener_popEvent(PikaEventListener** lisener_p,
return PIKA_RES_ERR_OPERATION_FAILED;
#else
/* pop from event_cq_buff */
- if (_ecq_isEmpty(&PikaVMSignal.cq)) {
+ if (_ecq_isEmpty(&g_PikaVMSignal.cq)) {
return PIKA_RES_ERR_SIGNAL_EVENT_EMPTY;
}
- *id = PikaVMSignal.cq.id[PikaVMSignal.cq.head];
- *data = PikaVMSignal.cq.data[PikaVMSignal.cq.head];
- *lisener_p = PikaVMSignal.cq.lisener[PikaVMSignal.cq.head];
- *head = PikaVMSignal.cq.head;
- PikaVMSignal.cq.head = (PikaVMSignal.cq.head + 1) % PIKA_EVENT_LIST_SIZE;
+ *id = g_PikaVMSignal.cq.id[g_PikaVMSignal.cq.head];
+ *data = g_PikaVMSignal.cq.data[g_PikaVMSignal.cq.head];
+ *lisener_p = g_PikaVMSignal.cq.lisener[g_PikaVMSignal.cq.head];
+ *head = g_PikaVMSignal.cq.head;
+ g_PikaVMSignal.cq.head =
+ (g_PikaVMSignal.cq.head + 1) % PIKA_EVENT_LIST_SIZE;
return PIKA_RES_OK;
#endif
}
@@ -252,26 +254,26 @@ void _VMEvent_pickupEvent(void) {
int head;
if (PIKA_RES_OK == __eventListener_popEvent(&event_lisener, &event_id,
&event_data, &head)) {
- PikaVMSignal.event_pickup_cnt++;
- pika_debug("pickup_cnt: %d", PikaVMSignal.event_pickup_cnt);
+ g_PikaVMSignal.event_pickup_cnt++;
+ pika_debug("pickup_cnt: %d", g_PikaVMSignal.event_pickup_cnt);
Arg* res =
__eventListener_runEvent(event_lisener, event_id, event_data);
- PikaVMSignal.cq.res[head] = res;
- PikaVMSignal.event_pickup_cnt--;
+ g_PikaVMSignal.cq.res[head] = res;
+ g_PikaVMSignal.event_pickup_cnt--;
}
#endif
}
VM_SIGNAL_CTRL VMSignal_getCtrl(void) {
- return PikaVMSignal.signal_ctrl;
+ return g_PikaVMSignal.signal_ctrl;
}
void pks_vm_exit(void) {
- PikaVMSignal.signal_ctrl = VM_SIGNAL_CTRL_EXIT;
+ g_PikaVMSignal.signal_ctrl = VM_SIGNAL_CTRL_EXIT;
}
void pks_vmSignal_setCtrlElear(void) {
- PikaVMSignal.signal_ctrl = VM_SIGNAL_CTRL_NONE;
+ g_PikaVMSignal.signal_ctrl = VM_SIGNAL_CTRL_NONE;
}
/* head declare start */
@@ -1676,6 +1678,7 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
Arg* arg_ret_reg) {
Arg* return_arg = NULL;
VMParameters* sub_locals = NULL;
+ VMParameters* sub_locals_init = NULL;
char* run_path = data;
PikaObj* method_host = NULL;
PikaObj* obj_this = NULL;
@@ -1866,24 +1869,24 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
PikaObj* new_obj = arg_getPtr(return_arg);
Arg* method_arg =
obj_getMethodArg_noalloc(new_obj, "__init__", &arg_reg1);
- PikaObj* sub_locals = New_PikaObj();
+ sub_locals_init = New_PikaObj();
Arg* return_arg_init = NULL;
if (NULL == method_arg) {
goto init_exit;
}
- VMState_loadArgsFromMethodArg(vm, new_obj, sub_locals->list, method_arg,
- "__init__", n_used);
+ VMState_loadArgsFromMethodArg(vm, new_obj, sub_locals_init->list,
+ method_arg, "__init__", n_used);
/* load args failed */
if (vm->error_code != 0) {
goto init_exit;
}
- return_arg_init = obj_runMethodArgWithState(new_obj, sub_locals,
+ return_arg_init = obj_runMethodArgWithState(new_obj, sub_locals_init,
method_arg, &sub_run_state);
init_exit:
if (NULL != return_arg_init) {
arg_deinit(return_arg_init);
}
- obj_deinit(sub_locals);
+ obj_deinit(sub_locals_init);
if (NULL != method_arg) {
arg_deinit(method_arg);
}
@@ -3644,10 +3647,10 @@ static VMParameters* __pikaVM_runByteCodeFrameWithState(
.super_invoke_deepth = 0};
stack_init(&(vm.stack));
VMState_initReg(&vm);
- if (PikaVMSignal.vm_cnt == 0) {
+ if (g_PikaVMSignal.vm_cnt == 0) {
pks_vmSignal_setCtrlElear();
}
- PikaVMSignal.vm_cnt++;
+ g_PikaVMSignal.vm_cnt++;
while (vm.pc < size) {
if (vm.pc == VM_PC_EXIT) {
break;
@@ -3705,7 +3708,7 @@ static VMParameters* __pikaVM_runByteCodeFrameWithState(
}
VMState_solveUnusedStack(&vm);
stack_deinit(&(vm.stack));
- PikaVMSignal.vm_cnt--;
+ g_PikaVMSignal.vm_cnt--;
return locals;
}
diff --git a/src/PikaVM.h b/src/PikaVM.h
index 3cf829162..f5ceb1b00 100644
--- a/src/PikaVM.h
+++ b/src/PikaVM.h
@@ -1,6 +1,6 @@
/*
* This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/TinyObj.c b/src/TinyObj.c
index 1e7c34c8c..9b15bc5b5 100644
--- a/src/TinyObj.c
+++ b/src/TinyObj.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/TinyObj.h b/src/TinyObj.h
index 72d388efe..85c6ed48a 100644
--- a/src/TinyObj.h
+++ b/src/TinyObj.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/__default_filter_msg_def.h b/src/__default_filter_msg_def.h
index 859096fad..bb86e6d01 100644
--- a/src/__default_filter_msg_def.h
+++ b/src/__default_filter_msg_def.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/__default_filter_msg_table.h b/src/__default_filter_msg_table.h
index 7bde1b376..3f607b666 100644
--- a/src/__default_filter_msg_table.h
+++ b/src/__default_filter_msg_table.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/__instruction_def.h b/src/__instruction_def.h
index b4e1d62da..05ab74009 100644
--- a/src/__instruction_def.h
+++ b/src/__instruction_def.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/__instruction_table.h b/src/__instruction_table.h
index e69baf288..0b92630b1 100644
--- a/src/__instruction_table.h
+++ b/src/__instruction_table.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/__pika_ooc.h b/src/__pika_ooc.h
index abf2e238a..9fb3f1336 100644
--- a/src/__pika_ooc.h
+++ b/src/__pika_ooc.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataArg.c b/src/dataArg.c
index 2593d20d8..6064b3e60 100644
--- a/src/dataArg.c
+++ b/src/dataArg.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -39,16 +39,16 @@ static PIKA_BOOL _arg_cache_push(Arg* self, uint32_t size) {
if (PIKA_FALSE == pika_hook_arg_cache_filter(self)) {
return PIKA_FALSE;
}
- extern PikaMemInfo pikaMemInfo;
+ extern pikaMemInfo g_pikaMemInfo;
if (self->heap_size < PIKA_ARG_CACHE_SIZE ||
self->heap_size > 2 * PIKA_ARG_CACHE_SIZE) {
return PIKA_FALSE;
}
- if (PIKA_ARG_CACHE_POOL_SIZE <= pikaMemInfo.cache_pool_top) {
+ if (PIKA_ARG_CACHE_POOL_SIZE <= g_pikaMemInfo.cache_pool_top) {
return PIKA_FALSE;
}
- pikaMemInfo.cache_pool[pikaMemInfo.cache_pool_top++] = (uint8_t*)self;
- pikaMemInfo.heapUsed -= mem_align(sizeof(Arg) + size);
+ g_pikaMemInfo.cache_pool[g_pikaMemInfo.cache_pool_top++] = (uint8_t*)self;
+ g_pikaMemInfo.heapUsed -= mem_align(sizeof(Arg) + size);
return PIKA_TRUE;
#endif
}
@@ -58,16 +58,16 @@ static Arg* _arg_cache_pop(uint32_t size) {
return NULL;
#else
uint32_t req_heap_size = mem_align(sizeof(Arg) + size);
- extern PikaMemInfo pikaMemInfo;
+ extern pikaMemInfo g_pikaMemInfo;
if (req_heap_size > PIKA_ARG_CACHE_SIZE) {
return NULL;
}
- if (!(pikaMemInfo.cache_pool_top > 0)) {
+ if (!(g_pikaMemInfo.cache_pool_top > 0)) {
return NULL;
}
- --pikaMemInfo.cache_pool_top;
- Arg* self = (Arg*)pikaMemInfo.cache_pool[pikaMemInfo.cache_pool_top];
- pikaMemInfo.heapUsed += mem_align(sizeof(Arg) + size);
+ --g_pikaMemInfo.cache_pool_top;
+ Arg* self = (Arg*)g_pikaMemInfo.cache_pool[g_pikaMemInfo.cache_pool_top];
+ g_pikaMemInfo.heapUsed += mem_align(sizeof(Arg) + size);
return self;
#endif
}
@@ -118,15 +118,15 @@ static Arg* _arg_set_hash(Arg* self,
// if (heap_size < PIKA_ARG_CACHE_SIZE) {
// heap_size = PIKA_ARG_CACHE_SIZE;
// }
- extern PikaMemInfo pikaMemInfo;
- pikaMemInfo.alloc_times++;
- pikaMemInfo.alloc_times_cache++;
+ extern pikaMemInfo g_pikaMemInfo;
+ g_pikaMemInfo.alloc_times++;
+ g_pikaMemInfo.alloc_times_cache++;
#endif
if (NULL == self) {
self = (Arg*)pikaMalloc(heap_size);
#if PIKA_ARG_CACHE_ENABLE
- extern PikaMemInfo pikaMemInfo;
- pikaMemInfo.alloc_times_cache--;
+ extern pikaMemInfo g_pikaMemInfo;
+ g_pikaMemInfo.alloc_times_cache--;
self->heap_size = mem_align(heap_size);
#endif
}
@@ -550,9 +550,9 @@ Arg* arg_append(Arg* self, void* new_content, size_t new_size) {
if (self->heap_size > mem_align(sizeof(Arg) + old_size + new_size)) {
new_arg = self;
new_arg->size = old_size + new_size;
- extern PikaMemInfo pikaMemInfo;
- pikaMemInfo.heapUsed += mem_align(sizeof(Arg) + old_size + new_size) -
- mem_align(sizeof(Arg) + old_size);
+ extern pikaMemInfo g_pikaMemInfo;
+ g_pikaMemInfo.heapUsed += mem_align(sizeof(Arg) + old_size + new_size) -
+ mem_align(sizeof(Arg) + old_size);
}
#endif
if (NULL == new_arg) {
diff --git a/src/dataArg.h b/src/dataArg.h
index 2ab65820c..9c23a7f4b 100644
--- a/src/dataArg.h
+++ b/src/dataArg.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataArgs.c b/src/dataArgs.c
index e76008bde..0979ca24c 100644
--- a/src/dataArgs.c
+++ b/src/dataArgs.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataArgs.h b/src/dataArgs.h
index 36683939a..3d59e8d61 100644
--- a/src/dataArgs.h
+++ b/src/dataArgs.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataLink.c b/src/dataLink.c
index 52e9d3e9a..59673b472 100644
--- a/src/dataLink.c
+++ b/src/dataLink.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataLink.h b/src/dataLink.h
index 1f1ede39d..5f723c3d9 100644
--- a/src/dataLink.h
+++ b/src/dataLink.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataLinkNode.c b/src/dataLinkNode.c
index b6f0c4d53..e284da0b1 100644
--- a/src/dataLinkNode.c
+++ b/src/dataLinkNode.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataLinkNode.h b/src/dataLinkNode.h
index 63b648f32..41a852adf 100644
--- a/src/dataLinkNode.h
+++ b/src/dataLinkNode.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataMemory.c b/src/dataMemory.c
index c4af07503..74ac4f1d7 100644
--- a/src/dataMemory.c
+++ b/src/dataMemory.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -29,7 +29,7 @@
#include "dataMemory.h"
#include "PikaPlatform.h"
-volatile PikaMemInfo pikaMemInfo = {0};
+volatile pikaMemInfo g_pikaMemInfo = {0};
void* pikaMalloc(uint32_t size) {
/* pika memory lock */
@@ -43,15 +43,16 @@ void* pikaMalloc(uint32_t size) {
size = mem_align(size);
#endif
- pikaMemInfo.heapUsed += size;
- if (pikaMemInfo.heapUsedMax < pikaMemInfo.heapUsed) {
- pikaMemInfo.heapUsedMax = pikaMemInfo.heapUsed;
+ g_pikaMemInfo.heapUsed += size;
+ if (g_pikaMemInfo.heapUsedMax < g_pikaMemInfo.heapUsed) {
+ g_pikaMemInfo.heapUsedMax = g_pikaMemInfo.heapUsed;
}
pika_platform_disable_irq_handle();
void* mem = pika_user_malloc(size);
pika_platform_enable_irq_handle();
if (NULL == mem) {
- pika_platform_printf("Error: No heap space! Please reset the device.\r\n");
+ pika_platform_printf(
+ "Error: No heap space! Please reset the device.\r\n");
while (1) {
}
}
@@ -72,20 +73,20 @@ void pikaFree(void* mem, uint32_t size) {
pika_platform_disable_irq_handle();
pika_user_free(mem, size);
pika_platform_enable_irq_handle();
- pikaMemInfo.heapUsed -= size;
+ g_pikaMemInfo.heapUsed -= size;
}
uint32_t pikaMemNow(void) {
- return pikaMemInfo.heapUsed;
+ return g_pikaMemInfo.heapUsed;
// return 0;
}
uint32_t pikaMemMax(void) {
- return pikaMemInfo.heapUsedMax;
+ return g_pikaMemInfo.heapUsedMax;
}
void pikaMemMaxReset(void) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
}
uint32_t pool_getBlockIndex_byMemSize(Pool* pool, uint32_t size) {
@@ -137,7 +138,7 @@ void pool_printBlocks(Pool* pool, uint32_t size_min, uint32_t size_max) {
break;
}
pika_platform_printf("0x%x\t: 0x%d", i * pool->aline,
- (i + 15) * pool->aline);
+ (i + 15) * pool->aline);
for (uint32_t j = i; j < i + 16; j += 4) {
if (is_end) {
break;
@@ -307,9 +308,10 @@ void mem_pool_init(void) {
void _mem_cache_deinit(void) {
#if PIKA_ARG_CACHE_ENABLE
- while (pikaMemInfo.cache_pool_top) {
- pika_user_free(pikaMemInfo.cache_pool[pikaMemInfo.cache_pool_top - 1], 0);
- pikaMemInfo.cache_pool_top--;
+ while (g_pikaMemInfo.cache_pool_top) {
+ pika_user_free(
+ g_pikaMemInfo.cache_pool[g_pikaMemInfo.cache_pool_top - 1], 0);
+ g_pikaMemInfo.cache_pool_top--;
}
#endif
}
diff --git a/src/dataMemory.h b/src/dataMemory.h
index fda218591..f3d380b2a 100644
--- a/src/dataMemory.h
+++ b/src/dataMemory.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -47,7 +47,7 @@ typedef struct {
#endif
uint32_t alloc_times;
uint32_t alloc_times_cache;
-} PikaMemInfo;
+} pikaMemInfo;
typedef uint8_t* BitMap;
diff --git a/src/dataQueue.c b/src/dataQueue.c
index 88d720938..fec57eda6 100644
--- a/src/dataQueue.c
+++ b/src/dataQueue.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataQueue.h b/src/dataQueue.h
index 28ad28c9a..f43c8ff15 100644
--- a/src/dataQueue.h
+++ b/src/dataQueue.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataQueueObj.c b/src/dataQueueObj.c
index ec07f59f7..f42626d71 100644
--- a/src/dataQueueObj.c
+++ b/src/dataQueueObj.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataQueueObj.h b/src/dataQueueObj.h
index 78531602c..fffa258d3 100644
--- a/src/dataQueueObj.h
+++ b/src/dataQueueObj.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataStack.c b/src/dataStack.c
index c6fc344cc..f9178bbe0 100644
--- a/src/dataStack.c
+++ b/src/dataStack.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataStack.h b/src/dataStack.h
index 4290cd0e8..a0c14194d 100644
--- a/src/dataStack.h
+++ b/src/dataStack.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataString.c b/src/dataString.c
index 45f4edd66..3826a5b28 100644
--- a/src/dataString.c
+++ b/src/dataString.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataString.h b/src/dataString.h
index 38dfeedfa..f552059eb 100644
--- a/src/dataString.h
+++ b/src/dataString.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataStrs.c b/src/dataStrs.c
index e2ea2bd2e..13d7ec803 100644
--- a/src/dataStrs.c
+++ b/src/dataStrs.c
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/dataStrs.h b/src/dataStrs.h
index 3d1bdb97a..b09e805e2 100644
--- a/src/dataStrs.h
+++ b/src/dataStrs.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
diff --git a/src/pika_config_valid.h b/src/pika_config_valid.h
index 6a9bdeb27..8d10fb6ce 100644
--- a/src/pika_config_valid.h
+++ b/src/pika_config_valid.h
@@ -1,6 +1,6 @@
/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
+ * This file is part of the PikaPython project.
+ * http://github.com/pikastech/pikapython
*
* MIT License
*
@@ -427,6 +427,10 @@
#define PIKA_EVENT_THREAD_ENABLE 1
#endif
+ #ifndef PIKA_GC_MARK_SWEEP_ENABLE
+ #define PIKA_GC_MARK_SWEEP_ENABLE 0
+ #endif
+
/* configuration validation */
#endif
diff --git a/test/PikaCV-test.cpp b/test/PikaCV-test.cpp
index f85052699..54f37a78b 100644
--- a/test/PikaCV-test.cpp
+++ b/test/PikaCV-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if (PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL) && (!PIKA_POOL_ENABLE)
TEST(PikaCV, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -19,7 +19,7 @@ TEST(PikaCV, test1) {
TEST(PikaCV, test2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -34,7 +34,7 @@ TEST(PikaCV, test2) {
TEST(PikaCV, test3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -49,7 +49,7 @@ TEST(PikaCV, test3) {
TEST(PikaCV, test4) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -64,7 +64,7 @@ TEST(PikaCV, test4) {
TEST(PikaCV, test5) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -79,7 +79,7 @@ TEST(PikaCV, test5) {
TEST(PikaCV, test6) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -94,7 +94,7 @@ TEST(PikaCV, test6) {
TEST(PikaCV, test7) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -109,7 +109,7 @@ TEST(PikaCV, test7) {
TEST(PikaCV, test8) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -124,7 +124,7 @@ TEST(PikaCV, test8) {
TEST(PikaCV, test9) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -139,7 +139,7 @@ TEST(PikaCV, test9) {
TEST(PikaCV, test10) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -154,7 +154,7 @@ TEST(PikaCV, test10) {
TEST(PikaCV, test11) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
diff --git a/test/PikaMath-test.cpp b/test/PikaMath-test.cpp
index 222da7c43..c332d2085 100644
--- a/test/PikaMath-test.cpp
+++ b/test/PikaMath-test.cpp
@@ -3,7 +3,7 @@ TEST_START
#if PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL
TEST(PikaMath, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -18,7 +18,7 @@ TEST(PikaMath, test1) {
TEST(PikaMath, quat_add) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -49,7 +49,7 @@ TEST(PikaMath, quat_add) {
TEST(PikaMath, quat_sub) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -80,7 +80,7 @@ TEST(PikaMath, quat_sub) {
TEST(PikaMath, quat_mul) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -111,7 +111,7 @@ TEST(PikaMath, quat_mul) {
TEST(PikaMath, quat_set) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -141,7 +141,7 @@ TEST(PikaMath, quat_set) {
TEST(PikaMath, quat_dot) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -166,7 +166,7 @@ TEST(PikaMath, quat_dot) {
TEST(PikaMath, quat_inv) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -196,7 +196,7 @@ TEST(PikaMath, quat_inv) {
TEST(PikaMath, quat_cross) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -230,7 +230,7 @@ TEST(PikaMath, quat_cross) {
TEST(PikaMath, quat_toEuler) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -259,7 +259,7 @@ TEST(PikaMath, quat_toEuler) {
TEST(PikaMath, quat_fromEuler) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
diff --git a/test/PikaNN-test.cpp b/test/PikaNN-test.cpp
index 17d1243a3..2e8d9a50a 100644
--- a/test/PikaNN-test.cpp
+++ b/test/PikaNN-test.cpp
@@ -5,7 +5,7 @@ TEST_START
TEST(PikaNN, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
diff --git a/test/VM-test.cpp b/test/VM-test.cpp
index 70223cb38..ade5bc016 100644
--- a/test/VM-test.cpp
+++ b/test/VM-test.cpp
@@ -149,9 +149,9 @@ TEST(VM, Run_add_1_2_3) {
EXPECT_EQ(pikaMemNow(), 0);
}
-extern PikaMemInfo pikaMemInfo;
+extern pikaMemInfo g_pikaMemInfo;
TEST(VM, WHILE) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"a = 1\n"
@@ -163,7 +163,7 @@ TEST(VM, WHILE) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* self = newRootObj("root", New_TinyObj);
VMParameters* globals = pikaVM_runAsm(self, pikaAsm);
EXPECT_EQ(args_getInt(globals->list, "a"), 0);
@@ -753,7 +753,7 @@ TEST(VM, bytecode_jjcc) {
}
TEST(VM, WHILE_byte) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"a = 1\n"
@@ -765,7 +765,7 @@ TEST(VM, WHILE_byte) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* self = newRootObj("root", New_TinyObj);
pikaVM_run(self, lines);
EXPECT_EQ(obj_getInt(self, "a"), 0);
@@ -776,7 +776,7 @@ TEST(VM, WHILE_byte) {
}
TEST(VM, for_break_byte) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"a = 0\n"
@@ -788,7 +788,7 @@ TEST(VM, for_break_byte) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
pikaVM_run(self, lines);
/* assert */
@@ -891,13 +891,13 @@ TEST(VM, load_static_bytes) {
}
TEST(VM, multi_jian) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = (3-4) - 4\n";
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
pikaVM_run(self, lines);
/* assert */
@@ -1309,7 +1309,7 @@ TEST(vm, class_keyword_mqtt) {
TEST(vm, vars_keyward) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1327,7 +1327,7 @@ TEST(vm, vars_keyward) {
TEST(vm, cb_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1346,7 +1346,7 @@ TEST(vm, cb_1) {
TEST(vm, cb_2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1369,7 +1369,7 @@ TEST(vm, cb_2) {
TEST(vm, cb_3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1387,7 +1387,7 @@ TEST(vm, cb_3) {
#if !PIKA_NANO_ENABLE
TEST(vm, default_no_input) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1407,7 +1407,7 @@ TEST(vm, default_no_input) {
TEST(vm, default_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1427,7 +1427,7 @@ TEST(vm, default_1) {
TEST(vm, default_2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1447,7 +1447,7 @@ TEST(vm, default_2) {
TEST(vm, default_3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1472,7 +1472,7 @@ TEST(vm, default_3) {
TEST(vm, default_4) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1500,7 +1500,7 @@ TEST(vm, default_4) {
TEST(vm, default_no_kw) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1526,7 +1526,7 @@ TEST(vm, default_no_kw) {
TEST(vm, none) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1544,7 +1544,7 @@ TEST(vm, none) {
#if !PIKA_NANO_ENABLE
TEST(vm, super_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1571,7 +1571,7 @@ TEST(vm, super_) {
TEST(vm, super_val) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1600,7 +1600,7 @@ TEST(vm, super_val) {
TEST(vm, super_val_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1633,7 +1633,7 @@ TEST(vm, super_val_) {
#if !PIKA_NANO_ENABLE
TEST(vm, multi_return) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1655,7 +1655,7 @@ TEST(vm, multi_return) {
#if !PIKA_NANO_ENABLE
TEST(vm, multi_return_fn) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1679,7 +1679,7 @@ TEST(vm, multi_return_fn) {
TEST(vm, range_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1700,7 +1700,7 @@ TEST(vm, range_1) {
TEST(vm, rang_3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1721,7 +1721,7 @@ TEST(vm, rang_3) {
TEST(vm, test64) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1742,7 +1742,7 @@ TEST(vm, test64) {
#if !PIKA_NANO_ENABLE
TEST(vm, exit) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1766,7 +1766,7 @@ TEST(vm, exit) {
TEST(vm, exit_fn) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1814,7 +1814,7 @@ void __gtest_hook_default_(void) {
void _vm_exit_fn_issue_1_item(int hook_cnt) {
g_hook_cnt_triggle = hook_cnt;
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1857,7 +1857,7 @@ TEST(vm, exit_fn_issue_1) {
TEST(vm, pass_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1881,7 +1881,7 @@ TEST(vm, pass_) {
TEST(vm, test64_hex) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1901,7 +1901,7 @@ TEST(vm, test64_hex) {
TEST(vm, test64_hex_print) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1922,7 +1922,7 @@ TEST(vm, test64_hex_print) {
#if !PIKA_NANO_ENABLE
TEST(vm, call_dict_err) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1941,7 +1941,7 @@ TEST(vm, call_dict_err) {
TEST(vm, getattribute) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1963,7 +1963,7 @@ TEST(vm, getattribute) {
TEST(vm, getattr) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -1989,7 +1989,7 @@ TEST(vm, getattr) {
TEST(vm, setattr) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2015,7 +2015,7 @@ TEST(vm, setattr) {
TEST(vm, c_module_get_set_attr) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2040,7 +2040,7 @@ TEST(vm, c_module_get_set_attr) {
TEST(vm, class_attr_ref) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2060,7 +2060,7 @@ TEST(vm, class_attr_ref) {
TEST(vm, getattr_native) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2080,7 +2080,7 @@ TEST(vm, getattr_native) {
TEST(vm, issue_dict_update) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2097,7 +2097,7 @@ TEST(vm, issue_dict_update) {
TEST(vm, issue_big_dict_update) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2116,7 +2116,7 @@ TEST(vm, issue_big_dict_update) {
TEST(vm, i_pp) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2150,7 +2150,7 @@ TEST(vm, i_pp) {
TEST(vm, benchmark) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2288,7 +2288,7 @@ TEST(VM, bc_fn_file_cb2) {
#if !PIKA_NANO_ENABLE
TEST(vm, slice_str_end) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2305,7 +2305,7 @@ TEST(vm, slice_str_end) {
#if !PIKA_NANO_ENABLE
TEST(vm, fn_pos_kw) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2323,7 +2323,7 @@ TEST(vm, fn_pos_kw) {
TEST(vm, fn_pos_kw2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2343,7 +2343,7 @@ TEST(vm, fn_pos_kw2) {
TEST(vm, fn_star) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2360,7 +2360,7 @@ TEST(vm, fn_star) {
TEST(vm, fn_star_pos) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2377,7 +2377,7 @@ TEST(vm, fn_star_pos) {
TEST(vm, fn_star_pos_2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2394,7 +2394,7 @@ TEST(vm, fn_star_pos_2) {
TEST(vm, fn_star_star) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2460,7 +2460,7 @@ TEST(vm, def_not_in) {
TEST(vm, fn_pos_kw_issue1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2478,7 +2478,7 @@ TEST(vm, fn_pos_kw_issue1) {
TEST(vm, fn_pos_kw_issue2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2496,7 +2496,7 @@ TEST(vm, fn_pos_kw_issue2) {
TEST(vm, num_issue_lakj) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2511,7 +2511,7 @@ TEST(vm, num_issue_lakj) {
TEST(vm, dir_issue) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2528,7 +2528,7 @@ TEST(vm, dir_issue) {
TEST(vm, dir_issue1lk) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2546,7 +2546,7 @@ TEST(vm, dir_issue1lk) {
TEST(vm, type_int) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2565,7 +2565,7 @@ TEST(vm, type_int) {
TEST(vm, method_int) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2584,7 +2584,7 @@ TEST(vm, method_int) {
TEST(vm, fn_method_int) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2606,7 +2606,7 @@ TEST(vm, fn_method_int) {
TEST(vm, kw_no_empty) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2626,7 +2626,7 @@ TEST(vm, kw_no_empty) {
TEST(vm, tuple_void) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2678,7 +2678,7 @@ TEST(vm, method_cb) {
TEST(vm, class_getattr) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2696,7 +2696,7 @@ TEST(vm, class_getattr) {
TEST(vm, type_fullfealure) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2714,7 +2714,7 @@ TEST(vm, type_fullfealure) {
TEST(vm, dir_print_arg) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -2731,7 +2731,7 @@ TEST(vm, dir_print_arg) {
TEST(vm, fn_pos_vars) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/builtin-test.cpp b/test/builtin-test.cpp
index dfa493ffe..6b5a57f6c 100644
--- a/test/builtin-test.cpp
+++ b/test/builtin-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(builtin, bytes) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -22,7 +22,7 @@ TEST(builtin, bytes) {
#if PIKA_BUILTIN_STRUCT_ENABLE
TEST(builtin, type1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -40,7 +40,7 @@ TEST(builtin, type1) {
#if PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL
TEST(builtin, seek) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -58,7 +58,7 @@ TEST(builtin, seek) {
#if (PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL)
TEST(builtin, file2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -76,7 +76,7 @@ TEST(builtin, file2) {
#if PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL
TEST(builtin, file3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -92,7 +92,7 @@ TEST(builtin, file3) {
#if (PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL) && !PIKA_POOL_ENABLE
TEST(builtin, bigfile) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -108,7 +108,7 @@ TEST(builtin, bigfile) {
TEST(builtin, nofound) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -123,7 +123,7 @@ TEST(builtin, nofound) {
#if PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL
TEST(builtin, callback_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -141,7 +141,7 @@ TEST(builtin, callback_1) {
#if !PIKA_NANO_ENABLE
TEST(builtin, utf8) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
diff --git a/test/cJSON-test.cpp b/test/cJSON-test.cpp
index c71cd0e98..e4df2c9c8 100644
--- a/test/cJSON-test.cpp
+++ b/test/cJSON-test.cpp
@@ -3,7 +3,7 @@ TEST_START
TEST(cJSON, parse_print) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
char testjson[] =
"{\n"
@@ -32,7 +32,7 @@ TEST(cJSON, parse_print) {
TEST(cJSON, getItem) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
char testjson[] =
"{\n"
@@ -65,7 +65,7 @@ TEST(cJSON, getItem) {
TEST(cJSON, next) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
char testjson[] =
"{\n"
@@ -103,7 +103,7 @@ TEST(cJSON, next) {
TEST(cJSON, next_get_value) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
char testjson[] =
"{\n"
@@ -144,7 +144,7 @@ TEST(cJSON, next_get_value) {
TEST(cJSON, item) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -189,7 +189,7 @@ TEST(cJSON, item) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(cJSON, construct) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -228,7 +228,7 @@ TEST(cJSON, construct) {
TEST(cJSON, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -248,7 +248,7 @@ TEST(cJSON, test1) {
TEST(cJSON, test2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -269,7 +269,7 @@ TEST(cJSON, test2) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(cJSON, test3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -292,7 +292,7 @@ TEST(cJSON, test3) {
TEST(cJSON, test4) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -318,7 +318,7 @@ TEST(cJSON, test4) {
TEST(cJSON, test5) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -348,7 +348,7 @@ TEST(cJSON, test5) {
TEST(cJSON, test6) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -380,7 +380,7 @@ TEST(cJSON, test6) {
TEST(cJSON, parse_failed) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
char testjson[] =
"{{\n"
@@ -419,7 +419,7 @@ TEST(cJSON, parse_failed) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(cJSON, test7) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -437,7 +437,7 @@ TEST(cJSON, test7) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(cJSON, module) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/chinese-test.cpp b/test/chinese-test.cpp
index b057aef35..8b7d54710 100644
--- a/test/chinese-test.cpp
+++ b/test/chinese-test.cpp
@@ -3,7 +3,7 @@ TEST_START
TEST(chinese, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
pikaVM_runSingleFile(pikaMain, "../../examples/Chinese/test_operator.py");
obj_run(pikaMain, "test()");
diff --git a/test/class-test.cpp b/test/class-test.cpp
index d18fe5240..3946159f1 100644
--- a/test/class-test.cpp
+++ b/test/class-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if !PIKA_NANO_ENABLE
TEST(class, class_par) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -23,7 +23,7 @@ TEST(class, class_par) {
TEST(class, classpar1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -41,7 +41,7 @@ TEST(class, classpar1) {
TEST(class, static_method) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -60,7 +60,7 @@ TEST(class, static_method) {
TEST(class, dir_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
diff --git a/test/cmodule-test.cpp b/test/cmodule-test.cpp
index 99cd41c6c..b477faed8 100644
--- a/test/cmodule-test.cpp
+++ b/test/cmodule-test.cpp
@@ -3,7 +3,7 @@ TEST_START
TEST(cmodule, print_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "print('test', 'test2')\n");
diff --git a/test/configparser-test.cpp b/test/configparser-test.cpp
index ecb597ce1..ca2781611 100644
--- a/test/configparser-test.cpp
+++ b/test/configparser-test.cpp
@@ -17,7 +17,7 @@ TEST(configparser, test1) {
"ForwardX11 = no\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -39,7 +39,7 @@ TEST(configparser, test1) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(configparser, test2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/ctypes-test.cpp b/test/ctypes-test.cpp
index e3084f54e..c496a2674 100644
--- a/test/ctypes-test.cpp
+++ b/test/ctypes-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(ctypes, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
pikaVM_runSingleFile(pikaMain, "../../examples/BuiltIn/ctypes.py");
@@ -20,7 +20,7 @@ TEST(ctypes, test1) {
#if !PIKA_NANO_ENABLE
TEST(ctypes, test2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
diff --git a/test/except-test.cpp b/test/except-test.cpp
index e1ab6fabc..800b7f0ff 100644
--- a/test/except-test.cpp
+++ b/test/except-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if PIKA_SYNTAX_EXCEPTION_ENABLE
TEST(except, try1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -28,7 +28,7 @@ TEST(except, try1) {
TEST(except, def_none) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -48,7 +48,7 @@ TEST(except, def_none) {
TEST(except, trydef1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -65,7 +65,7 @@ TEST(except, trydef1) {
TEST(except, try1file) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -82,7 +82,7 @@ TEST(except, try1file) {
TEST(except, for_loop) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -108,7 +108,7 @@ TEST(except, for_loop) {
TEST(except, dict) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -124,7 +124,7 @@ TEST(except, dict) {
TEST(except, len) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -140,7 +140,7 @@ TEST(except, len) {
TEST(except, trycmodule1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -163,7 +163,7 @@ TEST(except, trycmodule1) {
TEST(except, except_break) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -189,7 +189,7 @@ TEST(except, except_break) {
TEST(except, while_try_while) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
diff --git a/test/gc-test.cpp b/test/gc-test.cpp
index 66f48aac8..afd3e63c2 100644
--- a/test/gc-test.cpp
+++ b/test/gc-test.cpp
@@ -127,8 +127,30 @@ TEST(gc, heap_failed1) {
"iteri");
/* assert */
EXPECT_STREQ("128\r\n", log_buff[0]);
+ int cnt = pikaGC_count();
+ EXPECT_EQ(cnt != 0, 1);
+ pikaGC_markRoot();
+ int cnt_marked = pikaGC_countMarked();
+ EXPECT_EQ(cnt, cnt_marked);
+ /* deinit */
+ obj_deinit(pikaMain);
+ cnt = pikaGC_count();
+ EXPECT_EQ(cnt, 0);
+ EXPECT_EQ(pikaMemNow(), 0);
+}
+
+#if PIKA_GC_MARK_SWEEP_ENABLE
+TEST(gc, circle) {
+ /* init */
+ PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
+ /* run */
+ pikaVM_runSingleFile(pikaMain, "test/python/gc/gc_circle.py");
+ /* assert */
+ pikaGC_markSweep();
/* deinit */
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
+#endif
+
TEST_END
\ No newline at end of file
diff --git a/test/hashlib-test.cpp b/test/hashlib-test.cpp
index c17ee1d73..b9029f3fd 100644
--- a/test/hashlib-test.cpp
+++ b/test/hashlib-test.cpp
@@ -2,7 +2,7 @@
TEST(hashlib, new_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/json-test.cpp b/test/json-test.cpp
index 7a53b2e7d..685f83ef1 100644
--- a/test/json-test.cpp
+++ b/test/json-test.cpp
@@ -3,7 +3,7 @@ TEST_START
#if !PIKA_NANO_ENABLE
TEST(json, loads) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -63,7 +63,7 @@ TEST(json, loads) {
#if PIKA_FLOAT_TYPE_DOUBLE
TEST(json, dumps) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/main.cpp b/test/main.cpp
index 66eb700f9..c5976da61 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -19,11 +19,11 @@ int main(int argc, char** argv) {
#endif
mem_pool_deinit();
#if PIKA_ARG_CACHE_ENABLE
- extern PikaMemInfo pikaMemInfo;
+ extern pikaMemInfo g_pikaMemInfo;
printf("[ Info]: alloc times: %d, cached times: %d (%0.2f%%)\r\n",
- pikaMemInfo.alloc_times, pikaMemInfo.alloc_times_cache,
- ((float)pikaMemInfo.alloc_times_cache /
- (float)pikaMemInfo.alloc_times) *
+ g_pikaMemInfo.alloc_times, g_pikaMemInfo.alloc_times_cache,
+ ((float)g_pikaMemInfo.alloc_times_cache /
+ (float)g_pikaMemInfo.alloc_times) *
100.0);
#endif
return res;
diff --git a/test/module-test.cpp b/test/module-test.cpp
index d71d1f0c1..b98c9eded 100644
--- a/test/module-test.cpp
+++ b/test/module-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(module, cmodule_import) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
/* run */
@@ -23,7 +23,7 @@ TEST(module, cmodule_import) {
TEST(module, while_loop) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -42,7 +42,7 @@ TEST(module, while_loop) {
TEST(module, for_loop) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -61,7 +61,7 @@ TEST(module, for_loop) {
TEST(module, script) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -78,7 +78,7 @@ TEST(module, script) {
TEST(module, __init__) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -97,7 +97,7 @@ TEST(module, __init__) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(module, __init__2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -117,7 +117,7 @@ TEST(module, __init__2) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(module, import_as_issue1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -141,7 +141,7 @@ TEST(module, import_as_issue1) {
#if PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL
TEST(module, unittest_test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -163,7 +163,7 @@ TEST(module, unittest_test1) {
#if PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL
TEST(module, unittest_test2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -183,7 +183,7 @@ TEST(module, unittest_test2) {
TEST(module, unittest_test3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -205,7 +205,7 @@ TEST(module, unittest_test3) {
TEST(socket, gethostname) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -223,7 +223,7 @@ TEST(socket, gethostname) {
#if !PIKA_NANO_ENABLE
TEST(socket, server_client) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -242,7 +242,7 @@ TEST(socket, server_client) {
TEST(socket, thread) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -264,7 +264,7 @@ TEST(socket, thread) {
#if PIKA_FLOAT_TYPE_DOUBLE
TEST(socket, json_issue) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -296,7 +296,7 @@ TEST(socket, json_issue) {
#if !PIKA_NANO_ENABLE
TEST(re, match) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -319,7 +319,7 @@ TEST(re, match) {
#if !PIKA_NANO_ENABLE
TEST(re, search) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -340,7 +340,7 @@ TEST(re, search) {
#if !PIKA_NANO_ENABLE
TEST(re, sub) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -361,7 +361,7 @@ TEST(re, sub) {
#if !PIKA_NANO_ENABLE
TEST(re, findall) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -387,7 +387,7 @@ TEST(re, findall) {
TEST(modbus, rtu_master) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -414,7 +414,7 @@ TEST(modbus, rtu_master) {
TEST(proxy, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -432,7 +432,7 @@ TEST(proxy, test1) {
TEST(issue, global) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -449,7 +449,7 @@ TEST(issue, global) {
TEST(module, mod1_mod2_mod1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -468,7 +468,7 @@ TEST(module, mod1_mod2_mod1) {
TEST(module, improt_as_cmodule) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -497,7 +497,7 @@ void pikaScriptShell_withGetchar(PikaObj* self, sh_getchar getchar_fn);
TEST(module, REPL_runbytecode) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -517,7 +517,7 @@ TEST(module, REPL_runbytecode) {
TEST(module, REPL_script) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -536,7 +536,7 @@ TEST(module, REPL_script) {
TEST(module, REPL_script_2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -555,7 +555,7 @@ TEST(module, REPL_script_2) {
TEST(module, REPL_big_script) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -576,7 +576,7 @@ TEST(module, REPL_big_script) {
TEST(module, REPL_stdtask) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/network-test.cpp b/test/network-test.cpp
index f8952a960..b8d4cdfe7 100644
--- a/test/network-test.cpp
+++ b/test/network-test.cpp
@@ -74,7 +74,7 @@ int pika_hal_platform_WIFI_ioctl_others(pika_dev* dev,
}
TEST(network, scan) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -98,7 +98,7 @@ TEST(network, scan) {
}
TEST(network, connect) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -127,7 +127,7 @@ TEST(network, connect) {
}
TEST(network, config) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/parse-test.cpp b/test/parse-test.cpp
index 6ce614681..376c51e27 100644
--- a/test/parse-test.cpp
+++ b/test/parse-test.cpp
@@ -359,9 +359,9 @@ TEST(parser, if_) {
EXPECT_EQ(pikaMemNow(), 0);
}
-extern PikaMemInfo pikaMemInfo;
+extern pikaMemInfo g_pikaMemInfo;
TEST(parser, while_true_if_false_both_exit) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* bf = New_strBuff();
Stack bs;
stack_init(&bs);
@@ -399,7 +399,7 @@ TEST(parser, while_true_if_false_both_exit) {
}
TEST(parser, multiLine) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"while true:\n"
@@ -436,7 +436,7 @@ TEST(parser, multiLine) {
}
TEST(parser, pikaPi) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
const char lines[] =
@@ -546,7 +546,7 @@ TEST(parser, pikaPi) {
}
TEST(parser, add) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = 1 + 1\n";
printf("%s", lines);
@@ -564,7 +564,7 @@ TEST(parser, add) {
}
TEST(parser, add_3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = 1 + 2 + 3";
printf("%s", lines);
@@ -584,7 +584,7 @@ TEST(parser, add_3) {
}
TEST(parser, add_a_pp) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = a + 1\n";
printf("%s", lines);
@@ -602,7 +602,7 @@ TEST(parser, add_a_pp) {
}
TEST(parser, while_a_pp) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"while a < 10:\n"
@@ -634,7 +634,7 @@ TEST(parser, while_a_pp) {
}
TEST(parser, add_m2p3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = 1 * 2 + 3\n";
printf("%s", lines);
@@ -654,7 +654,7 @@ TEST(parser, add_m2p3) {
}
TEST(parser, add_m2p3_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = 1 * (2 + 3)\n";
printf("%s", lines);
@@ -675,7 +675,7 @@ TEST(parser, add_m2p3_) {
}
TEST(parser, add_m12p3_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = (1 + 2) * 3\n";
printf("%s", lines);
@@ -696,7 +696,7 @@ TEST(parser, add_m12p3_) {
}
TEST(parser, method_equ) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "if right.read() == 1:\n";
printf("%s", lines);
@@ -714,7 +714,7 @@ TEST(parser, method_equ) {
}
TEST(parser, equ_method) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "if 1 == right.read() :\n";
printf("%s", lines);
@@ -732,7 +732,7 @@ TEST(parser, equ_method) {
}
TEST(parser, def_add) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def add(a, b):\n"
@@ -757,7 +757,7 @@ TEST(parser, def_add) {
}
TEST(parser, def_add_return) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def add(a, b):\n"
@@ -784,7 +784,7 @@ TEST(parser, def_add_return) {
}
TEST(parser, def_while_return) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def add(a, b):\n"
@@ -817,7 +817,7 @@ TEST(parser, def_while_return) {
}
TEST(parser, def_while_return_void) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def add(a, b):\n"
@@ -847,7 +847,7 @@ TEST(parser, def_while_return_void) {
}
TEST(parser, signed_num) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = -1\n";
printf("%s", lines);
@@ -869,7 +869,7 @@ TEST(parser, signed_num) {
}
TEST(parser, comp_signed_num) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "if a > -1:\n";
printf("%s", lines);
@@ -890,7 +890,7 @@ TEST(parser, comp_signed_num) {
TEST(lexser, symbol_add) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -909,7 +909,7 @@ TEST(lexser, symbol_add) {
TEST(lexser, symbol_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -926,7 +926,7 @@ TEST(lexser, symbol_1) {
TEST(lexser, operator_not) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -944,7 +944,7 @@ TEST(lexser, operator_not) {
TEST(lexser, symbol_Nag) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -962,7 +962,7 @@ TEST(lexser, symbol_Nag) {
TEST(lexser, operator_all) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -993,7 +993,7 @@ TEST(lexser, operator_all) {
TEST(lexser, symbol_2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1013,7 +1013,7 @@ TEST(lexser, symbol_2) {
TEST(lexser, symbol_and) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1033,7 +1033,7 @@ TEST(lexser, symbol_and) {
TEST(lexser, sting) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1051,7 +1051,7 @@ TEST(lexser, sting) {
TEST(lexser, num_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1069,7 +1069,7 @@ TEST(lexser, num_1) {
TEST(lexser, jjcc) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1099,7 +1099,7 @@ TEST(parser, pop_by_str) {
}
TEST(parser, mm) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = a ** -1\n";
printf("%s", lines);
@@ -1118,7 +1118,7 @@ TEST(parser, mm) {
}
TEST(parser, self_inc) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"a += -1\n"
@@ -1199,7 +1199,7 @@ TEST(parser, self_inc) {
}
TEST(parser, n_n1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = ~-1\n";
printf("%s", lines);
@@ -1217,7 +1217,7 @@ TEST(parser, n_n1) {
}
TEST(parser, or_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "( a>1) or (b<= 3)\n";
printf("%s", lines);
@@ -1240,7 +1240,7 @@ TEST(parser, or_) {
}
TEST(parser, _or_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"if (1>2) and (2>1):\n"
@@ -1271,7 +1271,7 @@ TEST(parser, _or_) {
}
TEST(parser, annotation) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = t#test\n";
printf("%s", lines);
@@ -1287,7 +1287,7 @@ TEST(parser, annotation) {
}
TEST(parser, annotation_block) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"while True:\n"
@@ -1351,7 +1351,7 @@ TEST(parser, annotation_block) {
}
TEST(parser, if_elif_else) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"if a > 1:\n"
@@ -1422,7 +1422,7 @@ TEST(parser, if_elif_else) {
}
TEST(parser, for_range) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"for i in range(0,10):\n"
@@ -1455,7 +1455,7 @@ TEST(parser, for_range) {
}
TEST(parser, for_range_rtt) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"for i in range(0, 3):\n"
@@ -1527,7 +1527,7 @@ TEST(parser, for_list) {
}
TEST(parser, for_for_range) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"a = 0\n"
@@ -1595,7 +1595,7 @@ TEST(parser, for_for_range) {
}
TEST(parser, break_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"for i in range(0, 3):\n"
@@ -1642,7 +1642,7 @@ TEST(parser, break_) {
}
TEST(parser, prime_100) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"num = 0\n"
@@ -1729,7 +1729,7 @@ TEST(parser, prime_100) {
}
TEST(parser, __iter__) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "__res = __iter__()\n";
printf("%s", lines);
@@ -1747,7 +1747,7 @@ TEST(parser, __iter__) {
/* not solve yet */
// TEST(parser, strEqu) {
-// pikaMemInfo.heapUsedMax = 0;
+// g_pikaMemInfo.heapUsedMax = 0;
// Args* buffs = New_strBuff();
// char* lines =
// "a = '1ee' == '1ee'\n"
@@ -1765,7 +1765,7 @@ TEST(parser, __iter__) {
// }
TEST(parser, for_in_string) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"for b in 'test':\n"
@@ -1797,7 +1797,7 @@ TEST(parser, for_in_string) {
}
TEST(parser, print_ddd) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "print(\"[Info]: in Python config...\")\n";
printf("%s", lines);
@@ -1814,7 +1814,7 @@ TEST(parser, print_ddd) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, __getitem__3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b[c+d] + e[f*j]\n";
printf("%s", lines);
@@ -1842,7 +1842,7 @@ TEST(parser, __getitem__3) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, __getitem__) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b[c]\n";
printf("%s", lines);
@@ -1862,7 +1862,7 @@ TEST(parser, __getitem__) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, __getitem__2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b[c+d]\n";
printf("%s", lines);
@@ -1884,7 +1884,7 @@ TEST(parser, __getitem__2) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, __setitem__) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a[b] = c\n";
printf("%s", lines);
@@ -1904,7 +1904,7 @@ TEST(parser, __setitem__) {
#endif
TEST(parser, str_p_str) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = str(1) + str(1)\n";
printf("%s", lines);
@@ -1924,7 +1924,7 @@ TEST(parser, str_p_str) {
}
TEST(parser, test__) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"len = __calls.len()\n"
@@ -1971,7 +1971,7 @@ TEST(parser, test__) {
}
TEST(parser, global) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def test_global():\n"
@@ -1998,7 +1998,7 @@ TEST(parser, global) {
}
TEST(parser, mpy_demo_1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "chars = ' .,-:;i+hHM$*#@ '\n";
printf("%s", lines);
@@ -2014,7 +2014,7 @@ TEST(parser, mpy_demo_1) {
}
TEST(parser, clean_compled_str) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* res = Cursor_getCleanStmt(buffs, "chars = ' .,-:;i+hHM$*#@ '\n");
EXPECT_STREQ(res, "chars=' .,-:;i+hHM$*#@ '\n");
@@ -2024,7 +2024,7 @@ TEST(parser, clean_compled_str) {
}
TEST(parser, class_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"class Test(TinyObj):\n"
@@ -2057,7 +2057,7 @@ TEST(parser, class_) {
}
TEST(parser, class_def) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"class Test():\n"
@@ -2107,7 +2107,7 @@ TEST(parser, class_def) {
}
TEST(parser, nag_a) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "print(-a)\n";
printf("%s", lines);
@@ -2196,7 +2196,7 @@ TEST(asmer, asm_to_bytecode_0x0d) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, list_1_2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "print(list[0] + list[1])\n";
printf("%s", lines);
@@ -2219,7 +2219,7 @@ TEST(parser, list_1_2) {
#endif
TEST(parser, class_def_void_line) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"class Test():\n"
@@ -2273,7 +2273,7 @@ TEST(parser, class_def_void_line) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(parser, multiLine_import) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"import TEE\n"
@@ -2326,7 +2326,7 @@ TEST(parser, multiLine_import) {
#endif
TEST(parser, multiLine_comment) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"'''\n"
@@ -2373,7 +2373,7 @@ TEST(parser, multiLine_comment) {
}
TEST(parser, plus_equ) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a += 1+1\n";
printf("%s", lines);
@@ -2395,7 +2395,7 @@ TEST(parser, plus_equ) {
TEST(lexser, a_j) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -2412,7 +2412,7 @@ TEST(lexser, a_j) {
}
TEST(parser, plus_equ_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a -= (1+1-3)\n";
printf("%s", lines);
@@ -2436,7 +2436,7 @@ TEST(parser, plus_equ_) {
}
TEST(parser, class_demo_3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"class people:\n"
@@ -2459,7 +2459,7 @@ TEST(parser, class_demo_3) {
}
TEST(parser, a_a) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"a = 1\n"
@@ -2473,7 +2473,7 @@ TEST(parser, a_a) {
}
TEST(parser, a_cuohao_j) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = (3 - 4) - 4\n";
printf("%s\n",
@@ -2496,7 +2496,7 @@ TEST(parser, a_cuohao_j) {
}
TEST(parser, _3_3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "-3+3\n";
printf("%s\n",
@@ -2517,7 +2517,7 @@ TEST(parser, _3_3) {
#if PIKA_BUILTIN_STRUCT_ENABLE
TEST(parser, list_init) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = [1, 2, 3]\n";
printf("%s\n",
@@ -2538,7 +2538,7 @@ TEST(parser, list_init) {
}
TEST(parser, list_init_fun) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "test([1, 2, 3])\n";
printf("%s\n",
@@ -2560,7 +2560,7 @@ TEST(parser, list_init_fun) {
#endif
TEST(parser, bytes_iteral) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b'\\x00\\x01'\n";
char* tokens_str =
@@ -2580,7 +2580,7 @@ TEST(parser, bytes_iteral) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(parser, import_as) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "import PikaStdLib as std\n";
char* tokens_str =
@@ -2602,7 +2602,7 @@ TEST(parser, import_as) {
#endif
TEST(parser, str_equ) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = 'num ='\n";
char* tokens_str =
@@ -2622,7 +2622,7 @@ TEST(parser, str_equ) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, bytes_index) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "res2 = b'eqrt'[2]\n";
char* tokens_str =
@@ -2644,7 +2644,7 @@ TEST(parser, bytes_index) {
#endif
TEST(parser, hex_iteral) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = 0b10\n";
char* tokens_str =
@@ -2663,7 +2663,7 @@ TEST(parser, hex_iteral) {
}
TEST(parser, tab) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"for i in range(0, 100):\n"
@@ -2701,7 +2701,7 @@ TEST(parser, tab) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, parse_issue2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = " recv_buf[1] = dat \n";
char* tokens = Lexer_getTokenStream(buffs, lines);
@@ -2726,7 +2726,7 @@ TEST(parser, parse_issue2) {
#endif
TEST(parser, parse_issue3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "recv_buf[1] = dat ";
char* clean_cmd = Cursor_getCleanStmt(buffs, lines);
@@ -2737,7 +2737,7 @@ TEST(parser, parse_issue3) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, slice1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = recv_buf[1:4]\n";
printf("%s", lines);
@@ -2758,7 +2758,7 @@ TEST(parser, slice1) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, slice2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = recv_buf[1:4:2]\n";
printf("%s", lines);
@@ -2779,7 +2779,7 @@ TEST(parser, slice2) {
#endif
TEST(parser, str_add1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "msg = \"device_names[\" + str(i) + \"]:\"";
printf("%s\r\n", lines);
@@ -2806,7 +2806,7 @@ TEST(parser, str_add1) {
}
TEST(parser, str_add2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "msg = \"device_names[\" + str(i)";
printf("%s\r\n", lines);
@@ -2831,7 +2831,7 @@ TEST(parser, str_add2) {
}
TEST(parser, mpy1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"# Pong!\n"
@@ -2929,7 +2929,7 @@ TEST(parser, mpy1) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, slice_12lkj) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b[:6]\n";
printf("%s", lines);
@@ -2948,7 +2948,7 @@ TEST(parser, slice_12lkj) {
}
TEST(parser, slice_oifjlk) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b[6:]\n";
printf("%s", lines);
@@ -2969,7 +2969,7 @@ TEST(parser, slice_oifjlk) {
#endif
TEST(parser, str_string) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = str(String('test'))\n";
printf("%s", lines);
@@ -2987,7 +2987,7 @@ TEST(parser, str_string) {
}
TEST(parser, json_literal) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"a = '"
@@ -3029,7 +3029,7 @@ TEST(parser, json_literal) {
}
TEST(parser, issuekd) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"recv_buf = PikaStdData.List()\n"
@@ -3083,7 +3083,7 @@ TEST(parser, issuekd) {
}
TEST(parser, cjson_test4) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
Arg* lines_buff = arg_loadFile(NULL, "../../examples/cJSON/test4.py");
char* lines = (char*)arg_getBytes(lines_buff);
@@ -3107,7 +3107,7 @@ TEST(parser, cjson_test4) {
}
TEST(parser, connection) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"print('\\\n"
@@ -3125,7 +3125,7 @@ TEST(parser, connection) {
}
TEST(parser, connection2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"a = \\\n"
@@ -3149,7 +3149,7 @@ TEST(parser, connection2) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(parser, format1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "s = 'res:%d' % 23";
printf("%s", lines);
@@ -3169,7 +3169,7 @@ TEST(parser, format1) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(parser, format2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "'res:%d:%d' % (23, 25)";
printf("%s\n", lines);
@@ -3189,7 +3189,7 @@ TEST(parser, format2) {
#if PIKA_SYNTAX_EXCEPTION_ENABLE
TEST(parser, try1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"try:\n"
@@ -3231,7 +3231,7 @@ TEST(parser, try1) {
}
TEST(parser, except_issue) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"try:\n"
@@ -3278,7 +3278,7 @@ TEST(parser, except_issue) {
#endif
TEST(parser, optissue1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "~-1";
printf("%s\n", lines);
@@ -3295,7 +3295,7 @@ TEST(parser, optissue1) {
}
TEST(parser, optissue2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "test(not get())";
printf("%s\n", lines);
@@ -3313,7 +3313,7 @@ TEST(parser, optissue2) {
TEST(lexser, import_issue1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -3331,7 +3331,7 @@ TEST(lexser, import_issue1) {
TEST(lexser, dict_literal1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -3354,7 +3354,7 @@ TEST(lexser, dict_literal1) {
#if PIKA_BUILTIN_STRUCT_ENABLE
TEST(parser, dict_literal1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"tinydict = {'name': 'runoob', 'likes': 123, 'url': "
@@ -3379,7 +3379,7 @@ TEST(parser, dict_literal1) {
#endif
TEST(parser, common_issue1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"class ConfigParser():\n"
@@ -3419,7 +3419,7 @@ TEST(parser, common_issue1) {
}
TEST(parser, def_issue1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def options(self):\n"
@@ -3455,7 +3455,7 @@ TEST(parser, unittest) {
TEST(lexser, function_chain) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -3474,7 +3474,7 @@ TEST(lexser, function_chain) {
}
TEST(parser, function_chain) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = String('a,b,c').split(',')\n";
__platform_printf("%s\n", lines);
@@ -3497,7 +3497,7 @@ TEST(parser, str_issue1) {
"if str(type(data)) == \"\" and str(type(included_data)) "
"== \"\":\n"
"\n";
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
__platform_printf("%s\n", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
@@ -3524,7 +3524,7 @@ TEST(parser, str_issue1) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(parser, str_issue2) {
char* lines = "print('ret = %s' % str(ret))\n";
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
__platform_printf("%s\n", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
@@ -3543,7 +3543,7 @@ TEST(parser, str_issue2) {
#endif
TEST(parser, num_issue) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "(((1 + (2 * 3)/(4 + 5))*(6 - 7) + (8 + 9) * 10)/11) - 12\n";
__platform_printf("%s\n", lines);
@@ -3588,7 +3588,7 @@ TEST(parser, num_issue) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, branket_issue2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "temp = hex(int('12'))[0:2]\n";
__platform_printf("%s\n", lines);
@@ -3611,7 +3611,7 @@ TEST(parser, branket_issue2) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, branket_issue3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b[x][y]\n";
__platform_printf("%s\n", lines);
@@ -3633,7 +3633,7 @@ TEST(parser, branket_issue3) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, branket_issue4) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a = b[c[y]]\n";
__platform_printf("%s\n", lines);
@@ -3654,7 +3654,7 @@ TEST(parser, branket_issue4) {
#endif
TEST(parser, tuple1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "(a,b)\n";
__platform_printf("%s\n", lines);
@@ -3671,7 +3671,7 @@ TEST(parser, tuple1) {
}
TEST(parser, _del) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "del a\n";
__platform_printf("%s\n", lines);
@@ -3686,7 +3686,7 @@ TEST(parser, _del) {
}
TEST(parser, _del_issue1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "del(a)\n";
__platform_printf("%s\n", lines);
@@ -3702,7 +3702,7 @@ TEST(parser, _del_issue1) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(parser, issue_fa13f4) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "d['language'].append('Java')\n";
__platform_printf("%s\n", lines);
@@ -3722,7 +3722,7 @@ TEST(parser, issue_fa13f4) {
#endif
TEST(parser, _is) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a is b\n";
__platform_printf("%s\n", lines);
@@ -3739,7 +3739,7 @@ TEST(parser, _is) {
}
TEST(parser, _in) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a in b\n";
__platform_printf("%s\n", lines);
@@ -3756,7 +3756,7 @@ TEST(parser, _in) {
}
TEST(parser, _in2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"res1 = 'a' in 'aaa'\n"
@@ -3782,7 +3782,7 @@ TEST(parser, _in2) {
#if PIKA_SYNTAX_EXCEPTION_ENABLE
TEST(parser, assert_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"assert True\n"
@@ -3808,7 +3808,7 @@ TEST(parser, assert_) {
#if PIKA_SYNTAX_EXCEPTION_ENABLE
TEST(parser, except_for) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"for i in range(0, 10):\n"
@@ -3854,7 +3854,7 @@ TEST(parser, except_for) {
#endif
TEST(parser, line_void_issue$l1k2i) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "mem = PikaStdLib.MemChecker()";
__platform_printf("%s\n", lines);
@@ -3870,7 +3870,7 @@ TEST(parser, line_void_issue$l1k2i) {
}
TEST(parser, while_void_novoid) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "while True:\n";
__platform_printf("%s\n", lines);
@@ -3902,7 +3902,7 @@ TEST(parser, while_void_novoid) {
}
TEST(parser, connect_auto) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"method(a,\n"
@@ -3922,7 +3922,7 @@ TEST(parser, connect_auto) {
TEST(lexser, connet_part1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -3939,7 +3939,7 @@ TEST(lexser, connet_part1) {
}
TEST(parser, vars_runtime) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def testvars(a, *b):\n"
@@ -3990,7 +3990,7 @@ TEST(parser, vars_runtime) {
#if PIKA_BUILTIN_STRUCT_ENABLE
TEST(parser, issues_I5MIFO) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "[1, 2, 3] + [4, 5, 6]";
__platform_printf("%s\n", lines);
@@ -4015,7 +4015,7 @@ TEST(parser, issues_I5MIFO) {
TEST(lexser, science_num) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -4036,7 +4036,7 @@ TEST(lexser, science_num) {
TEST(lexser, issues_I5OJQB) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -4053,7 +4053,7 @@ TEST(lexser, issues_I5OJQB) {
}
TEST(parser, issues_I5OJQB) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "s = '\\\\'";
__platform_printf("%s\n", lines);
@@ -4069,7 +4069,7 @@ TEST(parser, issues_I5OJQB) {
}
TEST(parser, keyword1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "test(a=1, b ='test')";
__platform_printf("%s\n", lines);
@@ -4088,7 +4088,7 @@ TEST(parser, keyword1) {
}
TEST(parser, keyword_class) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "t = Test(0, b = 3)\n";
__platform_printf("%s\n", lines);
@@ -4107,7 +4107,7 @@ TEST(parser, keyword_class) {
}
TEST(parser, keyword_class_mqtt) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"class MQTT:\n"
@@ -4133,7 +4133,7 @@ TEST(parser, keyword_class_mqtt) {
#if !PIKA_NANO_ENABLE
TEST(parser, except_dict) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"dict = {'a':1, 'b':2, 'c':3}\n"
@@ -4191,7 +4191,7 @@ TEST(parser, except_dict) {
#if !PIKA_NANO_ENABLE
TEST(parser, default_fn_1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def test(a=1, b='test'):\n"
@@ -4227,7 +4227,7 @@ TEST(parser, default_fn_1) {
}
TEST(parser, default_fn_1_hint) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"def test(a:int =1, b:str ='test'):\n"
@@ -4265,7 +4265,7 @@ TEST(parser, default_fn_1_hint) {
#if !PIKA_NANO_ENABLE
TEST(parser, multi_return) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a , b = c";
__platform_printf("%s\n", lines);
@@ -4293,7 +4293,7 @@ TEST(parser, multi_return) {
}
TEST(parser, multi_return_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "test['a , b'] = c";
__platform_printf("%s\n", lines);
@@ -4312,7 +4312,7 @@ TEST(parser, multi_return_) {
}
TEST(parser, multi_return_2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "'test,q'[0] = c";
__platform_printf("%s\n", lines);
@@ -4333,7 +4333,7 @@ TEST(parser, multi_return_2) {
#if !PIKA_NANO_ENABLE
TEST(parser, multi_return_3) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "return a,b";
__platform_printf("%s\n", lines);
@@ -4351,7 +4351,7 @@ TEST(parser, multi_return_3) {
}
TEST(parser, multi_return_4) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"for a,b in c:\n"
@@ -4364,7 +4364,7 @@ TEST(parser, multi_return_4) {
}
TEST(parser, for_multi) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"d = {'a':1, 'b':2}\n"
@@ -4419,7 +4419,7 @@ TEST(parser, for_multi) {
}
TEST(parser, pass_) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"pass\n"
@@ -4460,7 +4460,7 @@ TEST(parser, pass_) {
}
TEST(parser, modbus_1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "dest[i + 1] * 256\n";
__platform_printf("%s\n", lines);
@@ -4482,7 +4482,7 @@ TEST(parser, modbus_1) {
}
TEST(parser, issue_big_dict) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* pikaAsm =
Parser_fileToAsm(buffs, "test/python/issue/issue_big_dict.py");
@@ -4887,7 +4887,7 @@ TEST(parser, issue_big_dict) {
}
TEST(parser, issue_dict_update) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* pikaAsm =
Parser_fileToAsm(buffs, "test/python/issue/issue_dict_update.py");
@@ -4897,7 +4897,7 @@ TEST(parser, issue_dict_update) {
}
TEST(parser, object_test2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"hello(name = 'world', isShow = isShow)";
printf("%s", lines);
@@ -4916,7 +4916,7 @@ TEST(parser, object_test2) {
}
TEST(parser, i_pp) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"i = 0\n"
@@ -4949,7 +4949,7 @@ TEST(parser, i_pp) {
}
TEST(parser, multi_num) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a,b ,c = 1, 2, 3\n";
printf("%s\r\n", lines);
@@ -4985,7 +4985,7 @@ TEST(parser, multi_num) {
}
TEST(parser, multi_import) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"import a,b ,c\n"
@@ -5061,7 +5061,7 @@ TEST(parser, multi_import) {
}
TEST(parser, from_import_as) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "from PikaStdData import String as string";
printf("%s\r\n", lines);
@@ -5079,7 +5079,7 @@ TEST(parser, from_import_as) {
}
TEST(parser, multi_from_import_as) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "from a import b, c, d as e, f, g\n";
printf("%s\r\n", lines);
@@ -5117,7 +5117,7 @@ TEST(parser, multi_from_import_as) {
}
TEST(parser, print_ssa) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "print(**a)\n";
printf("%s\r\n", lines);
@@ -5134,7 +5134,7 @@ TEST(parser, print_ssa) {
}
TEST(parser, not_in) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "1 not in a\n";
printf("%s\r\n", lines);
@@ -5152,7 +5152,7 @@ TEST(parser, not_in) {
}
// TEST(parser, def_not_in) {
-// pikaMemInfo.heapUsedMax = 0;
+// g_pikaMemInfo.heapUsedMax = 0;
// Args* buffs = New_strBuff();
// char* lines =
// "def test(a=\"hmac-md5\"):\n"
@@ -5171,7 +5171,7 @@ TEST(parser, not_in) {
// }
TEST(parser, syntex_issue_lwekj) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "json.loads('{a:1}'}";
EXPECT_EQ((uintptr_t)Parser_linesToAsm(buffs, lines), 0);
@@ -5180,7 +5180,7 @@ TEST(parser, syntex_issue_lwekj) {
}
TEST(parser, syntex_issue_lekj) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a[b()] = 1";
printf("%s\r\n", lines);
@@ -5199,7 +5199,7 @@ TEST(parser, syntex_issue_lekj) {
}
TEST(parser, syntex_issue_l1l2) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "test(a=1, b= 2)";
printf("%s\r\n", lines);
@@ -5218,7 +5218,7 @@ TEST(parser, syntex_issue_l1l2) {
}
TEST(parser, syntex_issue_12ojd) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"class Test:\n"
@@ -5267,7 +5267,7 @@ TEST(parser, syntex_issue_12ojd) {
}
TEST(parser, tuple_void) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "()\n";
printf("%s\r\n", lines);
@@ -5282,7 +5282,7 @@ TEST(parser, tuple_void) {
}
TEST(parser, page_add) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"PikaUI.Page().add(\n"
@@ -5318,7 +5318,7 @@ TEST(parser, page_add) {
}
TEST(parser, hint_assign) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"a:int = 1\n"
@@ -5339,7 +5339,7 @@ TEST(parser, hint_assign) {
}
TEST(parser, while_try_while) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"while True:\n"
@@ -5389,7 +5389,7 @@ TEST(parser, while_try_while) {
}
TEST(parser, return_list) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =
"return [\n"
@@ -5419,7 +5419,7 @@ TEST(parser, return_list) {
}
TEST(parser, not_in_or) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "a not in x or b not in x or c not in x\n";
printf("%s\r\n", lines);
diff --git a/test/pikaMain-test.cpp b/test/pikaMain-test.cpp
index 9d5607b2e..3a233058a 100644
--- a/test/pikaMain-test.cpp
+++ b/test/pikaMain-test.cpp
@@ -2,14 +2,16 @@
TEST_START
TEST(pikaMain, init) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = pikaScriptInit();
+ pikaGC_markRoot();
+ pikaGC_printCanFree();
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
TEST(pikaMain, new_mem) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
VMParameters* globals = obj_run(pikaMain,
"mem = PikaStdLib.MemChecker()\n"
@@ -24,7 +26,7 @@ TEST(pikaMain, new_mem) {
TEST(pikaMain, unitTest) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -39,7 +41,7 @@ TEST(pikaMain, unitTest) {
TEST(pikaMain, list_new) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
VMParameters* globals = obj_run(pikaMain,
@@ -67,7 +69,7 @@ TEST(pikaMain, list_new) {
TEST(pikaMain, int_float_convert) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
VMParameters* globals = obj_run(pikaMain,
@@ -95,7 +97,7 @@ TEST(pikaMain, int_float_convert) {
TEST(pikaMain, type_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -114,7 +116,7 @@ TEST(pikaMain, type_) {
TEST(pikaMain, a_signed) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "a = -1\n");
@@ -131,7 +133,7 @@ TEST(pikaMain, a_signed) {
TEST(pikaMain, a_mm) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "a = -1.1 ** 3\n");
@@ -148,7 +150,7 @@ TEST(pikaMain, a_mm) {
TEST(pikaMain, a_n1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "a = -2\n");
@@ -165,7 +167,7 @@ TEST(pikaMain, a_n1) {
TEST(pikaMain, a_l4) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "a = 1<<4\n");
@@ -182,7 +184,7 @@ TEST(pikaMain, a_l4) {
TEST(pikaMain, less_equ) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -203,7 +205,7 @@ TEST(pikaMain, less_equ) {
TEST(pikaMain, and_or_not) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -244,7 +246,7 @@ TEST(pikaMain, and_or_not) {
TEST(pikaMain, err_scop) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "print('test'");
@@ -259,7 +261,7 @@ TEST(pikaMain, err_scop) {
TEST(pikaMain, PikaStdData) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -283,7 +285,7 @@ TEST(pikaMain, PikaStdData) {
TEST(pikaMain, list_method) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -304,7 +306,7 @@ TEST(pikaMain, list_method) {
TEST(pikaMain, list_iter) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -326,7 +328,7 @@ TEST(pikaMain, list_iter) {
TEST(pikaMain, list_for_loop) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -350,7 +352,7 @@ TEST(pikaMain, list_for_loop) {
TEST(pikaMain, range) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -366,7 +368,7 @@ TEST(pikaMain, range) {
TEST(pikaMain, for_in_range) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -387,7 +389,7 @@ TEST(pikaMain, for_in_range) {
TEST(pikaMain, for_for_in_range) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -409,7 +411,7 @@ TEST(pikaMain, for_for_in_range) {
TEST(pikaMain, for_if_break) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -431,7 +433,7 @@ TEST(pikaMain, for_if_break) {
TEST(pikaMain, for_if_continue) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -455,7 +457,7 @@ TEST(pikaMain, for_if_continue) {
extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];
TEST(pikaMain, print_in_def) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
/* the test is used to fix too many print in def */
@@ -478,7 +480,7 @@ TEST(pikaMain, print_in_def) {
TEST(pikaMain, prime_100) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -510,7 +512,7 @@ TEST(pikaMain, prime_100) {
extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];
TEST(pikaMain, for_in_dict) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -533,7 +535,7 @@ TEST(pikaMain, for_in_dict) {
TEST(pikaMain, str_add) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -560,7 +562,7 @@ TEST(pikaMain, str_add) {
TEST(pikaMain, str_add_print) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -576,7 +578,7 @@ TEST(pikaMain, str_add_print) {
TEST(pikaMain, int_float_to_str) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -596,7 +598,7 @@ TEST(pikaMain, int_float_to_str) {
TEST(pikaMain, str_eq) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -625,7 +627,7 @@ TEST(pikaMain, str_eq) {
TEST(pikaMain, print_with_enter) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -641,7 +643,7 @@ TEST(pikaMain, print_with_enter) {
TEST(pikaMain, print_with_2enter) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -657,7 +659,7 @@ TEST(pikaMain, print_with_2enter) {
TEST(pikaMain, print_ddd) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -673,7 +675,7 @@ TEST(pikaMain, print_ddd) {
TEST(pikaMain, for_in_string) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -696,7 +698,7 @@ TEST(pikaMain, for_in_string) {
TEST(pikaMain, string_no_init_arg) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -714,7 +716,7 @@ TEST(pikaMain, string_no_init_arg) {
TEST(pikaMain, obj_no_free) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -732,7 +734,7 @@ TEST(pikaMain, obj_no_free) {
#if 0
TEST(pikaMain, list__setitem__) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -753,7 +755,7 @@ TEST(pikaMain, list__setitem__) {
TEST(pikaMain, string__getitem__) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -772,7 +774,7 @@ TEST(pikaMain, string__getitem__) {
TEST(pikaMain, dict__setitem__get) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -792,7 +794,7 @@ TEST(pikaMain, dict__setitem__get) {
TEST(pikaMain, str___getitem____setitem__) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -815,7 +817,7 @@ TEST(pikaMain, str___getitem____setitem__) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, str__index__) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -843,7 +845,7 @@ TEST(pikaMain, str__index__) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, bytes__index__) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -871,7 +873,7 @@ TEST(pikaMain, bytes__index__) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, list_index) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -893,7 +895,7 @@ TEST(pikaMain, list_index) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, dict_index) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\n");
@@ -914,7 +916,7 @@ TEST(pikaMain, dict_index) {
TEST(pikaMain, task_run_once) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
obj_run(pikaMain,
@@ -938,7 +940,7 @@ TEST(pikaMain, task_run_once) {
TEST(pikaMain, task_run_when) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
obj_run(pikaMain,
@@ -969,7 +971,7 @@ TEST(pikaMain, task_run_when) {
#if !PIKA_NANO_ENABLE
TEST(pikaMain, task_run_period_until) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1023,7 +1025,7 @@ TEST(pikaMain, task_run_period_until) {
TEST(pikaMain, fun_call) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1050,7 +1052,7 @@ TEST(pikaMain, fun_call) {
TEST(pikaMain, global) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1081,7 +1083,7 @@ TEST(pikaMain, global) {
TEST(pikaMain, complex_str) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1096,7 +1098,7 @@ TEST(pikaMain, complex_str) {
TEST(pikaMain, syntax_err_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1110,7 +1112,7 @@ TEST(pikaMain, syntax_err_1) {
TEST(pikaMain, class_arg) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1134,7 +1136,7 @@ TEST(pikaMain, class_arg) {
TEST(pikaMain, class_def) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1159,7 +1161,7 @@ TEST(pikaMain, class_def) {
TEST(pikaMain, class_def_print) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1180,7 +1182,7 @@ TEST(pikaMain, class_def_print) {
TEST(pikaMain, class_demo_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1205,7 +1207,7 @@ TEST(pikaMain, class_demo_1) {
TEST(pikaMain, class_demo_2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1228,7 +1230,7 @@ TEST(pikaMain, class_demo_2) {
TEST(pikaMain, class_demo_3) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1256,7 +1258,7 @@ TEST(pikaMain, class_demo_3) {
TEST(pikaMain, class_demo_save_asm) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1285,7 +1287,7 @@ TEST(pikaMain, class_demo_save_asm) {
TEST(pikaMain, for_if_continue_byte_code) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
pikaVM_run(pikaMain,
@@ -1307,7 +1309,7 @@ TEST(pikaMain, for_if_continue_byte_code) {
TEST(pikaMain, print_in_def_byte_code) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -1328,7 +1330,7 @@ TEST(pikaMain, print_in_def_byte_code) {
TEST(pikaMain, class_demo_1_file) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1361,7 +1363,7 @@ TEST(pikaMain, class_demo_1_file) {
// #if !PIKA_NANO_ENABLE
// TEST(pikaMain, get_native_method) {
// /* init */
-// pikaMemInfo.heapUsedMax = 0;
+// g_pikaMemInfo.heapUsedMax = 0;
// PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
// __platform_printf("BEGIN\r\n");
// /* do some thing */
@@ -1380,7 +1382,7 @@ TEST(pikaMain, class_demo_1_file) {
TEST(pikaMain, hex_list) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -1405,7 +1407,7 @@ TEST(pikaMain, hex_list) {
TEST(pikaMain, bytearray) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -1429,7 +1431,7 @@ TEST(pikaMain, bytearray) {
TEST(pikaMain, not_4_space) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -1445,7 +1447,7 @@ TEST(pikaMain, not_4_space) {
TEST(pikaMain, self_operator) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -1476,7 +1478,7 @@ TEST(pikaMain, self_operator) {
TEST(pikaMain, class_demo_2_initwitharg) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1499,7 +1501,7 @@ TEST(pikaMain, class_demo_2_initwitharg) {
TEST(pikaMain, def_args_err) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "print()\n");
@@ -1515,7 +1517,7 @@ TEST(pikaMain, def_args_err) {
// TEST(pikaMain, class_args_err) {
// /* init */
-// pikaMemInfo.heapUsedMax = 0;
+// g_pikaMemInfo.heapUsedMax = 0;
// PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
// /* run */
// obj_run(pikaMain, "mem = PikaStdLib.MemChecker(0)\n");
@@ -1532,7 +1534,7 @@ TEST(pikaMain, def_args_err) {
TEST(pikaMain, int_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "a = int('3')\n");
@@ -1547,7 +1549,7 @@ TEST(pikaMain, int_) {
TEST(pikaMain, len_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "a = len('331dd')\n");
@@ -1562,7 +1564,7 @@ TEST(pikaMain, len_) {
TEST(pikaMain, def_in_shell) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
@@ -1591,7 +1593,7 @@ TEST(pikaMain, def_in_shell) {
TEST(pikaMain, def_in_shell_override) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
@@ -1620,7 +1622,7 @@ TEST(pikaMain, def_in_shell_override) {
TEST(pikaMain, class_in_shell) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
@@ -1646,7 +1648,7 @@ TEST(pikaMain, class_in_shell) {
TEST(pikaMain, class_TinyObj) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
@@ -1672,7 +1674,7 @@ TEST(pikaMain, class_TinyObj) {
TEST(pikaMain, list_sysobj) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
@@ -1691,7 +1693,7 @@ TEST(pikaMain, list_sysobj) {
#if PIKA_BUILTIN_STRUCT_ENABLE
TEST(pikaMain, list_init) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1711,7 +1713,7 @@ TEST(pikaMain, list_init) {
TEST(pikaMain, ctypes) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
char* lines =
@@ -1738,7 +1740,7 @@ TEST(pikaMain, ctypes) {
TEST(pikaMain, import_err) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
char* lines = "import qqpe\n";
@@ -1757,7 +1759,7 @@ TEST(pikaMain, import_err) {
TEST(pikaMain, cmodule_in_py) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = pikaScriptInit();
char* lines =
@@ -1778,7 +1780,7 @@ TEST(pikaMain, cmodule_in_py) {
TEST(pikaMain, class___str___print) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1798,7 +1800,7 @@ TEST(pikaMain, class___str___print) {
TEST(pikaMain, CModule__str__) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1819,7 +1821,7 @@ TEST(pikaMain, CModule__str__) {
#if !PIKA_NANO_ENABLE
TEST(pikaMain, builtin_hex) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1843,7 +1845,7 @@ TEST(pikaMain, builtin_hex) {
#if !PIKA_NANO_ENABLE
TEST(pikaMain, builtin_ord) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1860,7 +1862,7 @@ TEST(pikaMain, builtin_ord) {
#if !PIKA_NANO_ENABLE
TEST(pikaMain, builtin_chr) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1876,7 +1878,7 @@ TEST(pikaMain, builtin_chr) {
TEST(pikaMain, iteral_oct) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1891,7 +1893,7 @@ TEST(pikaMain, iteral_oct) {
TEST(pikaMain, iteral_bin) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1906,7 +1908,7 @@ TEST(pikaMain, iteral_bin) {
TEST(pikaMain, REPL_push_mode) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1931,7 +1933,7 @@ TEST(pikaMain, REPL_push_mode) {
TEST(pikaMain, REPL_push_mode_err) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1952,7 +1954,7 @@ TEST(pikaMain, REPL_push_mode_err) {
#if 0
TEST(pikaMain, REPL_input) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1973,7 +1975,7 @@ TEST(pikaMain, REPL_input) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, int_from_bytes) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -1989,7 +1991,7 @@ TEST(pikaMain, int_from_bytes) {
// TEST(pikaMain, big_bytes) {
// /* init */
-// pikaMemInfo.heapUsedMax = 0;
+// g_pikaMemInfo.heapUsedMax = 0;
// /* run */
// PikaObj* self = newRootObj("pikaMain", New_PikaMain);
// __platform_printf("BEGIN\r\n");
@@ -2003,7 +2005,7 @@ TEST(pikaMain, int_from_bytes) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, utils_int_to_bytes) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2023,7 +2025,7 @@ TEST(pikaMain, utils_int_to_bytes) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, neg_index) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2043,7 +2045,7 @@ TEST(pikaMain, neg_index) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, slice1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2060,7 +2062,7 @@ TEST(pikaMain, slice1) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, slice2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2076,7 +2078,7 @@ TEST(pikaMain, slice2) {
TEST(pikaMain, c_buffer) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2089,7 +2091,7 @@ TEST(pikaMain, c_buffer) {
TEST(pikaMain, str_add1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2108,7 +2110,7 @@ TEST(pikaMain, str_add1) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, slice_eei) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2125,7 +2127,7 @@ TEST(pikaMain, slice_eei) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, slice_a97) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2142,7 +2144,7 @@ TEST(pikaMain, slice_a97) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, slice_a90) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2159,7 +2161,7 @@ TEST(pikaMain, slice_a90) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, slice_a12) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2175,7 +2177,7 @@ TEST(pikaMain, slice_a12) {
TEST(pikaMain, str_string) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2193,7 +2195,7 @@ TEST(pikaMain, str_string) {
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(pikaMain, string_index) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2214,7 +2216,7 @@ TEST(pikaMain, string_index) {
TEST(pikaMain, list_for_append) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2233,7 +2235,7 @@ TEST(pikaMain, list_for_append) {
TEST(pikaMain, string_str) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
@@ -2247,7 +2249,7 @@ TEST(pikaMain, string_str) {
}
TEST(pikaMain, module_import_from_module) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(self, pikaModules_py_a);
@@ -2263,7 +2265,7 @@ TEST(pikaMain, module_import_from_module) {
}
TEST(pikaMain, module_1_module2_test) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(self, pikaModules_py_a);
@@ -2279,7 +2281,7 @@ TEST(pikaMain, module_1_module2_test) {
TEST(pikaMain, string_startswith) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -2301,7 +2303,7 @@ TEST(pikaMain, string_startswith) {
TEST(pikaMain, string_endswith) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -2323,7 +2325,7 @@ TEST(pikaMain, string_endswith) {
TEST(pikaMain, string_isdigit) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -2350,7 +2352,7 @@ TEST(pikaMain, string_isdigit) {
TEST(pikaMain, string_islower) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -2377,7 +2379,7 @@ TEST(pikaMain, string_islower) {
TEST(pikaMain, string_isalnum) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -2404,7 +2406,7 @@ TEST(pikaMain, string_isalnum) {
TEST(pikaMain, string_isalpha) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -2431,7 +2433,7 @@ TEST(pikaMain, string_isalpha) {
TEST(pikaMain, string_isspace) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -2454,7 +2456,7 @@ TEST(pikaMain, string_isspace) {
TEST(pikaMain, print_obj) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2479,7 +2481,7 @@ TEST(pikaMain, print_obj) {
TEST(pikaMain, num_issue1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2496,7 +2498,7 @@ TEST(pikaMain, num_issue1) {
TEST(pikaMain, returnNullString) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2540,7 +2542,7 @@ TEST(pikaMain, for_loop_issue_1b2a3f1bdf) {
EXPECT_EQ(pikaMemNow(), 0);
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2559,7 +2561,7 @@ TEST(pikaMain, for_loop_issue_1b2a3f1bdf) {
TEST(pikaMain, syantex_issue123lkjxi) {
char* lines = "if i < 3\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2575,7 +2577,7 @@ TEST(pikaMain, syantex_issue123lkjxi) {
TEST(pikaMain, syantex_issue_fae13) {
char* lines = "for i < 3\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2591,7 +2593,7 @@ TEST(pikaMain, syantex_issue_fae13) {
TEST(pikaMain, syantex_issue_1289341) {
char* lines = "class lkj\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2607,7 +2609,7 @@ TEST(pikaMain, syantex_issue_1289341) {
TEST(pikaMain, syantex_issue_183571) {
char* lines = "def test\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2626,7 +2628,7 @@ TEST(pikaMain, dump_issue_12l3kjioa) {
" print('test')\n"
"\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2645,7 +2647,7 @@ TEST(pikaMain, issue_fa13f4) {
"d['language'].append('Java')\n"
"print(d)\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2671,7 +2673,7 @@ TEST(pikaMain, callback_issue_I5L1MI) {
"f = test\n"
"callback(f)\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2692,7 +2694,7 @@ TEST(pikaMain, runchar_multiline) {
"\r\n"
"test()\r\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2721,7 +2723,7 @@ TEST(pikaMain, callback_run_char) {
"\r\n"
"test()\r\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2739,7 +2741,7 @@ TEST(pikaMain, callback_run_char) {
TEST(pikaMain, REPL_backspace) {
char* lines = "print('test'\b\b')\r\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2757,7 +2759,7 @@ TEST(pikaMain, REPL_backspace) {
TEST(pikaMain, REPL_backspace_issue_1) {
char* lines = "print('test'\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b'a'\r\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2775,7 +2777,7 @@ TEST(pikaMain, REPL_backspace_issue_1) {
TEST(pikaMain, REPL_backspace_issue_2) {
char* lines = "loop\bp\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2793,7 +2795,7 @@ TEST(pikaMain, REPL_key_left) {
char lines[] = {'1', '2', '+', '3', '4', 0x1b,
0x5b, KEY_LEFT, '5', '\n', 0x00};
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2812,7 +2814,7 @@ TEST(pikaMain, REPL_key_left_del) {
char lines[] = {'1', '2', '+', '3', '4', 0x1b,
0x5b, KEY_LEFT, '\b', '\n', 0x00};
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2832,7 +2834,7 @@ TEST(pikaMain, REPL_key_left_del) {
TEST(pikaMain, SHELL_filter_hi_pika) {
char lines[] = {"###Hi Pika"};
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2850,7 +2852,7 @@ TEST(pikaMain, SHELL_filter_hi_pika) {
TEST(pikaMain, SHELL_filter_hi_pika_sence) {
char lines[] = {"###hi pika"};
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2868,7 +2870,7 @@ TEST(pikaMain, SHELL_filter_hi_pika_sence) {
TEST(pikaMain, SHELL_filter_bye_pika_sence) {
char lines[] = {"###Bye piKa"};
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2886,7 +2888,7 @@ TEST(pikaMain, SHELL_filter_bye_pika_sence) {
TEST(pikaMain, SHELL_filter_bye_pika_nomache) {
char lines[] = {"print('###Hi Pika')\nprint('###Hi_Pika')\n"};
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -2904,7 +2906,7 @@ TEST(pikaMain, SHELL_filter_bye_pika_nomache) {
TEST(pikaMain, mem_now) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
__platform_printf("BEGIN\r\n");
diff --git a/test/pikaui-test.cpp b/test/pikaui-test.cpp
index f25643842..71b85030d 100644
--- a/test/pikaui-test.cpp
+++ b/test/pikaui-test.cpp
@@ -4,7 +4,7 @@ TEST_START
TEST(pikaui, page) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
diff --git a/test/python/gc/gc_circle.py b/test/python/gc/gc_circle.py
new file mode 100644
index 000000000..d1a6adf94
--- /dev/null
+++ b/test/python/gc/gc_circle.py
@@ -0,0 +1,11 @@
+class Tree:
+ parent = None
+ child = []
+
+def test():
+ a = Tree()
+ b = Tree()
+ a.child.append(b)
+ b.parent = a
+
+test()
diff --git a/test/stddata-test.cpp b/test/stddata-test.cpp
index da0e5bdee..1cf919449 100644
--- a/test/stddata-test.cpp
+++ b/test/stddata-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if PIKA_SYNTAX_SLICE_ENABLE
TEST(stddata, test1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -31,7 +31,7 @@ TEST(stddata, test1) {
/* test b2a_hex */
TEST(stddata, test2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -49,7 +49,7 @@ TEST(stddata, test2) {
/* test a2b_hex */
TEST(stddata, a2b_hex) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -69,7 +69,7 @@ TEST(stddata, a2b_hex) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(stddata, encode_decode) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -91,7 +91,7 @@ TEST(stddata, encode_decode) {
#if PIKA_FILEIO_ENABLE
TEST(stddata, fileio) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -109,7 +109,7 @@ TEST(stddata, fileio) {
#if !PIKA_NANO_ENABLE
TEST(list, in) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -127,7 +127,7 @@ TEST(list, in) {
TEST(dict, in) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -144,7 +144,7 @@ TEST(dict, in) {
TEST(list, slice) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -165,7 +165,7 @@ TEST(list, slice) {
#if !PIKA_NANO_ENABLE
TEST(str, split) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -180,7 +180,7 @@ TEST(str, split) {
TEST(str, split2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -197,7 +197,7 @@ TEST(str, split2) {
TEST(dict, cmodule) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -214,7 +214,7 @@ TEST(dict, cmodule) {
TEST(dict, items) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -231,7 +231,7 @@ TEST(dict, items) {
TEST(dict, items2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -251,7 +251,7 @@ TEST(dict, items2) {
TEST(dict, items_kv) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -271,7 +271,7 @@ TEST(dict, items_kv) {
TEST(stddata, list_str) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -286,7 +286,7 @@ TEST(stddata, list_str) {
TEST(stddata, list_bytes) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -301,7 +301,7 @@ TEST(stddata, list_bytes) {
TEST(stddata, bytes_list) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -316,7 +316,7 @@ TEST(stddata, bytes_list) {
TEST(stddata, list_pop_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -338,7 +338,7 @@ TEST(stddata, list_pop_) {
TEST(stddata, list_remove_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -359,7 +359,7 @@ TEST(stddata, list_remove_) {
TEST(stddata, list_insert_) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -378,7 +378,7 @@ TEST(stddata, list_insert_) {
TEST(stddata, dict_update) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -399,7 +399,7 @@ TEST(stddata, dict_update) {
TEST(issue, id_test) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -415,7 +415,7 @@ TEST(issue, id_test) {
TEST(str, strip) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -431,7 +431,7 @@ TEST(str, strip) {
TEST(str, big_slice) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -445,7 +445,7 @@ TEST(str, big_slice) {
TEST(std, eval) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -460,7 +460,7 @@ TEST(std, eval) {
TEST(stddata, kw_fun) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -478,7 +478,7 @@ TEST(stddata, kw_fun) {
TEST(stddata, kw_fun_err_input) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -496,7 +496,7 @@ TEST(stddata, kw_fun_err_input) {
TEST(stddata, bytes_add) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -511,7 +511,7 @@ TEST(stddata, bytes_add) {
TEST(stddata, pikafs_open) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -531,7 +531,7 @@ TEST(stddata, pikafs_open) {
TEST(stddata, list_slice_issue) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
diff --git a/test/string-test.cpp b/test/string-test.cpp
index 5cf342b7b..224ad3199 100644
--- a/test/string-test.cpp
+++ b/test/string-test.cpp
@@ -4,7 +4,7 @@ TEST_START
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(string, cformat) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "s = cformat('test:%d:%f', 33, 1.5)\n");
@@ -21,7 +21,7 @@ TEST(string, cformat) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(string, cformat1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "s = 'res:%d' % 23\n");
@@ -38,7 +38,7 @@ TEST(string, cformat1) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(string, format1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "print('tes:%d,%f'%(123,1.5))\n");
@@ -54,7 +54,7 @@ TEST(string, format1) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(string, format2) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain, "print('tes:%d,%f'%(123,1.5), 23)\n");
@@ -70,7 +70,7 @@ TEST(string, format2) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(string, print_file) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -90,7 +90,7 @@ TEST(string, print_file) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(string, format_parse1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "print('tes:%0.2f'% mem.getMax())";
printf("%s\n", lines);
@@ -110,7 +110,7 @@ TEST(string, format_parse1) {
TEST(string, split) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -132,7 +132,7 @@ TEST(string, split) {
TEST(string, split_str) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -152,7 +152,7 @@ TEST(string, split_str) {
TEST(string, strip) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -170,7 +170,7 @@ TEST(string, strip) {
TEST(string, replace) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -189,7 +189,7 @@ TEST(string, replace) {
#if PIKA_SYNTAX_IMPORT_EX_ENABLE
TEST(string, replace_chain) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
obj_run(pikaMain,
@@ -212,7 +212,7 @@ TEST(string, replace_chain) {
#if !PIKA_NANO_ENABLE
TEST(string, split_chain) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -231,7 +231,7 @@ TEST(string, split_chain) {
TEST(string, str_chain) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -250,7 +250,7 @@ TEST(string, str_chain) {
#if PIKA_SYNTAX_FORMAT_ENABLE
TEST(string, str_issue1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -269,7 +269,7 @@ TEST(string, str_issue1) {
#if PIKA_STRING_UTF8_ENABLE
TEST(string, utf8_1) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
diff --git a/test/strs-test.cpp b/test/strs-test.cpp
index cd856db0b..71bd74528 100644
--- a/test/strs-test.cpp
+++ b/test/strs-test.cpp
@@ -1,7 +1,7 @@
#include "test_common.h"
TEST_START
-extern PikaMemInfo pikaMemInfo;
+extern pikaMemInfo g_pikaMemInfo;
/* the log_buff of printf */
extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];
@@ -104,7 +104,7 @@ TEST(str, strPointToLastToken) {
TEST(str, transfer) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -122,7 +122,7 @@ TEST(str, transfer) {
TEST(str, transfer_issue_jfo4i) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/sysObj-test.cpp b/test/sysObj-test.cpp
index 1c8273eda..0d0543318 100644
--- a/test/sysObj-test.cpp
+++ b/test/sysObj-test.cpp
@@ -39,7 +39,7 @@ TEST(sysObj, getattr) {
"test = Test()\n"
"aa = getattr(test, 'a')\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
@@ -63,7 +63,7 @@ TEST(sysObj, setattr) {
"setattr(test, 'a', 2)\n"
"aa = test.a\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
diff --git a/test/test_common.h b/test/test_common.h
index 413d54194..bab4a8657 100644
--- a/test/test_common.h
+++ b/test/test_common.h
@@ -18,7 +18,7 @@ extern "C" {
#include "dataStrs.h"
#include "pikaScript.h"
#include "pika_config_gtest.h"
-extern PikaMemInfo pikaMemInfo;
+extern pikaMemInfo g_pikaMemInfo;
/* the log_buff of printf */
extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];
}
diff --git a/test/thread-test.cpp b/test/thread-test.cpp
index 170777201..bbc01390b 100644
--- a/test/thread-test.cpp
+++ b/test/thread-test.cpp
@@ -3,7 +3,7 @@ TEST_START
#if !PIKA_NANO_ENABLE && 1
TEST(thread, test1) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
@@ -18,7 +18,7 @@ TEST(thread, test1) {
}
TEST(thread, self) {
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
diff --git a/test/unix-time-test.cpp b/test/unix-time-test.cpp
index 1af3d69c0..970a732d9 100644
--- a/test/unix-time-test.cpp
+++ b/test/unix-time-test.cpp
@@ -10,14 +10,14 @@ extern void time_asctime(const _tm* this_tm);
void time_struct_format(const _tm* this_tm, char* str);
}
-extern PikaMemInfo pikaMemInfo;
+extern pikaMemInfo g_pikaMemInfo;
/* the log_buff of printf */
extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];
#if 0
TEST(unix_time, time) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
@@ -40,7 +40,7 @@ TEST(unix_time, time) {
#if PIKA_STD_DEVICE_UNIX_TIME_ENABLE
TEST(unix_time, unix_time) {
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
/* run */
PikaObj* self = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
@@ -144,7 +144,7 @@ TEST(timetest, sleep) {
"t = PikaStdDevice.Time()\n"
"t.sleep(0.1)\n";
/* init */
- pikaMemInfo.heapUsedMax = 0;
+ g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
From 9d4aa3c38c34a35575e25da02f2bd9561a3b6e58 Mon Sep 17 00:00:00 2001
From: lyon
Date: Sun, 5 Mar 2023 16:27:28 +0800
Subject: [PATCH 09/41] try to fix gc about __pikaMain
fix format
can not markSweep after deinit root
support markRoot if not root
add clang-format
fix path
enable compile-commonds on to support clangd
set markSweep not default
use no_gc object for function frame
only gc for tinyobj, not pikaobj
restore add gc chain when init pikaObj
add clang-format in docker
set for default formatter to clang-format
all Object is GC_ROOT on create
only enable mark sweep to collect after OUT
markSweep after deinit __pikaMain
more mark sweep collect
---
docker/Dockerfile | 1 +
port/linux/.clang-format | 3 +
port/linux/.vscode/c_cpp_properties.json | 1 +
port/linux/.vscode/launch.json | 2 +-
port/linux/.vscode/settings.json | 6 +
port/linux/CMakeLists.txt | 2 +
port/linux/config/pika_config_default.h | 2 +-
port/linux/package/pikascript/main.py | 2 +-
.../pikascript-lib/_thread/_thread.c | 3 +-
src/PikaCompiler.c | 4 +-
src/PikaObj.c | 213 +++--
src/PikaObj.h | 26 +-
src/PikaVM.c | 118 +--
src/TinyObj.c | 3 +-
src/dataArgs.c | 13 +-
src/dataQueueObj.c | 2 +-
src/pika_config_valid.h | 4 +
test/compile-test.cpp | 2 -
test/event-test.cpp | 1 -
test/gc-test.cpp | 15 +
test/parse-test.cpp | 728 +++++++++---------
test/pikaMain-test.cpp | 2 -
test/pika_config_gtest.h | 5 +-
test/python/gc/gc_circle2.py | 9 +
test/test_common.h | 4 +-
25 files changed, 613 insertions(+), 558 deletions(-)
create mode 100644 port/linux/.clang-format
create mode 100644 test/python/gc/gc_circle2.py
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 079a82dd8..682f651ba 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -78,3 +78,4 @@ RUN cd root/pikascript && git remote add github https://github.com/pikastech/pik
RUN apt-get install clangd -y
RUN apt-get install libmbedtls-dev -y
RUN pip install -r /root/pikascript/docker/requirements.txt
+RUN apt-get install clang-format -y
diff --git a/port/linux/.clang-format b/port/linux/.clang-format
new file mode 100644
index 000000000..3dce2403f
--- /dev/null
+++ b/port/linux/.clang-format
@@ -0,0 +1,3 @@
+Language: Cpp
+BasedOnStyle: Chromium
+IndentWidth: 4
\ No newline at end of file
diff --git a/port/linux/.vscode/c_cpp_properties.json b/port/linux/.vscode/c_cpp_properties.json
index 8047c5722..ee4145e3b 100644
--- a/port/linux/.vscode/c_cpp_properties.json
+++ b/port/linux/.vscode/c_cpp_properties.json
@@ -6,6 +6,7 @@
"${workspaceFolder}/**",
"${workspaceFolder}/package/pikascript/pikascript-api/**",
"${workspaceFolder}/package/pikascript/pikascript-core/**",
+ "${workspaceFolder}/package/pikascript/pikascript-lib/PikaStdDevice",
"${workspaceFolder}/config/**",
"${workspaceFolder}/test/**",
"/usr/include/lua5.3"
diff --git a/port/linux/.vscode/launch.json b/port/linux/.vscode/launch.json
index 3af65c070..39689438c 100644
--- a/port/linux/.vscode/launch.json
+++ b/port/linux/.vscode/launch.json
@@ -11,7 +11,7 @@
"program": "${workspaceFolder}/build/test/pikascript_test",
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
- "--gtest_filter=gc.circle"
+ "--gtest_filter=event.remove_regist"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
diff --git a/port/linux/.vscode/settings.json b/port/linux/.vscode/settings.json
index 1185b90df..7b152dd60 100644
--- a/port/linux/.vscode/settings.json
+++ b/port/linux/.vscode/settings.json
@@ -1,5 +1,8 @@
{
"C_Cpp.clang_format_style": "{ BasedOnStyle: Chromium, IndentWidth: 4}",
+ "C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json",
+ "editor.defaultFormatter": "xaver.clang-format",
+ "C_Cpp.intelliSenseEngine": "disabled",
"files.associations": {
"*.rs": "rust",
"pikastdlib_sysobj.h": "c",
@@ -118,4 +121,7 @@
"assert.h": "c"
},
"python.formatting.provider": "autopep8",
+ "clangd.arguments": [
+ "-compile-commands-dir=build"
+ ]
}
\ No newline at end of file
diff --git a/port/linux/CMakeLists.txt b/port/linux/CMakeLists.txt
index bf20b5ccd..2a1d6719b 100644
--- a/port/linux/CMakeLists.txt
+++ b/port/linux/CMakeLists.txt
@@ -5,6 +5,7 @@ IF(PIKA_CONFIG_ENABLE)
ADD_DEFINITIONS(-DPIKA_CONFIG_ENABLE)
ENDIF(PIKA_CONFIG_ENABLE)
ADD_DEFINITIONS(-DUSE_GOOGLE_TEST=1)
+set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
# support lto
@@ -21,6 +22,7 @@ SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs
include_directories(package/pikascript/pikascript-core)
include_directories(package/pikascript/pikascript-api)
include_directories(package/pikascript/pikascript-lib/PikaNN/TinyMaix/include)
+include_directories(package/pikascript/pikascript-lib/PikaStdDevice)
include_directories(test)
INCLUDE_DIRECTORIES(/usr/include/lua5.3)
diff --git a/port/linux/config/pika_config_default.h b/port/linux/config/pika_config_default.h
index bff8f482c..c460618fb 100644
--- a/port/linux/config/pika_config_default.h
+++ b/port/linux/config/pika_config_default.h
@@ -6,4 +6,4 @@
#define PIKA_INSTRUCT_HOOK_ENABLE 1
#define PIKA_INSTRUCT_HOOK_PERIOD 1
#define PIKA_SHELL_FILTER_ENABLE 1
-#define PIKA_GC_MARK_SWEIP_ENABLE 1
\ No newline at end of file
+#define PIKA_GC_MARK_SWEEP_ENABLE 1
\ No newline at end of file
diff --git a/port/linux/package/pikascript/main.py b/port/linux/package/pikascript/main.py
index a200a657c..8ca50f3a8 100644
--- a/port/linux/package/pikascript/main.py
+++ b/port/linux/package/pikascript/main.py
@@ -5,7 +5,7 @@ import GTestTask, TempDevTest
import cb_test
import configparser, network
import test_module1, test_cmodule, test_module4, import_test
-import hashlib, hmac, aes, base64, time, gc
+import hashlib, hmac, aes, base64, time
import _thread, weakref
mem = PikaStdLib.MemChecker()
diff --git a/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c b/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c
index 94752a5c1..f73c8e56d 100644
--- a/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c
+++ b/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c
@@ -1,5 +1,6 @@
#include "_thread.h"
#include "PikaVM.h"
+#include "TinyObj.h"
typedef struct pika_thread_info {
Arg* function;
@@ -22,7 +23,7 @@ static void _thread_func(void* arg) {
}
pika_debug("thread start");
pika_GIL_ENTER();
- PikaObj* ctx = New_PikaObj();
+ PikaObj* ctx = New_TinyObj(NULL);
pika_thread_info* info = (pika_thread_info*)arg;
obj_setArg(ctx, "args", info->args);
obj_setArg(ctx, "thread", info->function);
diff --git a/src/PikaCompiler.c b/src/PikaCompiler.c
index 89b7588a8..a446f61c0 100644
--- a/src/PikaCompiler.c
+++ b/src/PikaCompiler.c
@@ -219,7 +219,7 @@ PIKA_RES pikaCompileFile(char* input_file_name) {
}
LibObj* New_LibObj(Args* args) {
- LibObj* self = New_TinyObj(NULL);
+ LibObj* self = New_PikaObj(NULL);
return self;
}
@@ -615,7 +615,7 @@ static PIKA_RES __Maker_compileModuleWithInfo(PikaMaker* self,
}
PikaMaker* New_PikaMaker(void) {
- PikaMaker* self = New_TinyObj(NULL);
+ PikaMaker* self = New_PikaObj(NULL);
obj_setStr(self, "pwd", "");
obj_setInt(self, "err", 0);
LibObj* lib = New_LibObj(NULL);
diff --git a/src/PikaObj.c b/src/PikaObj.c
index df1a0ac4d..897f002a6 100644
--- a/src/PikaObj.c
+++ b/src/PikaObj.c
@@ -31,6 +31,7 @@
#include "BaseObj.h"
#include "PikaCompiler.h"
#include "PikaPlatform.h"
+#include "dataArg.h"
#include "dataArgs.h"
#include "dataMemory.h"
#include "dataQueue.h"
@@ -41,7 +42,9 @@ extern volatile VMSignal g_PikaVMSignal;
static volatile PikaObjState g_PikaObjState = {
.helpModulesCmodule = NULL,
.inRootObj = PIKA_FALSE,
- .gcChain = NULL,
+#if PIKA_GC_MARK_SWEEP_ENABLE
+ .gcRoot = NULL,
+#endif
};
static enum shellCTRL __obj_shellLineHandler_REPL(PikaObj* self,
@@ -118,9 +121,9 @@ static int32_t obj_deinit_no_del(PikaObj* self) {
pikaGC_remove(self);
/* free the pointer */
pikaFree(self, sizeof(PikaObj));
- self = NULL;
if (self == (PikaObj*)__pikaMain) {
__pikaMain = NULL;
+ pikaGC_markSweep();
}
return 0;
}
@@ -307,10 +310,10 @@ size_t obj_loadBytes(PikaObj* self, char* argPath, uint8_t* out_buff) {
return size_mem;
}
-static PIKA_RES __obj_setArg(PikaObj* self,
- char* argPath,
- Arg* arg,
- uint8_t is_copy) {
+static PIKA_RES _obj_setArg(PikaObj* self,
+ char* argPath,
+ Arg* arg,
+ uint8_t is_copy) {
/* setArg would copy arg */
PikaObj* obj = obj_getHostObj(self, argPath);
if (NULL == obj) {
@@ -325,16 +328,22 @@ static PIKA_RES __obj_setArg(PikaObj* self,
newArg = arg;
}
newArg = arg_setName(newArg, argName);
+#if PIKA_GC_MARK_SWEEP_ENABLE
+ if (arg_isObject(newArg)) {
+ /* enable mark sweep to collect this object */
+ obj_clearFlag(arg_getPtr(newArg), OBJ_FLAG_GC_ROOT);
+ }
+#endif
args_setArg(obj->list, newArg);
return PIKA_RES_OK;
}
PIKA_RES obj_setArg(PikaObj* self, char* argPath, Arg* arg) {
- return __obj_setArg(self, argPath, arg, 1);
+ return _obj_setArg(self, argPath, arg, 1);
};
PIKA_RES obj_setArg_noCopy(PikaObj* self, char* argPath, Arg* arg) {
- return __obj_setArg(self, argPath, arg, 0);
+ return _obj_setArg(self, argPath, arg, 0);
}
void* obj_getPtr(PikaObj* self, char* argPath) {
@@ -370,10 +379,10 @@ char* obj_getStr(PikaObj* self, char* argPath) {
PikaObj* obj_newObjFromConstructor(PikaObj* context,
char* name,
NewFun constructor) {
- PikaObj* thisClass = constructor(NULL);
- thisClass->constructor = constructor;
- thisClass->refcnt = 0;
- return thisClass;
+ PikaObj* self = constructor(NULL);
+ self->constructor = constructor;
+ self->refcnt = 1;
+ return self;
}
Arg* _obj_getProp(PikaObj* obj, char* name) {
@@ -488,7 +497,6 @@ PikaObj* removeMethodInfo(PikaObj* thisClass) {
PikaObj* newNormalObj(NewFun newObjFun) {
PikaObj* thisClass = obj_newObjFromConstructor(NULL, "", newObjFun);
- obj_refcntInc(thisClass);
obj_setFlag(thisClass, OBJ_FLAG_ALREADY_INIT);
return removeMethodInfo(thisClass);
}
@@ -541,6 +549,11 @@ PikaObj* newRootObj(char* name, NewFun newObjFun) {
pika_platform_printf("~ pikascript.com ~\r\n");
pika_platform_printf("~~~~~~~~~~~~~~~~~~~~\r\n");
}
+ if (NULL != __pikaMain) {
+ pika_platform_printf("Error: root object already exists\r\n");
+ pika_platform_panic_handle();
+ return NULL;
+ }
__pikaMain = newObj;
g_PikaObjState.inRootObj = PIKA_FALSE;
return newObj;
@@ -576,10 +589,12 @@ static PikaObj* _obj_initMetaObj(PikaObj* obj, char* name) {
}
thisClass = obj_newObjFromConstructor(obj, name, constructor);
new_obj = removeMethodInfo(thisClass);
- obj_refcntInc(new_obj);
obj_runNativeMethod(new_obj, "__init__", NULL);
args_setPtrWithType(obj->list, name, ARG_TYPE_OBJECT, new_obj);
res = obj_getPtr(obj, name);
+#if PIKA_GC_MARK_SWEEP_ENABLE
+ obj_clearFlag(res, OBJ_FLAG_GC_ROOT);
+#endif
goto exit;
exit:
strsDeinit(&buffs);
@@ -616,9 +631,9 @@ PikaObj* _arg_to_obj(Arg* self, PIKA_BOOL* pIsTemp) {
return NULL;
}
-static PikaObj* __obj_getObjDirect(PikaObj* self,
- char* name,
- PIKA_BOOL* pIsTemp) {
+static PikaObj* _obj_getObjDirect(PikaObj* self,
+ char* name,
+ PIKA_BOOL* pIsTemp) {
*pIsTemp = PIKA_FALSE;
if (NULL == self) {
return NULL;
@@ -671,7 +686,7 @@ static PikaObj* __obj_getObjWithKeepDeepth(PikaObj* self,
PikaObj* obj = self;
for (int32_t i = 0; i < token_num - keepDeepth; i++) {
char* token = strPopFirstToken(&objPath_ptr, '.');
- obj = __obj_getObjDirect(obj, token, pIsTemp);
+ obj = _obj_getObjDirect(obj, token, pIsTemp);
if (obj == NULL) {
goto exit;
}
@@ -1663,19 +1678,9 @@ char* method_getStr(Args* args, char* argName) {
return args_getStr(args, argName);
}
-void pikaGC_append(PikaObj* self) {
- /* gc single chain */
- if (NULL == g_PikaObjState.gcChain) {
- g_PikaObjState.gcChain = self;
- return;
- }
- /* append to head of gc chain */
- self->gcNext = g_PikaObjState.gcChain;
- g_PikaObjState.gcChain = self;
-}
-
+#if PIKA_GC_MARK_SWEEP_ENABLE
PikaObj* pikaGC_getLast(PikaObj* self) {
- PikaObj* obj = g_PikaObjState.gcChain;
+ PikaObj* obj = g_PikaObjState.gcRoot;
PikaObj* last = NULL;
while (NULL != obj) {
if (obj == self) {
@@ -1687,19 +1692,17 @@ PikaObj* pikaGC_getLast(PikaObj* self) {
return NULL;
}
-void pikaGC_remove(PikaObj* self) {
- PikaObj* last = pikaGC_getLast(self);
- if (NULL == last) {
- /* remove head */
- g_PikaObjState.gcChain = self->gcNext;
- return;
+void pikaGC_cleanMark(void) {
+ PikaObj* obj = g_PikaObjState.gcRoot;
+ while (NULL != obj) {
+ obj_clearFlag(obj, OBJ_FLAG_GC_MARKED);
+ obj = obj->gcNext;
}
- last->gcNext = self->gcNext;
}
uint32_t pikaGC_count(void) {
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcChain;
+ PikaObj* obj = g_PikaObjState.gcRoot;
while (NULL != obj) {
count++;
obj = obj->gcNext;
@@ -1707,24 +1710,9 @@ uint32_t pikaGC_count(void) {
return count;
}
-PIKA_BOOL pikaGC_checkAlive(PikaObj* self) {
-#if !PIKA_GC_MARK_SWEEP_ENABLE
- return PIKA_TRUE;
-#else
- PikaObj* obj = g_PikaObjState.gcChain;
- while (NULL != obj) {
- if (obj == self) {
- return PIKA_TRUE;
- }
- obj = obj->gcNext;
- }
- return PIKA_FALSE;
-#endif
-}
-
uint32_t pikaGC_countMarked(void) {
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcChain;
+ PikaObj* obj = g_PikaObjState.gcRoot;
while (NULL != obj) {
if (obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
count++;
@@ -1736,7 +1724,7 @@ uint32_t pikaGC_countMarked(void) {
uint32_t pikaGC_printCanFree(void) {
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcChain;
+ PikaObj* obj = g_PikaObjState.gcRoot;
while (NULL != obj) {
if (!obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
count++;
@@ -1749,10 +1737,10 @@ uint32_t pikaGC_printCanFree(void) {
uint32_t pikaGC_FreeOnce(void) {
pikaGC_markRoot();
- pika_platform_printf("-----\r\n");
- pikaGC_printCanFree();
+ // pika_platform_printf("-----\r\n");
+ // pikaGC_printCanFree();
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcChain;
+ PikaObj* obj = g_PikaObjState.gcRoot;
while (NULL != obj) {
if (!obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
count++;
@@ -1764,14 +1752,6 @@ uint32_t pikaGC_FreeOnce(void) {
return count;
}
-uint32_t pikaGC_markSweep(void) {
- uint32_t count = 0;
- while (pikaGC_FreeOnce() != 0) {
- count++;
- };
- return count;
-}
-
int32_t pikaGC_markHandler(Arg* argEach, Args* context) {
if (arg_isObject(argEach)) {
PikaObj* obj = (PikaObj*)arg_getPtr(argEach);
@@ -1781,6 +1761,9 @@ int32_t pikaGC_markHandler(Arg* argEach, Args* context) {
}
void pikaGC_mark(PikaObj* self) {
+ if (NULL == self) {
+ return;
+ }
if (obj_getFlag(self, OBJ_FLAG_GC_MARKED)) {
return;
}
@@ -1788,28 +1771,89 @@ void pikaGC_mark(PikaObj* self) {
args_foreach(self->list, pikaGC_markHandler, NULL);
}
-void pikaGC_cleanMark(void) {
- PikaObj* obj = g_PikaObjState.gcChain;
- while (NULL != obj) {
- obj_clearFlag(obj, OBJ_FLAG_GC_MARKED);
- obj = obj->gcNext;
+void pikaGC_markRoot() {
+ pikaGC_cleanMark();
+ PikaObj* root = g_PikaObjState.gcRoot;
+ while (NULL != root) {
+ if (obj_getFlag(root, OBJ_FLAG_GC_ROOT)) {
+ pikaGC_mark(root);
+ }
+ root = root->gcNext;
}
}
-void pikaGC_markRoot() {
- pikaGC_cleanMark();
- PikaObj* root = (PikaObj*)__pikaMain;
- pikaGC_mark(root);
+#endif
+
+PIKA_BOOL pikaGC_checkAlive(PikaObj* self) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return PIKA_TRUE;
+#else
+ if (NULL == g_PikaObjState.gcRoot) {
+ return PIKA_TRUE;
+ }
+ PikaObj* obj = g_PikaObjState.gcRoot;
+ while (NULL != obj) {
+ if (obj == self) {
+ return PIKA_TRUE;
+ }
+ obj = obj->gcNext;
+ }
+ return PIKA_FALSE;
+#endif
}
-PikaObj* New_PikaObj(void) {
+uint32_t pikaGC_markSweep(void) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return 0;
+#else
+ uint32_t count = 0;
+ while (pikaGC_FreeOnce() != 0) {
+ count++;
+ };
+ return count;
+#endif
+}
+
+void pikaGC_append(PikaObj* self) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return;
+#else
+ /* gc single chain */
+ if (NULL == g_PikaObjState.gcRoot) {
+ g_PikaObjState.gcRoot = self;
+ return;
+ }
+ /* append to head of gc chain */
+ self->gcNext = g_PikaObjState.gcRoot;
+ g_PikaObjState.gcRoot = self;
+#endif
+}
+
+void pikaGC_remove(PikaObj* self) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return;
+#else
+ PikaObj* last = pikaGC_getLast(self);
+ if (NULL == last) {
+ /* remove head */
+ g_PikaObjState.gcRoot = self->gcNext;
+ return;
+ }
+ last->gcNext = self->gcNext;
+#endif
+}
+
+PikaObj* New_PikaObj(Args* args) {
PikaObj* self = pikaMalloc(sizeof(PikaObj));
/* List */
self->list = New_args(NULL);
self->refcnt = 0;
- self->constructor = NULL;
+ self->constructor = New_PikaObj;
self->flag = 0;
+#if PIKA_GC_MARK_SWEEP_ENABLE
self->gcNext = NULL;
+ obj_setFlag(self, OBJ_FLAG_GC_ROOT);
+#endif
/* append to gc chain */
pikaGC_append(self);
return self;
@@ -1826,10 +1870,13 @@ Arg* arg_setRef(Arg* self, char* name, PikaObj* obj) {
}
int32_t obj_newDirectObj(PikaObj* self, char* objName, NewFun newFunPtr) {
- Arg* new_obj = arg_newDirectObj(newFunPtr);
- new_obj = arg_setName(new_obj, objName);
- arg_setType(new_obj, ARG_TYPE_OBJECT);
- args_setArg(self->list, new_obj);
+ Arg* aNewObj = arg_newDirectObj(newFunPtr);
+ aNewObj = arg_setName(aNewObj, objName);
+ arg_setType(aNewObj, ARG_TYPE_OBJECT);
+#if PIKA_GC_MARK_SWEEP_ENABLE
+ obj_clearFlag(arg_getPtr(aNewObj), OBJ_FLAG_GC_ROOT);
+#endif
+ args_setArg(self->list, aNewObj);
return 0;
}
@@ -1915,7 +1962,7 @@ void obj_printModules(PikaObj* self) {
}
PikaObj* obj_linkLibObj(PikaObj* self, LibObj* library) {
- obj_setPtr(self, "@lib", library);
+ obj_setRef(self, "@lib", library);
return self;
}
@@ -1999,8 +2046,8 @@ void pks_eventListener_registEvent(PikaEventListener* self,
strsDeinit(&buffs);
}
-void pks_eventListener_removeEvent(PikaEventListener* self, uint32_t eventId) {
Args buffs = {0};
+void pks_eventListener_removeEvent(PikaEventListener* self, uint32_t eventId) {
char* event_name =
strsFormat(&buffs, PIKA_SPRINTF_BUFF_SIZE, "%ld", eventId);
obj_removeArg(self, event_name);
diff --git a/src/PikaObj.h b/src/PikaObj.h
index dc9414b81..82a189d5b 100644
--- a/src/PikaObj.h
+++ b/src/PikaObj.h
@@ -79,7 +79,9 @@ typedef struct PikaObj PikaObj;
struct PikaObj {
Args* list;
void* constructor;
+#if PIKA_GC_MARK_SWEEP_ENABLE
PikaObj* gcNext;
+#endif
uint8_t refcnt;
uint8_t flag;
};
@@ -96,16 +98,19 @@ typedef struct PikaObjState PikaObjState;
struct PikaObjState {
Arg* helpModulesCmodule;
PIKA_BOOL inRootObj;
- PikaObj* gcChain;
+#if PIKA_GC_MARK_SWEEP_ENABLE
+ PikaObj* gcRoot;
+#endif
};
-#define OBJ_FLAG_PROXY_GETATTRIBUTE 0x01
-#define OBJ_FLAG_PROXY_GETATTR 0x02
-#define OBJ_FLAG_PROXY_SETATTR 0x04
-#define OBJ_FLAG_ALREADY_INIT 0x08
-#define OBJ_FLAG_RUN_AS 0x16
-#define OBJ_FLAG_GLOBALS 0x32
-#define OBJ_FLAG_GC_MARKED 0x64
+#define OBJ_FLAG_PROXY_GETATTRIBUTE 1
+#define OBJ_FLAG_PROXY_GETATTR 2
+#define OBJ_FLAG_PROXY_SETATTR 4
+#define OBJ_FLAG_ALREADY_INIT 8
+#define OBJ_FLAG_RUN_AS 16
+#define OBJ_FLAG_GLOBALS 32
+#define OBJ_FLAG_GC_MARKED 64
+#define OBJ_FLAG_GC_ROOT 128
#define KEY_UP 0x41
#define KEY_DOWN 0x42
@@ -113,10 +118,12 @@ struct PikaObjState {
#define KEY_LEFT 0x44
static inline uint8_t obj_getFlag(PikaObj* self, uint8_t flag) {
+ pika_assert(self);
return (self->flag & flag) == flag;
}
static inline void obj_setFlag(PikaObj* self, uint8_t flag) {
+ pika_assert(self);
self->flag |= flag;
}
@@ -278,7 +285,8 @@ ByteCodeFrame* methodArg_getBytecodeFrame(Arg* method_arg);
Method methodArg_getPtr(Arg* method_arg);
VMParameters* obj_run(PikaObj* self, char* cmd);
-PikaObj* New_PikaObj(void);
+PikaObj* New_PikaObj(Args* args);
+PikaObj* New_PikaObj_noGC(void);
/* tools */
int64_t fast_atoi(char* src);
diff --git a/src/PikaVM.c b/src/PikaVM.c
index c5d352493..b1e166cd9 100644
--- a/src/PikaVM.c
+++ b/src/PikaVM.c
@@ -31,6 +31,7 @@
#include "PikaObj.h"
#include "PikaParser.h"
#include "PikaPlatform.h"
+#include "dataArg.h"
#include "dataStrs.h"
#if PIKA_MATH_ENABLE
#include
@@ -278,7 +279,7 @@ void pks_vmSignal_setCtrlElear(void) {
/* head declare start */
static uint8_t VMState_getInputArgNum(VMState* vm);
-static VMParameters* __pikaVM_runByteCodeFrameWithState(
+static VMParameters* _pikaVM_runByteCodeFrameWithState(
PikaObj* self,
VMParameters* locals,
VMParameters* globals,
@@ -997,7 +998,7 @@ Arg* _obj_runMethodArgWithState(PikaObj* self,
uintptr_t insturctArray_start = (uintptr_t)instructArray_getByOffset(
&(method_bytecodeFrame->instruct_array), 0);
uint16_t pc = (uintptr_t)fMethod - insturctArray_start;
- locals = __pikaVM_runByteCodeFrameWithState(
+ locals = _pikaVM_runByteCodeFrameWithState(
self, locals, self, method_bytecodeFrame, pc, run_state);
/* get method return */
@@ -1677,8 +1678,8 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
char* data,
Arg* arg_ret_reg) {
Arg* return_arg = NULL;
- VMParameters* sub_locals = NULL;
- VMParameters* sub_locals_init = NULL;
+ VMParameters* subLocals = NULL;
+ VMParameters* subLocalsInit = NULL;
char* run_path = data;
PikaObj* method_host = NULL;
PikaObj* obj_this = NULL;
@@ -1835,10 +1836,10 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
}
/* create sub local scope */
- sub_locals = New_PikaObj();
+ subLocals = New_TinyObj(NULL);
/* load args from vmState to sub_local->list */
- n_used += VMState_loadArgsFromMethodArg(vm, obj_this, sub_locals->list,
+ n_used += VMState_loadArgsFromMethodArg(vm, obj_this, subLocals->list,
method, run_path, n_used);
/* load args failed */
@@ -1847,7 +1848,7 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
}
/* run method arg */
- return_arg = obj_runMethodArgWithState_noalloc(obj_this, sub_locals, method,
+ return_arg = obj_runMethodArgWithState_noalloc(obj_this, subLocals, method,
&sub_run_state, arg_ret_reg);
if (skip_init) {
if (arg_getType(return_arg) == ARG_TYPE_OBJECT_NEW) {
@@ -1869,24 +1870,24 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
PikaObj* new_obj = arg_getPtr(return_arg);
Arg* method_arg =
obj_getMethodArg_noalloc(new_obj, "__init__", &arg_reg1);
- sub_locals_init = New_PikaObj();
+ subLocalsInit = New_TinyObj(NULL);
Arg* return_arg_init = NULL;
if (NULL == method_arg) {
goto init_exit;
}
- VMState_loadArgsFromMethodArg(vm, new_obj, sub_locals_init->list,
+ VMState_loadArgsFromMethodArg(vm, new_obj, subLocalsInit->list,
method_arg, "__init__", n_used);
/* load args failed */
if (vm->error_code != 0) {
goto init_exit;
}
- return_arg_init = obj_runMethodArgWithState(new_obj, sub_locals_init,
+ return_arg_init = obj_runMethodArgWithState(new_obj, subLocalsInit,
method_arg, &sub_run_state);
init_exit:
if (NULL != return_arg_init) {
arg_deinit(return_arg_init);
}
- obj_deinit(sub_locals_init);
+ obj_deinit(subLocalsInit);
if (NULL != method_arg) {
arg_deinit(method_arg);
}
@@ -1909,8 +1910,8 @@ exit:
if (NULL != method) {
arg_deinit(method);
}
- if (NULL != sub_locals) {
- obj_deinit(sub_locals);
+ if (NULL != subLocals) {
+ obj_deinit(subLocals);
}
if (NULL != host_arg) {
arg_deinit(host_arg);
@@ -2042,85 +2043,84 @@ static PIKA_BOOL _proxy_setattr(PikaObj* self, char* name, Arg* arg) {
static Arg* VM_instruction_handler_OUT(PikaObj* self,
VMState* vm,
char* data,
- Arg* arg_ret_reg) {
- char* arg_path = data;
- char* arg_name = strPointToLastToken(arg_path, '.');
- PikaObj* host_obj = NULL;
- PIKA_BOOL is_temp = PIKA_FALSE;
- arg_newReg(outArg_reg, PIKA_ARG_BUFF_SIZE);
- Arg* out_arg = stack_popArg(&vm->stack, &outArg_reg);
- // Arg* outArg = stack_popArg_alloc(&vm->stack);
- if (NULL == out_arg) {
+ Arg* aRetReg) {
+ char* sArgPath = data;
+ char* sArgName = strPointToLastToken(sArgPath, '.');
+ PikaObj* oHost = NULL;
+ PIKA_BOOL bIsTemp = PIKA_FALSE;
+ arg_newReg(aOutReg, PIKA_ARG_BUFF_SIZE);
+ Arg* aOut = stack_popArg(&vm->stack, &aOutReg);
+ if (NULL == aOut) {
return NULL;
}
- ArgType outArg_type = arg_getType(out_arg);
+ ArgType eOutArgType = arg_getType(aOut);
if (VMState_getInvokeDeepthNow(vm) > 0) {
/* in block, is a kw arg */
- arg_setIsKeyword(out_arg, PIKA_TRUE);
- arg_setName(out_arg, arg_path);
- Arg* res = arg_copy_noalloc(out_arg, arg_ret_reg);
- arg_deinit(out_arg);
+ arg_setIsKeyword(aOut, PIKA_TRUE);
+ arg_setName(aOut, sArgPath);
+ Arg* res = arg_copy_noalloc(aOut, aRetReg);
+ arg_deinit(aOut);
return res;
}
- if (_checkLReg(arg_path)) {
- uint8_t index = _getLRegIndex(arg_path);
- if (argType_isObject(outArg_type)) {
- PikaObj* obj = arg_getPtr(out_arg);
+ if (_checkLReg(sArgPath)) {
+ uint8_t index = _getLRegIndex(sArgPath);
+ if (argType_isObject(eOutArgType)) {
+ PikaObj* obj = arg_getPtr(aOut);
VMState_setLReg(vm, index, obj);
- arg_deinit(out_arg);
+ arg_deinit(aOut);
}
return NULL;
}
- PikaObj* context = vm->locals;
+ PikaObj* oContext = vm->locals;
/* match global_list */
if (obj_getFlag(vm->locals, OBJ_FLAG_GLOBALS)) {
- char* global_list = args_getStr(vm->locals->list, "@g");
+ char* sGlobalList = args_getStr(vm->locals->list, "@g");
/* use a arg as buff */
- Arg* global_list_arg = arg_newStr(global_list);
- char* global_list_buff = arg_getStr(global_list_arg);
+ Arg* aGlobalList = arg_newStr(sGlobalList);
+ char* sGlobalListBuff = arg_getStr(aGlobalList);
/* for each arg arg in global_list */
- for (int i = 0; i < strCountSign(global_list, ',') + 1; i++) {
- char* global_arg = strPopFirstToken(&global_list_buff, ',');
+ for (int i = 0; i < strCountSign(sGlobalList, ',') + 1; i++) {
+ char* sGlobalArg = strPopFirstToken(&sGlobalListBuff, ',');
/* matched global arg, context set to global */
- if (strEqu(global_arg, arg_path)) {
- context = vm->globals;
+ if (strEqu(sGlobalArg, sArgPath)) {
+ oContext = vm->globals;
}
}
- arg_deinit(global_list_arg);
+ arg_deinit(aGlobalList);
}
/* use RunAs object */
if (obj_getFlag(vm->locals, OBJ_FLAG_RUN_AS)) {
- context = args_getPtr(vm->locals->list, "@r");
+ oContext = args_getPtr(vm->locals->list, "@r");
}
/* set free object to nomal object */
- if (ARG_TYPE_OBJECT_NEW == outArg_type) {
- pika_assert(NULL != out_arg);
- arg_setType(out_arg, ARG_TYPE_OBJECT);
+ if (ARG_TYPE_OBJECT_NEW == eOutArgType) {
+ pika_assert(NULL != aOut);
+ arg_setType(aOut, ARG_TYPE_OBJECT);
}
/* ouput arg to context */
- if (arg_path == arg_name) {
- obj_setArg_noCopy(context, arg_path, out_arg);
+ if (sArgPath == sArgName) {
+ obj_setArg_noCopy(oContext, sArgPath, aOut);
return NULL;
}
- host_obj = obj_getHostObjWithIsTemp(context, arg_path, &is_temp);
+ oHost = obj_getHostObjWithIsTemp(oContext, sArgPath, &bIsTemp);
- if (NULL == host_obj) {
- host_obj = obj_getHostObjWithIsTemp(vm->globals, arg_path, &is_temp);
+ if (NULL == oHost) {
+ oHost = obj_getHostObjWithIsTemp(vm->globals, sArgPath, &bIsTemp);
}
- if (host_obj != NULL) {
- if (_proxy_setattr(host_obj, arg_name, out_arg)) {
+ if (oHost != NULL) {
+ if (_proxy_setattr(oHost, sArgName, aOut)) {
return NULL;
}
- obj_setArg_noCopy(host_obj, arg_name, out_arg);
+ obj_setArg_noCopy(oHost, sArgName, aOut);
return NULL;
}
- obj_setArg_noCopy(context, arg_path, out_arg);
+ obj_setArg_noCopy(oContext, sArgPath, aOut);
return NULL;
}
@@ -3242,8 +3242,8 @@ VMParameters* _do_pikaVM_runByteCode(PikaObj* self,
/* run byteCode */
- globals = __pikaVM_runByteCodeFrameWithState(
- self, locals, globals, bytecode_frame_p, 0, run_state);
+ globals = _pikaVM_runByteCodeFrameWithState(self, locals, globals,
+ bytecode_frame_p, 0, run_state);
goto exit;
exit:
if (!is_use_heap_bytecode) {
@@ -3622,7 +3622,7 @@ void VMState_solveUnusedStack(VMState* vm) {
}
}
-static VMParameters* __pikaVM_runByteCodeFrameWithState(
+static VMParameters* _pikaVM_runByteCodeFrameWithState(
PikaObj* self,
VMParameters* locals,
VMParameters* globals,
@@ -3716,8 +3716,8 @@ VMParameters* pikaVM_runByteCodeFrame(PikaObj* self,
ByteCodeFrame* byteCode_frame) {
RunState run_state = {.try_state = TRY_STATE_NONE,
.try_result = TRY_RESULT_NONE};
- return __pikaVM_runByteCodeFrameWithState(self, self, self, byteCode_frame,
- 0, &run_state);
+ return _pikaVM_runByteCodeFrameWithState(self, self, self, byteCode_frame,
+ 0, &run_state);
}
void constPool_printAsArray(ConstPool* self) {
diff --git a/src/TinyObj.c b/src/TinyObj.c
index 9b15bc5b5..50ff558f6 100644
--- a/src/TinyObj.c
+++ b/src/TinyObj.c
@@ -32,6 +32,7 @@ const NativeProperty TinyObjNativeProp = {.super = NULL,
.methodGroupCount = 0};
PikaObj* New_TinyObj(Args* args) {
- PikaObj* self = New_PikaObj();
+ PikaObj* self = New_PikaObj(NULL);
+ self->constructor = New_TinyObj;
return self;
}
diff --git a/src/dataArgs.c b/src/dataArgs.c
index 0979ca24c..9fbfce8d7 100644
--- a/src/dataArgs.c
+++ b/src/dataArgs.c
@@ -78,9 +78,12 @@ PIKA_RES args_setPtr(Args* self, char* name, void* argPointer) {
PIKA_RES args_setRef(Args* self, char* name, void* argPointer) {
PIKA_RES errCode = PIKA_RES_OK;
- Arg* argNew = New_arg(NULL);
- argNew = arg_setRef(argNew, name, argPointer);
- args_setArg(self, argNew);
+ Arg* aNewRef = New_arg(NULL);
+ aNewRef = arg_setRef(aNewRef, name, argPointer);
+#if PIKA_GC_MARK_SWEEP_ENABLE
+ obj_clearFlag(arg_getPtr(aNewRef), OBJ_FLAG_GC_ROOT);
+#endif
+ args_setArg(self, aNewRef);
return errCode;
}
@@ -311,7 +314,7 @@ int32_t args_isArgExist(Args* self, char* name) {
return 0;
}
-PIKA_RES __updateArg(Args* self, Arg* argNew) {
+PIKA_RES _updateArg(Args* self, Arg* argNew) {
pika_assert(NULL != self);
pika_assert(NULL != argNew);
LinkNode* nodeToUpdate = NULL;
@@ -361,7 +364,7 @@ exit:
PIKA_RES args_setArg(Args* self, Arg* arg) {
pika_assert(NULL != self);
pika_assert(NULL != arg);
- if (PIKA_RES_OK == __updateArg(self, arg)) {
+ if (PIKA_RES_OK == _updateArg(self, arg)) {
return PIKA_RES_OK;
}
args_pushArg(self, arg);
diff --git a/src/dataQueueObj.c b/src/dataQueueObj.c
index f42626d71..f963e8d9c 100644
--- a/src/dataQueueObj.c
+++ b/src/dataQueueObj.c
@@ -29,7 +29,7 @@
#include "BaseObj.h"
#include "dataQueue.h"
QueueObj* New_queueObj(void) {
- PikaObj* self = New_PikaObj();
+ PikaObj* self = New_PikaObj(NULL);
queueObj_init(self);
return self;
}
diff --git a/src/pika_config_valid.h b/src/pika_config_valid.h
index 8d10fb6ce..dc548d762 100644
--- a/src/pika_config_valid.h
+++ b/src/pika_config_valid.h
@@ -81,6 +81,10 @@
#define PIKA_EVENT_THREAD_ENABLE 0
#endif
+ #ifndef PIKA_GC_MARK_SWEEP_ENABLE
+ #define PIKA_GC_MARK_SWEEP_ENABLE 0
+ #endif
+
#endif
/* default optimize */
diff --git a/test/compile-test.cpp b/test/compile-test.cpp
index 2650701e5..3afcee32c 100644
--- a/test/compile-test.cpp
+++ b/test/compile-test.cpp
@@ -391,7 +391,6 @@ TEST(lib, compile_link_import) {
/* asset */
EXPECT_STREQ(log_buff[0], "test_module_1_hello\r\n");
/* deinit */
- LibObj_deinit(lib);
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -459,7 +458,6 @@ TEST(lib, load_file) {
EXPECT_STREQ(log_buff[1], "test_module_2_hello\r\n");
EXPECT_STREQ(log_buff[0], "test_module_3_hello\r\n");
/* deinit */
- LibObj_deinit(lib);
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
diff --git a/test/event-test.cpp b/test/event-test.cpp
index f4233ea2a..8cb4eacd1 100644
--- a/test/event-test.cpp
+++ b/test/event-test.cpp
@@ -68,7 +68,6 @@ TEST(event, remove_regist) {
EXPECT_EQ(testobj->refcnt, 1);
/* deinit */
obj_deinit(pikaMain);
- obj_deinit(testobj);
pks_eventListener_deinit(&g_pika_device_event_listener);
EXPECT_EQ(pikaMemNow(), 0);
}
diff --git a/test/gc-test.cpp b/test/gc-test.cpp
index afd3e63c2..356585442 100644
--- a/test/gc-test.cpp
+++ b/test/gc-test.cpp
@@ -127,15 +127,19 @@ TEST(gc, heap_failed1) {
"iteri");
/* assert */
EXPECT_STREQ("128\r\n", log_buff[0]);
+#if PIKA_GC_MARK_SWEEP_ENABLE
int cnt = pikaGC_count();
EXPECT_EQ(cnt != 0, 1);
pikaGC_markRoot();
int cnt_marked = pikaGC_countMarked();
EXPECT_EQ(cnt, cnt_marked);
/* deinit */
+#endif
obj_deinit(pikaMain);
+#if PIKA_GC_MARK_SWEEP_ENABLE
cnt = pikaGC_count();
EXPECT_EQ(cnt, 0);
+#endif
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -146,7 +150,18 @@ TEST(gc, circle) {
/* run */
pikaVM_runSingleFile(pikaMain, "test/python/gc/gc_circle.py");
/* assert */
+ /* deinit */
pikaGC_markSweep();
+ obj_deinit(pikaMain);
+ EXPECT_EQ(pikaMemNow(), 0);
+}
+
+TEST(gc, circle2) {
+ /* init */
+ PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
+ /* run */
+ pikaVM_runSingleFile(pikaMain, "test/python/gc/gc_circle2.py");
+ /* assert */
/* deinit */
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
diff --git a/test/parse-test.cpp b/test/parse-test.cpp
index 376c51e27..f7c721c33 100644
--- a/test/parse-test.cpp
+++ b/test/parse-test.cpp
@@ -101,11 +101,9 @@ TEST(parser, method_void) {
Args* buffs = New_strBuff();
char* pikaAsm = Parser_LineToAsm(buffs, line, NULL);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "1 RUN c\n"
- "0 RUN a\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "1 RUN c\n"
+ "0 RUN a\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
@@ -401,13 +399,12 @@ TEST(parser, while_true_if_false_both_exit) {
TEST(parser, multiLine) {
g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
- char* lines =(char *)
- "while true:\n"
- " rgb.flow()\n"
- " if false:\n"
- " a=3\n"
- " test.on(add(2,3))\n"
- "\n";
+ char *lines = (char *)"while true:\n"
+ " rgb.flow()\n"
+ " if false:\n"
+ " a=3\n"
+ " test.on(add(2,3))\n"
+ "\n";
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
@@ -740,18 +737,16 @@ TEST(parser, def_add) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 DEF add(a,b)\n"
- "0 JMP 1\n"
- "B1\n"
- "1 REF a\n"
- "1 REF b\n"
- "0 OPT +\n"
- "B1\n"
- "0 RET \n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 DEF add(a,b)\n"
+ "0 JMP 1\n"
+ "B1\n"
+ "1 REF a\n"
+ "1 REF b\n"
+ "0 OPT +\n"
+ "B1\n"
+ "0 RET \n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -766,19 +761,17 @@ TEST(parser, def_add_return) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 DEF add(a,b)\n"
- "0 JMP 1\n"
- "B1\n"
- "1 REF a\n"
- "1 REF b\n"
- "0 OPT +\n"
- "0 RET \n"
- "B1\n"
- "0 RET \n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 DEF add(a,b)\n"
+ "0 JMP 1\n"
+ "B1\n"
+ "1 REF a\n"
+ "1 REF b\n"
+ "0 OPT +\n"
+ "0 RET \n"
+ "B1\n"
+ "0 RET \n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -794,24 +787,22 @@ TEST(parser, def_while_return) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 DEF add(a,b)\n"
- "0 JMP 1\n"
- "B1\n"
- "0 REF True\n"
- "0 JEZ 2\n"
- "B2\n"
- "1 REF a\n"
- "1 REF b\n"
- "0 OPT +\n"
- "0 RET \n"
- "B1\n"
- "0 JMP -1\n"
- "B1\n"
- "0 RET \n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 DEF add(a,b)\n"
+ "0 JMP 1\n"
+ "B1\n"
+ "0 REF True\n"
+ "0 JEZ 2\n"
+ "B2\n"
+ "1 REF a\n"
+ "1 REF b\n"
+ "0 OPT +\n"
+ "0 RET \n"
+ "B1\n"
+ "0 JMP -1\n"
+ "B1\n"
+ "0 RET \n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -827,21 +818,19 @@ TEST(parser, def_while_return_void) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 DEF add(a,b)\n"
- "0 JMP 1\n"
- "B1\n"
- "0 REF True\n"
- "0 JEZ 2\n"
- "B2\n"
- "0 RET \n"
- "B1\n"
- "0 JMP -1\n"
- "B1\n"
- "0 RET \n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 DEF add(a,b)\n"
+ "0 JMP 1\n"
+ "B1\n"
+ "0 REF True\n"
+ "0 JEZ 2\n"
+ "B2\n"
+ "0 RET \n"
+ "B1\n"
+ "0 JMP -1\n"
+ "B1\n"
+ "0 RET \n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -857,13 +846,11 @@ TEST(parser, signed_num) {
printf("%s", tokens_print);
EXPECT_STREQ(tokens_print, "{sym}a{opt}={opt}-{lit}1\n");
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "1 NUM 1\n"
- "0 OPT -\n"
- "0 OUT a\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "1 NUM 1\n"
+ "0 OPT -\n"
+ "0 OUT a\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -875,15 +862,13 @@ TEST(parser, comp_signed_num) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "1 REF a\n"
- "2 NUM 1\n"
- "1 OPT -\n"
- "0 OPT >\n"
- "0 JEZ 1\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "1 REF a\n"
+ "2 NUM 1\n"
+ "1 OPT -\n"
+ "0 OPT >\n"
+ "0 JEZ 1\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -1134,66 +1119,65 @@ TEST(parser, self_inc) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "1 REF a\n"
- "3 NUM 1\n"
- "2 OPT -\n"
- "1 RUN \n"
- "0 OPT +\n"
- "0 OUT a\n"
- "B0\n"
- "1 REF a\n"
- "3 NUM 1\n"
- "2 OPT -\n"
- "1 RUN \n"
- "0 OPT -\n"
- "0 OUT a\n"
- "B0\n"
- "1 REF a\n"
- "3 NUM 1\n"
- "2 OPT -\n"
- "1 RUN \n"
- "0 OPT *\n"
- "0 OUT a\n"
- "B0\n"
- "1 REF a\n"
- "3 NUM 1\n"
- "2 OPT -\n"
- "1 RUN \n"
- "0 OPT /\n"
- "0 OUT a\n"
- "B0\n"
- "1 REF a\n"
- "2 NUM 1\n"
- "1 OPT -\n"
- "0 OPT **=\n"
- "B0\n"
- "1 REF a\n"
- "2 NUM 1\n"
- "1 OPT -\n"
- "0 OPT //=\n"
- "B0\n"
- "1 REF a\n"
- "2 NUM 1\n"
- "1 OPT -\n"
- "0 OPT >=\n"
- "B0\n"
- "1 REF a\n"
- "2 NUM 1\n"
- "1 OPT -\n"
- "0 OPT <=\n"
- "B0\n"
- "1 REF a\n"
- "2 NUM 1\n"
- "1 OPT -\n"
- "0 OPT !=\n"
- "B0\n"
- "1 REF a\n"
- "2 NUM 1\n"
- "1 OPT -\n"
- "0 OPT %=\n"
- "B0\n");
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "1 REF a\n"
+ "3 NUM 1\n"
+ "2 OPT -\n"
+ "1 RUN \n"
+ "0 OPT +\n"
+ "0 OUT a\n"
+ "B0\n"
+ "1 REF a\n"
+ "3 NUM 1\n"
+ "2 OPT -\n"
+ "1 RUN \n"
+ "0 OPT -\n"
+ "0 OUT a\n"
+ "B0\n"
+ "1 REF a\n"
+ "3 NUM 1\n"
+ "2 OPT -\n"
+ "1 RUN \n"
+ "0 OPT *\n"
+ "0 OUT a\n"
+ "B0\n"
+ "1 REF a\n"
+ "3 NUM 1\n"
+ "2 OPT -\n"
+ "1 RUN \n"
+ "0 OPT /\n"
+ "0 OUT a\n"
+ "B0\n"
+ "1 REF a\n"
+ "2 NUM 1\n"
+ "1 OPT -\n"
+ "0 OPT **=\n"
+ "B0\n"
+ "1 REF a\n"
+ "2 NUM 1\n"
+ "1 OPT -\n"
+ "0 OPT //=\n"
+ "B0\n"
+ "1 REF a\n"
+ "2 NUM 1\n"
+ "1 OPT -\n"
+ "0 OPT >=\n"
+ "B0\n"
+ "1 REF a\n"
+ "2 NUM 1\n"
+ "1 OPT -\n"
+ "0 OPT <=\n"
+ "B0\n"
+ "1 REF a\n"
+ "2 NUM 1\n"
+ "1 OPT -\n"
+ "0 OPT !=\n"
+ "B0\n"
+ "1 REF a\n"
+ "2 NUM 1\n"
+ "1 OPT -\n"
+ "0 OPT %=\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -1223,18 +1207,17 @@ TEST(parser, or_) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "3 REF a\n"
- "3 NUM 1\n"
- "2 OPT >\n"
- "1 RUN \n"
- "3 REF b\n"
- "3 NUM 3\n"
- "2 OPT <=\n"
- "1 RUN \n"
- "0 OPT or \n"
- "B0\n");
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "3 REF a\n"
+ "3 NUM 1\n"
+ "2 OPT >\n"
+ "1 RUN \n"
+ "3 REF b\n"
+ "3 NUM 3\n"
+ "2 OPT <=\n"
+ "1 RUN \n"
+ "0 OPT or \n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -1249,23 +1232,21 @@ TEST(parser, _or_) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "3 NUM 1\n"
- "3 NUM 2\n"
- "2 OPT >\n"
- "1 RUN \n"
- "3 NUM 2\n"
- "3 NUM 1\n"
- "2 OPT >\n"
- "1 RUN \n"
- "0 OPT and \n"
- "0 JEZ 1\n"
- "B1\n"
- "0 NUM 1\n"
- "0 OUT b\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "3 NUM 1\n"
+ "3 NUM 2\n"
+ "2 OPT >\n"
+ "1 RUN \n"
+ "3 NUM 2\n"
+ "3 NUM 1\n"
+ "2 OPT >\n"
+ "1 RUN \n"
+ "0 OPT and \n"
+ "0 JEZ 1\n"
+ "B1\n"
+ "0 NUM 1\n"
+ "0 OUT b\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -1277,11 +1258,10 @@ TEST(parser, annotation) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 REF t\n"
- "0 OUT a\n"
- "B0\n");
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 REF t\n"
+ "0 OUT a\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -1295,17 +1275,15 @@ TEST(parser, annotation_block) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 REF True\n"
- "0 JEZ 2\n"
- "B1\n"
- "0 NUM 1\n"
- "0 OUT a\n"
- "B0\n"
- "0 JMP -1\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 REF True\n"
+ "0 JEZ 2\n"
+ "B1\n"
+ "0 NUM 1\n"
+ "0 OUT a\n"
+ "B0\n"
+ "0 JMP -1\n"
+ "B0\n");
lines =
"while True:\n"
" a = 1\n"
@@ -1313,17 +1291,15 @@ TEST(parser, annotation_block) {
printf("%s", lines);
pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 REF True\n"
- "0 JEZ 2\n"
- "B1\n"
- "0 NUM 1\n"
- "0 OUT a\n"
- "B0\n"
- "0 JMP -1\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 REF True\n"
+ "0 JEZ 2\n"
+ "B1\n"
+ "0 NUM 1\n"
+ "0 OUT a\n"
+ "B0\n"
+ "0 JMP -1\n"
+ "B0\n");
lines =
"while True:\n"
" a = 1\n"
@@ -1332,20 +1308,18 @@ TEST(parser, annotation_block) {
printf("%s", lines);
pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 REF True\n"
- "0 JEZ 2\n"
- "B1\n"
- "0 NUM 1\n"
- "0 OUT a\n"
- "B1\n"
- "0 NUM 2\n"
- "0 OUT b\n"
- "B0\n"
- "0 JMP -1\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 REF True\n"
+ "0 JEZ 2\n"
+ "B1\n"
+ "0 NUM 1\n"
+ "0 OUT a\n"
+ "B1\n"
+ "0 NUM 2\n"
+ "0 OUT b\n"
+ "B0\n"
+ "0 JMP -1\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -1370,53 +1344,51 @@ TEST(parser, if_elif_else) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "1 REF a\n"
- "1 NUM 1\n"
- "0 OPT >\n"
- "0 JEZ 1\n"
- "B1\n"
- "0 NUM 1\n"
- "0 OUT b\n"
- "B0\n"
- "0 NEL 1\n"
- "1 REF a\n"
- "1 NUM 2\n"
- "0 OPT >\n"
- "0 JEZ 1\n"
- "B1\n"
- "0 NUM 2\n"
- "0 OUT b\n"
- "B1\n"
- "1 REF a\n"
- "1 NUM 1\n"
- "0 OPT >\n"
- "0 JEZ 1\n"
- "B2\n"
- "0 NUM 1\n"
- "0 OUT b\n"
- "B1\n"
- "0 NEL 1\n"
- "1 REF a\n"
- "1 NUM 2\n"
- "0 OPT >\n"
- "0 JEZ 1\n"
- "B2\n"
- "0 NUM 2\n"
- "0 OUT b\n"
- "B1\n"
- "0 NEL 1\n"
- "B2\n"
- "0 NUM 3\n"
- "0 OUT b\n"
- "B0\n"
- "0 NEL 1\n"
- "B1\n"
- "0 NUM 3\n"
- "0 OUT b\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "1 REF a\n"
+ "1 NUM 1\n"
+ "0 OPT >\n"
+ "0 JEZ 1\n"
+ "B1\n"
+ "0 NUM 1\n"
+ "0 OUT b\n"
+ "B0\n"
+ "0 NEL 1\n"
+ "1 REF a\n"
+ "1 NUM 2\n"
+ "0 OPT >\n"
+ "0 JEZ 1\n"
+ "B1\n"
+ "0 NUM 2\n"
+ "0 OUT b\n"
+ "B1\n"
+ "1 REF a\n"
+ "1 NUM 1\n"
+ "0 OPT >\n"
+ "0 JEZ 1\n"
+ "B2\n"
+ "0 NUM 1\n"
+ "0 OUT b\n"
+ "B1\n"
+ "0 NEL 1\n"
+ "1 REF a\n"
+ "1 NUM 2\n"
+ "0 OPT >\n"
+ "0 JEZ 1\n"
+ "B2\n"
+ "0 NUM 2\n"
+ "0 OUT b\n"
+ "B1\n"
+ "0 NEL 1\n"
+ "B2\n"
+ "0 NUM 3\n"
+ "0 OUT b\n"
+ "B0\n"
+ "0 NEL 1\n"
+ "B1\n"
+ "0 NUM 3\n"
+ "0 OUT b\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -1539,50 +1511,48 @@ TEST(parser, for_for_range) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "0 NUM 0\n"
- "0 OUT a\n"
- "B0\n"
- "2 NUM 0\n"
- "2 NUM 10\n"
- "1 RUN range\n"
- "0 RUN iter\n"
- "0 OUT $l0\n"
- "B0\n"
- "0 RUN $l0.__next__\n"
- "0 OUT i\n"
- "0 EST i\n"
- "0 JEZ 2\n"
- "B1\n"
- "2 NUM 0\n"
- "2 NUM 3\n"
- "1 RUN range\n"
- "0 RUN iter\n"
- "0 OUT $l1\n"
- "B1\n"
- "0 RUN $l1.__next__\n"
- "0 OUT k\n"
- "0 EST k\n"
- "0 JEZ 2\n"
- "B2\n"
- "1 REF k\n"
- "0 RUN print\n"
- "B2\n"
- "1 REF a\n"
- "1 REF k\n"
- "0 OPT +\n"
- "0 OUT a\n"
- "B1\n"
- "0 JMP -1\n"
- "B1\n"
- "0 DEL $l1\n"
- "B0\n"
- "0 JMP -1\n"
- "B0\n"
- "0 DEL $l0\n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 NUM 0\n"
+ "0 OUT a\n"
+ "B0\n"
+ "2 NUM 0\n"
+ "2 NUM 10\n"
+ "1 RUN range\n"
+ "0 RUN iter\n"
+ "0 OUT $l0\n"
+ "B0\n"
+ "0 RUN $l0.__next__\n"
+ "0 OUT i\n"
+ "0 EST i\n"
+ "0 JEZ 2\n"
+ "B1\n"
+ "2 NUM 0\n"
+ "2 NUM 3\n"
+ "1 RUN range\n"
+ "0 RUN iter\n"
+ "0 OUT $l1\n"
+ "B1\n"
+ "0 RUN $l1.__next__\n"
+ "0 OUT k\n"
+ "0 EST k\n"
+ "0 JEZ 2\n"
+ "B2\n"
+ "1 REF k\n"
+ "0 RUN print\n"
+ "B2\n"
+ "1 REF a\n"
+ "1 REF k\n"
+ "0 OPT +\n"
+ "0 OUT a\n"
+ "B1\n"
+ "0 JMP -1\n"
+ "B1\n"
+ "0 DEL $l1\n"
+ "B0\n"
+ "0 JMP -1\n"
+ "B0\n"
+ "0 DEL $l0\n"
+ "B0\n");
ByteCodeFrame bytecode_frame;
byteCodeFrame_init(&bytecode_frame);
@@ -1981,18 +1951,16 @@ TEST(parser, global) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm, (char *)
- "B0\n"
- "0 DEF test_global()\n"
- "0 JMP 1\n"
- "B1\n"
- "0 GLB x\n"
- "B1\n"
- "0 GLB y,z\n"
- "B1\n"
- "0 RET \n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 DEF test_global()\n"
+ "0 JMP 1\n"
+ "B1\n"
+ "0 GLB x\n"
+ "B1\n"
+ "0 GLB y,z\n"
+ "B1\n"
+ "0 RET \n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -2033,25 +2001,23 @@ TEST(parser, class_) {
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm, (char* )
- "B0\n"
- "0 CLS Test()\n"
- "0 JMP 1\n"
- "B1\n"
- "0 RUN TinyObj\n"
- "0 OUT self\n"
- "B1\n"
- "0 RAS self\n"
- "B1\n"
- "0 NUM 1\n"
- "0 OUT x\n"
- "B1\n"
- "0 RAS $origin\n"
- "B1\n"
- "0 NEW self\n"
- "0 RET \n"
- "B0\n"
- );
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "0 CLS Test()\n"
+ "0 JMP 1\n"
+ "B1\n"
+ "0 RUN TinyObj\n"
+ "0 OUT self\n"
+ "B1\n"
+ "0 RAS self\n"
+ "B1\n"
+ "0 NUM 1\n"
+ "0 OUT x\n"
+ "B1\n"
+ "0 RAS $origin\n"
+ "B1\n"
+ "0 NEW self\n"
+ "0 RET \n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -2275,16 +2241,15 @@ TEST(parser, class_def_void_line) {
TEST(parser, multiLine_import) {
g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
- char* lines =(char *)
- "import TEE\n"
- "from EE import C\n"
- "from PikaStdLib import MemChecker as MC\n"
- "while true:\n"
- " rgb.flow()\n"
- " if false:\n"
- " a=3\n"
- " test.on(add(2,3))\n"
- "\n";
+ char *lines = (char *)"import TEE\n"
+ "from EE import C\n"
+ "from PikaStdLib import MemChecker as MC\n"
+ "while true:\n"
+ " rgb.flow()\n"
+ " if false:\n"
+ " a=3\n"
+ " test.on(add(2,3))\n"
+ "\n";
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
@@ -2328,23 +2293,22 @@ TEST(parser, multiLine_import) {
TEST(parser, multiLine_comment) {
g_pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
- char* lines =(char *)
- "'''\n"
- "a = 1\n"
- "'''\n"
- "while true:\n"
- " rgb.flow()\n"
- " ''' \n"
- " a = 1\n"
- " ''' \n"
- " if false:\n"
- " \"\"\" \n"
- " a = 1\n"
- " a = 1\n"
- " \"\"\"\n"
- " a=3\n"
- " test.on(add(2,3))\n"
- "\n";
+ char *lines = (char *)"'''\n"
+ "a = 1\n"
+ "'''\n"
+ "while true:\n"
+ " rgb.flow()\n"
+ " ''' \n"
+ " a = 1\n"
+ " ''' \n"
+ " if false:\n"
+ " \"\"\" \n"
+ " a = 1\n"
+ " a = 1\n"
+ " \"\"\"\n"
+ " a=3\n"
+ " test.on(add(2,3))\n"
+ "\n";
printf("%s", lines);
char* pikaAsm = Parser_linesToAsm(buffs, lines);
printf("%s", pikaAsm);
@@ -2791,16 +2755,15 @@ TEST(parser, str_add1) {
"{sym}msg{opt}={lit}\"device_names[\"{opt}+{sym}str{dvd}({sym}"
"i{dvd}){opt}+{lit}\"]:\"");
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "2 STR device_names[\n"
- "3 REF i\n"
- "2 RUN str\n"
- "1 OPT +\n"
- "1 STR ]:\n"
- "0 OPT +\n"
- "0 OUT msg\n"
- "B0\n");
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "2 STR device_names[\n"
+ "3 REF i\n"
+ "2 RUN str\n"
+ "1 OPT +\n"
+ "1 STR ]:\n"
+ "0 OPT +\n"
+ "0 OUT msg\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
@@ -2818,14 +2781,13 @@ TEST(parser, str_add2) {
"{sym}msg{opt}={lit}\"device_names[\"{opt}+{sym}str{dvd}({sym}"
"i{dvd})");
printf("%s", pikaAsm);
- EXPECT_STREQ(pikaAsm,(char *)
- "B0\n"
- "1 STR device_names[\n"
- "2 REF i\n"
- "1 RUN str\n"
- "0 OPT +\n"
- "0 OUT msg\n"
- "B0\n");
+ EXPECT_STREQ(pikaAsm, (char *)"B0\n"
+ "1 STR device_names[\n"
+ "2 REF i\n"
+ "1 RUN str\n"
+ "0 OPT +\n"
+ "0 OUT msg\n"
+ "B0\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
diff --git a/test/pikaMain-test.cpp b/test/pikaMain-test.cpp
index 3a233058a..a65dde2c8 100644
--- a/test/pikaMain-test.cpp
+++ b/test/pikaMain-test.cpp
@@ -4,8 +4,6 @@ TEST_START
TEST(pikaMain, init) {
g_pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = pikaScriptInit();
- pikaGC_markRoot();
- pikaGC_printCanFree();
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
diff --git a/test/pika_config_gtest.h b/test/pika_config_gtest.h
index 7daa910ff..451c800b6 100644
--- a/test/pika_config_gtest.h
+++ b/test/pika_config_gtest.h
@@ -1,5 +1,2 @@
#define LOG_BUFF_MAX 100
-#define LOG_SIZE 512
-
-void mem_pool_init(void);
-void mem_pool_deinit(void);
\ No newline at end of file
+#define LOG_SIZE 512
\ No newline at end of file
diff --git a/test/python/gc/gc_circle2.py b/test/python/gc/gc_circle2.py
new file mode 100644
index 000000000..46b4dfccd
--- /dev/null
+++ b/test/python/gc/gc_circle2.py
@@ -0,0 +1,9 @@
+class Tree:
+ parent = None
+ child = []
+
+
+a = Tree()
+b = Tree()
+a.child.append(b)
+b.parent = a
diff --git a/test/test_common.h b/test/test_common.h
index bab4a8657..d2b7e2ece 100644
--- a/test/test_common.h
+++ b/test/test_common.h
@@ -3,11 +3,11 @@
extern "C" {
#include
-#include "../package/pikascript/pikascript-lib/PikaStdDevice/pika_hal.h"
-#include "BaseObj.h"
#include "PikaCompiler.h"
#include "PikaMain.h"
#include "PikaMath_Operator.h"
+#include "BaseObj.h"
+#include "pika_hal.h"
#include "PikaParser.h"
#include "PikaStdLib_MemChecker.h"
#include "PikaStdLib_SysObj.h"
From 1a691f60d4c46d07439d16c9d5cb324d6315bd9a Mon Sep 17 00:00:00 2001
From: pikastech
Date: Mon, 6 Mar 2023 11:10:13 +0800
Subject: [PATCH 10/41] fix name
---
src/PikaVM.c | 195 +++++++++++++++++++++++++--------------------------
1 file changed, 97 insertions(+), 98 deletions(-)
diff --git a/src/PikaVM.c b/src/PikaVM.c
index b1e166cd9..da9716035 100644
--- a/src/PikaVM.c
+++ b/src/PikaVM.c
@@ -1676,74 +1676,74 @@ static char* _find_self_name(VMState* vm) {
static Arg* VM_instruction_handler_RUN(PikaObj* self,
VMState* vm,
char* data,
- Arg* arg_ret_reg) {
- Arg* return_arg = NULL;
- VMParameters* subLocals = NULL;
- VMParameters* subLocalsInit = NULL;
- char* run_path = data;
- PikaObj* method_host = NULL;
- PikaObj* obj_this = NULL;
- Arg* method = NULL;
- Arg* host_arg = NULL;
- PIKA_BOOL is_temp = PIKA_FALSE;
- PIKA_BOOL skip_init = PIKA_FALSE;
- char* sys_out;
- int n_used = 0;
+ Arg* aReturnRegistor) {
+ Arg* aReturn = NULL;
+ VMParameters* oSublocals = NULL;
+ VMParameters* oSublocalsInit = NULL;
+ char* sRunPath = data;
+ PikaObj* oMethodHost = NULL;
+ PikaObj* oThis = NULL;
+ Arg* aMethod = NULL;
+ Arg* aHost = NULL;
+ PIKA_BOOL bIsTemp = PIKA_FALSE;
+ PIKA_BOOL bSkipInit = PIKA_FALSE;
+ char* sSysOut;
+ int iNumUsed = 0;
arg_newReg(arg_reg1, 64);
- RunState sub_run_state = {.try_state = vm->run_state->try_state,
- .try_result = TRY_RESULT_NONE};
+ RunState tSubRunState = {.try_state = vm->run_state->try_state,
+ .try_result = TRY_RESULT_NONE};
pika_assert(NULL != vm->run_state);
/* inhert */
if (vm->pc - 2 * (int)instructUnit_getSize() >= 0) {
if (CLS == VMstate_getInstructWithOffset(
vm, -2 * (int)instructUnit_getSize())) {
- skip_init = PIKA_TRUE;
+ bSkipInit = PIKA_TRUE;
}
}
/* tuple or single arg */
- if (NULL == run_path || run_path[0] == 0) {
+ if (NULL == sRunPath || sRunPath[0] == 0) {
if (VMState_getInputArgNum(vm) == 1) {
/* return arg directly */
- return_arg = stack_popArg(&(vm->stack), arg_ret_reg);
+ aReturn = stack_popArg(&(vm->stack), aReturnRegistor);
goto exit;
}
/* create a tuple */
- return_arg = _vm_create_list_or_tuple(self, vm, PIKA_FALSE);
+ aReturn = _vm_create_list_or_tuple(self, vm, PIKA_FALSE);
goto exit;
}
#if !PIKA_NANO_ENABLE
/* support for super() */
- if (strEqu(run_path, "super")) {
- run_path = _find_super_class_name(vm);
+ if (strEqu(sRunPath, "super")) {
+ sRunPath = _find_super_class_name(vm);
vm->in_super = PIKA_TRUE;
vm->super_invoke_deepth = VMState_getInvokeDeepthNow(vm);
- skip_init = PIKA_TRUE;
+ bSkipInit = PIKA_TRUE;
}
#endif
/* return tiny obj */
- if (strEqu(run_path, "TinyObj")) {
- return_arg = arg_newMetaObj(New_TinyObj);
+ if (strEqu(sRunPath, "TinyObj")) {
+ aReturn = arg_newMetaObj(New_TinyObj);
goto exit;
}
- if (strEqu(run_path, "object")) {
- return_arg = arg_newMetaObj(New_TinyObj);
+ if (strEqu(sRunPath, "object")) {
+ aReturn = arg_newMetaObj(New_TinyObj);
goto exit;
}
/* get method host obj from reg */
- if (NULL == method_host && _checkLReg(run_path)) {
- uint8_t reg_index = _getLRegIndex(run_path);
- method_host = vm->lreg[reg_index];
+ if (NULL == oMethodHost && _checkLReg(sRunPath)) {
+ uint8_t reg_index = _getLRegIndex(sRunPath);
+ oMethodHost = vm->lreg[reg_index];
}
#if !PIKA_NANO_ENABLE
/* get method host obj from stack */
- if (NULL == method_host && run_path[0] == '.') {
+ if (NULL == oMethodHost && sRunPath[0] == '.') {
/* get method host obj from stack */
Arg* stack_tmp[PIKA_ARG_NUM_MAX] = {0};
int n_arg = VMState_getInputArgNum(vm);
@@ -1756,10 +1756,10 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
for (int i = 0; i < n_arg; i++) {
stack_tmp[i] = stack_popArg_alloc(&(vm->stack));
}
- host_arg = stack_tmp[n_arg - 1];
- method_host = _arg_to_obj(host_arg, &is_temp);
- if (NULL != method_host) {
- n_used++;
+ aHost = stack_tmp[n_arg - 1];
+ oMethodHost = _arg_to_obj(aHost, &bIsTemp);
+ if (NULL != oMethodHost) {
+ iNumUsed++;
}
/* push back other args to stack */
for (int i = n_arg - 2; i >= 0; i--) {
@@ -1769,78 +1769,78 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
#endif
/* get method host obj from local scope */
- if (NULL == method_host) {
- method_host = obj_getHostObjWithIsTemp(vm->locals, run_path, &is_temp);
+ if (NULL == oMethodHost) {
+ oMethodHost = obj_getHostObjWithIsTemp(vm->locals, sRunPath, &bIsTemp);
}
/* get method host obj from global scope */
- if (NULL == method_host) {
- method_host = obj_getHostObjWithIsTemp(vm->globals, run_path, &is_temp);
+ if (NULL == oMethodHost) {
+ oMethodHost = obj_getHostObjWithIsTemp(vm->globals, sRunPath, &bIsTemp);
}
/* method host obj is not found */
- if (NULL == method_host) {
+ if (NULL == oMethodHost) {
/* error, not found object */
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
- pika_platform_printf("Error: method '%s' no found.\r\n", run_path);
+ pika_platform_printf("Error: method '%s' no found.\r\n", sRunPath);
goto exit;
}
#if !PIKA_NANO_ENABLE
- if (!skip_init && vm->in_super &&
+ if (!bSkipInit && vm->in_super &&
VMState_getInvokeDeepthNow(vm) == vm->super_invoke_deepth - 1) {
vm->in_super = PIKA_FALSE;
- obj_this = obj_getPtr(vm->locals, _find_self_name(vm));
+ oThis = obj_getPtr(vm->locals, _find_self_name(vm));
}
#endif
/* get object this */
- if (NULL == obj_this) {
- obj_this = method_host;
+ if (NULL == oThis) {
+ oThis = oMethodHost;
}
/* get method in object */
- if (NULL == method) {
- method = obj_getMethodArg_noalloc(method_host, run_path, &arg_reg1);
+ if (NULL == aMethod) {
+ aMethod = obj_getMethodArg_noalloc(oMethodHost, sRunPath, &arg_reg1);
}
/* get method in locals */
- if (NULL == method) {
- method = obj_getMethodArg_noalloc(vm->locals, run_path, &arg_reg1);
+ if (NULL == aMethod) {
+ aMethod = obj_getMethodArg_noalloc(vm->locals, sRunPath, &arg_reg1);
}
/* get method in global */
- if (NULL == method) {
- method = obj_getMethodArg_noalloc(vm->globals, run_path, &arg_reg1);
- if (method != NULL) {
- obj_this = vm->globals;
+ if (NULL == aMethod) {
+ aMethod = obj_getMethodArg_noalloc(vm->globals, sRunPath, &arg_reg1);
+ if (aMethod != NULL) {
+ oThis = vm->globals;
}
}
/* assert method exist */
- if (NULL == method || ARG_TYPE_NONE == arg_getType(method)) {
+ if (NULL == aMethod || ARG_TYPE_NONE == arg_getType(aMethod)) {
/* error, method no found */
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
pika_platform_printf("NameError: name '%s' is not defined\r\n",
- run_path);
+ sRunPath);
goto exit;
}
/* assert methodd type */
- if (!argType_isCallable(arg_getType(method))) {
+ if (!argType_isCallable(arg_getType(aMethod))) {
/* error, method no found */
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
pika_platform_printf("TypeError: '%s' object is not callable\r\n",
- run_path);
+ sRunPath);
goto exit;
}
/* create sub local scope */
- subLocals = New_TinyObj(NULL);
+ oSublocals = New_TinyObj(NULL);
/* load args from vmState to sub_local->list */
- n_used += VMState_loadArgsFromMethodArg(vm, obj_this, subLocals->list,
- method, run_path, n_used);
+ iNumUsed += VMState_loadArgsFromMethodArg(vm, oThis, oSublocals->list,
+ aMethod, sRunPath, iNumUsed);
/* load args failed */
if (vm->error_code != 0) {
@@ -1848,80 +1848,79 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
}
/* run method arg */
- return_arg = obj_runMethodArgWithState_noalloc(obj_this, subLocals, method,
- &sub_run_state, arg_ret_reg);
- if (skip_init) {
- if (arg_getType(return_arg) == ARG_TYPE_OBJECT_NEW) {
- pika_assert(NULL != return_arg);
- arg_setType(return_arg, ARG_TYPE_OBJECT);
+ aReturn = obj_runMethodArgWithState_noalloc(oThis, oSublocals, aMethod,
+ &tSubRunState, aReturnRegistor);
+ if (bSkipInit) {
+ if (arg_getType(aReturn) == ARG_TYPE_OBJECT_NEW) {
+ pika_assert(NULL != aReturn);
+ arg_setType(aReturn, ARG_TYPE_OBJECT);
}
}
- if (sub_run_state.try_result != TRY_RESULT_NONE) {
+ if (tSubRunState.try_result != TRY_RESULT_NONE) {
/* try result */
- vm->error_code = sub_run_state.try_result;
+ vm->error_code = tSubRunState.try_result;
}
/* __init__() */
- if (NULL != return_arg && ARG_TYPE_OBJECT_NEW == arg_getType(return_arg)) {
- pika_assert(NULL != return_arg);
- arg_setType(return_arg, ARG_TYPE_OBJECT);
+ if (NULL != aReturn && ARG_TYPE_OBJECT_NEW == arg_getType(aReturn)) {
+ pika_assert(NULL != aReturn);
+ arg_setType(aReturn, ARG_TYPE_OBJECT);
/* init object */
- PikaObj* new_obj = arg_getPtr(return_arg);
- Arg* method_arg =
- obj_getMethodArg_noalloc(new_obj, "__init__", &arg_reg1);
- subLocalsInit = New_TinyObj(NULL);
- Arg* return_arg_init = NULL;
- if (NULL == method_arg) {
+ PikaObj* oNew = arg_getPtr(aReturn);
+ Arg* aMethod = obj_getMethodArg_noalloc(oNew, "__init__", &arg_reg1);
+ oSublocalsInit = New_TinyObj(NULL);
+ Arg* aReturnInit = NULL;
+ if (NULL == aMethod) {
goto init_exit;
}
- VMState_loadArgsFromMethodArg(vm, new_obj, subLocalsInit->list,
- method_arg, "__init__", n_used);
+ VMState_loadArgsFromMethodArg(vm, oNew, oSublocalsInit->list, aMethod,
+ "__init__", iNumUsed);
/* load args failed */
if (vm->error_code != 0) {
goto init_exit;
}
- return_arg_init = obj_runMethodArgWithState(new_obj, subLocalsInit,
- method_arg, &sub_run_state);
+ aReturnInit = obj_runMethodArgWithState(oNew, oSublocalsInit, aMethod,
+ &tSubRunState);
init_exit:
- if (NULL != return_arg_init) {
- arg_deinit(return_arg_init);
+ if (NULL != aReturnInit) {
+ arg_deinit(aReturnInit);
}
- obj_deinit(subLocalsInit);
- if (NULL != method_arg) {
- arg_deinit(method_arg);
+ obj_deinit(oSublocalsInit);
+ if (NULL != aMethod) {
+ arg_deinit(aMethod);
}
}
/* transfer sysOut */
- sys_out = obj_getSysOut(obj_this);
- if (NULL != sys_out) {
- args_setSysOut(vm->locals->list, sys_out);
+ sSysOut = obj_getSysOut(oThis);
+ if (NULL != sSysOut) {
+ args_setSysOut(vm->locals->list, sSysOut);
}
/* transfer errCode */
- if (0 != obj_getErrorCode(obj_this)) {
+ if (0 != obj_getErrorCode(oThis)) {
/* method error */
VMState_setErrorCode(vm, PIKA_RES_ERR_RUNTIME_ERROR);
}
goto exit;
exit:
- if (NULL != method) {
- arg_deinit(method);
+ if (NULL != aMethod) {
+ arg_deinit(aMethod);
}
- if (NULL != subLocals) {
- obj_deinit(subLocals);
+ if (NULL != oSublocals) {
+ obj_deinit(oSublocals);
}
- if (NULL != host_arg) {
- arg_deinit(host_arg);
+ if (NULL != aHost) {
+ arg_deinit(aHost);
}
- if (NULL != method_host && is_temp) {
+ if (NULL != oMethodHost && bIsTemp) {
/* class method */
- obj_GC(method_host);
+ obj_GC(oMethodHost);
}
- return return_arg;
+ return aReturn;
}
static char* __get_transferd_str(Args* buffs, char* str, size_t* iout_p) {
From cbca98afcc72bf7589a2fec88ed5d7905a07aea8 Mon Sep 17 00:00:00 2001
From: pikastech
Date: Mon, 6 Mar 2023 11:11:17 +0800
Subject: [PATCH 11/41] update version date
---
src/PikaVersion.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PikaVersion.h b/src/PikaVersion.h
index 832ed432b..7d03c3fe9 100644
--- a/src/PikaVersion.h
+++ b/src/PikaVersion.h
@@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 12
#define PIKA_VERSION_MICRO 0
-#define PIKA_EDIT_TIME "2023/02/18 20:34:52"
+#define PIKA_EDIT_TIME "2023/03/06 11:11:16"
From db47c72fa228d380116f6129cb26ad518fd0ac61 Mon Sep 17 00:00:00 2001
From: Gabriel Wang
Date: Tue, 7 Mar 2023 21:47:32 +0000
Subject: [PATCH 12/41] add instruction extension support to VM
---
bsp/simulation-keil/Core/Src/main.c | 110 +++++-
src/PikaVM.c | 546 +++++++++++++++++++---------
src/PikaVM.h | 40 +-
src/__instruction_def.h | 25 +-
src/pika_config_valid.h | 12 +
5 files changed, 548 insertions(+), 185 deletions(-)
diff --git a/bsp/simulation-keil/Core/Src/main.c b/bsp/simulation-keil/Core/Src/main.c
index b01a7be61..90504c093 100644
--- a/bsp/simulation-keil/Core/Src/main.c
+++ b/bsp/simulation-keil/Core/Src/main.c
@@ -21,6 +21,8 @@
#include "main.h"
#include "usart.h"
#include "gpio.h"
+#include "perf_counter.h"
+#include "PikaVM.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
@@ -67,6 +69,28 @@ char __platform_getchar(void) {
}
+
+static void prime_number_100_c(void) {
+ volatile int num = 0;
+ /* run */
+ for (volatile int i = 2; i < 100; i++) {
+ volatile int is_prime = 1;
+ for (volatile int j = 2; j < i; j++) {
+ if (i % j == 0) {
+ is_prime = 0;
+ break;
+ }
+ }
+ if (is_prime) {
+ num = num + i;
+ }
+ }
+ if ( num != 1060){
+ printf("[error] in benchmark prime_number_100_c \r\n");
+ }
+}
+
+
/* USER CODE END 0 */
/**
@@ -99,14 +123,94 @@ int main(void)
MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
- PikaObj *pikaMain = pikaScriptInit();
- pikaScriptShell(pikaMain);
+
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
/* user input buff */
-
+
+
+ /* run unit test */
+ obj_deinit(pikaScriptInit());
+
+ /* benchmark */
+ uint64_t nCycleUsed_c,nCycleUsed_pika = 0;
+ printf("[----------benchmark----------]\r\n");
+ __cycleof__("", {
+ nCycleUsed_c = _;
+ printf("[prime_number_100_c] Cycle Used %lld\r\n", _);
+
+ }) {
+ prime_number_100_c();
+ }
+
+ /* create pikaMain root obj */
+ PikaObj *pikaMain = newRootObj((char*)"pikaMain", New_PikaMain);
+ /* clang-format off */
+ PIKA_PYTHON(
+ num = 0
+ i = 2
+ for i in range(2,100):
+ j=2
+ is_prime = 1
+ for j in range(2,i):
+ if i%j==0 :
+ is_prime = 0
+ break
+ if is_prime:
+ num = num + i
+
+
+ )
+ /* clang-format on */
+ const uint8_t bytes[] = {
+ 0xb4, 0x00, 0x00, 0x00, /* instruct array size */
+ 0x00, 0x85, 0x01, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x85, 0x07, 0x00,
+ 0x00, 0x04, 0x09, 0x00, 0x20, 0x85, 0x07, 0x00, 0x20, 0x05, 0x0b, 0x00,
+ 0x10, 0x02, 0x0f, 0x00, 0x00, 0x02, 0x15, 0x00, 0x00, 0x04, 0x1a, 0x00,
+ 0x00, 0x82, 0x1e, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x0d, 0x09, 0x00,
+ 0x00, 0x07, 0x07, 0x00, 0x01, 0x85, 0x07, 0x00, 0x01, 0x04, 0x2b, 0x00,
+ 0x01, 0x85, 0x2d, 0x00, 0x01, 0x04, 0x2f, 0x00, 0x21, 0x85, 0x07, 0x00,
+ 0x21, 0x01, 0x09, 0x00, 0x11, 0x02, 0x0f, 0x00, 0x01, 0x02, 0x15, 0x00,
+ 0x01, 0x04, 0x38, 0x00, 0x01, 0x82, 0x3c, 0x00, 0x01, 0x04, 0x2b, 0x00,
+ 0x01, 0x0d, 0x2b, 0x00, 0x01, 0x07, 0x07, 0x00, 0x22, 0x81, 0x09, 0x00,
+ 0x22, 0x01, 0x2b, 0x00, 0x12, 0x08, 0x49, 0x00, 0x12, 0x05, 0x01, 0x00,
+ 0x02, 0x08, 0x4b, 0x00, 0x02, 0x07, 0x2d, 0x00, 0x03, 0x85, 0x01, 0x00,
+ 0x03, 0x04, 0x2f, 0x00, 0x03, 0x8e, 0x00, 0x00, 0x01, 0x86, 0x4e, 0x00,
+ 0x01, 0x8c, 0x38, 0x00, 0x01, 0x81, 0x2f, 0x00, 0x01, 0x07, 0x2d, 0x00,
+ 0x12, 0x81, 0x03, 0x00, 0x12, 0x01, 0x09, 0x00, 0x02, 0x08, 0x51, 0x00,
+ 0x02, 0x04, 0x03, 0x00, 0x00, 0x86, 0x4e, 0x00, 0x00, 0x8c, 0x1a, 0x00,
+ /* instruct array */
+ 0x53, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x30, 0x00, 0x6e, 0x75, 0x6d, 0x00, 0x32, 0x00, 0x69, 0x00, 0x31, 0x30,
+ 0x30, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74, 0x65, 0x72,
+ 0x00, 0x24, 0x6c, 0x30, 0x00, 0x24, 0x6c, 0x30, 0x2e, 0x5f, 0x5f, 0x6e,
+ 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x6a, 0x00, 0x31, 0x00, 0x69, 0x73,
+ 0x5f, 0x70, 0x72, 0x69, 0x6d, 0x65, 0x00, 0x24, 0x6c, 0x31, 0x00, 0x24,
+ 0x6c, 0x31, 0x2e, 0x5f, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00,
+ 0x25, 0x00, 0x3d, 0x3d, 0x00, 0x2d, 0x31, 0x00, 0x2b, 0x00, /* const pool */
+ };
+ __cycleof__("", {
+ nCycleUsed_pika = _;
+ printf("[prime_number_100_pika] Cycle Used %lld\r\n", _);
+ }) {
+ /* run pika ByteCode */
+ pikaVM_runByteCode(pikaMain, (uint8_t*)bytes);
+ }
+ int num = obj_getInt(pikaMain, "num");
+ if ( num != 1060){
+ printf("[error] in benchmark prime_number_100_pika \r\n");
+ }
+ /* free the pikaMain obj */
+ obj_deinit(pikaMain);
+
+ uint64_t benchmark_result = ((double) nCycleUsed_c / (double)nCycleUsed_pika) * 100 * 100000;
+
+ printf("\r\n[------benchmark finished ---------]\r\n");
+ printf("benchmakr result :%lld\r\n", benchmark_result);
+
+ pikaScriptShell(pikaMain);
while (1)
{
}
diff --git a/src/PikaVM.c b/src/PikaVM.c
index c5d352493..37753c5ce 100644
--- a/src/PikaVM.c
+++ b/src/PikaVM.c
@@ -1,4 +1,4 @@
-/*
+/*
* This file is part of the PikaPython project.
* http://github.com/pikastech/pikapython
*
@@ -31,6 +31,7 @@
#include "PikaObj.h"
#include "PikaParser.h"
#include "PikaPlatform.h"
+#include "dataArg.h"
#include "dataStrs.h"
#if PIKA_MATH_ENABLE
#include
@@ -278,7 +279,7 @@ void pks_vmSignal_setCtrlElear(void) {
/* head declare start */
static uint8_t VMState_getInputArgNum(VMState* vm);
-static VMParameters* __pikaVM_runByteCodeFrameWithState(
+static VMParameters* _pikaVM_runByteCodeFrameWithState(
PikaObj* self,
VMParameters* locals,
VMParameters* globals,
@@ -292,9 +293,9 @@ static void VMState_setErrorCode(VMState* vm, int8_t error_code) {
vm->error_code = error_code;
}
-static enum Instruct VMstate_getInstructWithOffset(VMState* vm,
+static enum InstructIndex VMstate_getInstructWithOffset(VMState* vm,
int32_t offset) {
- return instructUnit_getInstruct(
+ return instructUnit_getInstructIndex(
VMState_getInstructUnitWithOffset(vm, offset));
}
@@ -328,12 +329,12 @@ static int32_t VMState_getAddrOffsetOfJmpBack(VMState* vm) {
InstructUnit* insUnitThis =
VMState_getInstructUnitWithOffset(vm, offset);
uint16_t invokeDeepth = instructUnit_getInvokeDeepth(insUnitThis);
- enum Instruct ins = instructUnit_getInstruct(insUnitThis);
+ enum InstructIndex ins = instructUnit_getInstructIndex(insUnitThis);
char* data = VMState_getConstWithInstructUnit(vm, insUnitThis);
if ((0 == invokeDeepth) && (JEZ == ins) && data[0] == '2') {
InstructUnit* insUnitLast = VMState_getInstructUnitWithOffset(
vm, offset - instructUnit_getSize());
- enum Instruct insLast = instructUnit_getInstruct(insUnitLast);
+ enum InstructIndex insLast = instructUnit_getInstructIndex(insUnitLast);
/* skip try stmt */
if (GER == insLast) {
continue;
@@ -353,7 +354,7 @@ static int32_t VMState_getAddrOffsetOfJmpBack(VMState* vm) {
offset += instructUnit_getSize();
InstructUnit* insUnitThis =
VMState_getInstructUnitWithOffset(vm, offset);
- enum Instruct ins = instructUnit_getInstruct(insUnitThis);
+ enum InstructIndex ins = instructUnit_getInstructIndex(insUnitThis);
char* data = VMState_getConstWithInstructUnit(vm, insUnitThis);
int blockDeepthThis = instructUnit_getBlockDeepth(insUnitThis);
if ((blockDeepthThis == blockDeepthGot) && (JMP == ins) &&
@@ -427,7 +428,7 @@ static int32_t VMState_getAddrOffsetOfRaise(VMState* vm) {
return 0;
}
ins_unit_now = VMState_getInstructUnitWithOffset(vm, offset);
- enum Instruct ins = instructUnit_getInstruct(ins_unit_now);
+ enum InstructIndex ins = instructUnit_getInstructIndex(ins_unit_now);
if (NTR == ins) {
return offset;
}
@@ -511,11 +512,6 @@ static void VMState_setLReg(VMState* vm, uint8_t index, PikaObj* obj) {
vm->lreg[index] = obj;
}
-typedef Arg* (*VM_instruct_handler)(PikaObj* self,
- VMState* vm,
- char* data,
- Arg* arg_ret_reg);
-
static Arg* VM_instruction_handler_NON(PikaObj* self,
VMState* vm,
char* data,
@@ -997,7 +993,7 @@ Arg* _obj_runMethodArgWithState(PikaObj* self,
uintptr_t insturctArray_start = (uintptr_t)instructArray_getByOffset(
&(method_bytecodeFrame->instruct_array), 0);
uint16_t pc = (uintptr_t)fMethod - insturctArray_start;
- locals = __pikaVM_runByteCodeFrameWithState(
+ locals = _pikaVM_runByteCodeFrameWithState(
self, locals, self, method_bytecodeFrame, pc, run_state);
/* get method return */
@@ -1634,7 +1630,7 @@ static char* _find_super_class_name(VMState* vm) {
if (vm->pc + offset >= (int)VMState_getInstructArraySize(vm)) {
return 0;
}
- if ((RUN == instructUnit_getInstruct(
+ if ((RUN == instructUnit_getInstructIndex(
VMState_getInstructUnitWithOffset(vm, offset)))) {
super_class_name = VMState_getConstWithOffset(vm, offset);
return super_class_name;
@@ -1663,7 +1659,7 @@ static char* _find_self_name(VMState* vm) {
if (vm->pc + offset >= (int)VMState_getInstructArraySize(vm)) {
return 0;
}
- if ((OUT == instructUnit_getInstruct(
+ if ((OUT == instructUnit_getInstructIndex(
VMState_getInstructUnitWithOffset(vm, offset)))) {
self_name = VMState_getConstWithOffset(vm, offset);
return self_name;
@@ -1675,74 +1671,74 @@ static char* _find_self_name(VMState* vm) {
static Arg* VM_instruction_handler_RUN(PikaObj* self,
VMState* vm,
char* data,
- Arg* arg_ret_reg) {
- Arg* return_arg = NULL;
- VMParameters* sub_locals = NULL;
- VMParameters* sub_locals_init = NULL;
- char* run_path = data;
- PikaObj* method_host = NULL;
- PikaObj* obj_this = NULL;
- Arg* method = NULL;
- Arg* host_arg = NULL;
- PIKA_BOOL is_temp = PIKA_FALSE;
- PIKA_BOOL skip_init = PIKA_FALSE;
- char* sys_out;
- int n_used = 0;
+ Arg* aReturnRegistor) {
+ Arg* aReturn = NULL;
+ VMParameters* oSublocals = NULL;
+ VMParameters* oSublocalsInit = NULL;
+ char* sRunPath = data;
+ PikaObj* oMethodHost = NULL;
+ PikaObj* oThis = NULL;
+ Arg* aMethod = NULL;
+ Arg* aHost = NULL;
+ PIKA_BOOL bIsTemp = PIKA_FALSE;
+ PIKA_BOOL bSkipInit = PIKA_FALSE;
+ char* sSysOut;
+ int iNumUsed = 0;
arg_newReg(arg_reg1, 64);
- RunState sub_run_state = {.try_state = vm->run_state->try_state,
- .try_result = TRY_RESULT_NONE};
+ RunState tSubRunState = {.try_state = vm->run_state->try_state,
+ .try_result = TRY_RESULT_NONE};
pika_assert(NULL != vm->run_state);
/* inhert */
if (vm->pc - 2 * (int)instructUnit_getSize() >= 0) {
if (CLS == VMstate_getInstructWithOffset(
vm, -2 * (int)instructUnit_getSize())) {
- skip_init = PIKA_TRUE;
+ bSkipInit = PIKA_TRUE;
}
}
/* tuple or single arg */
- if (NULL == run_path || run_path[0] == 0) {
+ if (NULL == sRunPath || sRunPath[0] == 0) {
if (VMState_getInputArgNum(vm) == 1) {
/* return arg directly */
- return_arg = stack_popArg(&(vm->stack), arg_ret_reg);
+ aReturn = stack_popArg(&(vm->stack), aReturnRegistor);
goto exit;
}
/* create a tuple */
- return_arg = _vm_create_list_or_tuple(self, vm, PIKA_FALSE);
+ aReturn = _vm_create_list_or_tuple(self, vm, PIKA_FALSE);
goto exit;
}
#if !PIKA_NANO_ENABLE
/* support for super() */
- if (strEqu(run_path, "super")) {
- run_path = _find_super_class_name(vm);
+ if (strEqu(sRunPath, "super")) {
+ sRunPath = _find_super_class_name(vm);
vm->in_super = PIKA_TRUE;
vm->super_invoke_deepth = VMState_getInvokeDeepthNow(vm);
- skip_init = PIKA_TRUE;
+ bSkipInit = PIKA_TRUE;
}
#endif
/* return tiny obj */
- if (strEqu(run_path, "TinyObj")) {
- return_arg = arg_newMetaObj(New_TinyObj);
+ if (strEqu(sRunPath, "TinyObj")) {
+ aReturn = arg_newMetaObj(New_TinyObj);
goto exit;
}
- if (strEqu(run_path, "object")) {
- return_arg = arg_newMetaObj(New_TinyObj);
+ if (strEqu(sRunPath, "object")) {
+ aReturn = arg_newMetaObj(New_TinyObj);
goto exit;
}
/* get method host obj from reg */
- if (NULL == method_host && _checkLReg(run_path)) {
- uint8_t reg_index = _getLRegIndex(run_path);
- method_host = vm->lreg[reg_index];
+ if (NULL == oMethodHost && _checkLReg(sRunPath)) {
+ uint8_t reg_index = _getLRegIndex(sRunPath);
+ oMethodHost = vm->lreg[reg_index];
}
#if !PIKA_NANO_ENABLE
/* get method host obj from stack */
- if (NULL == method_host && run_path[0] == '.') {
+ if (NULL == oMethodHost && sRunPath[0] == '.') {
/* get method host obj from stack */
Arg* stack_tmp[PIKA_ARG_NUM_MAX] = {0};
int n_arg = VMState_getInputArgNum(vm);
@@ -1755,10 +1751,10 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
for (int i = 0; i < n_arg; i++) {
stack_tmp[i] = stack_popArg_alloc(&(vm->stack));
}
- host_arg = stack_tmp[n_arg - 1];
- method_host = _arg_to_obj(host_arg, &is_temp);
- if (NULL != method_host) {
- n_used++;
+ aHost = stack_tmp[n_arg - 1];
+ oMethodHost = _arg_to_obj(aHost, &bIsTemp);
+ if (NULL != oMethodHost) {
+ iNumUsed++;
}
/* push back other args to stack */
for (int i = n_arg - 2; i >= 0; i--) {
@@ -1768,78 +1764,78 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
#endif
/* get method host obj from local scope */
- if (NULL == method_host) {
- method_host = obj_getHostObjWithIsTemp(vm->locals, run_path, &is_temp);
+ if (NULL == oMethodHost) {
+ oMethodHost = obj_getHostObjWithIsTemp(vm->locals, sRunPath, &bIsTemp);
}
/* get method host obj from global scope */
- if (NULL == method_host) {
- method_host = obj_getHostObjWithIsTemp(vm->globals, run_path, &is_temp);
+ if (NULL == oMethodHost) {
+ oMethodHost = obj_getHostObjWithIsTemp(vm->globals, sRunPath, &bIsTemp);
}
/* method host obj is not found */
- if (NULL == method_host) {
+ if (NULL == oMethodHost) {
/* error, not found object */
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
- pika_platform_printf("Error: method '%s' no found.\r\n", run_path);
+ pika_platform_printf("Error: method '%s' no found.\r\n", sRunPath);
goto exit;
}
#if !PIKA_NANO_ENABLE
- if (!skip_init && vm->in_super &&
+ if (!bSkipInit && vm->in_super &&
VMState_getInvokeDeepthNow(vm) == vm->super_invoke_deepth - 1) {
vm->in_super = PIKA_FALSE;
- obj_this = obj_getPtr(vm->locals, _find_self_name(vm));
+ oThis = obj_getPtr(vm->locals, _find_self_name(vm));
}
#endif
/* get object this */
- if (NULL == obj_this) {
- obj_this = method_host;
+ if (NULL == oThis) {
+ oThis = oMethodHost;
}
/* get method in object */
- if (NULL == method) {
- method = obj_getMethodArg_noalloc(method_host, run_path, &arg_reg1);
+ if (NULL == aMethod) {
+ aMethod = obj_getMethodArg_noalloc(oMethodHost, sRunPath, &arg_reg1);
}
/* get method in locals */
- if (NULL == method) {
- method = obj_getMethodArg_noalloc(vm->locals, run_path, &arg_reg1);
+ if (NULL == aMethod) {
+ aMethod = obj_getMethodArg_noalloc(vm->locals, sRunPath, &arg_reg1);
}
/* get method in global */
- if (NULL == method) {
- method = obj_getMethodArg_noalloc(vm->globals, run_path, &arg_reg1);
- if (method != NULL) {
- obj_this = vm->globals;
+ if (NULL == aMethod) {
+ aMethod = obj_getMethodArg_noalloc(vm->globals, sRunPath, &arg_reg1);
+ if (aMethod != NULL) {
+ oThis = vm->globals;
}
}
/* assert method exist */
- if (NULL == method || ARG_TYPE_NONE == arg_getType(method)) {
+ if (NULL == aMethod || ARG_TYPE_NONE == arg_getType(aMethod)) {
/* error, method no found */
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
pika_platform_printf("NameError: name '%s' is not defined\r\n",
- run_path);
+ sRunPath);
goto exit;
}
/* assert methodd type */
- if (!argType_isCallable(arg_getType(method))) {
+ if (!argType_isCallable(arg_getType(aMethod))) {
/* error, method no found */
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
pika_platform_printf("TypeError: '%s' object is not callable\r\n",
- run_path);
+ sRunPath);
goto exit;
}
/* create sub local scope */
- sub_locals = New_PikaObj();
+ oSublocals = New_TinyObj(NULL);
/* load args from vmState to sub_local->list */
- n_used += VMState_loadArgsFromMethodArg(vm, obj_this, sub_locals->list,
- method, run_path, n_used);
+ iNumUsed += VMState_loadArgsFromMethodArg(vm, oThis, oSublocals->list,
+ aMethod, sRunPath, iNumUsed);
/* load args failed */
if (vm->error_code != 0) {
@@ -1847,80 +1843,79 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
}
/* run method arg */
- return_arg = obj_runMethodArgWithState_noalloc(obj_this, sub_locals, method,
- &sub_run_state, arg_ret_reg);
- if (skip_init) {
- if (arg_getType(return_arg) == ARG_TYPE_OBJECT_NEW) {
- pika_assert(NULL != return_arg);
- arg_setType(return_arg, ARG_TYPE_OBJECT);
+ aReturn = obj_runMethodArgWithState_noalloc(oThis, oSublocals, aMethod,
+ &tSubRunState, aReturnRegistor);
+ if (bSkipInit) {
+ if (arg_getType(aReturn) == ARG_TYPE_OBJECT_NEW) {
+ pika_assert(NULL != aReturn);
+ arg_setType(aReturn, ARG_TYPE_OBJECT);
}
}
- if (sub_run_state.try_result != TRY_RESULT_NONE) {
+ if (tSubRunState.try_result != TRY_RESULT_NONE) {
/* try result */
- vm->error_code = sub_run_state.try_result;
+ vm->error_code = tSubRunState.try_result;
}
/* __init__() */
- if (NULL != return_arg && ARG_TYPE_OBJECT_NEW == arg_getType(return_arg)) {
- pika_assert(NULL != return_arg);
- arg_setType(return_arg, ARG_TYPE_OBJECT);
+ if (NULL != aReturn && ARG_TYPE_OBJECT_NEW == arg_getType(aReturn)) {
+ pika_assert(NULL != aReturn);
+ arg_setType(aReturn, ARG_TYPE_OBJECT);
/* init object */
- PikaObj* new_obj = arg_getPtr(return_arg);
- Arg* method_arg =
- obj_getMethodArg_noalloc(new_obj, "__init__", &arg_reg1);
- sub_locals_init = New_PikaObj();
- Arg* return_arg_init = NULL;
- if (NULL == method_arg) {
+ PikaObj* oNew = arg_getPtr(aReturn);
+ Arg* aMethod = obj_getMethodArg_noalloc(oNew, "__init__", &arg_reg1);
+ oSublocalsInit = New_TinyObj(NULL);
+ Arg* aReturnInit = NULL;
+ if (NULL == aMethod) {
goto init_exit;
}
- VMState_loadArgsFromMethodArg(vm, new_obj, sub_locals_init->list,
- method_arg, "__init__", n_used);
+ VMState_loadArgsFromMethodArg(vm, oNew, oSublocalsInit->list, aMethod,
+ "__init__", iNumUsed);
/* load args failed */
if (vm->error_code != 0) {
goto init_exit;
}
- return_arg_init = obj_runMethodArgWithState(new_obj, sub_locals_init,
- method_arg, &sub_run_state);
+ aReturnInit = obj_runMethodArgWithState(oNew, oSublocalsInit, aMethod,
+ &tSubRunState);
init_exit:
- if (NULL != return_arg_init) {
- arg_deinit(return_arg_init);
+ if (NULL != aReturnInit) {
+ arg_deinit(aReturnInit);
}
- obj_deinit(sub_locals_init);
- if (NULL != method_arg) {
- arg_deinit(method_arg);
+ obj_deinit(oSublocalsInit);
+ if (NULL != aMethod) {
+ arg_deinit(aMethod);
}
}
/* transfer sysOut */
- sys_out = obj_getSysOut(obj_this);
- if (NULL != sys_out) {
- args_setSysOut(vm->locals->list, sys_out);
+ sSysOut = obj_getSysOut(oThis);
+ if (NULL != sSysOut) {
+ args_setSysOut(vm->locals->list, sSysOut);
}
/* transfer errCode */
- if (0 != obj_getErrorCode(obj_this)) {
+ if (0 != obj_getErrorCode(oThis)) {
/* method error */
VMState_setErrorCode(vm, PIKA_RES_ERR_RUNTIME_ERROR);
}
goto exit;
exit:
- if (NULL != method) {
- arg_deinit(method);
+ if (NULL != aMethod) {
+ arg_deinit(aMethod);
}
- if (NULL != sub_locals) {
- obj_deinit(sub_locals);
+ if (NULL != oSublocals) {
+ obj_deinit(oSublocals);
}
- if (NULL != host_arg) {
- arg_deinit(host_arg);
+ if (NULL != aHost) {
+ arg_deinit(aHost);
}
- if (NULL != method_host && is_temp) {
+ if (NULL != oMethodHost && bIsTemp) {
/* class method */
- obj_GC(method_host);
+ obj_GC(oMethodHost);
}
- return return_arg;
+ return aReturn;
}
static char* __get_transferd_str(Args* buffs, char* str, size_t* iout_p) {
@@ -2042,85 +2037,84 @@ static PIKA_BOOL _proxy_setattr(PikaObj* self, char* name, Arg* arg) {
static Arg* VM_instruction_handler_OUT(PikaObj* self,
VMState* vm,
char* data,
- Arg* arg_ret_reg) {
- char* arg_path = data;
- char* arg_name = strPointToLastToken(arg_path, '.');
- PikaObj* host_obj = NULL;
- PIKA_BOOL is_temp = PIKA_FALSE;
- arg_newReg(outArg_reg, PIKA_ARG_BUFF_SIZE);
- Arg* out_arg = stack_popArg(&vm->stack, &outArg_reg);
- // Arg* outArg = stack_popArg_alloc(&vm->stack);
- if (NULL == out_arg) {
+ Arg* aRetReg) {
+ char* sArgPath = data;
+ char* sArgName = strPointToLastToken(sArgPath, '.');
+ PikaObj* oHost = NULL;
+ PIKA_BOOL bIsTemp = PIKA_FALSE;
+ arg_newReg(aOutReg, PIKA_ARG_BUFF_SIZE);
+ Arg* aOut = stack_popArg(&vm->stack, &aOutReg);
+ if (NULL == aOut) {
return NULL;
}
- ArgType outArg_type = arg_getType(out_arg);
+ ArgType eOutArgType = arg_getType(aOut);
if (VMState_getInvokeDeepthNow(vm) > 0) {
/* in block, is a kw arg */
- arg_setIsKeyword(out_arg, PIKA_TRUE);
- arg_setName(out_arg, arg_path);
- Arg* res = arg_copy_noalloc(out_arg, arg_ret_reg);
- arg_deinit(out_arg);
+ arg_setIsKeyword(aOut, PIKA_TRUE);
+ arg_setName(aOut, sArgPath);
+ Arg* res = arg_copy_noalloc(aOut, aRetReg);
+ arg_deinit(aOut);
return res;
}
- if (_checkLReg(arg_path)) {
- uint8_t index = _getLRegIndex(arg_path);
- if (argType_isObject(outArg_type)) {
- PikaObj* obj = arg_getPtr(out_arg);
+ if (_checkLReg(sArgPath)) {
+ uint8_t index = _getLRegIndex(sArgPath);
+ if (argType_isObject(eOutArgType)) {
+ PikaObj* obj = arg_getPtr(aOut);
VMState_setLReg(vm, index, obj);
- arg_deinit(out_arg);
+ arg_deinit(aOut);
}
return NULL;
}
- PikaObj* context = vm->locals;
+ PikaObj* oContext = vm->locals;
/* match global_list */
if (obj_getFlag(vm->locals, OBJ_FLAG_GLOBALS)) {
- char* global_list = args_getStr(vm->locals->list, "@g");
+ char* sGlobalList = args_getStr(vm->locals->list, "@g");
/* use a arg as buff */
- Arg* global_list_arg = arg_newStr(global_list);
- char* global_list_buff = arg_getStr(global_list_arg);
+ Arg* aGlobalList = arg_newStr(sGlobalList);
+ char* sGlobalListBuff = arg_getStr(aGlobalList);
/* for each arg arg in global_list */
- for (int i = 0; i < strCountSign(global_list, ',') + 1; i++) {
- char* global_arg = strPopFirstToken(&global_list_buff, ',');
+ for (int i = 0; i < strCountSign(sGlobalList, ',') + 1; i++) {
+ char* sGlobalArg = strPopFirstToken(&sGlobalListBuff, ',');
/* matched global arg, context set to global */
- if (strEqu(global_arg, arg_path)) {
- context = vm->globals;
+ if (strEqu(sGlobalArg, sArgPath)) {
+ oContext = vm->globals;
}
}
- arg_deinit(global_list_arg);
+ arg_deinit(aGlobalList);
}
/* use RunAs object */
if (obj_getFlag(vm->locals, OBJ_FLAG_RUN_AS)) {
- context = args_getPtr(vm->locals->list, "@r");
+ oContext = args_getPtr(vm->locals->list, "@r");
}
/* set free object to nomal object */
- if (ARG_TYPE_OBJECT_NEW == outArg_type) {
- pika_assert(NULL != out_arg);
- arg_setType(out_arg, ARG_TYPE_OBJECT);
+ if (ARG_TYPE_OBJECT_NEW == eOutArgType) {
+ pika_assert(NULL != aOut);
+ arg_setType(aOut, ARG_TYPE_OBJECT);
}
/* ouput arg to context */
- if (arg_path == arg_name) {
- obj_setArg_noCopy(context, arg_path, out_arg);
+ if (sArgPath == sArgName) {
+ obj_setArg_noCopy(oContext, sArgPath, aOut);
return NULL;
}
- host_obj = obj_getHostObjWithIsTemp(context, arg_path, &is_temp);
+ oHost = obj_getHostObjWithIsTemp(oContext, sArgPath, &bIsTemp);
- if (NULL == host_obj) {
- host_obj = obj_getHostObjWithIsTemp(vm->globals, arg_path, &is_temp);
+ if (NULL == oHost) {
+ oHost = obj_getHostObjWithIsTemp(vm->globals, sArgPath, &bIsTemp);
}
- if (host_obj != NULL) {
- if (_proxy_setattr(host_obj, arg_name, out_arg)) {
+ if (oHost != NULL) {
+ if (_proxy_setattr(oHost, sArgName, aOut)) {
return NULL;
}
- obj_setArg_noCopy(host_obj, arg_name, out_arg);
+ obj_setArg_noCopy(oHost, sArgName, aOut);
return NULL;
}
- obj_setArg_noCopy(context, arg_path, out_arg);
+ obj_setArg_noCopy(oContext, sArgPath, aOut);
return NULL;
}
@@ -2252,7 +2246,7 @@ static uint8_t VMState_getInputArgNum(VMState* vm) {
break;
}
if (invode_deepth == invoke_deepth_this + 1) {
- if (instructUnit_getInstruct(ins_unit_now) == OUT) {
+ if (instructUnit_getInstructIndex(ins_unit_now) == OUT) {
continue;
}
num++;
@@ -3005,21 +2999,178 @@ static Arg* VM_instruction_handler_IMP(PikaObj* self,
return NULL;
}
-const VM_instruct_handler VM_instruct_handler_table[__INSTRCUTION_CNT] = {
-#define __INS_TABLE
-#include "__instruction_table.h"
+
+
+
+
+#if PIKA_INSTRUCT_EXTENSION_ENABLE
+const VMInstructionSet VM_default_instruction_set = {
+ #define __INS_OPCODE
+ .instructions = (const VMInstruction []) {
+ #include "__instruction_table.h"
+ },
+ .count = __INSTRUCTION_CNT,
+ .op_idx_start = NON,
+ .op_idx_end = NON + __INSTRUCTION_CNT - 1,
};
-enum Instruct pikaVM_getInstructFromAsm(char* ins_str) {
-#define __INS_COMPIRE
+
+#ifndef PIKA_INSTRUCT_SIGNATURE_DICT
+# define PIKA_INSTRUCT_SIGNATURE_DICT 0
+#endif
+
+typedef struct VMInstructionSetItem VMInstructionSetItem;
+struct VMInstructionSetItem {
+ VMInstructionSetItem *next;
+ const VMInstructionSet *ins_set;
+};
+
+static struct {
+ const VMInstructionSetItem default_ins_set;
+ VMInstructionSetItem *list;
+ VMInstructionSetItem *recent;
+#if PIKA_INSTRUCT_SIGNATURE_DICT_COUNT > 0
+ const uint16_t signature_dict[PIKA_INSTRUCT_SIGNATURE_DICT_COUNT];
+#endif
+} VM = {
+ .default_ins_set = {
+ .ins_set = &VM_default_instruction_set,
+ .next = NULL,
+ },
+ .list = (VMInstructionSetItem *)&VM.default_ins_set,
+ .recent = (VMInstructionSetItem *)&VM.default_ins_set,
+#if PIKA_INSTRUCT_SIGNATURE_DICT_COUNT > 0
+ .signature_dict = {
+ PIKA_INSTRUCT_SIGNATURE_DICT
+ },
+#endif
+};
+
+PIKA_BOOL pikaVM_registerInstructionSet(VMInstructionSet *ins_set)
+{
+ pika_assert(NULL != ins_set);
+
+#if PIKA_INSTRUCT_SIGNATURE_DICT_COUNT > 0
+ uint16_t signature = ins_set->signature;
+
+ PIKA_BOOL ins_set_valid = PIKA_FALSE;
+ for (int n = 0; n < sizeof(VM.signature_dict) / sizeof(uint16_t); n++) {
+ if (VM.signature_dict[n] == signature) {
+ ins_set_valid = PIKA_TRUE;
+ break;
+ }
+ }
+ if (!ins_set_valid) {
+ return PIKA_FALSE;
+ }
+#endif
+
+ /* check whether the target instruction set exists or not */
+ VMInstructionSetItem *list_item = VM.list;
+ do {
+ if (list_item->ins_set->signature == signature) {
+ return PIKA_TRUE; /* already exist */
+ }
+
+ list_item = list_item->next;
+ } while(NULL != list_item->next);
+
+
+ VMInstructionSetItem *item = pika_platform_malloc(sizeof(VMInstructionSetItem));
+ if (NULL == item) {
+ return PIKA_FALSE;
+ }
+ item->ins_set = ins_set;
+ item->next = NULL;
+
+ /* add item to the tail of VM.list */
+ list_item->next = item;
+
+ return PIKA_TRUE;
+}
+
+static
+const VMInstruction *instructUnit_getInstruct(enum InstructIndex ins_idx) {
+ VMInstructionSetItem *item = VM.recent;
+
+ if ( (ins_idx >= item->ins_set->op_idx_start)
+ && (ins_idx <= item->ins_set->op_idx_end)) {
+ return &(item->ins_set->instructions[ins_idx - item->ins_set->op_idx_start]);
+ }
+
+ /* search list */
+ item = VM.list;
+ do {
+ if ( (ins_idx >= item->ins_set->op_idx_start)
+ && (ins_idx <= item->ins_set->op_idx_end)) {
+ VM.recent = item;
+ return &(item->ins_set->instructions[ins_idx - item->ins_set->op_idx_start]);
+ }
+ item = item->next;
+ } while(NULL != item->next);
+
+ return NULL;
+}
+
+
+static enum InstructIndex __find_ins_idx_in_ins_set(char* ins_str, const VMInstructionSet *set)
+{
+ const VMInstruction *ins = set->instructions;
+ uint_fast16_t count = set->count;
+
+ do {
+ if (0 == strncmp(ins_str, ins->op_str, ins->op_str_len)) {
+ return ins->op_idx;
+ }
+ ins++;
+ } while(--count);
+ return __INSTRUCTION_UNKNOWN;
+}
+
+enum InstructIndex pikaVM_getInstructFromAsm(char* ins_str) {
+
+ enum InstructIndex ins_idx = __find_ins_idx_in_ins_set(ins_str, VM.recent->ins_set);
+
+ if (__INSTRUCTION_UNKNOWN == ins_idx) {
+ VMInstructionSetItem *item = VM.list;
+
+ do {
+ ins_idx = __find_ins_idx_in_ins_set(ins_str, item->ins_set);
+ if (__INSTRUCTION_UNKNOWN != ins_idx) {
+ VM.recent = item;
+ return ins_idx;
+ }
+ item = item->next;
+ } while(NULL != item->next);
+
+ return NON;
+ }
+
+ return ins_idx;
+}
+
+#else
+
+PIKA_BOOL pikaVM_registerInstructionSet(VMInstructionSet *ins_set) {
+ return PIKA_FALSE;
+}
+
+enum InstructIndex pikaVM_getInstructFromAsm(char* ins_str) {
+#define __INS_COMPARE
#include "__instruction_table.h"
return NON;
}
+const VM_instruct_handler VM_instruct_handler_table[__INSTRUCTION_CNT] = {
+#define __INS_TABLE
+#include "__instruction_table.h"
+};
+#endif
+
static int pikaVM_runInstructUnit(PikaObj* self,
VMState* vm,
InstructUnit* ins_unit) {
- enum Instruct instruct = instructUnit_getInstruct(ins_unit);
+ enum InstructIndex instruct = instructUnit_getInstructIndex(ins_unit);
arg_newReg(ret_reg, PIKA_ARG_BUFF_SIZE);
Arg* return_arg = &ret_reg;
// char invode_deepth1_str[2] = {0};
@@ -3027,7 +3178,20 @@ static int pikaVM_runInstructUnit(PikaObj* self,
char* data = VMState_getConstWithInstructUnit(vm, ins_unit);
/* run instruct */
pika_assert(NULL != vm->run_state);
+
+#if PIKA_INSTRUCT_EXTENSION_ENABLE
+ const VMInstruction * ins = instructUnit_getInstruct(instruct);
+ if (NULL == ins) {
+ /* todo: unsupported instruction */
+ pika_assert(NULL != ins);
+ }
+ pika_assert(NULL != ins->handler);
+
+ return_arg = ins->handler(self, vm, data, &ret_reg);
+#else
return_arg = VM_instruct_handler_table[instruct](self, vm, data, &ret_reg);
+#endif
+
if (vm->error_code != PIKA_RES_OK ||
VMSignal_getCtrl() == VM_SIGNAL_CTRL_EXIT) {
@@ -3146,8 +3310,8 @@ static ByteCodeFrame* _cache_bcf_fn(PikaObj* self, char* py_lines) {
}
static char* _get_data_from_bytecode2(uint8_t* bytecode,
- enum Instruct ins1,
- enum Instruct ins2) {
+ enum InstructIndex ins1,
+ enum InstructIndex ins2) {
ByteCodeFrame bf = {0};
char* res = NULL;
byteCodeFrame_init(&bf);
@@ -3157,7 +3321,7 @@ static char* _get_data_from_bytecode2(uint8_t* bytecode,
if (NULL == ins_unit) {
goto __exit;
}
- enum Instruct ins = instructUnit_getInstruct(ins_unit);
+ enum InstructIndex ins = instructUnit_getInstructIndex(ins_unit);
if (ins == ins1 || ins == ins2) {
res = constPool_getByOffset(&bf.const_pool,
ins_unit->const_pool_index);
@@ -3242,8 +3406,8 @@ VMParameters* _do_pikaVM_runByteCode(PikaObj* self,
/* run byteCode */
- globals = __pikaVM_runByteCodeFrameWithState(
- self, locals, globals, bytecode_frame_p, 0, run_state);
+ globals = _pikaVM_runByteCodeFrameWithState(self, locals, globals,
+ bytecode_frame_p, 0, run_state);
goto exit;
exit:
if (!is_use_heap_bytecode) {
@@ -3502,11 +3666,53 @@ InstructUnit* instructArray_getNext(InstructArray* self) {
return instructArray_getNow(self);
}
+#if PIKA_INSTRUCT_EXTENSION_ENABLE
+
+static const char * __find_ins_str_in_ins_set(enum InstructIndex op_idx, const VMInstructionSet *set)
+{
+ const VMInstruction *ins = set->instructions;
+ uint_fast16_t count = set->count;
+
+ do {
+ if (ins->op_idx == op_idx) {
+ return ins->op_str;
+ }
+ ins++;
+ } while(--count);
+ return NULL;
+}
+
+
+static char* instructUnit_getInstructStr(InstructUnit* self) {
+
+ enum InstructIndex op_idx = instructUnit_getInstructIndex(self);
+
+ const char *ins_str = __find_ins_str_in_ins_set(op_idx, VM.recent->ins_set);
+
+ if (NULL == ins_str) {
+ VMInstructionSetItem *item = VM.list;
+
+ do {
+ ins_str = __find_ins_str_in_ins_set(op_idx, item->ins_set);
+ if (NULL != ins_str) {
+ VM.recent = item;
+ return (char *)ins_str;
+ }
+ item = item->next;
+ } while(NULL != item->next);
+
+ return "NON";
+ }
+
+ return "NON";
+}
+#else
static char* instructUnit_getInstructStr(InstructUnit* self) {
#define __INS_GET_INS_STR
#include "__instruction_table.h"
return "NON";
}
+#endif
void instructUnit_print(InstructUnit* self) {
if (instructUnit_getIsNewLine(self)) {
@@ -3622,7 +3828,7 @@ void VMState_solveUnusedStack(VMState* vm) {
}
}
-static VMParameters* __pikaVM_runByteCodeFrameWithState(
+static VMParameters* _pikaVM_runByteCodeFrameWithState(
PikaObj* self,
VMParameters* locals,
VMParameters* globals,
@@ -3716,8 +3922,8 @@ VMParameters* pikaVM_runByteCodeFrame(PikaObj* self,
ByteCodeFrame* byteCode_frame) {
RunState run_state = {.try_state = TRY_STATE_NONE,
.try_result = TRY_RESULT_NONE};
- return __pikaVM_runByteCodeFrameWithState(self, self, self, byteCode_frame,
- 0, &run_state);
+ return _pikaVM_runByteCodeFrameWithState(self, self, self, byteCode_frame,
+ 0, &run_state);
}
void constPool_printAsArray(ConstPool* self) {
diff --git a/src/PikaVM.h b/src/PikaVM.h
index f5ceb1b00..2422bd178 100644
--- a/src/PikaVM.h
+++ b/src/PikaVM.h
@@ -35,10 +35,12 @@
#include
#endif
-enum Instruct {
+enum InstructIndex {
#define __INS_ENUM
#include "__instruction_table.h"
- __INSTRCUTION_CNT,
+ __INSTRUCTION_CNT,
+ __INSTRUCTION_INDEX_MAX = 0xFFFF,
+ __INSTRUCTION_UNKNOWN = 0xFFFF,
};
typedef enum {
@@ -154,6 +156,33 @@ struct VMSignal {
#endif
};
+typedef Arg* (*VM_instruct_handler)(PikaObj* self,
+ VMState* vm,
+ char* data,
+ Arg* arg_ret_reg);
+
+typedef struct VMInstruction VMInstruction;
+struct VMInstruction {
+ VM_instruct_handler handler;
+ const char *op_str;
+ uint16_t op_idx;
+ uint16_t op_str_len : 4;
+ uint16_t : 12;
+};
+
+
+typedef struct VMInstructionSet VMInstructionSet;
+struct VMInstructionSet {
+ const VMInstruction *instructions;
+ uint16_t count;
+ uint16_t signature;
+ uint16_t op_idx_start;
+ uint16_t op_idx_end;
+};
+
+
+
+
VMParameters* pikaVM_run(PikaObj* self, char* pyLine);
VMParameters* pikaVM_runAsm(PikaObj* self, char* pikaAsm);
VMParameters* pikaVM_runByteCodeFrame(PikaObj* self,
@@ -167,8 +196,8 @@ static inline int instructUnit_getInvokeDeepth(InstructUnit* self) {
return self->deepth >> 4;
}
-static inline enum Instruct instructUnit_getInstruct(InstructUnit* self) {
- return (enum Instruct)(self->isNewLine_instruct & 0x7F);
+static inline enum InstructIndex instructUnit_getInstructIndex(InstructUnit* self) {
+ return (enum InstructIndex)(self->isNewLine_instruct & 0x7F);
}
static inline int instructUnit_getConstPoolIndex(InstructUnit* self) {
@@ -202,7 +231,7 @@ static inline void instructUnit_setIsNewLine(InstructUnit* self, int val) {
InstructUnit* New_instructUnit(uint8_t data_size);
void instructUnit_deinit(InstructUnit* self);
-enum Instruct pikaVM_getInstructFromAsm(char* line);
+enum InstructIndex pikaVM_getInstructFromAsm(char* line);
void constPool_init(ConstPool* self);
void constPool_deinit(ConstPool* self);
@@ -286,6 +315,7 @@ void instructArray_printAsArray(InstructArray* self);
void byteCodeFrame_loadByteCode(ByteCodeFrame* self, uint8_t* bytes);
void byteCodeFrame_printAsArray(ByteCodeFrame* self);
void byteCodeFrame_init(ByteCodeFrame* self);
+PIKA_BOOL pikaVM_registerInstructionSet(VMInstructionSet *ins_set);
VMParameters* pikaVM_runByteCode(PikaObj* self, const uint8_t* bytecode);
VMParameters* pikaVM_runByteCodeInconstant(PikaObj* self, uint8_t* bytecode);
InstructUnit* instructArray_getNow(InstructArray* self);
diff --git a/src/__instruction_def.h b/src/__instruction_def.h
index 05ab74009..e42d0d7f1 100644
--- a/src/__instruction_def.h
+++ b/src/__instruction_def.h
@@ -35,20 +35,31 @@
#define def_ins(__INS_NAME) [__INS_NAME] = &VM_instruction_handler_##__INS_NAME,
#endif
-#if defined(__INS_COMPIRE)
-#define def_ins(__INS_NAME) \
- if (0 == strncmp(ins_str, "" #__INS_NAME "", 3)) { \
- return __INS_NAME; \
+#if defined(__INS_COMPARE)
+#define def_ins(__INS_NAME) \
+ if (0 == strncmp(ins_str, "" #__INS_NAME "", 3)) { \
+ return __INS_NAME; \
}
#endif
#if defined(__INS_GET_INS_STR)
-#define def_ins(__INS_NAME) \
- if (__INS_NAME == instructUnit_getInstruct(self)){ \
+#define def_ins(__INS_NAME) \
+ if (__INS_NAME == instructUnit_getInstructIndex(self)){ \
return ""#__INS_NAME""; \
}
#endif
+#if defined(__INS_OPCODE)
+#define def_ins(__INS_NAME) \
+ [__INS_NAME] = { \
+ .handler = &VM_instruction_handler_##__INS_NAME, \
+ .op_str = (const char []){#__INS_NAME}, \
+ .op_str_len = sizeof(#__INS_NAME) - 1, \
+ .op_idx = __INS_NAME, \
+ },
+#endif
+
#undef __INS_ENUM
#undef __INS_TABLE
-#undef __INS_COMPIRE
+#undef __INS_COMPARE
+#undef __INS_OPCODE
diff --git a/src/pika_config_valid.h b/src/pika_config_valid.h
index 8d10fb6ce..777030470 100644
--- a/src/pika_config_valid.h
+++ b/src/pika_config_valid.h
@@ -81,6 +81,10 @@
#define PIKA_EVENT_THREAD_ENABLE 0
#endif
+ #ifndef PIKA_GC_MARK_SWEEP_ENABLE
+ #define PIKA_GC_MARK_SWEEP_ENABLE 0
+ #endif
+
#endif
/* default optimize */
@@ -309,6 +313,14 @@
#ifndef PIKA_INSTRUCT_YIELD_PERIOD
#define PIKA_INSTRUCT_YIELD_PERIOD 1
#endif
+
+ #ifndef PIKA_INSTRUCT_EXTENSION_ENABLE
+ #define PIKA_INSTRUCT_EXTENSION_ENABLE 1
+ #endif
+
+ #ifndef PIKA_INSTRUCT_SIGNATURE_DICT_COUNT
+ #define PIKA_INSTRUCT_SIGNATURE_DICT_COUNT 1
+ #endif
#ifndef PIKA_EXEC_ENABLE
#define PIKA_EXEC_ENABLE 1
From 7f5edaf09027d6fd58d88dc3aa7952a1cd332ae4 Mon Sep 17 00:00:00 2001
From: pikastech
Date: Mon, 6 Mar 2023 14:39:04 +0800
Subject: [PATCH 13/41] add objCnt
ready to check where enable the mark_sweep
auto gc with threshold failed, add some assert
more assert about obj alive, dict mark not correct
add pikaGC_try, but cannot run at any time
markSweep crashed on keyword
save gcRoot for obj to debug
add debug point
add kernal_debug config to keep more debug info
use @res_ to mark operation
found self reference on __iter__()
can not fix gc err around iter
remove lock, only keep the self lock
more obj info for debug
only pikaui not pass
only pikaui not pass
---
package/PikaStdLib/PikaStdData_Dict.c | 6 +-
package/PikaStdLib/PikaStdLib_SysObj.c | 84 ++---
port/linux/.vscode/launch.json | 2 +-
port/linux/.vscode/settings.json | 3 +-
port/linux/boot/banchmark/main.c | 2 +-
port/linux/config/pika_config_default.h | 4 +-
...oogletest-param-test-invalid-name2-test.py | 66 ++--
.../PikaStdLib/PikaStdData_Dict.c | 6 +-
.../PikaStdLib/PikaStdLib_SysObj.c | 84 ++---
port/linux/performance/main.c | 8 +-
src/PikaObj.c | 286 +++++++++++----
src/PikaObj.h | 72 +++-
src/PikaVM.c | 76 ++--
src/TinyObj.c | 6 +
src/TinyObj.h | 1 +
src/dataArg.c | 32 +-
src/dataArg.h | 2 +-
src/dataArgs.c | 4 +-
src/dataLink.c | 12 +-
src/dataMemory.c | 22 +-
src/dataMemory.h | 2 +-
src/dataStack.c | 3 +
src/pika_config_valid.h | 8 +
test/PikaCV-test.cpp | 22 +-
test/PikaMath-test.cpp | 20 +-
test/PikaNN-test.cpp | 2 +-
test/VM-test.cpp | 132 +++----
test/builtin-test.cpp | 18 +-
test/cJSON-test.cpp | 30 +-
test/chinese-test.cpp | 2 +-
test/class-test.cpp | 8 +-
test/cmodule-test.cpp | 2 +-
test/compile-test.cpp | 22 +-
test/configparser-test.cpp | 4 +-
test/ctypes-test.cpp | 4 +-
test/event-test.cpp | 1 +
test/except-test.cpp | 20 +-
test/gc-test.cpp | 1 -
test/hashlib-test.cpp | 2 +-
test/json-test.cpp | 4 +-
test/main.cpp | 15 +-
test/module-test.cpp | 56 +--
test/network-test.cpp | 6 +-
test/parse-test.cpp | 328 +++++++++---------
test/pikaMain-test.cpp | 274 +++++++--------
test/pika_config_gtest.h | 4 +-
test/pikaui-test.cpp | 2 +-
test/python/gc/gc_circle.py | 2 +
test/stddata-test.cpp | 60 ++--
test/string-test.cpp | 30 +-
test/strs-test.cpp | 6 +-
test/sysObj-test.cpp | 4 +-
test/test_common.h | 2 +-
test/thread-test.cpp | 4 +-
test/unix-time-test.cpp | 8 +-
55 files changed, 1067 insertions(+), 819 deletions(-)
diff --git a/package/PikaStdLib/PikaStdData_Dict.c b/package/PikaStdLib/PikaStdData_Dict.c
index 63447c256..a9712a908 100644
--- a/package/PikaStdLib/PikaStdData_Dict.c
+++ b/package/PikaStdLib/PikaStdData_Dict.c
@@ -8,12 +8,14 @@
#include "dataStrs.h"
Arg* PikaStdData_Dict_get(PikaObj* self, char* key) {
+ pika_assert_obj_alive(self);
PikaDict* dict = obj_getPtr(self, "dict");
Arg* res = pikaDict_getArg(dict, key);
if (NULL == res) {
obj_setErrorCode(self, PIKA_RES_ERR_RUNTIME_ERROR);
__platform_printf("KeyError: %s\n", key);
}
+ pika_assert_arg_alive(res);
return arg_copy(res);
}
@@ -271,7 +273,7 @@ void PikaStdData_Dict_update(PikaObj* self, PikaObj* other) {
const uint8_t
bytes[] =
{
- 0x40, 0x00, 0x00, 0x00,/* instruct array size */
+ 0x40, 0x00, 0x00, 0x00, /* instruct array size */
0x10, 0x81, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04,
0x0d, 0x00, 0x00, 0x82, 0x11, 0x00, 0x00, 0x04, 0x1e, 0x00,
0x00, 0x0d, 0x1e, 0x00, 0x00, 0x07, 0x24, 0x00, 0x11, 0x81,
@@ -279,7 +281,7 @@ void PikaStdData_Dict_update(PikaObj* self, PikaObj* other) {
0x21, 0x01, 0x1e, 0x00, 0x11, 0x1d, 0x00, 0x00, 0x01, 0x02,
0x2c, 0x00, 0x01, 0x04, 0x26, 0x00, 0x00, 0x86, 0x38, 0x00,
0x00, 0x8c, 0x0d, 0x00, /* instruct array */
- 0x3b, 0x00, 0x00, 0x00, /* const pool size */
+ 0x3b, 0x00, 0x00, 0x00, /* const pool size */
0x00, 0x40, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x00, 0x69, 0x74,
0x65, 0x72, 0x00, 0x24, 0x6c, 0x30, 0x00, 0x24, 0x6c, 0x30,
0x2e, 0x5f, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00,
diff --git a/package/PikaStdLib/PikaStdLib_SysObj.c b/package/PikaStdLib/PikaStdLib_SysObj.c
index fb61272cb..7b7127ff5 100644
--- a/package/PikaStdLib/PikaStdLib_SysObj.c
+++ b/package/PikaStdLib/PikaStdLib_SysObj.c
@@ -169,29 +169,31 @@ char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg) {
Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) {
/* object */
- PIKA_BOOL is_temp = PIKA_FALSE;
- PikaObj* arg_obj = _arg_to_obj(arg, &is_temp);
- NewFun _clsptr = (NewFun)arg_obj->constructor;
+ PIKA_BOOL bIsTemp = PIKA_FALSE;
+ PikaObj* oArg = _arg_to_obj(arg, &bIsTemp);
+ NewFun _clsptr = (NewFun)oArg->constructor;
if (_clsptr == New_PikaStdLib_RangeObj) {
/* found RangeObj, return directly */
return arg_copy(arg);
}
- // pikaVM_runAsm(arg_obj,
- // "B0\n"
- // "0 RUN __iter__\n"
- // "0 OUT __res\n");
+ /* clang-format off */
+ PIKA_PYTHON(
+ @res_iter = __iter__()
+ )
+ /* clang-format on */
const uint8_t bytes[] = {
0x08, 0x00, 0x00, 0x00, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0a, 0x00, /* instruct array */
- 0x10, 0x00, 0x00, 0x00, /* const pool size */
- 0x00, 0x5f, 0x5f, 0x69, 0x74, 0x65, 0x72, 0x5f,
- 0x5f, 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, /* const pool */
+ 0x14, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x5f, 0x5f, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x5f, 0x00, 0x40,
+ 0x72, 0x65, 0x73, 0x5f, 0x69, 0x74, 0x65, 0x72, 0x00, /* const pool */
};
- pikaVM_runByteCode(arg_obj, (uint8_t*)bytes);
- Arg* res = arg_copy(args_getArg(arg_obj->list, "__res"));
- obj_removeArg(arg_obj, "__res");
- if (is_temp) {
- obj_refcntDec(arg_obj);
+ pikaVM_runByteCode(oArg, (uint8_t*)bytes);
+ Arg* res = arg_copy(args_getArg(oArg->list, "@res_iter"));
+ obj_setFlag(arg_getPtr(res), OBJ_FLAG_GC_ROOT);
+ obj_removeArg(oArg, "@res_iter");
+ if (bIsTemp) {
+ obj_refcntDec(oArg);
}
return res;
}
@@ -296,22 +298,22 @@ int PikaStdLib_SysObj_len(PikaObj* self, Arg* arg) {
Arg* method_arg = obj_getMethodArg(arg_obj, "__len__");
if (NULL != method_arg) {
arg_deinit(method_arg);
-
+ obj_removeArg(arg_obj, "@res_len");
/* clang-format off */
- PIKA_PYTHON(
- __res = __len__()
- )
+ PIKA_PYTHON(
+ @res_len = __len__()
+ )
/* clang-format on */
const uint8_t bytes[] = {
0x08, 0x00, 0x00, 0x00, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x09, 0x00, /* instruct
array */
- 0x0f, 0x00, 0x00, 0x00, /* const pool size */
- 0x00, 0x5f, 0x5f, 0x6c, 0x65, 0x6e, 0x5f, 0x5f, 0x00,
- 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, /* const pool */
+ 0x12, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x5f, 0x5f, 0x6c, 0x65, 0x6e, 0x5f, 0x5f, 0x00, 0x40,
+ 0x72, 0x65, 0x73, 0x5f, 0x6c, 0x65, 0x6e, 0x00, /* const pool */
};
pikaVM_runByteCode(arg_obj, (uint8_t*)bytes);
- return obj_getInt(arg_obj, "__res");
+ return obj_getInt(arg_obj, "@res_len");
}
}
@@ -325,35 +327,37 @@ Arg* PikaStdLib_SysObj_list(PikaObj* self, PikaTuple* val) {
if (1 == pikaTuple_getSize(val)) {
Arg* in = pikaTuple_getArg(val, 0);
obj_setArg(self, "__list", in);
+ obj_removeArg(self, "@res_list");
/* clang-format off */
PIKA_PYTHON(
- __res = []
+ @res_list = []
for __item in __list:
- __res.append(__item)
+ @res_list.append(__item)
del __item
del __list
+
)
/* clang-format on */
const uint8_t bytes[] = {
0x3c, 0x00, 0x00, 0x00, /* instruct array size */
- 0x00, 0x95, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x10, 0x81, 0x07,
- 0x00, 0x00, 0x02, 0x0e, 0x00, 0x00, 0x04, 0x13, 0x00, 0x00, 0x82,
- 0x17, 0x00, 0x00, 0x04, 0x24, 0x00, 0x00, 0x0d, 0x24, 0x00, 0x00,
- 0x07, 0x2b, 0x00, 0x11, 0x81, 0x24, 0x00, 0x01, 0x02, 0x2d, 0x00,
- 0x00, 0x86, 0x3a, 0x00, 0x00, 0x8c, 0x13, 0x00, 0x00, 0x8c, 0x24,
- 0x00, 0x00, 0x8c, 0x07, 0x00,
+ 0x00, 0x95, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x10, 0x81, 0x0b,
+ 0x00, 0x00, 0x02, 0x12, 0x00, 0x00, 0x04, 0x17, 0x00, 0x00, 0x82,
+ 0x1b, 0x00, 0x00, 0x04, 0x28, 0x00, 0x00, 0x0d, 0x28, 0x00, 0x00,
+ 0x07, 0x2f, 0x00, 0x11, 0x81, 0x28, 0x00, 0x01, 0x02, 0x31, 0x00,
+ 0x00, 0x86, 0x42, 0x00, 0x00, 0x8c, 0x17, 0x00, 0x00, 0x8c, 0x28,
+ 0x00, 0x00, 0x8c, 0x0b, 0x00,
/* instruct array */
- 0x3d, 0x00, 0x00, 0x00, /* const pool size */
- 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, 0x5f, 0x5f, 0x6c, 0x69,
- 0x73, 0x74, 0x00, 0x69, 0x74, 0x65, 0x72, 0x00, 0x24, 0x6c, 0x30,
- 0x00, 0x24, 0x6c, 0x30, 0x2e, 0x5f, 0x5f, 0x6e, 0x65, 0x78, 0x74,
- 0x5f, 0x5f, 0x00, 0x5f, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x00, 0x32,
- 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x70, 0x65,
- 0x6e, 0x64, 0x00, 0x2d, 0x31, 0x00,
- /* const pool */
+ 0x45, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x40, 0x72, 0x65, 0x73, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x00,
+ 0x5f, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x00, 0x69, 0x74, 0x65, 0x72,
+ 0x00, 0x24, 0x6c, 0x30, 0x00, 0x24, 0x6c, 0x30, 0x2e, 0x5f, 0x5f,
+ 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x5f, 0x5f, 0x69, 0x74,
+ 0x65, 0x6d, 0x00, 0x32, 0x00, 0x40, 0x72, 0x65, 0x73, 0x5f, 0x6c,
+ 0x69, 0x73, 0x74, 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x00,
+ 0x2d, 0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
- return arg_copy(obj_getArg(self, "__res"));
+ return arg_copy(obj_getArg(self, "@res_list"));
}
PikaObj* New_PikaStdData_List(Args * args);
return arg_newDirectObj(New_PikaStdData_List);
diff --git a/port/linux/.vscode/launch.json b/port/linux/.vscode/launch.json
index 39689438c..b6f5eec80 100644
--- a/port/linux/.vscode/launch.json
+++ b/port/linux/.vscode/launch.json
@@ -11,7 +11,7 @@
"program": "${workspaceFolder}/build/test/pikascript_test",
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
- "--gtest_filter=event.remove_regist"
+ "--gtest_filter=pikaui.*"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
diff --git a/port/linux/.vscode/settings.json b/port/linux/.vscode/settings.json
index 7b152dd60..03da629cb 100644
--- a/port/linux/.vscode/settings.json
+++ b/port/linux/.vscode/settings.json
@@ -122,6 +122,7 @@
},
"python.formatting.provider": "autopep8",
"clangd.arguments": [
- "-compile-commands-dir=build"
+ "-compile-commands-dir=build",
+ "-header-insertion=never"
]
}
\ No newline at end of file
diff --git a/port/linux/boot/banchmark/main.c b/port/linux/boot/banchmark/main.c
index 2898198ed..92e954f9b 100644
--- a/port/linux/boot/banchmark/main.c
+++ b/port/linux/boot/banchmark/main.c
@@ -28,7 +28,7 @@ void checker_memInfo(void)
{
printf("---------------------------\r\n");
printf("Memory pool info:\r\n");
- checker_printMem(" mem state size = ", sizeof(pikaMemInfo));
+ checker_printMem(" mem state size = ", sizeof(PikaMemInfo));
printf("---------------------------\r\n");
}
void checker_assertMemFree()
diff --git a/port/linux/config/pika_config_default.h b/port/linux/config/pika_config_default.h
index c460618fb..2e383dd0d 100644
--- a/port/linux/config/pika_config_default.h
+++ b/port/linux/config/pika_config_default.h
@@ -6,4 +6,6 @@
#define PIKA_INSTRUCT_HOOK_ENABLE 1
#define PIKA_INSTRUCT_HOOK_PERIOD 1
#define PIKA_SHELL_FILTER_ENABLE 1
-#define PIKA_GC_MARK_SWEEP_ENABLE 1
\ No newline at end of file
+#define PIKA_GC_MARK_SWEEP_ENABLE 1
+#define PIKA_GC_MARK_SWEEP_THRESHOLD 1
+#define PIKA_KERNAL_DEBUG_ENABLE 1
\ No newline at end of file
diff --git a/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py b/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py
index c49b178d7..9367b72a8 100644
--- a/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py
+++ b/port/linux/package/googletest/googletest/test/googletest-param-test-invalid-name2-test.py
@@ -337,9 +337,9 @@ stack_init(&bs);
EXPECT_EQ(pikaMemNow(), 0);
}
-extern pikaMemInfo g_pikaMemInfo;
+extern PikaMemInfo g_PikaMemInfo;
TEST(parser, while_true_if_false_both_exit) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* bf = New_strBuff();
Stack bs;
stack_init(&bs);
@@ -377,7 +377,7 @@ stack_init(&bs);
}
TEST(parser, multiLine) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines =(char *)
"while true:\n"
@@ -414,7 +414,7 @@ TEST(parser, multiLine) {
}
TEST(parser, pikaPi) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
const char lines[] =
@@ -533,7 +533,7 @@ TEST(parser, pikaPi) {
}
TEST(parser, add) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 + 1\n";
printf("%s", lines);
@@ -550,7 +550,7 @@ TEST(parser, add) {
}
TEST(parser, add_3) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 + 2 + 3\n";
printf("%s", lines);
@@ -569,7 +569,7 @@ TEST(parser, add_3) {
}
TEST(parser, add_a_pp) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = a + 1\n";
printf("%s", lines);
@@ -586,7 +586,7 @@ TEST(parser, add_a_pp) {
}
TEST(parser, while_a_pp) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"while a < 10:\n"
@@ -618,7 +618,7 @@ TEST(parser, while_a_pp) {
}
TEST(parser, add_m2p3) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 * 2 + 3\n";
printf("%s", lines);
@@ -637,7 +637,7 @@ TEST(parser, add_m2p3) {
}
TEST(parser, add_m2p3_) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = 1 * (2 + 3)\n";
printf("%s", lines);
@@ -657,7 +657,7 @@ TEST(parser, add_m2p3_) {
}
TEST(parser, add_m12p3_) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = (1 + 2) * 3\n";
printf("%s", lines);
@@ -677,7 +677,7 @@ TEST(parser, add_m12p3_) {
}
TEST(parser, method_equ) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"if right.read() == 1:\n";
printf("%s", lines);
@@ -694,7 +694,7 @@ TEST(parser, method_equ) {
}
TEST(parser, equ_method) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"if 1 == right.read() :\n";
printf("%s", lines);
@@ -711,7 +711,7 @@ TEST(parser, equ_method) {
}
TEST(parser, def_add) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -737,7 +737,7 @@ TEST(parser, def_add) {
}
TEST(parser, def_add_return) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -764,7 +764,7 @@ TEST(parser, def_add_return) {
}
TEST(parser, def_while_return) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -797,7 +797,7 @@ TEST(parser, def_while_return) {
}
TEST(parser, def_while_return_void) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"def add(a, b):\n"
@@ -827,7 +827,7 @@ TEST(parser, def_while_return_void) {
}
TEST(parser, signed_num) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = -1\n";
printf("%s", lines);
@@ -843,7 +843,7 @@ TEST(parser, signed_num) {
}
TEST(parser, comp_signed_num) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"if a > -1:\n";
printf("%s", lines);
@@ -862,7 +862,7 @@ TEST(parser, comp_signed_num) {
TEST(lexser, symbol_add) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -881,7 +881,7 @@ TEST(lexser, symbol_add) {
TEST(lexser, symbol_1) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -899,7 +899,7 @@ TEST(lexser, symbol_1) {
TEST(lexser, operator_not) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -917,7 +917,7 @@ TEST(lexser, operator_not) {
TEST(lexser, symbol_Nag) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -935,7 +935,7 @@ TEST(lexser, symbol_Nag) {
TEST(lexser, operator_all) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -967,7 +967,7 @@ TEST(lexser, operator_all) {
TEST(lexser, symbol_2) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -987,7 +987,7 @@ TEST(lexser, symbol_2) {
TEST(lexser, symbol_and) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1007,7 +1007,7 @@ TEST(lexser, symbol_and) {
TEST(lexser, sting) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1025,7 +1025,7 @@ TEST(lexser, sting) {
TEST(lexser, num_1) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1043,7 +1043,7 @@ TEST(lexser, num_1) {
TEST(lexser, jjcc) {
/* init */
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
/* run */
@@ -1074,7 +1074,7 @@ TEST(parser, pop_by_str) {
}
TEST(parser, mm) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = a ** -1\n";
printf("%s", lines);
@@ -1092,7 +1092,7 @@ TEST(parser, mm) {
}
TEST(parser, self_inc) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)
"a += -1\n"
@@ -1156,7 +1156,7 @@ TEST(parser, self_inc) {
}
TEST(parser, n_n1) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"a = ~-1\n";
printf("%s", lines);
@@ -1173,7 +1173,7 @@ TEST(parser, n_n1) {
}
TEST(parser, or_) {
- g_pikaMemInfo.heapUsedMax = 0;
+ g_PikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = (char*)"( a>1) or (b<= 3)\n";
printf("%s", lines);
diff --git a/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_Dict.c b/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_Dict.c
index 63447c256..a9712a908 100644
--- a/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_Dict.c
+++ b/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_Dict.c
@@ -8,12 +8,14 @@
#include "dataStrs.h"
Arg* PikaStdData_Dict_get(PikaObj* self, char* key) {
+ pika_assert_obj_alive(self);
PikaDict* dict = obj_getPtr(self, "dict");
Arg* res = pikaDict_getArg(dict, key);
if (NULL == res) {
obj_setErrorCode(self, PIKA_RES_ERR_RUNTIME_ERROR);
__platform_printf("KeyError: %s\n", key);
}
+ pika_assert_arg_alive(res);
return arg_copy(res);
}
@@ -271,7 +273,7 @@ void PikaStdData_Dict_update(PikaObj* self, PikaObj* other) {
const uint8_t
bytes[] =
{
- 0x40, 0x00, 0x00, 0x00,/* instruct array size */
+ 0x40, 0x00, 0x00, 0x00, /* instruct array size */
0x10, 0x81, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04,
0x0d, 0x00, 0x00, 0x82, 0x11, 0x00, 0x00, 0x04, 0x1e, 0x00,
0x00, 0x0d, 0x1e, 0x00, 0x00, 0x07, 0x24, 0x00, 0x11, 0x81,
@@ -279,7 +281,7 @@ void PikaStdData_Dict_update(PikaObj* self, PikaObj* other) {
0x21, 0x01, 0x1e, 0x00, 0x11, 0x1d, 0x00, 0x00, 0x01, 0x02,
0x2c, 0x00, 0x01, 0x04, 0x26, 0x00, 0x00, 0x86, 0x38, 0x00,
0x00, 0x8c, 0x0d, 0x00, /* instruct array */
- 0x3b, 0x00, 0x00, 0x00, /* const pool size */
+ 0x3b, 0x00, 0x00, 0x00, /* const pool size */
0x00, 0x40, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x00, 0x69, 0x74,
0x65, 0x72, 0x00, 0x24, 0x6c, 0x30, 0x00, 0x24, 0x6c, 0x30,
0x2e, 0x5f, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00,
diff --git a/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdLib_SysObj.c b/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdLib_SysObj.c
index fb61272cb..7b7127ff5 100644
--- a/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdLib_SysObj.c
+++ b/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdLib_SysObj.c
@@ -169,29 +169,31 @@ char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg) {
Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) {
/* object */
- PIKA_BOOL is_temp = PIKA_FALSE;
- PikaObj* arg_obj = _arg_to_obj(arg, &is_temp);
- NewFun _clsptr = (NewFun)arg_obj->constructor;
+ PIKA_BOOL bIsTemp = PIKA_FALSE;
+ PikaObj* oArg = _arg_to_obj(arg, &bIsTemp);
+ NewFun _clsptr = (NewFun)oArg->constructor;
if (_clsptr == New_PikaStdLib_RangeObj) {
/* found RangeObj, return directly */
return arg_copy(arg);
}
- // pikaVM_runAsm(arg_obj,
- // "B0\n"
- // "0 RUN __iter__\n"
- // "0 OUT __res\n");
+ /* clang-format off */
+ PIKA_PYTHON(
+ @res_iter = __iter__()
+ )
+ /* clang-format on */
const uint8_t bytes[] = {
0x08, 0x00, 0x00, 0x00, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0a, 0x00, /* instruct array */
- 0x10, 0x00, 0x00, 0x00, /* const pool size */
- 0x00, 0x5f, 0x5f, 0x69, 0x74, 0x65, 0x72, 0x5f,
- 0x5f, 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, /* const pool */
+ 0x14, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x5f, 0x5f, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x5f, 0x00, 0x40,
+ 0x72, 0x65, 0x73, 0x5f, 0x69, 0x74, 0x65, 0x72, 0x00, /* const pool */
};
- pikaVM_runByteCode(arg_obj, (uint8_t*)bytes);
- Arg* res = arg_copy(args_getArg(arg_obj->list, "__res"));
- obj_removeArg(arg_obj, "__res");
- if (is_temp) {
- obj_refcntDec(arg_obj);
+ pikaVM_runByteCode(oArg, (uint8_t*)bytes);
+ Arg* res = arg_copy(args_getArg(oArg->list, "@res_iter"));
+ obj_setFlag(arg_getPtr(res), OBJ_FLAG_GC_ROOT);
+ obj_removeArg(oArg, "@res_iter");
+ if (bIsTemp) {
+ obj_refcntDec(oArg);
}
return res;
}
@@ -296,22 +298,22 @@ int PikaStdLib_SysObj_len(PikaObj* self, Arg* arg) {
Arg* method_arg = obj_getMethodArg(arg_obj, "__len__");
if (NULL != method_arg) {
arg_deinit(method_arg);
-
+ obj_removeArg(arg_obj, "@res_len");
/* clang-format off */
- PIKA_PYTHON(
- __res = __len__()
- )
+ PIKA_PYTHON(
+ @res_len = __len__()
+ )
/* clang-format on */
const uint8_t bytes[] = {
0x08, 0x00, 0x00, 0x00, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x09, 0x00, /* instruct
array */
- 0x0f, 0x00, 0x00, 0x00, /* const pool size */
- 0x00, 0x5f, 0x5f, 0x6c, 0x65, 0x6e, 0x5f, 0x5f, 0x00,
- 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, /* const pool */
+ 0x12, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x5f, 0x5f, 0x6c, 0x65, 0x6e, 0x5f, 0x5f, 0x00, 0x40,
+ 0x72, 0x65, 0x73, 0x5f, 0x6c, 0x65, 0x6e, 0x00, /* const pool */
};
pikaVM_runByteCode(arg_obj, (uint8_t*)bytes);
- return obj_getInt(arg_obj, "__res");
+ return obj_getInt(arg_obj, "@res_len");
}
}
@@ -325,35 +327,37 @@ Arg* PikaStdLib_SysObj_list(PikaObj* self, PikaTuple* val) {
if (1 == pikaTuple_getSize(val)) {
Arg* in = pikaTuple_getArg(val, 0);
obj_setArg(self, "__list", in);
+ obj_removeArg(self, "@res_list");
/* clang-format off */
PIKA_PYTHON(
- __res = []
+ @res_list = []
for __item in __list:
- __res.append(__item)
+ @res_list.append(__item)
del __item
del __list
+
)
/* clang-format on */
const uint8_t bytes[] = {
0x3c, 0x00, 0x00, 0x00, /* instruct array size */
- 0x00, 0x95, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x10, 0x81, 0x07,
- 0x00, 0x00, 0x02, 0x0e, 0x00, 0x00, 0x04, 0x13, 0x00, 0x00, 0x82,
- 0x17, 0x00, 0x00, 0x04, 0x24, 0x00, 0x00, 0x0d, 0x24, 0x00, 0x00,
- 0x07, 0x2b, 0x00, 0x11, 0x81, 0x24, 0x00, 0x01, 0x02, 0x2d, 0x00,
- 0x00, 0x86, 0x3a, 0x00, 0x00, 0x8c, 0x13, 0x00, 0x00, 0x8c, 0x24,
- 0x00, 0x00, 0x8c, 0x07, 0x00,
+ 0x00, 0x95, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x10, 0x81, 0x0b,
+ 0x00, 0x00, 0x02, 0x12, 0x00, 0x00, 0x04, 0x17, 0x00, 0x00, 0x82,
+ 0x1b, 0x00, 0x00, 0x04, 0x28, 0x00, 0x00, 0x0d, 0x28, 0x00, 0x00,
+ 0x07, 0x2f, 0x00, 0x11, 0x81, 0x28, 0x00, 0x01, 0x02, 0x31, 0x00,
+ 0x00, 0x86, 0x42, 0x00, 0x00, 0x8c, 0x17, 0x00, 0x00, 0x8c, 0x28,
+ 0x00, 0x00, 0x8c, 0x0b, 0x00,
/* instruct array */
- 0x3d, 0x00, 0x00, 0x00, /* const pool size */
- 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, 0x5f, 0x5f, 0x6c, 0x69,
- 0x73, 0x74, 0x00, 0x69, 0x74, 0x65, 0x72, 0x00, 0x24, 0x6c, 0x30,
- 0x00, 0x24, 0x6c, 0x30, 0x2e, 0x5f, 0x5f, 0x6e, 0x65, 0x78, 0x74,
- 0x5f, 0x5f, 0x00, 0x5f, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x00, 0x32,
- 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x70, 0x65,
- 0x6e, 0x64, 0x00, 0x2d, 0x31, 0x00,
- /* const pool */
+ 0x45, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x40, 0x72, 0x65, 0x73, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x00,
+ 0x5f, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x00, 0x69, 0x74, 0x65, 0x72,
+ 0x00, 0x24, 0x6c, 0x30, 0x00, 0x24, 0x6c, 0x30, 0x2e, 0x5f, 0x5f,
+ 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x5f, 0x5f, 0x69, 0x74,
+ 0x65, 0x6d, 0x00, 0x32, 0x00, 0x40, 0x72, 0x65, 0x73, 0x5f, 0x6c,
+ 0x69, 0x73, 0x74, 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x00,
+ 0x2d, 0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
- return arg_copy(obj_getArg(self, "__res"));
+ return arg_copy(obj_getArg(self, "@res_list"));
}
PikaObj* New_PikaStdData_List(Args * args);
return arg_newDirectObj(New_PikaStdData_List);
diff --git a/port/linux/performance/main.c b/port/linux/performance/main.c
index d39e4ea0c..335494cc0 100644
--- a/port/linux/performance/main.c
+++ b/port/linux/performance/main.c
@@ -29,11 +29,11 @@ int main(void) {
/* deinit */
obj_deinit(pikaMain);
#if PIKA_ARG_CACHE_ENABLE
- extern pikaMemInfo g_pikaMemInfo;
+ extern PikaMemInfo g_PikaMemInfo;
printf("[ Info]: alloc times: %d, cached times: %d (%0.2f%%)\r\n",
- g_pikaMemInfo.alloc_times, g_pikaMemInfo.alloc_times_cache,
- ((float)g_pikaMemInfo.alloc_times_cache /
- (float)g_pikaMemInfo.alloc_times) *
+ g_PikaMemInfo.alloc_times, g_PikaMemInfo.alloc_times_cache,
+ ((float)g_PikaMemInfo.alloc_times_cache /
+ (float)g_PikaMemInfo.alloc_times) *
100.0);
#endif
printf("[ Info]: time elapsed: %lfs\r\n",
diff --git a/src/PikaObj.c b/src/PikaObj.c
index 897f002a6..31b7d1aee 100644
--- a/src/PikaObj.c
+++ b/src/PikaObj.c
@@ -39,14 +39,25 @@
#include "dataStrs.h"
extern volatile VMSignal g_PikaVMSignal;
-static volatile PikaObjState g_PikaObjState = {
+volatile PikaObjState g_PikaObjState = {
.helpModulesCmodule = NULL,
.inRootObj = PIKA_FALSE,
#if PIKA_GC_MARK_SWEEP_ENABLE
- .gcRoot = NULL,
+ .objCnt = 0,
+ .objCntMax = 0,
+ .objCntLastGC = 0,
+ .gcChain = NULL,
+ .markSweepBusy = 0,
#endif
};
+PikaObj* New_PikaStdData_Dict(Args* args);
+PikaObj* New_PikaStdData_dict_keys(Args* args);
+PikaObj* New_PikaStdData_List(Args* args);
+PikaObj* New_PikaStdData_Tuple(Args* args);
+void _mem_cache_deinit(void);
+void _VMEvent_deinit(void);
+
static enum shellCTRL __obj_shellLineHandler_REPL(PikaObj* self,
char* input_line,
ShellConfig* shell);
@@ -116,6 +127,11 @@ char* fast_itoa(char* buf, uint32_t val) {
static int32_t obj_deinit_no_del(PikaObj* self) {
/* free the list */
args_deinit(self->list);
+#if PIKA_KERNAL_DEBUG_ENABLE
+ if (NULL != self->aName) {
+ arg_deinit(self->aName);
+ }
+#endif
extern volatile PikaObj* __pikaMain;
/* remove self from gc chain */
pikaGC_remove(self);
@@ -123,7 +139,6 @@ static int32_t obj_deinit_no_del(PikaObj* self) {
pikaFree(self, sizeof(PikaObj));
if (self == (PikaObj*)__pikaMain) {
__pikaMain = NULL;
- pikaGC_markSweep();
}
return 0;
}
@@ -141,6 +156,11 @@ int obj_GC(PikaObj* self) {
}
int32_t obj_deinit(PikaObj* self) {
+ pikaGC_lock();
+ PIKA_BOOL bisRoot = PIKA_FALSE;
+#if PIKA_KERNAL_DEBUG_ENABLE
+ self->isAlive = PIKA_FALSE;
+#endif
Arg* del = obj_getMethodArg(self, "__del__");
if (NULL != del) {
const uint8_t bytes[] = {
@@ -155,8 +175,7 @@ int32_t obj_deinit(PikaObj* self) {
}
extern volatile PikaObj* __pikaMain;
if (self == (PikaObj*)__pikaMain) {
- void _mem_cache_deinit(void);
- void _VMEvent_deinit(void);
+ bisRoot = PIKA_TRUE;
_mem_cache_deinit();
#if PIKA_EVENT_ENABLE
_VMEvent_deinit();
@@ -166,7 +185,12 @@ int32_t obj_deinit(PikaObj* self) {
g_PikaObjState.helpModulesCmodule = NULL;
}
}
- return obj_deinit_no_del(self);
+ int32_t ret = obj_deinit_no_del(self);
+ pikaGC_unlock();
+ if (bisRoot) {
+ pikaGC_markSweep();
+ }
+ return ret;
}
PIKA_RES obj_setInt(PikaObj* self, char* argPath, int64_t val) {
@@ -263,6 +287,7 @@ PIKA_BOOL obj_getBool(PikaObj* self, char* argPath) {
}
Arg* obj_getArg(PikaObj* self, char* argPath) {
+ pika_assert(pikaGC_checkAlive(self));
PIKA_BOOL is_temp = PIKA_FALSE;
PikaObj* obj = obj_getHostObjWithIsTemp(self, argPath, &is_temp);
if (NULL == obj) {
@@ -314,27 +339,45 @@ static PIKA_RES _obj_setArg(PikaObj* self,
char* argPath,
Arg* arg,
uint8_t is_copy) {
+ pika_assert(pikaGC_checkAlive(self));
/* setArg would copy arg */
- PikaObj* obj = obj_getHostObj(self, argPath);
- if (NULL == obj) {
+ PikaObj* host = obj_getHostObj(self, argPath);
+ PikaObj* oNew = NULL;
+ PIKA_BOOL bNew = PIKA_FALSE;
+ if (NULL == host) {
/* object no found */
return PIKA_RES_ERR_ARG_NO_FOUND;
}
- char* argName = strPointToLastToken(argPath, '.');
- Arg* newArg;
+ char* sArgName = strPointToLastToken(argPath, '.');
+ Arg* aNew;
if (is_copy) {
- newArg = arg_copy(arg);
+ aNew = arg_copy(arg);
} else {
- newArg = arg;
- }
- newArg = arg_setName(newArg, argName);
-#if PIKA_GC_MARK_SWEEP_ENABLE
- if (arg_isObject(newArg)) {
- /* enable mark sweep to collect this object */
- obj_clearFlag(arg_getPtr(newArg), OBJ_FLAG_GC_ROOT);
+ aNew = arg;
}
+ aNew = arg_setName(aNew, sArgName);
+ if (arg_isObject(aNew)) {
+ oNew = arg_getPtr(aNew);
+ bNew = PIKA_TRUE;
+ pika_assert(pikaGC_checkAlive(oNew));
+#if PIKA_KERNAL_DEBUG_ENABLE
+ if (host != oNew) {
+ /* skip self ref */
+ oNew->parent = host;
+ }
+ if (NULL != oNew->aName) {
+ arg_deinit(oNew->aName);
+ }
+ oNew->aName = arg_newStr(sArgName);
+ oNew->name = arg_getStr(oNew->aName);
#endif
- args_setArg(obj->list, newArg);
+ }
+ args_setArg(host->list, aNew);
+ /* enable mark sweep to collect this object */
+ if (bNew) {
+ /* only enable mark sweep after setArg */
+ pikaGC_enable(oNew);
+ }
return PIKA_RES_OK;
}
@@ -592,9 +635,7 @@ static PikaObj* _obj_initMetaObj(PikaObj* obj, char* name) {
obj_runNativeMethod(new_obj, "__init__", NULL);
args_setPtrWithType(obj->list, name, ARG_TYPE_OBJECT, new_obj);
res = obj_getPtr(obj, name);
-#if PIKA_GC_MARK_SWEEP_ENABLE
- obj_clearFlag(res, OBJ_FLAG_GC_ROOT);
-#endif
+ // pikaGC_enable(res);
goto exit;
exit:
strsDeinit(&buffs);
@@ -675,10 +716,10 @@ static PikaObj* _obj_getObjDirect(PikaObj* self,
return _arg_to_obj(arg_obj, pIsTemp);
}
-static PikaObj* __obj_getObjWithKeepDeepth(PikaObj* self,
- char* objPath,
- PIKA_BOOL* pIsTemp,
- int32_t keepDeepth) {
+static PikaObj* _obj_getObjWithKeepDeepth(PikaObj* self,
+ char* objPath,
+ PIKA_BOOL* pIsTemp,
+ int32_t keepDeepth) {
char objPath_buff[PIKA_PATH_BUFF_SIZE];
char* objPath_ptr = objPath_buff;
strcpy(objPath_buff, objPath);
@@ -693,23 +734,26 @@ static PikaObj* __obj_getObjWithKeepDeepth(PikaObj* self,
}
goto exit;
exit:
+ if (NULL != obj) {
+ pika_assert(pikaGC_checkAlive(obj));
+ }
return obj;
}
PikaObj* obj_getObj(PikaObj* self, char* objPath) {
PIKA_BOOL is_temp = PIKA_FALSE;
- return __obj_getObjWithKeepDeepth(self, objPath, &is_temp, 0);
+ return _obj_getObjWithKeepDeepth(self, objPath, &is_temp, 0);
}
PikaObj* obj_getHostObj(PikaObj* self, char* objPath) {
PIKA_BOOL is_temp = PIKA_FALSE;
- return __obj_getObjWithKeepDeepth(self, objPath, &is_temp, 1);
+ return _obj_getObjWithKeepDeepth(self, objPath, &is_temp, 1);
}
PikaObj* obj_getHostObjWithIsTemp(PikaObj* self,
char* objPath,
PIKA_BOOL* pIsTemp) {
- return __obj_getObjWithKeepDeepth(self, objPath, pIsTemp, 1);
+ return _obj_getObjWithKeepDeepth(self, objPath, pIsTemp, 1);
}
Method methodArg_getPtr(Arg* method_arg) {
@@ -1680,7 +1724,7 @@ char* method_getStr(Args* args, char* argName) {
#if PIKA_GC_MARK_SWEEP_ENABLE
PikaObj* pikaGC_getLast(PikaObj* self) {
- PikaObj* obj = g_PikaObjState.gcRoot;
+ PikaObj* obj = g_PikaObjState.gcChain;
PikaObj* last = NULL;
while (NULL != obj) {
if (obj == self) {
@@ -1693,16 +1737,17 @@ PikaObj* pikaGC_getLast(PikaObj* self) {
}
void pikaGC_cleanMark(void) {
- PikaObj* obj = g_PikaObjState.gcRoot;
+ PikaObj* obj = g_PikaObjState.gcChain;
while (NULL != obj) {
obj_clearFlag(obj, OBJ_FLAG_GC_MARKED);
+ // obj->gcRoot = NULL;
obj = obj->gcNext;
}
}
uint32_t pikaGC_count(void) {
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcRoot;
+ PikaObj* obj = g_PikaObjState.gcChain;
while (NULL != obj) {
count++;
obj = obj->gcNext;
@@ -1712,7 +1757,7 @@ uint32_t pikaGC_count(void) {
uint32_t pikaGC_countMarked(void) {
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcRoot;
+ PikaObj* obj = g_PikaObjState.gcChain;
while (NULL != obj) {
if (obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
count++;
@@ -1722,9 +1767,10 @@ uint32_t pikaGC_countMarked(void) {
return count;
}
-uint32_t pikaGC_printCanFree(void) {
+uint32_t pikaGC_printFreeList(void) {
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcRoot;
+ PikaObj* obj = g_PikaObjState.gcChain;
+ pika_platform_printf("-----\r\n");
while (NULL != obj) {
if (!obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
count++;
@@ -1732,6 +1778,7 @@ uint32_t pikaGC_printCanFree(void) {
}
obj = obj->gcNext;
}
+ pika_platform_printf("-----\r\n");
return count;
}
@@ -1740,21 +1787,30 @@ uint32_t pikaGC_FreeOnce(void) {
// pika_platform_printf("-----\r\n");
// pikaGC_printCanFree();
uint32_t count = 0;
- PikaObj* obj = g_PikaObjState.gcRoot;
+ PikaObj* freeList[16] = {0};
+ PikaObj* obj = g_PikaObjState.gcChain;
while (NULL != obj) {
if (!obj_getFlag(obj, OBJ_FLAG_GC_MARKED)) {
+ freeList[count] = obj;
count++;
- obj_GC(obj);
- return count;
}
obj = obj->gcNext;
}
+ if (count > 0) {
+ pikaGC_printFreeList();
+ for (uint32_t i = 0; i < count; i++) {
+ obj_GC(freeList[i]);
+ }
+ }
return count;
}
int32_t pikaGC_markHandler(Arg* argEach, Args* context) {
if (arg_isObject(argEach)) {
PikaObj* obj = (PikaObj*)arg_getPtr(argEach);
+#if PIKA_KERNAL_DEBUG_ENABLE
+ obj->gcRoot = (void*)context;
+#endif
pikaGC_mark(obj);
}
return 0;
@@ -1768,12 +1824,29 @@ void pikaGC_mark(PikaObj* self) {
return;
}
obj_setFlag(self, OBJ_FLAG_GC_MARKED);
- args_foreach(self->list, pikaGC_markHandler, NULL);
+ args_foreach(self->list, pikaGC_markHandler, (void*)self);
+ if (self->constructor == New_PikaStdData_Dict) {
+ PikaDict* dict = obj_getPtr(self, "dict");
+ if (NULL == dict) {
+ return;
+ }
+ args_foreach(&dict->super, pikaGC_markHandler, (void*)self);
+ return;
+ }
+ if (self->constructor == New_PikaStdData_List ||
+ self->constructor == New_PikaStdData_Tuple) {
+ PikaList* list = obj_getPtr(self, "list");
+ if (NULL == list) {
+ return;
+ }
+ args_foreach(&list->super, pikaGC_markHandler, (void*)self);
+ return;
+ }
}
void pikaGC_markRoot() {
pikaGC_cleanMark();
- PikaObj* root = g_PikaObjState.gcRoot;
+ PikaObj* root = g_PikaObjState.gcChain;
while (NULL != root) {
if (obj_getFlag(root, OBJ_FLAG_GC_ROOT)) {
pikaGC_mark(root);
@@ -1788,17 +1861,26 @@ PIKA_BOOL pikaGC_checkAlive(PikaObj* self) {
#if !PIKA_GC_MARK_SWEEP_ENABLE
return PIKA_TRUE;
#else
- if (NULL == g_PikaObjState.gcRoot) {
- return PIKA_TRUE;
+ PIKA_BOOL ret = PIKA_FALSE;
+ if (NULL == g_PikaObjState.gcChain) {
+ ret = PIKA_FALSE;
+ goto __exit;
}
- PikaObj* obj = g_PikaObjState.gcRoot;
+ PikaObj* obj = g_PikaObjState.gcChain;
while (NULL != obj) {
if (obj == self) {
- return PIKA_TRUE;
+ ret = PIKA_TRUE;
+ goto __exit;
}
obj = obj->gcNext;
}
- return PIKA_FALSE;
+__exit:
+#if PIKA_KERNAL_DEBUG_ENABLE
+ if (ret == PIKA_TRUE) {
+ self->isAlive = ret;
+ }
+#endif
+ return ret;
#endif
}
@@ -1807,25 +1889,47 @@ uint32_t pikaGC_markSweep(void) {
return 0;
#else
uint32_t count = 0;
+ if (pikaGC_islock()) {
+ return 0;
+ }
+ pikaGC_lock();
while (pikaGC_FreeOnce() != 0) {
count++;
};
+ /* update gc state */
+ g_PikaObjState.objCntLastGC = g_PikaObjState.objCnt;
+ pikaGC_unlock();
return count;
#endif
}
+void pikaGC_checkThreshold(void) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return;
+#else
+ if (g_PikaObjState.objCnt >
+ g_PikaObjState.objCntLastGC + PIKA_GC_MARK_SWEEP_THRESHOLD) {
+ pikaGC_markSweep();
+ }
+#endif
+}
+
void pikaGC_append(PikaObj* self) {
#if !PIKA_GC_MARK_SWEEP_ENABLE
return;
#else
+ g_PikaObjState.objCnt++;
+ if (g_PikaObjState.objCntMax < g_PikaObjState.objCnt) {
+ g_PikaObjState.objCntMax = g_PikaObjState.objCnt;
+ }
/* gc single chain */
- if (NULL == g_PikaObjState.gcRoot) {
- g_PikaObjState.gcRoot = self;
+ if (NULL == g_PikaObjState.gcChain) {
+ g_PikaObjState.gcChain = self;
return;
}
/* append to head of gc chain */
- self->gcNext = g_PikaObjState.gcRoot;
- g_PikaObjState.gcRoot = self;
+ self->gcNext = g_PikaObjState.gcChain;
+ g_PikaObjState.gcChain = self;
#endif
}
@@ -1833,16 +1937,49 @@ void pikaGC_remove(PikaObj* self) {
#if !PIKA_GC_MARK_SWEEP_ENABLE
return;
#else
+ g_PikaObjState.objCnt--;
PikaObj* last = pikaGC_getLast(self);
if (NULL == last) {
/* remove head */
- g_PikaObjState.gcRoot = self->gcNext;
+ g_PikaObjState.gcChain = self->gcNext;
return;
}
last->gcNext = self->gcNext;
#endif
}
+void pikaGC_enable(PikaObj* self) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return;
+#else
+ obj_clearFlag(self, OBJ_FLAG_GC_ROOT);
+#endif
+}
+
+void pikaGC_lock(void) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return;
+#else
+ g_PikaObjState.markSweepBusy++;
+#endif
+}
+
+void pikaGC_unlock(void) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return;
+#else
+ g_PikaObjState.markSweepBusy--;
+#endif
+}
+
+PIKA_BOOL pikaGC_islock(void) {
+#if !PIKA_GC_MARK_SWEEP_ENABLE
+ return PIKA_FALSE;
+#else
+ return g_PikaObjState.markSweepBusy > 0;
+#endif
+}
+
PikaObj* New_PikaObj(Args* args) {
PikaObj* self = pikaMalloc(sizeof(PikaObj));
/* List */
@@ -1853,9 +1990,19 @@ PikaObj* New_PikaObj(Args* args) {
#if PIKA_GC_MARK_SWEEP_ENABLE
self->gcNext = NULL;
obj_setFlag(self, OBJ_FLAG_GC_ROOT);
+#endif
+#if PIKA_KERNAL_DEBUG_ENABLE
+ self->aName = NULL;
+ self->name = NULL;
+ self->parent = NULL;
+ self->isAlive = PIKA_TRUE;
+#endif
+#if PIKA_GC_MARK_SWEEP_ENABLE && PIKA_KERNAL_DEBUG_ENABLE
+ self->gcRoot = NULL;
#endif
/* append to gc chain */
pikaGC_append(self);
+ pikaGC_checkThreshold();
return self;
}
@@ -1873,9 +2020,7 @@ int32_t obj_newDirectObj(PikaObj* self, char* objName, NewFun newFunPtr) {
Arg* aNewObj = arg_newDirectObj(newFunPtr);
aNewObj = arg_setName(aNewObj, objName);
arg_setType(aNewObj, ARG_TYPE_OBJECT);
-#if PIKA_GC_MARK_SWEEP_ENABLE
- obj_clearFlag(arg_getPtr(aNewObj), OBJ_FLAG_GC_ROOT);
-#endif
+ // pikaGC_enable(arg_getPtr(aNewObj));
args_setArg(self->list, aNewObj);
return 0;
}
@@ -2002,26 +2147,25 @@ int obj_importModule(PikaObj* self, char* module_name) {
}
char* obj_toStr(PikaObj* self) {
- /* clang-format off */
- PIKA_PYTHON(
- __res = __str__()
- )
- /* clang-format on */
-
/* check method arg */
- Arg* method_arg = obj_getMethodArg(self, "__str__");
- if (NULL != method_arg) {
- arg_deinit(method_arg);
+ Arg* aMethod = obj_getMethodArg(self, "__str__");
+ if (NULL != aMethod) {
+ arg_deinit(aMethod);
+ /* clang-format off */
+ PIKA_PYTHON(
+ @res_str = __str__()
+ )
+ /* clang-format on */
const uint8_t bytes[] = {
0x08, 0x00, 0x00, 0x00, /* instruct array size */
- 0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x09, 0x00, /* instruct
- array */
- 0x0f, 0x00, 0x00, 0x00, /* const pool size */
- 0x00, 0x5f, 0x5f, 0x73, 0x74, 0x72, 0x5f, 0x5f, 0x00,
- 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, /* const pool */
+ 0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x09, 0x00, /* instruct array */
+ 0x12, 0x00, 0x00, 0x00, /* const pool size */
+ 0x00, 0x5f, 0x5f, 0x73, 0x74, 0x72, 0x5f, 0x5f, 0x00, 0x40,
+ 0x72, 0x65, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
- char* str_res = obj_getStr(self, "__res");
+ char* str_res = obj_cacheStr(self, obj_getStr(self, "@res_str"));
+ obj_removeArg(self, "@res_str");
return str_res;
}
@@ -2029,9 +2173,9 @@ char* obj_toStr(PikaObj* self) {
Args buffs = {0};
char* str_res =
strsFormat(&buffs, PIKA_SPRINTF_BUFF_SIZE, "
-[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/pikapython/dev/bench/)
+[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/PikaPython/dev/bench/)
# 1. Abstract
diff --git a/README_zh.md b/README_zh.md
index 6aa2516e9..9dcf9c5b0 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -24,7 +24,7 @@
商业合作
-[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/pikapython/dev/bench/)
+[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/PikaPython/dev/bench/)
# 1.简介
diff --git a/assets/README.mdpp b/assets/README.mdpp
index 4faecfc1c..0334beb57 100644
--- a/assets/README.mdpp
+++ b/assets/README.mdpp
@@ -26,7 +26,7 @@
Business
-[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/pikapython/dev/bench/)
+[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/PikaPython/dev/bench/)
# 1. Abstract
diff --git a/assets/README_zh.mdpp b/assets/README_zh.mdpp
index ebfd0d548..4d7ec8803 100644
--- a/assets/README_zh.mdpp
+++ b/assets/README_zh.mdpp
@@ -24,7 +24,7 @@
商业合作
-[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/pikapython/dev/bench/)
+[![image](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png)](https://pikastech.github.io/PikaPython/dev/bench/)
# 1.简介
From 8ad1427f5196806ef3359f8e7c72c5e086783a5d Mon Sep 17 00:00:00 2001
From: lyon
Date: Wed, 8 Mar 2023 20:33:45 +0800
Subject: [PATCH 17/41] fix parse err, open assert on rust-msc-
add test about while data[:]
add test for list_list slice
release cross build
---
port/linux/.vscode/launch.json | 2 +-
src/PikaParser.c | 2 +-
test/VM-test.cpp | 47 ++++++++++++++++++
test/parse-test.cpp | 48 +++++++++++++++++++
tools/pikaByteCodeGen/pika_config.h | 1 +
tools/pikaCompiler/rust-msc-latest-win10.exe | Bin 253966 -> 258574 bytes
6 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/port/linux/.vscode/launch.json b/port/linux/.vscode/launch.json
index a05274bf8..186f606e6 100644
--- a/port/linux/.vscode/launch.json
+++ b/port/linux/.vscode/launch.json
@@ -12,7 +12,7 @@
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
// "--gtest_filter=pikaui.*"
- "--gtest_filter=InstructUnit.base"
+ "--gtest_filter=parser.for_in_split"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
diff --git a/src/PikaParser.c b/src/PikaParser.c
index 816ba5979..cdcb0c341 100644
--- a/src/PikaParser.c
+++ b/src/PikaParser.c
@@ -2015,7 +2015,7 @@ AST* AST_parseLine_withBlockStack_withBlockDeepth(char* line,
char* arg_in = strsPopToken(list_buffs, &line_buff, ' ');
AST_setNodeAttr(ast, "arg_in", arg_in);
strsPopToken(list_buffs, &line_buff, ' ');
- char* list_in = strsPopToken(list_buffs, &line_buff, ':');
+ char* list_in = Cursor_splitCollect(list_buffs, line_buff, ":", 0);
list_in = strsAppend(list_buffs, "iter(", list_in);
list_in = strsAppend(list_buffs, list_in, ")");
list_in = strsCopy(&buffs, list_in);
diff --git a/test/VM-test.cpp b/test/VM-test.cpp
index f77ae7703..7a84fca78 100644
--- a/test/VM-test.cpp
+++ b/test/VM-test.cpp
@@ -2300,6 +2300,53 @@ TEST(vm, slice_str_end) {
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
+
+TEST(vm, slice_list) {
+ /* init */
+ g_PikaMemInfo.heapUsedMax = 0;
+ PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
+ /* run */
+ __platform_printf("BEGIN\r\n");
+ obj_run(pikaMain, "[1,2,3][1:]");
+ /* collect */
+ /* assert */
+ EXPECT_STREQ(log_buff[0], "[2, 3]\r\n");
+ EXPECT_STREQ(log_buff[1], "BEGIN\r\n");
+ /* deinit */
+ obj_deinit(pikaMain);
+ EXPECT_EQ(pikaMemNow(), 0);
+}
+
+TEST(vm, slice_list_list) {
+ /* init */
+ g_PikaMemInfo.heapUsedMax = 0;
+ PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
+ /* run */
+ __platform_printf("BEGIN\r\n");
+ obj_run(pikaMain,
+ "l = "
+ "[[\"ID\",\"TCP_URL\",\"VERSION\",\"SENSOR_SCAN_s\",\"DATA_UPLOAD_"
+ "s\",\"ACT_LOGIC_SCAN_s\",\"NETWORK\",\"AUTO_ACT\",\"START_TIME\"],"
+ "[\"ABC123\",\"iot.365sn.cn/operate/h/"
+ "1234\",\"V1.1\",60,1800,0.5,\"4G\",\"TRUE\",1669017826]]\n"
+ "ll = l[1:]\n"
+ "print(len(l), l)\n"
+ "print(len(ll),ll)\n");
+ /* collect */
+ /* assert */
+ EXPECT_STREQ(log_buff[0],
+ "9 ['ABC123', 'iot.365sn.cn/operate/h/1234', 'V1.1', 60, "
+ "1800, 0.500000, '4G', 'TRUE', 1669017826]\r\n");
+ EXPECT_STREQ(log_buff[1],
+ "2 [['ID', 'TCP_URL', 'VERSION', 'SENSOR_SCAN_s', "
+ "'DATA_UPLOAD_s', 'ACT_LOGIC_SCAN_s', 'NETWORK', 'AUTO_ACT', "
+ "'START_TIME'], ['ABC123', 'iot.365sn.cn/operate/h/1234', "
+ "'V1.1', 60, 1800, 0.500000, '4G', 'TRUE', 1669017826]]\r\n");
+ /* deinit */
+ obj_deinit(pikaMain);
+ EXPECT_EQ(pikaMemNow(), 0);
+}
+
#endif
#if !PIKA_NANO_ENABLE
diff --git a/test/parse-test.cpp b/test/parse-test.cpp
index 7e9a3f3ee..431bcc4c3 100644
--- a/test/parse-test.cpp
+++ b/test/parse-test.cpp
@@ -5408,6 +5408,54 @@ TEST(parser, not_in_or) {
EXPECT_EQ(pikaMemNow(), 0);
}
+TEST(parser, for_in_split) {
+ g_PikaMemInfo.heapUsedMax = 0;
+ Args* buffs = New_strBuff();
+ char* lines =
+ "for rows in data[1:]:\n"
+ " print(rows)"
+ "while data[1:]:\n"
+ " print(data[1:])\n";
+ printf("%s\r\n", lines);
+ char* pikaAsm = Parser_linesToAsm(buffs, lines);
+ printf("%s", pikaAsm);
+ EXPECT_STREQ(pikaAsm,
+ "B0\n"
+ "2 REF data\n"
+ "2 NUM 1\n"
+ "3 NUM 99999\n"
+ "2 OPT -\n"
+ "1 SLC \n"
+ "0 RUN iter\n"
+ "0 OUT $l0\n"
+ "B0\n"
+ "0 RUN $l0.__next__\n"
+ "0 OUT rows\n"
+ "0 EST rows\n"
+ "0 JEZ 2\n"
+ "B1\n"
+ "2 REF rows\n"
+ "1 RUN print\n"
+ "1 NUM 1\n"
+ "2 NUM 99999\n"
+ "1 OPT -\n"
+ "0 SLC \n"
+ "B1\n"
+ "2 REF data\n"
+ "2 NUM 1\n"
+ "3 NUM 99999\n"
+ "2 OPT -\n"
+ "1 SLC \n"
+ "0 RUN print\n"
+ "B0\n"
+ "0 JMP -1\n"
+ "B0\n"
+ "0 DEL $l0\n"
+ "B0\n");
+ args_deinit(buffs);
+ EXPECT_EQ(pikaMemNow(), 0);
+}
+
#endif
TEST_END
\ No newline at end of file
diff --git a/tools/pikaByteCodeGen/pika_config.h b/tools/pikaByteCodeGen/pika_config.h
index 2b56cf79f..1aea718db 100644
--- a/tools/pikaByteCodeGen/pika_config.h
+++ b/tools/pikaByteCodeGen/pika_config.h
@@ -5,3 +5,4 @@
#define PIKA_PATH_BUFF_SIZE 640
#define PIKA_BYTES_DEFAULT_SIZE 640
#define PIKA_READ_FILE_BUFF_SIZE 0x10000
+#define PIKA_ASSERT_ENABLE 1
\ No newline at end of file
diff --git a/tools/pikaCompiler/rust-msc-latest-win10.exe b/tools/pikaCompiler/rust-msc-latest-win10.exe
index 7d1a0f5f1ce8e0e01fbb89fb18886f3216f230dd..9e929c7b6779328aa7f70fc352def38f26f4cfa6 100644
GIT binary patch
delta 254134
zcmXtfc{r5c8}~f3Fvg4-`(QBkec!h%W9+*`*=Zrk(u|Ze!x&6MMhI;PQBiy&ifZgc
z-zcGwvGk2*WR#@U>-WCbd;WRub3dPRpL4F~dd~S==l-0FZ1lwy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