blob: 08cf9d86befcfc0f79c1893ff105f0f9089e3150 [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 {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080024namespace mirror {
Mathieu Chartier66f19252012-09-18 08:57:04 -070025class AbstractMethod;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080026} // namespace mirror
Ian Rogers57b86d42012-03-27 16:05:41 -070027
Ian Rogers00f7d0e2012-07-19 15:28:27 -070028// Place a special frame at the TOS that will save the callee saves for the given type.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080029static void FinishCalleeSaveFrameSetup(Thread* self, mirror::AbstractMethod** sp,
Ian Rogers81d425b2012-09-27 16:03:43 -070030 Runtime::CalleeSaveType type)
Ian Rogersb726dcb2012-09-05 08:57:23 -070031 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -070032 // Be aware the store below may well stomp on an incoming argument.
Ian Rogers81d425b2012-09-27 16:03:43 -070033 Locks::mutator_lock_->AssertSharedHeld(self);
Ian Rogers57b86d42012-03-27 16:05:41 -070034 *sp = Runtime::Current()->GetCalleeSaveMethod(type);
35 self->SetTopOfStack(sp, 0);
36 self->VerifyStack();
37}
38
39} // namespace art
40
41#endif // ART_SRC_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_