blob: fe66b91f64a2542c6fe6e891c9dc63b2d69d9ad7 [file] [log] [blame]
Ian Rogers57b86d42012-03-27 16:05:41 -07001/*
Elliott Hughes0f3c5532012-03-30 14:51:51 -07002 * Copyright (C) 2012 The Android Open Source Project
Ian Rogers57b86d42012-03-27 16:05:41 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_SRC_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_
18#define ART_SRC_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_
19
Elliott Hughes76b61672012-12-12 17:47:30 -080020#include "base/mutex.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070021#include "thread.h"
22
23namespace art {
24
Mathieu Chartier66f19252012-09-18 08:57:04 -070025class AbstractMethod;
Ian Rogers57b86d42012-03-27 16:05:41 -070026
Ian Rogers00f7d0e2012-07-19 15:28:27 -070027// Place a special frame at the TOS that will save the callee saves for the given type.
Ian Rogers81d425b2012-09-27 16:03:43 -070028static void FinishCalleeSaveFrameSetup(Thread* self, AbstractMethod** sp,
29 Runtime::CalleeSaveType type)
Ian Rogersb726dcb2012-09-05 08:57:23 -070030 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -070031 // Be aware the store below may well stomp on an incoming argument.
Ian Rogers81d425b2012-09-27 16:03:43 -070032 Locks::mutator_lock_->AssertSharedHeld(self);
Ian Rogers57b86d42012-03-27 16:05:41 -070033 *sp = Runtime::Current()->GetCalleeSaveMethod(type);
34 self->SetTopOfStack(sp, 0);
35 self->VerifyStack();
36}
37
38} // namespace art
39
40#endif // ART_SRC_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_