remove unused ids

This commit is contained in:
blueloveTH 2024-07-02 19:00:38 +08:00
parent 2d9a06a3fc
commit 163effc00d
3 changed files with 4 additions and 18 deletions

View File

@ -18,11 +18,6 @@ c11_sv pk_StrName__rmap2(uint16_t index);
void pk_StrName__initialize(); void pk_StrName__initialize();
void pk_StrName__finalize(); void pk_StrName__finalize();
extern uint16_t pk_id_add;
extern uint16_t pk_id_set;
extern uint16_t pk_id_long;
extern uint16_t pk_id_complex;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -28,11 +28,6 @@ void pk_StrName__initialize() {
for(int i = 0; i < _interned.count; i++) { for(int i = 0; i < _interned.count; i++) {
printf("%d: %s\n", i + 1, c11__getitem(char*, &_r_interned, i)); printf("%d: %s\n", i + 1, c11__getitem(char*, &_r_interned, i));
} }
pk_id_add = pk_StrName__map("add");
pk_id_set = pk_StrName__map("set");
pk_id_long = pk_StrName__map("long");
pk_id_complex = pk_StrName__map("complex");
} }
void pk_StrName__finalize() { void pk_StrName__finalize() {
@ -93,8 +88,3 @@ bool py_ismagicname(py_Name name){
return name <= __missing__; return name <= __missing__;
} }
///////////////////////////////////
uint16_t pk_id_add;
uint16_t pk_id_set;
uint16_t pk_id_long;
uint16_t pk_id_complex;

View File

@ -404,7 +404,7 @@ pk_FrameResult pk_VM__run_top_frame(pk_VM* self) {
case OP_BUILD_LONG: { case OP_BUILD_LONG: {
// [x] // [x]
py_Ref f = py_getdict(&self->builtins, pk_id_long); py_Ref f = py_getdict(&self->builtins, py_name("long"));
assert(f != NULL); assert(f != NULL);
if(!py_call(f, 1, TOP())) goto __ERROR; if(!py_call(f, 1, TOP())) goto __ERROR;
*TOP() = self->last_retval; *TOP() = self->last_retval;
@ -413,7 +413,7 @@ pk_FrameResult pk_VM__run_top_frame(pk_VM* self) {
case OP_BUILD_IMAG: { case OP_BUILD_IMAG: {
// [x] // [x]
py_Ref f = py_getdict(&self->builtins, pk_id_complex); py_Ref f = py_getdict(&self->builtins, py_name("complex"));
assert(f != NULL); assert(f != NULL);
py_TValue tmp = *TOP(); py_TValue tmp = *TOP();
*TOP() = *f; // [complex] *TOP() = *f; // [complex]
@ -467,8 +467,9 @@ pk_FrameResult pk_VM__run_top_frame(pk_VM* self) {
py_TValue* begin = SP() - byte.arg; py_TValue* begin = SP() - byte.arg;
py_Ref tmp = py_pushtmp(); py_Ref tmp = py_pushtmp();
py_newset(tmp); py_newset(tmp);
py_Name id_add = py_name("add");
for(int i = 0; i < byte.arg; i++) { for(int i = 0; i < byte.arg; i++) {
if(!py_callmethod(tmp, pk_id_add, 1, begin + i)) goto __ERROR; if(!py_callmethod(tmp, id_add, 1, begin + i)) goto __ERROR;
} }
SP() = begin; SP() = begin;
PUSH(tmp); PUSH(tmp);