| 656 | ////////////////////////////////////////////////////////////////////////// |
| 657 | |
| 658 | int64 BfDeferredMethodCallData::GenerateMethodId(BfModule* module, int64 methodId) |
| 659 | { |
| 660 | // The mMethodId MUST be unique within a given deferred method processor. We are even more conservative, making it |
| 661 | // unique per module |
| 662 | if (module->mDeferredMethodIds.Add(methodId)) |
| 663 | { |
| 664 | return methodId; |
| 665 | } |
| 666 | else |
| 667 | { |
| 668 | // Ideally the passed in methodId just works, otherwise -- |
| 669 | // We hope to create a hash that will hopefully be globally unique. If it isn't then it just means we will end up with two |
| 670 | // conflicting debug info definitions for the same name, which is not an error but may cause a debugger to show the |
| 671 | // wrong one to the user. Does not affect runtime correctness. |
| 672 | int64 checkId = Hash64(module->mModuleName.c_str(), (int)module->mModuleName.length(), module->mDeferredMethodIds.size()); |
| 673 | while (true) |
| 674 | { |
| 675 | if (!module->mDeferredMethodIds.Contains(checkId)) |
| 676 | break; |
| 677 | checkId += 0x100; |
| 678 | } |
| 679 | module->mDeferredMethodIds.Add(checkId); |
| 680 | return checkId; |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | ////////////////////////////////////////////////////////////////////////// |
| 685 | |