mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
restore befor OUT
This commit is contained in:
parent
e19d44cc92
commit
e98c6b4e13
1
.vscode/configurationCache.log
vendored
Normal file
1
.vscode/configurationCache.log
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"buildTargets":[],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}}
|
6
.vscode/dryrun.log
vendored
Normal file
6
.vscode/dryrun.log
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
make --dry-run --always-make --keep-going --print-directory
|
||||||
|
make: Entering directory '/root/pikascript'
|
||||||
|
make: Leaving directory '/root/pikascript'
|
||||||
|
|
||||||
|
make: *** No targets specified and no makefile found. Stop.
|
||||||
|
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"makefile.extensionOutputFolder": "./.vscode"
|
||||||
|
}
|
210
.vscode/targets.log
vendored
Normal file
210
.vscode/targets.log
vendored
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
make all --print-data-base --no-builtin-variables --no-builtin-rules --question
|
||||||
|
make: *** No rule to make target 'all'. Stop.
|
||||||
|
|
||||||
|
# GNU Make 4.3
|
||||||
|
# Built for x86_64-pc-linux-gnu
|
||||||
|
# Copyright (C) 1988-2020 Free Software Foundation, Inc.
|
||||||
|
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||||
|
# This is free software: you are free to change and redistribute it.
|
||||||
|
# There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
|
||||||
|
# Make data base, printed on Wed Aug 24 21:15:35 2022
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
|
||||||
|
# environment
|
||||||
|
REMOTE_CONTAINERS_SOCKETS = ["/tmp/vscode-ssh-auth-0cbbdc11027918311efe3bd284f60e72d4c31ea5.sock"]
|
||||||
|
# environment
|
||||||
|
LC_ALL = C
|
||||||
|
# environment
|
||||||
|
VSCODE_CWD = /root/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662
|
||||||
|
# default
|
||||||
|
MAKE_COMMAND := make
|
||||||
|
# environment
|
||||||
|
VSCODE_HANDLES_SIGPIPE = true
|
||||||
|
# automatic
|
||||||
|
@D = $(patsubst %/,%,$(dir $@))
|
||||||
|
# environment
|
||||||
|
VSCODE_HANDLES_UNCAUGHT_ERRORS = true
|
||||||
|
# default
|
||||||
|
.VARIABLES :=
|
||||||
|
# environment
|
||||||
|
PWD = /root/pikascript
|
||||||
|
# automatic
|
||||||
|
%D = $(patsubst %/,%,$(dir $%))
|
||||||
|
# environment
|
||||||
|
HOSTNAME = 438a9adb6812
|
||||||
|
# automatic
|
||||||
|
^D = $(patsubst %/,%,$(dir $^))
|
||||||
|
# automatic
|
||||||
|
%F = $(notdir $%)
|
||||||
|
# environment
|
||||||
|
LANG = C
|
||||||
|
# default
|
||||||
|
.LOADED :=
|
||||||
|
# default
|
||||||
|
.INCLUDE_DIRS = /usr/local/include /usr/include /usr/include
|
||||||
|
# makefile
|
||||||
|
MAKEFLAGS = pqrR
|
||||||
|
# makefile
|
||||||
|
CURDIR := /root/pikascript
|
||||||
|
# environment
|
||||||
|
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1
|
||||||
|
# environment
|
||||||
|
LESSOPEN = | /usr/bin/lesspipe %s
|
||||||
|
# automatic
|
||||||
|
*D = $(patsubst %/,%,$(dir $*))
|
||||||
|
# environment
|
||||||
|
MFLAGS = -pqrR
|
||||||
|
# environment
|
||||||
|
SSH_AUTH_SOCK = /tmp/vscode-ssh-auth-0cbbdc11027918311efe3bd284f60e72d4c31ea5.sock
|
||||||
|
# default
|
||||||
|
.SHELLFLAGS := -c
|
||||||
|
# automatic
|
||||||
|
+D = $(patsubst %/,%,$(dir $+))
|
||||||
|
# makefile
|
||||||
|
MAKEFILE_LIST :=
|
||||||
|
# automatic
|
||||||
|
@F = $(notdir $@)
|
||||||
|
# automatic
|
||||||
|
?D = $(patsubst %/,%,$(dir $?))
|
||||||
|
# automatic
|
||||||
|
*F = $(notdir $*)
|
||||||
|
# automatic
|
||||||
|
<D = $(patsubst %/,%,$(dir $<))
|
||||||
|
# environment
|
||||||
|
VSCODE_NLS_CONFIG = {"locale":"zh-cn","availableLanguages":{"*":"zh-cn"},"_languagePackId":"cc0490d1397af23dc5bf44a96fe15dbb.zh-cn","_translationsConfigFile":"/root/.vscode-server/data/clp/cc0490d1397af23dc5bf44a96fe15dbb.zh-cn/tcf.json","_cacheRoot":"/root/.vscode-server/data/clp/cc0490d1397af23dc5bf44a96fe15dbb.zh-cn","_resolvedLanguagePackCoreLocation":"/root/.vscode-server/data/clp/cc0490d1397af23dc5bf44a96fe15dbb.zh-cn/e4503b30fc78200f846c62cf8091b76ff5547662","_corruptedFile":"/root/.vscode-server/data/clp/cc0490d1397af23dc5bf44a96fe15dbb.zh-cn/corrupted.info","_languagePackSupport":true}
|
||||||
|
# default
|
||||||
|
MAKE_HOST := x86_64-pc-linux-gnu
|
||||||
|
# makefile
|
||||||
|
SHELL = /bin/sh
|
||||||
|
# default
|
||||||
|
MAKECMDGOALS := all
|
||||||
|
# environment
|
||||||
|
SHLVL = 1
|
||||||
|
# environment
|
||||||
|
MAKELEVEL := 0
|
||||||
|
# default
|
||||||
|
MAKE = $(MAKE_COMMAND)
|
||||||
|
# environment
|
||||||
|
PATH = /root/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/bin/remote-cli:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
# default
|
||||||
|
MAKEFILES :=
|
||||||
|
# automatic
|
||||||
|
^F = $(notdir $^)
|
||||||
|
# environment
|
||||||
|
REMOTE_CONTAINERS_IPC = /tmp/vscode-remote-containers-ipc-0cbbdc11027918311efe3bd284f60e72d4c31ea5.sock
|
||||||
|
# environment
|
||||||
|
LESSCLOSE = /usr/bin/lesspipe %s %s
|
||||||
|
# environment
|
||||||
|
REMOTE_CONTAINERS = true
|
||||||
|
# automatic
|
||||||
|
?F = $(notdir $?)
|
||||||
|
# environment
|
||||||
|
LS_COLORS =
|
||||||
|
# automatic
|
||||||
|
+F = $(notdir $+)
|
||||||
|
# 'override' directive
|
||||||
|
GNUMAKEFLAGS :=
|
||||||
|
# environment
|
||||||
|
BROWSER = /root/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/bin/helpers/browser.sh
|
||||||
|
# makefile
|
||||||
|
.DEFAULT_GOAL :=
|
||||||
|
# default
|
||||||
|
MAKE_VERSION := 4.3
|
||||||
|
# environment
|
||||||
|
DEBUGINFOD_URLS =
|
||||||
|
# environment
|
||||||
|
VSCODE_AGENT_FOLDER = /root/.vscode-server
|
||||||
|
# environment
|
||||||
|
_ = /usr/bin/cat
|
||||||
|
# environment
|
||||||
|
RUSTUP_DIST_SERVER = https://mirrors.ustc.edu.cn/rust-static
|
||||||
|
# environment
|
||||||
|
VSCODE_IPC_HOOK_CLI = /tmp/vscode-ipc-b1f18302-a396-4580-a229-16a9f05461ec.sock
|
||||||
|
# environment
|
||||||
|
RUSTUP_UPDATE_ROOT = https://mirrors.ustc.edu.cn/rust-static/rustup
|
||||||
|
# environment
|
||||||
|
VSCODE_AMD_ENTRYPOINT = vs/workbench/api/node/extensionHostProcess
|
||||||
|
# environment
|
||||||
|
HOME = /root
|
||||||
|
# environment
|
||||||
|
ELECTRON_RUN_AS_NODE = 1
|
||||||
|
# default
|
||||||
|
.RECIPEPREFIX :=
|
||||||
|
# automatic
|
||||||
|
<F = $(notdir $<)
|
||||||
|
# default
|
||||||
|
SUFFIXES :=
|
||||||
|
# default
|
||||||
|
.FEATURES := target-specific order-only second-expansion else-if shortest-stem undefine oneshell nocomment grouped-target extra-prereqs archives jobserver output-sync check-symlink load
|
||||||
|
# variable set hash-table stats:
|
||||||
|
# Load=63/1024=6%, Rehash=0, Collisions=1/90=1%
|
||||||
|
|
||||||
|
# Pattern-specific Variable Values
|
||||||
|
|
||||||
|
# No pattern-specific variable values.
|
||||||
|
|
||||||
|
# Directories
|
||||||
|
|
||||||
|
# . (device 250, inode 1246684): 23 files, no impossibilities.
|
||||||
|
|
||||||
|
# 23 files, no impossibilities in 1 directories.
|
||||||
|
|
||||||
|
# Implicit Rules
|
||||||
|
|
||||||
|
# No implicit rules.
|
||||||
|
|
||||||
|
# Files
|
||||||
|
|
||||||
|
# Not a target:
|
||||||
|
Makefile:
|
||||||
|
# Implicit rule search has been done.
|
||||||
|
# File does not exist.
|
||||||
|
# File has been updated.
|
||||||
|
# Failed to be updated.
|
||||||
|
|
||||||
|
# Not a target:
|
||||||
|
.DEFAULT:
|
||||||
|
# Implicit rule search has not been done.
|
||||||
|
# Modification time never checked.
|
||||||
|
# File has not been updated.
|
||||||
|
|
||||||
|
# Not a target:
|
||||||
|
all:
|
||||||
|
# Command line target.
|
||||||
|
# Implicit rule search has been done.
|
||||||
|
# File does not exist.
|
||||||
|
# File has not been updated.
|
||||||
|
|
||||||
|
# Not a target:
|
||||||
|
makefile:
|
||||||
|
# Implicit rule search has been done.
|
||||||
|
# File does not exist.
|
||||||
|
# File has been updated.
|
||||||
|
# Failed to be updated.
|
||||||
|
|
||||||
|
# Not a target:
|
||||||
|
GNUmakefile:
|
||||||
|
# Implicit rule search has been done.
|
||||||
|
# File does not exist.
|
||||||
|
# File has been updated.
|
||||||
|
# Failed to be updated.
|
||||||
|
|
||||||
|
# files hash-table stats:
|
||||||
|
# Load=6/1024=1%, Rehash=0, Collisions=0/15=0%
|
||||||
|
# VPATH Search Paths
|
||||||
|
|
||||||
|
# No 'vpath' search paths.
|
||||||
|
|
||||||
|
# No general ('VPATH' variable) search path.
|
||||||
|
|
||||||
|
# strcache buffers: 1 (0) / strings = 31 / storage = 273 B / avg = 8 B
|
||||||
|
# current buf: size = 8162 B / used = 273 B / count = 31 / avg = 8 B
|
||||||
|
|
||||||
|
# strcache performance: lookups = 34 / hit rate = 8%
|
||||||
|
# hash-table stats:
|
||||||
|
# Load=31/8192=0%, Rehash=0, Collisions=0/34=0%
|
||||||
|
# Finished Make data base on Wed Aug 24 21:15:35 2022
|
||||||
|
|
||||||
|
|
@ -1198,7 +1198,6 @@ TEST(VM, science_num) {
|
|||||||
EXPECT_EQ(pikaMemNow(), 0);
|
EXPECT_EQ(pikaMemNow(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !PIKA_NANO_ENABLE
|
|
||||||
TEST(VM, issue_I5OJQB) {
|
TEST(VM, issue_I5OJQB) {
|
||||||
char* line = "s = '\\\\'";
|
char* line = "s = '\\\\'";
|
||||||
PikaObj* self = newRootObj("root", New_PikaStdLib_SysObj);
|
PikaObj* self = newRootObj("root", New_PikaStdLib_SysObj);
|
||||||
@ -1206,23 +1205,7 @@ TEST(VM, issue_I5OJQB) {
|
|||||||
/* collect */
|
/* collect */
|
||||||
char* s = obj_getStr(self, "s");
|
char* s = obj_getStr(self, "s");
|
||||||
/* assert */
|
/* assert */
|
||||||
EXPECT_STREQ(log_buff[0], "1");
|
EXPECT_STREQ(s, "\\");
|
||||||
/* deinit */
|
|
||||||
obj_deinit(self);
|
|
||||||
EXPECT_EQ(pikaMemNow(), 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST(vm, keyword_2) {
|
|
||||||
char* line =
|
|
||||||
"def test(a, b):\n"
|
|
||||||
" print(a, b)\n"
|
|
||||||
"test(a=1, b= 2)";
|
|
||||||
PikaObj* self = newRootObj("root", New_PikaStdLib_SysObj);
|
|
||||||
obj_run(self, line);
|
|
||||||
/* collect */
|
|
||||||
/* assert */
|
|
||||||
EXPECT_STREQ(log_buff[0], "1 2\r\n");
|
|
||||||
/* deinit */
|
/* deinit */
|
||||||
obj_deinit(self);
|
obj_deinit(self);
|
||||||
EXPECT_EQ(pikaMemNow(), 0);
|
EXPECT_EQ(pikaMemNow(), 0);
|
||||||
|
@ -4000,23 +4000,3 @@ TEST(parser, issues_I5OJQB) {
|
|||||||
args_deinit(buffs);
|
args_deinit(buffs);
|
||||||
EXPECT_EQ(pikaMemNow(), 0);
|
EXPECT_EQ(pikaMemNow(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(parser, keyword1) {
|
|
||||||
pikaMemInfo.heapUsedMax = 0;
|
|
||||||
Args* buffs = New_strBuff();
|
|
||||||
char* lines = "test(a=1, b ='test')";
|
|
||||||
__platform_printf("%s\n", lines);
|
|
||||||
char* pikaAsm = Parser_linesToAsm(buffs, lines);
|
|
||||||
__platform_printf("%s", pikaAsm);
|
|
||||||
EXPECT_STREQ(pikaAsm,
|
|
||||||
"B0\n"
|
|
||||||
"1 NUM 1\n"
|
|
||||||
"1 OUT a\n"
|
|
||||||
"1 STR test\n"
|
|
||||||
"1 OUT b\n"
|
|
||||||
"0 RUN test\n"
|
|
||||||
"B0\n");
|
|
||||||
args_deinit(buffs);
|
|
||||||
EXPECT_EQ(pikaMemNow(), 0);
|
|
||||||
}
|
|
||||||
|
20
src/PikaVM.c
20
src/PikaVM.c
@ -69,12 +69,6 @@ static int VMState_getBlockDeepthNow(VMState* vm) {
|
|||||||
return instructUnit_getBlockDeepth(ins_unit);
|
return instructUnit_getBlockDeepth(ins_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int VMState_getInvokeDeepthNow(VMState* vm) {
|
|
||||||
/* support run byteCode */
|
|
||||||
InstructUnit* ins_unit = VMState_getInstructNow(vm);
|
|
||||||
return instructUnit_getInvokeDeepth(ins_unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char* VMState_getConstWithInstructUnit(VMState* vm,
|
static char* VMState_getConstWithInstructUnit(VMState* vm,
|
||||||
InstructUnit* ins_unit) {
|
InstructUnit* ins_unit) {
|
||||||
return constPool_getByOffset(&(vm->bytecode_frame->const_pool),
|
return constPool_getByOffset(&(vm->bytecode_frame->const_pool),
|
||||||
@ -1091,18 +1085,10 @@ static Arg* VM_instruction_handler_OUT(PikaObj* self,
|
|||||||
char* data,
|
char* data,
|
||||||
Arg* arg_ret_reg) {
|
Arg* arg_ret_reg) {
|
||||||
arg_newReg(outArg_reg, PIKA_ARG_BUFF_SIZE);
|
arg_newReg(outArg_reg, PIKA_ARG_BUFF_SIZE);
|
||||||
|
|
||||||
Arg* outArg = stack_popArg(&vm->stack, &outArg_reg);
|
Arg* outArg = stack_popArg(&vm->stack, &outArg_reg);
|
||||||
// Arg* outArg = stack_popArg_alloc(&vm->stack);
|
// Arg* outArg = stack_popArg_alloc(&vm->stack);
|
||||||
ArgType outArg_type = arg_getType(outArg);
|
ArgType outArg_type = arg_getType(outArg);
|
||||||
|
|
||||||
if (VMState_getInvokeDeepthNow(vm) > 0) {
|
|
||||||
/* in block, is a keyword arg */
|
|
||||||
arg_setIsKeyword(outArg, PIKA_TRUE);
|
|
||||||
arg_setName(outArg, data);
|
|
||||||
return arg_copy_noalloc(outArg, arg_ret_reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_checkLReg(data)) {
|
if (_checkLReg(data)) {
|
||||||
uint8_t index = _getLRegIndex(data);
|
uint8_t index = _getLRegIndex(data);
|
||||||
if (argType_isObject(outArg_type)) {
|
if (argType_isObject(outArg_type)) {
|
||||||
@ -1210,7 +1196,8 @@ static Arg* VM_instruction_handler_JEZ(PikaObj* self,
|
|||||||
VMState* vm,
|
VMState* vm,
|
||||||
char* data,
|
char* data,
|
||||||
Arg* arg_ret_reg) {
|
Arg* arg_ret_reg) {
|
||||||
int thisBlockDeepth = VMState_getBlockDeepthNow(vm);
|
int thisBlockDeepth;
|
||||||
|
thisBlockDeepth = VMState_getBlockDeepthNow(vm);
|
||||||
int jmp_expect = fast_atoi(data);
|
int jmp_expect = fast_atoi(data);
|
||||||
arg_newReg(pika_assertArg_reg, PIKA_ARG_BUFF_SIZE);
|
arg_newReg(pika_assertArg_reg, PIKA_ARG_BUFF_SIZE);
|
||||||
Arg* pika_assertArg = stack_popArg(&(vm->stack), &pika_assertArg_reg);
|
Arg* pika_assertArg = stack_popArg(&(vm->stack), &pika_assertArg_reg);
|
||||||
@ -1248,9 +1235,6 @@ static uint8_t VMState_getInputArgNum(VMState* vm) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (invode_deepth == invoke_deepth_this + 1) {
|
if (invode_deepth == invoke_deepth_this + 1) {
|
||||||
if (instructUnit_getInstruct(ins_unit_now) == OUT) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
if (instructUnit_getIsNewLine(ins_unit_now)) {
|
if (instructUnit_getIsNewLine(ins_unit_now)) {
|
||||||
|
@ -61,12 +61,12 @@ typedef union {
|
|||||||
uint8_t* buffer;
|
uint8_t* buffer;
|
||||||
} _arg_union;
|
} _arg_union;
|
||||||
struct Arg {
|
struct Arg {
|
||||||
_arg_union _; // 32/64 bit
|
_arg_union _;
|
||||||
uint32_t size; // 32 bit
|
uint32_t size;
|
||||||
uint8_t type; // 8 bit
|
uint8_t type;
|
||||||
uint32_t flag; //
|
PIKA_BOOL serialized;
|
||||||
Hash name_hash; // 32bit
|
Hash name_hash;
|
||||||
uint8_t content[]; // n bit
|
uint8_t content[];
|
||||||
};
|
};
|
||||||
|
|
||||||
Arg* arg_getNext(Arg* self);
|
Arg* arg_getNext(Arg* self);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user