Shih-wei Liao | 21d28f5 | 2012-06-12 05:55:00 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 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 | #include "greenland/runtime_entry_points.h" |
| 18 | |
| 19 | #include "runtime_utils.h" |
| 20 | #include "runtime_support.h" |
| 21 | |
| 22 | using namespace art; |
| 23 | using namespace art::greenland; |
| 24 | |
| 25 | namespace { |
| 26 | |
| 27 | Object* art_alloc_array_from_code(uint32_t type_idx, |
| 28 | Method* referrer, |
| 29 | uint32_t length, |
| 30 | Thread* thread) { |
| 31 | return AllocArrayFromCode(type_idx, referrer, length, thread, false); |
| 32 | } |
| 33 | |
| 34 | Object* art_alloc_array_from_code_with_access_check(uint32_t type_idx, |
| 35 | Method* referrer, |
| 36 | uint32_t length, |
| 37 | Thread* thread) { |
| 38 | return AllocArrayFromCode(type_idx, referrer, length, thread, true); |
| 39 | } |
| 40 | |
| 41 | Object* art_check_and_alloc_array_from_code(uint32_t type_idx, |
| 42 | Method* referrer, |
| 43 | uint32_t length, |
| 44 | Thread* thread) { |
| 45 | return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, false); |
| 46 | } |
| 47 | |
| 48 | Object* art_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx, |
| 49 | Method* referrer, |
| 50 | uint32_t length, |
| 51 | Thread* thread) { |
| 52 | return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, true); |
| 53 | } |
| 54 | |
| 55 | } // anonymous namespace |
| 56 | |
| 57 | namespace art { |
| 58 | namespace greenland { |
| 59 | |
| 60 | void InitAllocRuntimes(RuntimeEntryPoints* entry_points) { |
| 61 | entry_points->AllocArray = art_alloc_array_from_code; |
| 62 | entry_points->AllocArrayWithAccessCheck = art_alloc_array_from_code_with_access_check; |
| 63 | entry_points->CheckAndAllocArray = art_check_and_alloc_array_from_code; |
| 64 | entry_points->CheckAndAllocArrayWithAccessCheck = art_check_and_alloc_array_from_code_with_access_check; |
| 65 | return; |
| 66 | } |
| 67 | |
| 68 | } // namespace greenland |
| 69 | } // namespace art |