| Index: runtime/vm/unit_test.h
|
| diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
|
| index 6e1ca5c04dcb0e500327897dbb102fc8a0982a38..a8b063a2b6c8df56febdb2779c2e75da9e224a64 100644
|
| --- a/runtime/vm/unit_test.h
|
| +++ b/runtime/vm/unit_test.h
|
| @@ -360,36 +360,44 @@ class AssemblerTest {
|
|
|
| uword entry() const { return code_.EntryPoint(); }
|
|
|
| - // Invoke/InvokeWithCode is used to call assembler test functions using the
|
| - // ABI calling convention.
|
| + // Invoke/InvokeWithCodeAndThread is used to call assembler test functions
|
| + // using the ABI calling convention.
|
| // ResultType is the return type of the assembler test function.
|
| // ArgNType is the type of the Nth argument.
|
| #if defined(USING_SIMULATOR)
|
|
|
| #if defined(ARCH_IS_64_BIT)
|
| - // TODO(fschneider): Make InvokeWithCode<> more general and work on 32-bit.
|
| + // TODO(fschneider): Make InvokeWithCodeAndThread<> more general and work on
|
| + // 32-bit.
|
| // Since Simulator::Call always return a int64_t, bit_cast does not work
|
| // on 32-bit platforms when returning an int32_t. Since template functions
|
| // don't support partial specialization, we'd need to introduce a helper
|
| // class to support 32-bit return types.
|
| - template<typename ResultType> ResultType InvokeWithCode() {
|
| + template<typename ResultType> ResultType InvokeWithCodeAndThread() {
|
| const bool fp_return = is_double<ResultType>::value;
|
| const bool fp_args = false;
|
| + Thread* thread = Thread::Current();
|
| + ASSERT(thread != NULL);
|
| return bit_cast<ResultType, int64_t>(Simulator::Current()->Call(
|
| bit_cast<intptr_t, uword>(entry()),
|
| - reinterpret_cast<intptr_t>(&code_), 0, 0, 0, fp_return, fp_args));
|
| + reinterpret_cast<intptr_t>(&code_),
|
| + reinterpret_cast<intptr_t>(thread),
|
| + 0, 0, fp_return, fp_args));
|
| }
|
| template<typename ResultType, typename Arg1Type>
|
| - ResultType InvokeWithCode(Arg1Type arg1) {
|
| + ResultType InvokeWithCodeAndThread(Arg1Type arg1) {
|
| const bool fp_return = is_double<ResultType>::value;
|
| const bool fp_args = is_double<Arg1Type>::value;
|
| // TODO(fschneider): Support double arguments for simulator calls.
|
| COMPILE_ASSERT(!fp_args);
|
| + Thread* thread = Thread::Current();
|
| + ASSERT(thread != NULL);
|
| return bit_cast<ResultType, int64_t>(Simulator::Current()->Call(
|
| bit_cast<intptr_t, uword>(entry()),
|
| reinterpret_cast<intptr_t>(&code_),
|
| + reinterpret_cast<intptr_t>(thread),
|
| reinterpret_cast<intptr_t>(arg1),
|
| - 0, 0, fp_return, fp_args));
|
| + 0, fp_return, fp_args));
|
| }
|
| #endif // ARCH_IS_64_BIT
|
|
|
| @@ -413,15 +421,19 @@ class AssemblerTest {
|
| 0, fp_return, fp_args);
|
| }
|
| #else
|
| - template<typename ResultType> ResultType InvokeWithCode() {
|
| - typedef ResultType (*FunctionType) (const Code&);
|
| - return reinterpret_cast<FunctionType>(entry())(code_);
|
| + template<typename ResultType> ResultType InvokeWithCodeAndThread() {
|
| + Thread* thread = Thread::Current();
|
| + ASSERT(thread != NULL);
|
| + typedef ResultType (*FunctionType) (const Code&, Thread*);
|
| + return reinterpret_cast<FunctionType>(entry())(code_, thread);
|
| }
|
|
|
| template<typename ResultType, typename Arg1Type>
|
| - ResultType InvokeWithCode(Arg1Type arg1) {
|
| - typedef ResultType (*FunctionType) (const Code&, Arg1Type);
|
| - return reinterpret_cast<FunctionType>(entry())(code_, arg1);
|
| + ResultType InvokeWithCodeAndThread(Arg1Type arg1) {
|
| + Thread* thread = Thread::Current();
|
| + ASSERT(thread != NULL);
|
| + typedef ResultType (*FunctionType) (const Code&, Thread*, Arg1Type);
|
| + return reinterpret_cast<FunctionType>(entry())(code_, thread, arg1);
|
| }
|
|
|
| template<typename ResultType,
|
|
|