• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MIRROR_STACK_TRACE_ELEMENT_H_
18 #define ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_
19 
20 #include "object.h"
21 
22 namespace art {
23 
24 template<class T> class Handle;
25 struct StackTraceElementOffsets;
26 
27 namespace mirror {
28 
29 // C++ mirror of java.lang.StackTraceElement
30 class MANAGED StackTraceElement final : public Object {
31  public:
32   MIRROR_CLASS("Ljava/lang/StackTraceElement;");
33 
34   ObjPtr<String> GetDeclaringClass() REQUIRES_SHARED(Locks::mutator_lock_);
35 
36   ObjPtr<String> GetMethodName() REQUIRES_SHARED(Locks::mutator_lock_);
37 
38   ObjPtr<String> GetFileName() REQUIRES_SHARED(Locks::mutator_lock_);
39 
GetLineNumber()40   int32_t GetLineNumber() REQUIRES_SHARED(Locks::mutator_lock_) {
41     return GetField32(OFFSET_OF_OBJECT_MEMBER(StackTraceElement, line_number_));
42   }
43 
44   static ObjPtr<StackTraceElement> Alloc(Thread* self,
45                                          Handle<String> declaring_class,
46                                          Handle<String> method_name,
47                                          Handle<String> file_name,
48                                          int32_t line_number)
49       REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
50 
51  private:
52   // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
53   HeapReference<String> declaring_class_;
54   HeapReference<String> file_name_;
55   HeapReference<String> method_name_;
56   int32_t line_number_;
57 
58   template<bool kTransactionActive>
59   void Init(ObjPtr<String> declaring_class,
60             ObjPtr<String> method_name,
61             ObjPtr<String> file_name,
62             int32_t line_number)
63       REQUIRES_SHARED(Locks::mutator_lock_);
64 
65   friend struct art::StackTraceElementOffsets;  // for verifying offset information
66   DISALLOW_IMPLICIT_CONSTRUCTORS(StackTraceElement);
67 };
68 
69 }  // namespace mirror
70 }  // namespace art
71 
72 #endif  // ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_
73