| 275 | } |
| 276 | |
| 277 | static bool CanJit(VMScriptFunction *func) |
| 278 | { |
| 279 | // Asmjit has a 256 register limit. Stay safely away from it as the jit compiler uses a few for temporaries as well. |
| 280 | // Any function exceeding the limit will use the VM - a fair punishment to someone for writing a function so bloated ;) |
| 281 | |
| 282 | if(func->blockJit) return false; |
| 283 | |
| 284 | int maxregs = 200; |
| 285 | if (func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS < maxregs) |
| 286 | return true; |
| 287 | |
| 288 | Printf(TEXTCOLOR_ORANGE "%s is using too many registers (%d of max %d)! Function will not use native code.\n", func->PrintableName, func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS, maxregs); |
| 289 | |
| 290 | return false; |
| 291 | } |
| 292 | |
| 293 | void VMScriptFunction::JitCompile() |
| 294 | { |