| 234 | } |
| 235 | |
| 236 | void JitCompiler::Setup() |
| 237 | { |
| 238 | using namespace asmjit; |
| 239 | |
| 240 | ResetTemp(); |
| 241 | |
| 242 | static const char *marks = "======================================================="; |
| 243 | cc.comment("", 0); |
| 244 | cc.comment(marks, 56); |
| 245 | |
| 246 | FString funcname; |
| 247 | funcname.Format("Function: %s", sfunc->PrintableName); |
| 248 | cc.comment(funcname.GetChars(), funcname.Len()); |
| 249 | |
| 250 | cc.comment(marks, 56); |
| 251 | cc.comment("", 0); |
| 252 | |
| 253 | auto unusedFunc = cc.newIntPtr("func"); // VMFunction* |
| 254 | args = cc.newIntPtr("args"); // VMValue *params |
| 255 | numargs = cc.newInt32("numargs"); // int numargs |
| 256 | ret = cc.newIntPtr("ret"); // VMReturn *ret |
| 257 | numret = cc.newInt32("numret"); // int numret |
| 258 | |
| 259 | func = cc.addFunc(FuncSignature5<int, VMFunction *, void *, int, void *, int>()); |
| 260 | cc.setArg(0, unusedFunc); |
| 261 | cc.setArg(1, args); |
| 262 | cc.setArg(2, numargs); |
| 263 | cc.setArg(3, ret); |
| 264 | cc.setArg(4, numret); |
| 265 | |
| 266 | callReturnsCursor = cc.getCursor(); |
| 267 | |
| 268 | konstd = sfunc->KonstD; |
| 269 | konstf = sfunc->KonstF; |
| 270 | konsts = sfunc->KonstS; |
| 271 | konsta = sfunc->KonstA; |
| 272 | |
| 273 | labels.Resize(sfunc->CodeSize); |
| 274 | |
| 275 | CreateRegisters(); |
| 276 | IncrementVMCalls(); |
| 277 | SetupFrame(); |
| 278 | } |
| 279 | |
| 280 | void JitCompiler::SetupFrame() |
| 281 | { |