ExecutionEngine::updateGlobalMapping

Hello,

I am using updateGlobalMapping to inform the JIT engine the address of some C helpers. Due to the nature of the analysis pass, there can be several calls to updateGlobalMapping with the same GlobalValue key and the same (or sometimes different) address.

My problem is when the reverse mapping is enabled, the following fragment:

// If we are using the reverse mapping, add it too.

if (!EEState.getGlobalAddressReverseMap(locked).empty()) {

AssertingVH &V =

EEState.getGlobalAddressReverseMap(locked)[Addr];

assert((V == 0 || GV == 0) && “GlobalMapping already established!”);

V = GV;

}

Will assert even though the update of the reverse map, if allowed to execute, is exactly has I will like to see. The comments for updateGlobalMapping suggest this is supposed to be a valid operation.

I worked around it by removing the previous mapping first but that seems a little inefficient and not elegant.

PS: I tried to use addGlobalMapping too.

Manny