blob: 649e6eaf77b5d7c6902cb2d929424365b793bb0d [file] [log] [blame]
Elliott Hughes2faa5f12012-01-30 14:42:07 -08001/*
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 */
Shih-wei Liao63433ba2011-10-15 18:40:39 -070016
17#include <stdio.h>
18
19#include "UniquePtr.h"
20#include "class_linker.h"
Ian Rogers0c7abda2012-09-19 13:33:42 -070021#include "gc_map.h"
Shih-wei Liao63433ba2011-10-15 18:40:39 -070022#include "object.h"
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080023#include "object_utils.h"
Ian Rogers00f7d0e2012-07-19 15:28:27 -070024#include "scoped_thread_state_change.h"
Shih-wei Liao371814f2011-10-27 16:52:10 -070025#include "thread.h"
Shih-wei Liao63433ba2011-10-15 18:40:39 -070026#include "jni.h"
Ian Rogers776ac1f2012-04-13 23:36:36 -070027#include "verifier/method_verifier.h"
Shih-wei Liao63433ba2011-10-15 18:40:39 -070028
29namespace art {
30
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080031#define IS_IN_REF_BITMAP(mh, ref_bitmap, reg) \
32 ( ((reg) < mh.GetCodeItem()->registers_size_) && \
Shih-wei Liao39723d32011-10-24 02:20:31 -070033 (( *((ref_bitmap) + (reg)/8) >> ((reg) % 8) ) & 0x01) )
Shih-wei Liao63433ba2011-10-15 18:40:39 -070034
Shih-wei Liao39723d32011-10-24 02:20:31 -070035#define CHECK_REGS_CONTAIN_REFS(...) \
36 do { \
Shih-wei Liao63433ba2011-10-15 18:40:39 -070037 int t[] = {__VA_ARGS__}; \
38 int t_size = sizeof(t) / sizeof(*t); \
39 for (int i = 0; i < t_size; ++i) \
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080040 CHECK(IS_IN_REF_BITMAP(mh, ref_bitmap, t[i])) \
Shih-wei Liao39723d32011-10-24 02:20:31 -070041 << "Error: Reg @ " << i << "-th argument is not in GC map"; \
Elliott Hughesb25c3f62012-03-26 16:35:06 -070042 } while (false)
Shih-wei Liao63433ba2011-10-15 18:40:39 -070043
Ian Rogers0399dde2012-06-06 17:09:28 -070044struct ReferenceMap2Visitor : public StackVisitor {
45 explicit ReferenceMap2Visitor(const ManagedStack* stack,
Ian Rogers00f7d0e2012-07-19 15:28:27 -070046 const std::vector<TraceStackFrame>* trace_stack)
Ian Rogersb726dcb2012-09-05 08:57:23 -070047 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
Ian Rogers00f7d0e2012-07-19 15:28:27 -070048 : StackVisitor(stack, trace_stack, NULL) {
Shih-wei Liao63433ba2011-10-15 18:40:39 -070049 }
50
Ian Rogersb726dcb2012-09-05 08:57:23 -070051 bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers0399dde2012-06-06 17:09:28 -070052 Method* m = GetMethod();
53 if (!m || m->IsNative() || m->IsRuntimeMethod() || IsShadowFrame()) {
Elliott Hughes530fa002012-03-12 11:44:49 -070054 return true;
Shih-wei Liao63433ba2011-10-15 18:40:39 -070055 }
56 LOG(INFO) << "At " << PrettyMethod(m, false);
57
Ian Rogers0c7abda2012-09-19 13:33:42 -070058 NativePcOffsetToReferenceMap map(m->GetNativeGcMap());
Shih-wei Liao63433ba2011-10-15 18:40:39 -070059
Shih-wei Liao63433ba2011-10-15 18:40:39 -070060 if (m->IsCalleeSaveMethod()) {
61 LOG(WARNING) << "no PC for " << PrettyMethod(m);
Elliott Hughes530fa002012-03-12 11:44:49 -070062 return true;
Shih-wei Liao63433ba2011-10-15 18:40:39 -070063 }
64
Shih-wei Liao371814f2011-10-27 16:52:10 -070065 // Enable this to dump reference map to LOG(INFO)
66 if (false) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -070067 ScopedObjectAccess ts(Thread::Current());
Ian Rogers776ac1f2012-04-13 23:36:36 -070068 art::verifier::MethodVerifier::VerifyMethodAndDump(m);
Shih-wei Liao371814f2011-10-27 16:52:10 -070069 }
Shih-wei Liao39723d32011-10-24 02:20:31 -070070 const uint8_t* ref_bitmap = NULL;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080071 MethodHelper mh(m);
72 std::string m_name(mh.GetName());
Shih-wei Liao63433ba2011-10-15 18:40:39 -070073
74 // Given the method name and the number of times the method has been called,
75 // we know the Dex registers with live reference values. Assert that what we
76 // find is what is expected.
77 if (m_name.compare("f") == 0) {
Ian Rogers0c7abda2012-09-19 13:33:42 -070078 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x03U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -070079 CHECK(ref_bitmap);
80 CHECK_REGS_CONTAIN_REFS(8); // v8: this
Shih-wei Liao63433ba2011-10-15 18:40:39 -070081
Ian Rogers0c7abda2012-09-19 13:33:42 -070082 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x06U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -070083 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -070084 CHECK_REGS_CONTAIN_REFS(8, 1); // v8: this, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -070085
Ian Rogers0c7abda2012-09-19 13:33:42 -070086 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x08U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -070087 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -070088 CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -070089
Ian Rogers0c7abda2012-09-19 13:33:42 -070090 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x0cU)));
Shih-wei Liao39723d32011-10-24 02:20:31 -070091 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -070092 CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -070093
Ian Rogers0c7abda2012-09-19 13:33:42 -070094 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x0eU)));
Shih-wei Liao39723d32011-10-24 02:20:31 -070095 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -070096 CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -070097
Ian Rogers0c7abda2012-09-19 13:33:42 -070098 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x10U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -070099 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700100 CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700101
Ian Rogers0c7abda2012-09-19 13:33:42 -0700102 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x13U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700103 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700104 // v2 is added because of the instruction at DexPC 0024. Object merges with 0 is Object. See:
105 // 0024: move-object v3, v2
106 // 0025: goto 0013
107 // Detaled dex instructions for ReferenceMap.java are at the end of this function.
108 CHECK_REGS_CONTAIN_REFS(8, 3, 2, 1); // v8: this, v3: y, v2: y, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700109
Ian Rogers0c7abda2012-09-19 13:33:42 -0700110 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x18U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700111 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700112 CHECK_REGS_CONTAIN_REFS(8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700113
Ian Rogers0c7abda2012-09-19 13:33:42 -0700114 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x1aU)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700115 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700116 CHECK_REGS_CONTAIN_REFS(8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700117
Ian Rogers0c7abda2012-09-19 13:33:42 -0700118 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x1dU)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700119 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700120 CHECK_REGS_CONTAIN_REFS(8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700121
Ian Rogers0c7abda2012-09-19 13:33:42 -0700122 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x1fU)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700123 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700124 // v5 is removed from the root set because there is a "merge" operation.
125 // See 0015: if-nez v2, 001f.
126 CHECK_REGS_CONTAIN_REFS(8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700127
Ian Rogers0c7abda2012-09-19 13:33:42 -0700128 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x21U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700129 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700130 CHECK_REGS_CONTAIN_REFS(8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700131
Ian Rogers0c7abda2012-09-19 13:33:42 -0700132 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x25U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700133 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700134 CHECK_REGS_CONTAIN_REFS(8, 3, 2, 1, 0); // v8: this, v3: y, v2: y, v1: x, v0: ex
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700135
Ian Rogers0c7abda2012-09-19 13:33:42 -0700136 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x27U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700137 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700138 CHECK_REGS_CONTAIN_REFS(8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700139
Ian Rogers0c7abda2012-09-19 13:33:42 -0700140 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x29U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700141 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700142 CHECK_REGS_CONTAIN_REFS(8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700143
Ian Rogers0c7abda2012-09-19 13:33:42 -0700144 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x2cU)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700145 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700146 CHECK_REGS_CONTAIN_REFS(8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
Shih-wei Liao39723d32011-10-24 02:20:31 -0700147
Ian Rogers0c7abda2012-09-19 13:33:42 -0700148 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x2fU)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700149 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700150 CHECK_REGS_CONTAIN_REFS(8, 4, 3, 2, 1); // v8: this, v4: ex, v3: y, v2: y, v1: x
Shih-wei Liao39723d32011-10-24 02:20:31 -0700151
Ian Rogers0c7abda2012-09-19 13:33:42 -0700152 ref_bitmap = map.FindBitMap(m->NativePcOffset(m->ToNativePc(0x32U)));
Shih-wei Liao39723d32011-10-24 02:20:31 -0700153 CHECK(ref_bitmap);
Shih-wei Liao371814f2011-10-27 16:52:10 -0700154 CHECK_REGS_CONTAIN_REFS(8, 3, 2, 1, 0); // v8: this, v3: y, v2: y, v1: x, v0: ex
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700155 }
Elliott Hughes530fa002012-03-12 11:44:49 -0700156
157 return true;
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700158 }
159};
160
Shih-wei Liao371814f2011-10-27 16:52:10 -0700161// Dex instructions for the function 'f' in ReferenceMap.java
162// Virtual methods -
163// #0 : (in LReferenceMap;)
164// name : 'f'
165// type : '()Ljava/lang/Object;'
166// access : 0x0000 ()
167// code -
168// registers : 9
169// ins : 1
170// outs : 2
171// insns size : 51 16-bit code units
172// |[0001e8] ReferenceMap.f:()Ljava/lang/Object;
173// |0000: const/4 v4, #int 2 // #2
174// |0001: const/4 v7, #int 0 // #0
175// |0002: const/4 v6, #int 1 // #1
176//
177//0:[Unknown],1:[Unknown],2:[Unknown],3:[Unknown],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
178// |0003: new-array v1, v4, [Ljava/lang/Object; // type@0007
179// |0005: const/4 v2, #int 0 // #0
180
181//0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Unknown],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
182// |0006: new-instance v3, Ljava/lang/Object; // type@0003
183
184//[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Uninitialized Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
185// |0008: +invoke-object-init/range {}, Ljava/lang/Object;.<init>:()V // method@0005
186// |000b: const/4 v4, #int 2 // #2
187
188//0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
189// |000c: aput-object v3, v1, v4
190
191//0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
192// |000e: aput-object v3, v1, v6
193
194//0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
195// |0010: +invoke-virtual-quick {v8, v7}, [000c] // vtable #000c
196
197//0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
198// |0013: return-object v3
199// |0014: move-exception v0
200
201//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
202// |0015: if-nez v2, 001f // +000a
203// |0017: const/4 v4, #int 1 // #1
204
205//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 1],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
206// |0018: new-instance v5, Ljava/lang/Object; // type@0003
207
208//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 1],5:[Uninitialized Reference: java.lang.Object],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
209// |001a: +invoke-object-init/range {}, Ljava/lang/Object;.<init>:()V // method@0005
210
211//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 1],5:[Reference: java.lang.Object],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
212// |001d: aput-object v5, v1, v4
213
214//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
215// |001f: aput-object v2, v1, v6
216
217//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
218// |0021: +invoke-virtual-quick {v8, v7}, [000c] // vtable #000c
219// |0024: move-object v3, v2
220
221//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
222// |0025: goto 0013 // -0012
223// |0026: move-exception v4
224
225//0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[Reference: java.lang.Throwable],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
226// |0027: aput-object v2, v1, v6
227
228//0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[Reference: java.lang.Throwable],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
229// |0029: +invoke-virtual-quick {v8, v7}, [000c] // vtable #000c
230
231//0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[Reference: java.lang.Throwable],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
232// |002c: throw v4
233// |002d: move-exception v4
234// |002e: move-object v2, v3
235
236//0:[Unknown],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[Reference: java.lang.Throwable],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
237// |002f: goto 0027 // -0008
238// |0030: move-exception v0
239// |0031: move-object v2, v3
240
241//0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap],
242// |0032: goto 0015 // -001d
243// catches : 3
244// 0x0006 - 0x000b
245// Ljava/lang/Exception; -> 0x0014
246// <any> -> 0x0026
247// 0x000c - 0x000e
248// Ljava/lang/Exception; -> 0x0030
249// <any> -> 0x002d
250// 0x0018 - 0x001f
251// <any> -> 0x0026
252// positions :
253// 0x0003 line=8
254// 0x0005 line=9
255// 0x0006 line=11
256// 0x000b line=12
257// 0x000e line=18
258// 0x0010 line=19
259// 0x0013 line=21
260// 0x0014 line=13
261// 0x0015 line=14
262// 0x0017 line=15
263// 0x001f line=18
264// 0x0021 line=19
265// 0x0025 line=20
266// 0x0026 line=18
267// 0x0029 line=19
268// 0x002d line=18
269// 0x0030 line=13
270// locals :
271// 0x0006 - 0x000b reg=2 y Ljava/lang/Object;
272// 0x000b - 0x0013 reg=3 y Ljava/lang/Object;
273// 0x0014 - 0x0015 reg=2 y Ljava/lang/Object;
274// 0x0015 - 0x0026 reg=0 ex Ljava/lang/Exception;
275// 0x002d - 0x0032 reg=3 y Ljava/lang/Object;
276// 0x0005 - 0x0033 reg=1 x [Ljava/lang/Object;
277// 0x0032 - 0x0033 reg=2 y Ljava/lang/Object;
278// 0x0000 - 0x0033 reg=8 this LReferenceMap;
279
Elliott Hughes1bac54f2012-03-16 12:48:31 -0700280extern "C" JNIEXPORT jint JNICALL Java_ReferenceMap_refmap(JNIEnv*, jobject, jint count) {
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700281 // Visitor
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700282 ScopedObjectAccess ts(Thread::Current());
Ian Rogers0399dde2012-06-06 17:09:28 -0700283 ReferenceMap2Visitor mapper(Thread::Current()->GetManagedStack(),
284 Thread::Current()->GetTraceStack());
285 mapper.WalkStack();
Shih-wei Liao63433ba2011-10-15 18:40:39 -0700286
287 return count + 1;
288}
289
290}