Home | History | Annotate | Download | only in runtime
      1 /*
      2  * Copyright (C) 2011 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 #ifndef ART_RUNTIME_REFLECTION_H_
     18 #define ART_RUNTIME_REFLECTION_H_
     19 
     20 #include "jni.h"
     21 #include "primitive.h"
     22 
     23 namespace art {
     24 namespace mirror {
     25   class ArtField;
     26   class ArtMethod;
     27   class Class;
     28   class Object;
     29 }  // namespace mirror
     30 union JValue;
     31 class MethodHelper;
     32 class ScopedObjectAccessAlreadyRunnable;
     33 class ShadowFrame;
     34 class ThrowLocation;
     35 
     36 mirror::Object* BoxPrimitive(Primitive::Type src_class, const JValue& value)
     37     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     38 bool UnboxPrimitiveForField(mirror::Object* o, mirror::Class* dst_class, mirror::ArtField* f,
     39                             JValue* unboxed_value)
     40     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     41 bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object* o,
     42                              mirror::Class* dst_class, JValue* unboxed_value)
     43     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     44 
     45 ALWAYS_INLINE bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbox_for_result,
     46                                          Primitive::Type src_class, Primitive::Type dst_class,
     47                                          const JValue& src, JValue* dst)
     48     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     49 
     50 JValue InvokeWithVarArgs(const ScopedObjectAccessAlreadyRunnable& soa, jobject obj, jmethodID mid,
     51                          va_list args)
     52     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     53 
     54 JValue InvokeWithJValues(const ScopedObjectAccessAlreadyRunnable& soa, mirror::Object* receiver,
     55                          jmethodID mid, jvalue* args)
     56     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     57 
     58 JValue InvokeVirtualOrInterfaceWithJValues(const ScopedObjectAccessAlreadyRunnable& soa,
     59                                            mirror::Object* receiver, jmethodID mid, jvalue* args)
     60     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     61 
     62 JValue InvokeVirtualOrInterfaceWithVarArgs(const ScopedObjectAccessAlreadyRunnable& soa,
     63                                            jobject obj, jmethodID mid, va_list args)
     64     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     65 
     66 void InvokeWithShadowFrame(Thread* self, ShadowFrame* shadow_frame, uint16_t arg_offset,
     67                            MethodHelper& mh, JValue* result)
     68     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     69 
     70 jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject method, jobject receiver,
     71                      jobject args, bool accessible)
     72     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     73 
     74 bool VerifyObjectIsClass(mirror::Object* o, mirror::Class* c)
     75     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     76 
     77 bool VerifyAccess(Thread* self, mirror::Object* obj, mirror::Class* declaring_class,
     78                   uint32_t access_flags)
     79     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
     80 
     81 }  // namespace art
     82 
     83 #endif  // ART_RUNTIME_REFLECTION_H_
     84