@@ -839,7 +839,7 @@ def freeze_children(self, prelude_ptr=None):
839
839
print ("};" )
840
840
print ()
841
841
842
- def freeze_raw_code (self , prelude_ptr = None , qstr_links = (), type_sig = 0 ):
842
+ def freeze_raw_code (self , prelude_ptr = None , type_sig = 0 ):
843
843
# Generate mp_raw_code_t.
844
844
print ("static const mp_raw_code_t raw_code_%s = {" % self .escaped_name )
845
845
print (" .kind = %s," % RawCode .code_kind_str [self .code_kind ])
@@ -879,8 +879,6 @@ def freeze_raw_code(self, prelude_ptr=None, qstr_links=(), type_sig=0):
879
879
print (" #endif" )
880
880
print (" #if MICROPY_EMIT_MACHINE_CODE" )
881
881
print (" .prelude_offset = %u," % self .prelude_offset )
882
- print (" .n_qstr = %u," % len (qstr_links ))
883
- print (" .qstr_link = NULL," ) # TODO
884
882
print (" #endif" )
885
883
print (" #endif" )
886
884
print (" #if MICROPY_EMIT_MACHINE_CODE" )
@@ -1038,47 +1036,6 @@ def disassemble(self):
1038
1036
ip += sz
1039
1037
self .disassemble_children ()
1040
1038
1041
- def _asm_thumb_rewrite_mov (self , pc , val ):
1042
- print (" (%u & 0xf0) | (%s >> 12)," % (self .fun_data [pc ], val ), end = "" )
1043
- print (" (%u & 0xfb) | (%s >> 9 & 0x04)," % (self .fun_data [pc + 1 ], val ), end = "" )
1044
- print (" (%s & 0xff)," % (val ,), end = "" )
1045
- print (" (%u & 0x07) | (%s >> 4 & 0x70)," % (self .fun_data [pc + 3 ], val ))
1046
-
1047
- def _link_qstr (self , pc , kind , qst ):
1048
- if kind == 0 :
1049
- # Generic 16-bit link
1050
- print (" %s & 0xff, %s >> 8," % (qst , qst ))
1051
- return 2
1052
- else :
1053
- # Architecture-specific link
1054
- is_obj = kind == 2
1055
- if is_obj :
1056
- qst = "((uintptr_t)MP_OBJ_NEW_QSTR(%s))" % qst
1057
- if config .native_arch in (
1058
- MP_NATIVE_ARCH_X86 ,
1059
- MP_NATIVE_ARCH_X64 ,
1060
- MP_NATIVE_ARCH_ARMV6 ,
1061
- MP_NATIVE_ARCH_XTENSA ,
1062
- MP_NATIVE_ARCH_XTENSAWIN ,
1063
- ):
1064
- print (
1065
- " %s & 0xff, (%s >> 8) & 0xff, (%s >> 16) & 0xff, %s >> 24,"
1066
- % (qst , qst , qst , qst )
1067
- )
1068
- return 4
1069
- elif MP_NATIVE_ARCH_ARMV6M <= config .native_arch <= MP_NATIVE_ARCH_ARMV7EMDP :
1070
- if is_obj :
1071
- # qstr object, movw and movt
1072
- self ._asm_thumb_rewrite_mov (pc , qst )
1073
- self ._asm_thumb_rewrite_mov (pc + 4 , "(%s >> 16)" % qst )
1074
- return 8
1075
- else :
1076
- # qstr number, movw instruction
1077
- self ._asm_thumb_rewrite_mov (pc , qst )
1078
- return 4
1079
- else :
1080
- assert 0
1081
-
1082
1039
def freeze (self ):
1083
1040
if self .scope_flags & ~ 0x0F :
1084
1041
raise FreezeError ("unable to freeze code with relocations" )
@@ -1098,21 +1055,13 @@ def freeze(self):
1098
1055
i = 0
1099
1056
qi = 0
1100
1057
while i < i_top :
1101
- if qi < len (self .qstr_links ) and i == self .qstr_links [qi ][0 ]:
1102
- # link qstr
1103
- qi_off , qi_kind , qi_val = self .qstr_links [qi ]
1104
- i += self ._link_qstr (i , qi_kind , qi_val .qstr_id )
1105
- qi += 1
1106
- else :
1107
- # copy machine code (max 16 bytes)
1108
- i16 = min (i + 16 , i_top )
1109
- if qi < len (self .qstr_links ):
1110
- i16 = min (i16 , self .qstr_links [qi ][0 ])
1111
- print (" " , end = "" )
1112
- for ii in range (i , i16 ):
1113
- print (" 0x%02x," % self .fun_data [ii ], end = "" )
1114
- print ()
1115
- i = i16
1058
+ # copy machine code (max 16 bytes)
1059
+ i16 = min (i + 16 , i_top )
1060
+ print (" " , end = "" )
1061
+ for ii in range (i , i16 ):
1062
+ print (" 0x%02x," % self .fun_data [ii ], end = "" )
1063
+ print ()
1064
+ i = i16
1116
1065
1117
1066
print ("};" )
1118
1067
@@ -1134,7 +1083,7 @@ def freeze(self):
1134
1083
print ("#endif" )
1135
1084
1136
1085
self .freeze_children (prelude_ptr )
1137
- self .freeze_raw_code (prelude_ptr , self .qstr_links , self . type_sig )
1086
+ self .freeze_raw_code (prelude_ptr , self .type_sig )
1138
1087
1139
1088
1140
1089
class MPYSegment :
0 commit comments