Left: | ||
Right: |
OLD | NEW |
---|---|
1 //===-- JITEmitter.cpp - Write machine code to executable memory ----------===// | 1 //===-- JITEmitter.cpp - Write machine code to executable memory ----------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file defines a MachineCodeEmitter object that is used by the JIT to | 10 // This file defines a MachineCodeEmitter object that is used by the JIT to |
(...skipping 30 matching lines...) Expand all Loading... | |
41 #include "llvm/ADT/SmallVector.h" | 41 #include "llvm/ADT/SmallVector.h" |
42 #include "llvm/ADT/Statistic.h" | 42 #include "llvm/ADT/Statistic.h" |
43 #include <algorithm> | 43 #include <algorithm> |
44 #ifndef NDEBUG | 44 #ifndef NDEBUG |
45 #include <iomanip> | 45 #include <iomanip> |
46 #endif | 46 #endif |
47 using namespace llvm; | 47 using namespace llvm; |
48 | 48 |
49 STATISTIC(NumBytes, "Number of bytes of machine code compiled"); | 49 STATISTIC(NumBytes, "Number of bytes of machine code compiled"); |
50 STATISTIC(NumRelos, "Number of relocations applied"); | 50 STATISTIC(NumRelos, "Number of relocations applied"); |
51 STATISTIC(NumRetries, "Number of retries with more memory"); | |
51 static JIT *TheJIT = 0; | 52 static JIT *TheJIT = 0; |
52 | 53 |
53 | 54 |
54 //===----------------------------------------------------------------------===// | 55 //===----------------------------------------------------------------------===// |
55 // JIT lazy compilation code. | 56 // JIT lazy compilation code. |
56 // | 57 // |
57 namespace { | 58 namespace { |
58 class JITResolverState { | 59 class JITResolverState { |
59 public: | 60 public: |
60 typedef std::map<AssertingVH<Function>, void*> FunctionToStubMapTy; | 61 typedef std::map<AssertingVH<Function>, void*> FunctionToStubMapTy; |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 namespace { | 547 namespace { |
547 /// JITEmitter - The JIT implementation of the MachineCodeEmitter, which is | 548 /// JITEmitter - The JIT implementation of the MachineCodeEmitter, which is |
548 /// used to output functions to memory for execution. | 549 /// used to output functions to memory for execution. |
549 class JITEmitter : public JITCodeEmitter { | 550 class JITEmitter : public JITCodeEmitter { |
550 JITMemoryManager *MemMgr; | 551 JITMemoryManager *MemMgr; |
551 | 552 |
552 // When outputting a function stub in the context of some other function, we | 553 // When outputting a function stub in the context of some other function, we |
553 // save BufferBegin/BufferEnd/CurBufferPtr here. | 554 // save BufferBegin/BufferEnd/CurBufferPtr here. |
554 uint8_t *SavedBufferBegin, *SavedBufferEnd, *SavedCurBufferPtr; | 555 uint8_t *SavedBufferBegin, *SavedBufferEnd, *SavedCurBufferPtr; |
555 | 556 |
557 // When reattempting to JIT a function after running out of space, we store | |
558 // the minimum size for the new allocation here. When we successfully emit | |
559 // the function, we reset this back to zero so it doesn't keep growing. | |
560 uintptr_t MinSize; | |
561 | |
556 /// Relocations - These are the relocations that the function needs, as | 562 /// Relocations - These are the relocations that the function needs, as |
557 /// emitted. | 563 /// emitted. |
558 std::vector<MachineRelocation> Relocations; | 564 std::vector<MachineRelocation> Relocations; |
559 ···· | 565 ···· |
560 /// MBBLocations - This vector is a mapping from MBB ID's to their address. | 566 /// MBBLocations - This vector is a mapping from MBB ID's to their address. |
561 /// It is filled in by the StartMachineBasicBlock callback and queried by | 567 /// It is filled in by the StartMachineBasicBlock callback and queried by |
562 /// the getMachineBasicBlockAddress callback. | 568 /// the getMachineBasicBlockAddress callback. |
563 std::vector<uintptr_t> MBBLocations; | 569 std::vector<uintptr_t> MBBLocations; |
564 | 570 |
565 /// ConstantPool - The constant pool for the current function. | 571 /// ConstantPool - The constant pool for the current function. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
613 DenseMap<void *, SmallPtrSet<const Function*, 1> > StubFnRefs; | 619 DenseMap<void *, SmallPtrSet<const Function*, 1> > StubFnRefs; |
614 ···· | 620 ···· |
615 // ExtFnStubs - A map of external function names to stubs which have entries | 621 // ExtFnStubs - A map of external function names to stubs which have entries |
616 // in the JITResolver's ExternalFnToStubMap. | 622 // in the JITResolver's ExternalFnToStubMap. |
617 StringMap<void *> ExtFnStubs; | 623 StringMap<void *> ExtFnStubs; |
618 | 624 |
619 // MCI - A pointer to a MachineCodeInfo object to update with information. | 625 // MCI - A pointer to a MachineCodeInfo object to update with information. |
620 MachineCodeInfo *MCI; | 626 MachineCodeInfo *MCI; |
621 | 627 |
622 public: | 628 public: |
623 JITEmitter(JIT &jit, JITMemoryManager *JMM) : Resolver(jit), CurFn(0), MCI(0 ) { | 629 JITEmitter(JIT &jit, JITMemoryManager *JMM) |
630 : MinSize(0), Resolver(jit), CurFn(0), MCI(0) { | |
624 MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager(); | 631 MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager(); |
625 if (jit.getJITInfo().needsGOT()) { | 632 if (jit.getJITInfo().needsGOT()) { |
626 MemMgr->AllocateGOT(); | 633 MemMgr->AllocateGOT(); |
627 DOUT << "JIT is managing a GOT\n"; | 634 DOUT << "JIT is managing a GOT\n"; |
628 } | 635 } |
629 | 636 |
630 if (ExceptionHandling) DE = new JITDwarfEmitter(jit); | 637 if (ExceptionHandling) DE = new JITDwarfEmitter(jit); |
631 } | 638 } |
632 ~JITEmitter() {· | 639 ~JITEmitter() {· |
633 delete MemMgr; | 640 delete MemMgr; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 | 680 |
674 virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const; | 681 virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const; |
675 virtual uintptr_t getJumpTableEntryAddress(unsigned Entry) const; | 682 virtual uintptr_t getJumpTableEntryAddress(unsigned Entry) const; |
676 | 683 |
677 virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const { | 684 virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const { |
678 assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&· | 685 assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&· |
679 MBBLocations[MBB->getNumber()] && "MBB not emitted!"); | 686 MBBLocations[MBB->getNumber()] && "MBB not emitted!"); |
680 return MBBLocations[MBB->getNumber()]; | 687 return MBBLocations[MBB->getNumber()]; |
681 } | 688 } |
682 | 689 |
690 /// retryWithMoreMemory - Log a retry and deallocate all memory for the | |
691 /// given function. Increase the minimum allocation size so that we get | |
692 /// more memory next time. | |
693 void retryWithMoreMemory(MachineFunction &F); | |
694 | |
683 /// deallocateMemForFunction - Deallocate all memory for the specified | 695 /// deallocateMemForFunction - Deallocate all memory for the specified |
684 /// function body. | 696 /// function body. |
685 void deallocateMemForFunction(Function *F); | 697 void deallocateMemForFunction(const Function *F); |
686 | 698 |
687 /// AddStubToCurrentFunction - Mark the current function being JIT'd as | 699 /// AddStubToCurrentFunction - Mark the current function being JIT'd as |
688 /// using the stub at the specified address. Allows | 700 /// using the stub at the specified address. Allows |
689 /// deallocateMemForFunction to also remove stubs no longer referenced. | 701 /// deallocateMemForFunction to also remove stubs no longer referenced. |
690 void AddStubToCurrentFunction(void *Stub); | 702 void AddStubToCurrentFunction(void *Stub); |
691 ···· | 703 ···· |
692 /// getExternalFnStubs - Accessor for the JIT to find stubs emitted for | 704 /// getExternalFnStubs - Accessor for the JIT to find stubs emitted for |
693 /// MachineRelocations that reference external functions by name. | 705 /// MachineRelocations that reference external functions by name. |
694 const StringMap<void*> &getExternalFnStubs() const { return ExtFnStubs; } | 706 const StringMap<void*> &getExternalFnStubs() const { return ExtFnStubs; } |
695 ···· | 707 ···· |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
993 << F.getFunction()->getName() << "\n"; | 1005 << F.getFunction()->getName() << "\n"; |
994 | 1006 |
995 uintptr_t ActualSize = 0; | 1007 uintptr_t ActualSize = 0; |
996 // Set the memory writable, if it's not already | 1008 // Set the memory writable, if it's not already |
997 MemMgr->setMemoryWritable(); | 1009 MemMgr->setMemoryWritable(); |
998 if (MemMgr->NeedsExactSize()) { | 1010 if (MemMgr->NeedsExactSize()) { |
999 DOUT << "JIT: ExactSize\n"; | 1011 DOUT << "JIT: ExactSize\n"; |
1000 const TargetInstrInfo* TII = F.getTarget().getInstrInfo(); | 1012 const TargetInstrInfo* TII = F.getTarget().getInstrInfo(); |
1001 MachineJumpTableInfo *MJTI = F.getJumpTableInfo(); | 1013 MachineJumpTableInfo *MJTI = F.getJumpTableInfo(); |
1002 MachineConstantPool *MCP = F.getConstantPool(); | 1014 MachineConstantPool *MCP = F.getConstantPool(); |
1003 | 1015 |
nlewycky
2009/06/17 04:53:57
Don't include unrelated whitespace changes when yo
Reid Kleckner
2009/06/17 20:29:57
Done.
| |
1004 // Ensure the constant pool/jump table info is at least 4-byte aligned. | 1016 // Ensure the constant pool/jump table info is at least 4-byte aligned. |
1005 ActualSize = RoundUpToAlign(ActualSize, 16); | 1017 ActualSize = RoundUpToAlign(ActualSize, 16); |
1006 | 1018 |
1007 // Add the alignment of the constant pool | 1019 // Add the alignment of the constant pool |
1008 ActualSize = RoundUpToAlign(ActualSize, MCP->getConstantPoolAlignment()); | 1020 ActualSize = RoundUpToAlign(ActualSize, MCP->getConstantPoolAlignment()); |
1009 | 1021 |
1010 // Add the constant pool size | 1022 // Add the constant pool size |
1011 ActualSize += GetConstantPoolSizeInBytes(MCP, TheJIT->getTargetData()); | 1023 ActualSize += GetConstantPoolSizeInBytes(MCP, TheJIT->getTargetData()); |
1012 | 1024 |
1013 // Add the aligment of the jump table info | 1025 // Add the aligment of the jump table info |
1014 ActualSize = RoundUpToAlign(ActualSize, MJTI->getAlignment()); | 1026 ActualSize = RoundUpToAlign(ActualSize, MJTI->getAlignment()); |
1015 | 1027 |
1016 // Add the jump table size | 1028 // Add the jump table size |
1017 ActualSize += GetJumpTableSizeInBytes(MJTI); | 1029 ActualSize += GetJumpTableSizeInBytes(MJTI); |
1018 | 1030 |
1019 // Add the alignment for the function | 1031 // Add the alignment for the function |
1020 ActualSize = RoundUpToAlign(ActualSize, | 1032 ActualSize = RoundUpToAlign(ActualSize, |
1021 std::max(F.getFunction()->getAlignment(), 8U)); | 1033 std::max(F.getFunction()->getAlignment(), 8U)); |
1022 | 1034 |
1023 // Add the function size | 1035 // Add the function size |
1024 ActualSize += TII->GetFunctionSizeInBytes(F); | 1036 ActualSize += TII->GetFunctionSizeInBytes(F); |
1025 | 1037 |
1026 DOUT << "JIT: ActualSize before globals " << ActualSize << "\n"; | 1038 DOUT << "JIT: ActualSize before globals " << ActualSize << "\n"; |
1027 // Add the size of the globals that will be allocated after this function. | 1039 // Add the size of the globals that will be allocated after this function. |
1028 // These are all the ones referenced from this function that were not | 1040 // These are all the ones referenced from this function that were not |
1029 // previously allocated. | 1041 // previously allocated. |
1030 ActualSize += GetSizeOfGlobalsInBytes(F); | 1042 ActualSize += GetSizeOfGlobalsInBytes(F); |
1031 DOUT << "JIT: ActualSize after globals " << ActualSize << "\n"; | 1043 DOUT << "JIT: ActualSize after globals " << ActualSize << "\n"; |
1044 } else if (MinSize > 0) { | |
1045 // MinSize will be non-zero on reallocation attempts. | |
1046 ActualSize = MinSize; | |
1032 } | 1047 } |
1033 | 1048 |
1034 BufferBegin = CurBufferPtr = MemMgr->startFunctionBody(F.getFunction(), | 1049 BufferBegin = CurBufferPtr = MemMgr->startFunctionBody(F.getFunction(), |
1035 ActualSize); | 1050 ActualSize); |
1036 BufferEnd = BufferBegin+ActualSize; | 1051 BufferEnd = BufferBegin+ActualSize; |
1037 | 1052 |
1038 // Ensure the constant pool/jump table info is at least 4-byte aligned. | 1053 // Ensure the constant pool/jump table info is at least 4-byte aligned. |
1039 emitAlignment(16); | 1054 emitAlignment(16); |
1040 | 1055 |
1041 emitConstantPool(F.getConstantPool()); | 1056 emitConstantPool(F.getConstantPool()); |
1042 initJumpTableInfo(F.getJumpTableInfo()); | 1057 initJumpTableInfo(F.getJumpTableInfo()); |
1043 | 1058 |
1044 // About to start emitting the machine code for the function. | 1059 // About to start emitting the machine code for the function. |
1045 emitAlignment(std::max(F.getFunction()->getAlignment(), 8U)); | 1060 emitAlignment(std::max(F.getFunction()->getAlignment(), 8U)); |
1046 TheJIT->updateGlobalMapping(F.getFunction(), CurBufferPtr); | 1061 TheJIT->updateGlobalMapping(F.getFunction(), CurBufferPtr); |
1047 | 1062 |
1048 MBBLocations.clear(); | 1063 MBBLocations.clear(); |
1049 } | 1064 } |
1050 | 1065 |
1051 bool JITEmitter::finishFunction(MachineFunction &F) { | 1066 bool JITEmitter::finishFunction(MachineFunction &F) { |
1052 if (CurBufferPtr == BufferEnd) { | 1067 if (CurBufferPtr == BufferEnd) { |
1053 // FIXME: Allocate more space, then try again. | 1068 // We must call endFunctionBody before retrying, because |
1054 cerr << "JIT: Ran out of space for generated machine code!\n"; | 1069 // deallocateMemForFunction requires it. |
1055 abort(); | 1070 MemMgr->endFunctionBody(F.getFunction(), BufferBegin, CurBufferPtr); |
1071 retryWithMoreMemory(F); | |
1072 return true; | |
1056 } | 1073 } |
1057 | 1074 |
1058 emitJumpTableInfo(F.getJumpTableInfo()); | 1075 emitJumpTableInfo(F.getJumpTableInfo()); |
1059 | 1076 |
1060 // FnStart is the start of the text, not the start of the constant pool and | 1077 // FnStart is the start of the text, not the start of the constant pool and |
1061 // other per-function data. | 1078 // other per-function data. |
1062 uint8_t *FnStart = | 1079 uint8_t *FnStart = |
1063 (uint8_t *)TheJIT->getPointerToGlobalIfAvailable(F.getFunction()); | 1080 (uint8_t *)TheJIT->getPointerToGlobalIfAvailable(F.getFunction()); |
1064 | 1081 |
1065 // FnEnd is the end of the function's machine code. | 1082 // FnEnd is the end of the function's machine code. |
1066 uint8_t *FnEnd = CurBufferPtr; | 1083 uint8_t *FnEnd = CurBufferPtr; |
1067 | 1084 |
1068 if (!Relocations.empty()) { | 1085 if (!Relocations.empty()) { |
1069 CurFn = F.getFunction(); | 1086 CurFn = F.getFunction(); |
(...skipping 27 matching lines...) Expand all Loading... | |
1097 ResultPtr = getPointerToGlobal(MR.getGlobalValue(), | 1114 ResultPtr = getPointerToGlobal(MR.getGlobalValue(), |
1098 BufferBegin+MR.getMachineCodeOffset(), | 1115 BufferBegin+MR.getMachineCodeOffset(), |
1099 MR.doesntNeedStub()); | 1116 MR.doesntNeedStub()); |
1100 } else if (MR.isIndirectSymbol()) { | 1117 } else if (MR.isIndirectSymbol()) { |
1101 ResultPtr = getPointerToGVIndirectSym(MR.getGlobalValue(), | 1118 ResultPtr = getPointerToGVIndirectSym(MR.getGlobalValue(), |
1102 BufferBegin+MR.getMachineCodeOffset(), | 1119 BufferBegin+MR.getMachineCodeOffset(), |
1103 MR.doesntNeedStub()); | 1120 MR.doesntNeedStub()); |
1104 } else if (MR.isBasicBlock()) { | 1121 } else if (MR.isBasicBlock()) { |
1105 ResultPtr = (void*)getMachineBasicBlockAddress(MR.getBasicBlock()); | 1122 ResultPtr = (void*)getMachineBasicBlockAddress(MR.getBasicBlock()); |
1106 } else if (MR.isConstantPoolIndex()) { | 1123 } else if (MR.isConstantPoolIndex()) { |
1107 ResultPtr = (void*)getConstantPoolEntryAddress(MR.getConstantPoolIndex ()); | 1124 ResultPtr = (void*)getConstantPoolEntryAddress( |
1125 MR.getConstantPoolIndex()); | |
1108 } else { | 1126 } else { |
1109 assert(MR.isJumpTableIndex()); | 1127 assert(MR.isJumpTableIndex()); |
1110 ResultPtr=(void*)getJumpTableEntryAddress(MR.getJumpTableIndex()); | 1128 ResultPtr = (void*)getJumpTableEntryAddress(MR.getJumpTableIndex()); |
1111 } | 1129 } |
1112 | 1130 |
1113 MR.setResultPointer(ResultPtr); | 1131 MR.setResultPointer(ResultPtr); |
1114 } | 1132 } |
1115 | 1133 |
1116 // if we are managing the GOT and the relocation wants an index, | 1134 // if we are managing the GOT and the relocation wants an index, |
1117 // give it one | 1135 // give it one |
1118 if (MR.isGOTRelative() && MemMgr->isManagingGOT()) { | 1136 if (MR.isGOTRelative() && MemMgr->isManagingGOT()) { |
1119 unsigned idx = Resolver.getGOTIndexForAddr(ResultPtr); | 1137 unsigned idx = Resolver.getGOTIndexForAddr(ResultPtr); |
1120 MR.setGOTIndex(idx); | 1138 MR.setGOTIndex(idx); |
(...skipping 19 matching lines...) Expand all Loading... | |
1140 << " pointing at " << ((void**)MemMgr->getGOTBase())[idx] << "\n"; | 1158 << " pointing at " << ((void**)MemMgr->getGOTBase())[idx] << "\n"; |
1141 ((void**)MemMgr->getGOTBase())[idx] = (void*)BufferBegin; | 1159 ((void**)MemMgr->getGOTBase())[idx] = (void*)BufferBegin; |
1142 } | 1160 } |
1143 } | 1161 } |
1144 | 1162 |
1145 // CurBufferPtr may have moved beyond FnEnd, due to memory allocation for | 1163 // CurBufferPtr may have moved beyond FnEnd, due to memory allocation for |
1146 // global variables that were referenced in the relocations. | 1164 // global variables that were referenced in the relocations. |
1147 MemMgr->endFunctionBody(F.getFunction(), BufferBegin, CurBufferPtr); | 1165 MemMgr->endFunctionBody(F.getFunction(), BufferBegin, CurBufferPtr); |
1148 | 1166 |
1149 if (CurBufferPtr == BufferEnd) { | 1167 if (CurBufferPtr == BufferEnd) { |
1150 // FIXME: Allocate more space, then try again. | 1168 retryWithMoreMemory(F); |
1151 cerr << "JIT: Ran out of space for generated machine code!\n"; | 1169 return true; |
1152 abort(); | 1170 } else { |
1171 // Now that we've succeeded in emitting the function, reset the MinSize | |
1172 // back down to zero. | |
1173 MinSize = 0; | |
1153 } | 1174 } |
1154 | 1175 |
1155 BufferBegin = CurBufferPtr = 0; | 1176 BufferBegin = CurBufferPtr = 0; |
1156 NumBytes += FnEnd-FnStart; | 1177 NumBytes += FnEnd-FnStart; |
1157 | 1178 |
1158 // Invalidate the icache if necessary. | 1179 // Invalidate the icache if necessary. |
1159 sys::Memory::InvalidateInstructionCache(FnStart, FnEnd-FnStart); | 1180 sys::Memory::InvalidateInstructionCache(FnStart, FnEnd-FnStart); |
1160 ·· | 1181 ·· |
1161 // Add it to the JIT symbol table if the host wants it. | 1182 // Add it to the JIT symbol table if the host wants it. |
1162 AddFunctionToSymbolTable(F.getFunction()->getNameStart(), | 1183 AddFunctionToSymbolTable(F.getFunction()->getNameStart(), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1233 | 1254 |
1234 TheJIT->RegisterTable(FrameRegister); | 1255 TheJIT->RegisterTable(FrameRegister); |
1235 } | 1256 } |
1236 | 1257 |
1237 if (MMI) | 1258 if (MMI) |
1238 MMI->EndFunction(); | 1259 MMI->EndFunction(); |
1239 · | 1260 · |
1240 return false; | 1261 return false; |
1241 } | 1262 } |
1242 | 1263 |
1264 void JITEmitter::retryWithMoreMemory(MachineFunction &F) { | |
1265 DOUT << "JIT: Ran out of space for native code. Reattempting.\n"; | |
1266 Relocations.clear(); // Clear the old relocations or we'll reapply them. | |
1267 ++NumRetries; | |
1268 deallocateMemForFunction(F.getFunction()); | |
1269 // Try again with at least twice as much free space. | |
1270 MinSize = (uintptr_t)(2 * (BufferEnd - BufferBegin)); | |
nlewycky
2009/06/17 04:53:57
Your description of MinSize was:
"When reattempti
Reid Kleckner
2009/06/17 20:29:57
Name and comment fixed. Maybe a better way to do
| |
1271 } | |
1272 | |
1243 /// deallocateMemForFunction - Deallocate all memory for the specified | 1273 /// deallocateMemForFunction - Deallocate all memory for the specified |
1244 /// function body. Also drop any references the function has to stubs. | 1274 /// function body. Also drop any references the function has to stubs. |
1245 void JITEmitter::deallocateMemForFunction(Function *F) { | 1275 void JITEmitter::deallocateMemForFunction(const Function *F) { |
1246 MemMgr->deallocateMemForFunction(F); | 1276 MemMgr->deallocateMemForFunction(F); |
1247 | 1277 |
1248 // If the function did not reference any stubs, return. | 1278 // If the function did not reference any stubs, return. |
1249 if (CurFnStubUses.find(F) == CurFnStubUses.end()) | 1279 if (CurFnStubUses.find(F) == CurFnStubUses.end()) |
1250 return; | 1280 return; |
1251 ·· | 1281 ·· |
1252 // For each referenced stub, erase the reference to this function, and then | 1282 // For each referenced stub, erase the reference to this function, and then |
1253 // erase the list of referenced stubs. | 1283 // erase the list of referenced stubs. |
1254 SmallVectorImpl<void *> &StubList = CurFnStubUses[F]; | 1284 SmallVectorImpl<void *> &StubList = CurFnStubUses[F]; |
1255 for (unsigned i = 0, e = StubList.size(); i != e; ++i) { | 1285 for (unsigned i = 0, e = StubList.size(); i != e; ++i) { |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1608 // retranslated next time it is used. | 1638 // retranslated next time it is used. |
1609 void *OldPtr = updateGlobalMapping(F, 0); | 1639 void *OldPtr = updateGlobalMapping(F, 0); |
1610 | 1640 |
1611 if (OldPtr) | 1641 if (OldPtr) |
1612 RemoveFunctionFromSymbolTable(OldPtr); | 1642 RemoveFunctionFromSymbolTable(OldPtr); |
1613 | 1643 |
1614 // Free the actual memory for the function body and related stuff. | 1644 // Free the actual memory for the function body and related stuff. |
1615 assert(isa<JITEmitter>(JCE) && "Unexpected MCE?"); | 1645 assert(isa<JITEmitter>(JCE) && "Unexpected MCE?"); |
1616 cast<JITEmitter>(JCE)->deallocateMemForFunction(F); | 1646 cast<JITEmitter>(JCE)->deallocateMemForFunction(F); |
1617 } | 1647 } |
1618 | |
OLD | NEW |