• 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   ObjPtr<String> GetDeclaringClass() REQUIRES_SHARED(Locks::mutator_lock_);
33 
34   ObjPtr<String> GetMethodName() REQUIRES_SHARED(Locks::mutator_lock_);
35 
36   ObjPtr<String> GetFileName() REQUIRES_SHARED(Locks::mutator_lock_);
37 
GetLineNumber()38   int32_t GetLineNumber() REQUIRES_SHARED(Locks::mutator_lock_) {
39     return GetField32(OFFSET_OF_OBJECT_MEMBER(StackTraceElement, line_number_));
40   }
41 
42   static ObjPtr<StackTraceElement> Alloc(Thread* self,
43                                          Handle<String> declaring_class,
44                                          Handle<String> method_name,
45                                          Handle<String> file_name,
46                                          int32_t line_number)
47       REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
48 
49  private:
50   // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
51   HeapReference<String> declaring_class_;
52   HeapReference<String> file_name_;
53   HeapReference<String> method_name_;
54   int32_t line_number_;
55 
56   template<bool kTransactionActive>
57   void Init(ObjPtr<String> declaring_class,
58             ObjPtr<String> method_name,
59             ObjPtr<String> file_name,
60             int32_t line_number)
61       REQUIRES_SHARED(Locks::mutator_lock_);
62 
63   friend struct art::StackTraceElementOffsets;  // for verifying offset information
64   DISALLOW_IMPLICIT_CONSTRUCTORS(StackTraceElement);
65 };
66 
67 }  // namespace mirror
68 }  // namespace art
69 
70 #endif  // ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_
71