comparison gen/runtime.cpp @ 1512:09734fb929c0

Make == for associative arrays test for equality, not identity. _aaEq was added to runtime/internal/aaA.d which forwards to TypeInfo_AssociativeArray.equals in genobj.d. On the codegen side, DtoAAEquals was added to gen/aa.cpp and is called from EqualExp::toElem in gen/toir.cpp. I assume that the frontend will produce an error if == is used on associative arrays of different type. This fixes DMD bug 1429.
author Christian Kamm <kamm incasoftware de>
date Sun, 21 Jun 2009 19:05:24 +0200
parents 76936858d1c6
children 982eb70e83b2 833337c65fd3
comparison
equal deleted inserted replaced
1511:5b66008246bb 1512:09734fb929c0
218 = NoAttrs.addAttr(1, NoCapture), 218 = NoAttrs.addAttr(1, NoCapture),
219 Attr_NoAlias_1_NoCapture 219 Attr_NoAlias_1_NoCapture
220 = Attr_1_NoCapture.addAttr(0, NoAlias), 220 = Attr_1_NoCapture.addAttr(0, NoAlias),
221 Attr_NoAlias_3_NoCapture 221 Attr_NoAlias_3_NoCapture
222 = Attr_NoAlias.addAttr(3, NoCapture), 222 = Attr_NoAlias.addAttr(3, NoCapture),
223 Attr_1_2_NoCapture
224 = Attr_1_NoCapture.addAttr(2, NoCapture),
223 Attr_1_3_NoCapture 225 Attr_1_3_NoCapture
224 = Attr_1_NoCapture.addAttr(3, NoCapture), 226 = Attr_1_NoCapture.addAttr(3, NoCapture),
225 Attr_1_4_NoCapture 227 Attr_1_4_NoCapture
226 = Attr_1_NoCapture.addAttr(4, NoCapture); 228 = Attr_1_NoCapture.addAttr(4, NoCapture);
227 229
736 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 738 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
737 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) 739 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
738 ->setAttributes(Attr_1_NoCapture); 740 ->setAttributes(Attr_1_NoCapture);
739 } 741 }
740 742
743 // int _aaEq(AA aa, AA ab, TypeInfo_AssociativeArray ti)
744 {
745 std::string fname("_aaEq");
746 std::vector<const LLType*> types;
747 types.push_back(aaTy);
748 types.push_back(aaTy);
749 types.push_back(typeInfoTy);
750 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
751 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
752 ->setAttributes(Attr_1_2_NoCapture);
753 }
754
741 ///////////////////////////////////////////////////////////////////////////////////// 755 /////////////////////////////////////////////////////////////////////////////////////
742 ///////////////////////////////////////////////////////////////////////////////////// 756 /////////////////////////////////////////////////////////////////////////////////////
743 ///////////////////////////////////////////////////////////////////////////////////// 757 /////////////////////////////////////////////////////////////////////////////////////
744 758
745 // void _moduleCtor() 759 // void _moduleCtor()