@@ -1123,21 +1123,23 @@ def _quote(self, value, typ, path):
1123
1123
llty = self .llty_of_type (typ )
1124
1124
1125
1125
if types .is_constructor (typ ) or types .is_instance (typ ):
1126
+ llglobal = None
1126
1127
llfields = []
1127
1128
for attr in typ .attributes :
1128
1129
if attr == "__objectid__" :
1129
1130
objectid = self .object_map .store (value )
1130
1131
llfields .append (ll .Constant (lli32 , objectid ))
1131
- global_name = "object.{}" .format (objectid )
1132
+
1133
+ assert llglobal is None
1134
+ llglobal = ll .GlobalVariable (self .llmodule , llty .pointee ,
1135
+ name = "object.{}" .format (objectid ))
1136
+ self .llobject_map [value_id ] = llglobal
1132
1137
else :
1133
1138
llfields .append (self ._quote (getattr (value , attr ), typ .attributes [attr ],
1134
1139
lambda : path () + [attr ]))
1135
- llconst = ll .Constant (llty .pointee , llfields )
1136
1140
1137
- llglobal = ll .GlobalVariable (self .llmodule , llconst .type , global_name )
1138
- llglobal .initializer = llconst
1141
+ llglobal .initializer = ll .Constant (llty .pointee , llfields )
1139
1142
llglobal .linkage = "private"
1140
- self .llobject_map [value_id ] = llglobal
1141
1143
return llglobal
1142
1144
elif builtins .is_none (typ ):
1143
1145
assert value is None
0 commit comments