| 524 | } |
| 525 | |
| 526 | unsigned invokeNativeSlow(Thread* t, GcMethod* method, void* function) |
| 527 | { |
| 528 | PROTECT(t, method); |
| 529 | |
| 530 | pushFrame(t, method); |
| 531 | |
| 532 | unsigned footprint = method->parameterFootprint() + 1; |
| 533 | if (method->flags() & ACC_STATIC) { |
| 534 | ++footprint; |
| 535 | } |
| 536 | unsigned count = method->parameterCount() + 2; |
| 537 | |
| 538 | THREAD_RUNTIME_ARRAY(t, uintptr_t, args, footprint); |
| 539 | unsigned argOffset = 0; |
| 540 | THREAD_RUNTIME_ARRAY(t, uint8_t, types, count); |
| 541 | unsigned typeOffset = 0; |
| 542 | |
| 543 | RUNTIME_ARRAY_BODY(args)[argOffset++] = reinterpret_cast<uintptr_t>(t); |
| 544 | RUNTIME_ARRAY_BODY(types)[typeOffset++] = POINTER_TYPE; |
| 545 | |
| 546 | GcJclass* jclass = 0; |
| 547 | PROTECT(t, jclass); |
| 548 | |
| 549 | unsigned sp; |
| 550 | if (method->flags() & ACC_STATIC) { |
| 551 | sp = frameBase(t, t->frame); |
| 552 | jclass = getJClass(t, method->class_()); |
| 553 | RUNTIME_ARRAY_BODY(args)[argOffset++] |
| 554 | = reinterpret_cast<uintptr_t>(&jclass); |
| 555 | } else { |
| 556 | sp = frameBase(t, t->frame); |
| 557 | object* v = reinterpret_cast<object*>(t->stack + ((sp++) * 2) + 1); |
| 558 | if (*v == 0) { |
| 559 | v = 0; |
| 560 | } |
| 561 | RUNTIME_ARRAY_BODY(args)[argOffset++] = reinterpret_cast<uintptr_t>(v); |
| 562 | } |
| 563 | RUNTIME_ARRAY_BODY(types)[typeOffset++] = POINTER_TYPE; |
| 564 | |
| 565 | marshalArguments(t, |
| 566 | RUNTIME_ARRAY_BODY(args) + argOffset, |
| 567 | RUNTIME_ARRAY_BODY(types) + typeOffset, |
| 568 | sp, |
| 569 | method, |
| 570 | false); |
| 571 | |
| 572 | unsigned returnCode = method->returnCode(); |
| 573 | unsigned returnType = fieldType(t, returnCode); |
| 574 | uint64_t result; |
| 575 | |
| 576 | if (DebugRun) { |
| 577 | fprintf(stderr, |
| 578 | "invoke native method %s.%s\n", |
| 579 | method->class_()->name()->body().begin(), |
| 580 | method->name()->body().begin()); |
| 581 | } |
| 582 | |
| 583 | { |
no test coverage detected