/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "jni_internal.h"
#include "mirror/array.h"
#include "oat/runtime/oat_support_entrypoints.h"
#include "oat/runtime/stub.h"
#include "oat/utils/mips/assembler_mips.h"
#include "stack_indirect_reference_table.h"
#include "sirt_ref.h"

#define __ assembler->

namespace art {
namespace mips {

mirror::ByteArray* MipsCreateResolutionTrampoline(Runtime::TrampolineType type) {
  UniquePtr<MipsAssembler> assembler(static_cast<MipsAssembler*>(Assembler::Create(kMips)));
#if !defined(ART_USE_LLVM_COMPILER)
  // | Out args   |
  // | Method*    | <- SP on entry
  // | RA         |    return address into caller
  // | ...        |    callee saves
  // | A3         |    possible argument
  // | A2         |    possible argument
  // | A1         |    possible argument
  // | A0/Method* |    Callee save Method* set up by UnresolvedDirectMethodTrampolineFromCode
  // Save callee saves and ready frame for exception delivery
  __ AddConstant(SP, SP, -48);
  __ StoreToOffset(kStoreWord, RA, SP, 44);
  __ StoreToOffset(kStoreWord, FP, SP, 40);
  __ StoreToOffset(kStoreWord, S7, SP, 36);
  __ StoreToOffset(kStoreWord, S6, SP, 32);
  __ StoreToOffset(kStoreWord, S5, SP, 28);
  __ StoreToOffset(kStoreWord, S4, SP, 24);
  __ StoreToOffset(kStoreWord, S3, SP, 20);
  __ StoreToOffset(kStoreWord, S2, SP, 16);
  __ StoreToOffset(kStoreWord, A3, SP, 12);
  __ StoreToOffset(kStoreWord, A2, SP, 8);
  __ StoreToOffset(kStoreWord, A1, SP, 4);

  __ LoadFromOffset(kLoadWord, T9, S1,
                    ENTRYPOINT_OFFSET(pUnresolvedDirectMethodTrampolineFromCode));
  __ Move(A2, S1);  // Pass Thread::Current() in A2
  __ LoadImmediate(A3, type); // Pass is_static
  __ Move(A1, SP);  // Pass SP for Method** callee_addr
  __ Jalr(T9); // Call to unresolved direct method trampoline (method_idx, sp, Thread*, is_static)

  // Restore registers which may have been modified by GC
  __ LoadFromOffset(kLoadWord, A0, SP, 0);
  __ LoadFromOffset(kLoadWord, A1, SP, 4);
  __ LoadFromOffset(kLoadWord, A2, SP, 8);
  __ LoadFromOffset(kLoadWord, A3, SP, 12);
  __ LoadFromOffset(kLoadWord, S2, SP, 16);
  __ LoadFromOffset(kLoadWord, S3, SP, 20);
  __ LoadFromOffset(kLoadWord, S4, SP, 24);
  __ LoadFromOffset(kLoadWord, S5, SP, 28);
  __ LoadFromOffset(kLoadWord, S6, SP, 32);
  __ LoadFromOffset(kLoadWord, S7, SP, 36);
  __ LoadFromOffset(kLoadWord, FP, SP, 40);
  __ LoadFromOffset(kLoadWord, RA, SP, 44);
  __ AddConstant(SP, SP, 48);

  __ Move(T9, V0); // Put method's code in T9
  __ Jr(T9);  // Leaf call to method's code

  __ Break();
#else // ART_USE_LLVM_COMPILER
  // Build frame and save argument registers and RA.
  __ AddConstant(SP, SP, -32);
  __ StoreToOffset(kStoreWord, RA, SP, 28);
  __ StoreToOffset(kStoreWord, A3, SP, 24);
  __ StoreToOffset(kStoreWord, A2, SP, 20);
  __ StoreToOffset(kStoreWord, A1, SP, 16);
  __ StoreToOffset(kStoreWord, A0, SP, 12);

  __ LoadFromOffset(kLoadWord, T9, S1,
                    ENTRYPOINT_OFFSET(pUnresolvedDirectMethodTrampolineFromCode));
  __ Move(A2, S1);  // Pass Thread::Current() in A2
  __ LoadImmediate(A3, type);  // Pass is_static
  __ Move(A1, SP);  // Pass SP for Method** callee_addr
  __ Jalr(T9); // Call to unresolved direct method trampoline (callee, callee_addr, Thread*, is_static)

  // Restore frame, argument registers, and RA.
  __ LoadFromOffset(kLoadWord, A0, SP, 12);
  __ LoadFromOffset(kLoadWord, A1, SP, 16);
  __ LoadFromOffset(kLoadWord, A2, SP, 20);
  __ LoadFromOffset(kLoadWord, A3, SP, 24);
  __ LoadFromOffset(kLoadWord, RA, SP, 28);
  __ AddConstant(SP, SP, 32);

  Label resolve_fail;
  __ EmitBranch(V0, ZERO, &resolve_fail, true);
  __ Jr(V0); // If V0 != 0 tail call method's code
  __ Bind(&resolve_fail, false);
  __ Jr(RA); // Return to caller to handle exception
#endif // ART_USE_LLVM_COMPILER

  assembler->EmitSlowPaths();

  size_t cs = assembler->CodeSize();
  Thread* self = Thread::Current();
  SirtRef<mirror::ByteArray> resolution_trampoline(self, mirror::ByteArray::Alloc(self, cs));
  CHECK(resolution_trampoline.get() != NULL);
  MemoryRegion code(resolution_trampoline->GetData(), resolution_trampoline->GetLength());
  assembler->FinalizeInstructions(code);

  return resolution_trampoline.get();
}

typedef void (*ThrowAme)(mirror::AbstractMethod*, Thread*);

mirror::ByteArray* CreateAbstractMethodErrorStub() {
  UniquePtr<MipsAssembler> assembler(static_cast<MipsAssembler*>(Assembler::Create(kMips)));
#if !defined(ART_USE_LLVM_COMPILER)
  // Save callee saves and ready frame for exception delivery
  __ AddConstant(SP, SP, -64);
  __ StoreToOffset(kStoreWord, RA, SP, 60);
  __ StoreToOffset(kStoreWord, FP, SP, 56);
  __ StoreToOffset(kStoreWord, S7, SP, 52);
  __ StoreToOffset(kStoreWord, S6, SP, 48);
  __ StoreToOffset(kStoreWord, S5, SP, 44);
  __ StoreToOffset(kStoreWord, S4, SP, 40);
  __ StoreToOffset(kStoreWord, S3, SP, 36);
  __ StoreToOffset(kStoreWord, S2, SP, 32);
  __ StoreToOffset(kStoreWord, S1, SP, 28);
  __ StoreToOffset(kStoreWord, S0, SP, 24);

  // A0 is the Method* already
  __ Move(A1, S1);  // Pass Thread::Current() in A1
  __ Move(A2, SP);  // Pass SP in A2
  // Call to throw AbstractMethodError
  __ LoadFromOffset(kLoadWord, T9, S1, ENTRYPOINT_OFFSET(pThrowAbstractMethodErrorFromCode));
  __ Jr(T9);  // Leaf call to routine that never returns

  __ Break();
#else // ART_USE_LLVM_COMPILER
  // R0 is the Method* already
  __ Move(A1, S1);  // Pass Thread::Current() in A1
  // Call to throw AbstractMethodError
  __ LoadFromOffset(kLoadWord, T9, S1, ENTRYPOINT_OFFSET(pThrowAbstractMethodErrorFromCode));
  __ Jr(T9);  // Leaf call to routine that never returns

  __ Break();
#endif // ART_USE_LLVM_COMPILER

  assembler->EmitSlowPaths();

  size_t cs = assembler->CodeSize();
  Thread* self = Thread::Current();
  SirtRef<mirror::ByteArray> abstract_stub(self, mirror::ByteArray::Alloc(self, cs));
  CHECK(abstract_stub.get() != NULL);
  MemoryRegion code(abstract_stub->GetData(), abstract_stub->GetLength());
  assembler->FinalizeInstructions(code);

  return abstract_stub.get();
}

mirror::ByteArray* CreateJniDlsymLookupStub() {
  UniquePtr<MipsAssembler> assembler(static_cast<MipsAssembler*>(Assembler::Create(kMips)));

  // Build frame and save argument registers and RA.
  __ AddConstant(SP, SP, -32);
  __ StoreToOffset(kStoreWord, RA, SP, 28);
  __ StoreToOffset(kStoreWord, A3, SP, 24);
  __ StoreToOffset(kStoreWord, A2, SP, 20);
  __ StoreToOffset(kStoreWord, A1, SP, 16);
  __ StoreToOffset(kStoreWord, A0, SP, 12);

  __ Move(A0, S1); // Pass Thread::Current() in A0
  __ LoadFromOffset(kLoadWord, T9, S1, ENTRYPOINT_OFFSET(pFindNativeMethod));
  __ Jalr(T9); // Call FindNativeMethod

  // Restore frame, argument registers, and RA.
  __ LoadFromOffset(kLoadWord, A0, SP, 12);
  __ LoadFromOffset(kLoadWord, A1, SP, 16);
  __ LoadFromOffset(kLoadWord, A2, SP, 20);
  __ LoadFromOffset(kLoadWord, A3, SP, 24);
  __ LoadFromOffset(kLoadWord, RA, SP, 28);
  __ AddConstant(SP, SP, 32);

  Label no_native_code_found;
  __ EmitBranch(V0, ZERO, &no_native_code_found, true);
  __ Move(T9, V0); // Move result into T9
  __ Jr(T9); // If result != 0, tail call method's code
  __ Bind(&no_native_code_found, false);
  __ Jr(RA); // Return to caller to handle exception

  assembler->EmitSlowPaths();

  size_t cs = assembler->CodeSize();
  Thread* self = Thread::Current();
  SirtRef<mirror::ByteArray> jni_stub(self, mirror::ByteArray::Alloc(self, cs));
  CHECK(jni_stub.get() != NULL);
  MemoryRegion code(jni_stub->GetData(), jni_stub->GetLength());
  assembler->FinalizeInstructions(code);

  return jni_stub.get();
}

} // namespace mips
} // namespace art
