1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)scopeDesc.cpp 1.58 07/07/27 16:13:17 JVM"
3 #endif
4 /*
5 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
77 }
78
79
80 GrowableArray<ScopeValue*>* ScopeDesc::decode_scope_values(int decode_offset) {
81 if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
82 DebugInfoReadStream* stream = stream_at(decode_offset);
83 int length = stream->read_int();
84 GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*> (length);
85 for (int index = 0; index < length; index++) {
86 result->push(ScopeValue::read_from(stream));
87 }
88 return result;
89 }
90
91 GrowableArray<ScopeValue*>* ScopeDesc::decode_object_values(int decode_offset) {
92 if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
93 GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*>();
94 DebugInfoReadStream* stream = new DebugInfoReadStream(_code, decode_offset, result);
95 int length = stream->read_int();
96 for (int index = 0; index < length; index++) {
97 result->push(ScopeValue::read_from(stream));
98 }
99 assert(result->length() == length, "inconsistent debug information");
100 return result;
101 }
102
103
104 GrowableArray<MonitorValue*>* ScopeDesc::decode_monitor_values(int decode_offset) {
105 if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
106 DebugInfoReadStream* stream = stream_at(decode_offset);
107 int length = stream->read_int();
108 GrowableArray<MonitorValue*>* result = new GrowableArray<MonitorValue*> (length);
109 for (int index = 0; index < length; index++) {
110 result->push(new MonitorValue(stream));
111 }
112 return result;
113 }
114
115 DebugInfoReadStream* ScopeDesc::stream_at(int decode_offset) const {
116 return new DebugInfoReadStream(_code, decode_offset, _objects);
117 }
|
1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)scopeDesc.cpp 1.58 07/07/27 16:13:17 JVM"
3 #endif
4 /*
5 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
77 }
78
79
80 GrowableArray<ScopeValue*>* ScopeDesc::decode_scope_values(int decode_offset) {
81 if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
82 DebugInfoReadStream* stream = stream_at(decode_offset);
83 int length = stream->read_int();
84 GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*> (length);
85 for (int index = 0; index < length; index++) {
86 result->push(ScopeValue::read_from(stream));
87 }
88 return result;
89 }
90
91 GrowableArray<ScopeValue*>* ScopeDesc::decode_object_values(int decode_offset) {
92 if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
93 GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*>();
94 DebugInfoReadStream* stream = new DebugInfoReadStream(_code, decode_offset, result);
95 int length = stream->read_int();
96 for (int index = 0; index < length; index++) {
97 // Objects values are pushed to 'result' array during read so that
98 // object's fields could reference it (OBJECT_ID_CODE).
99 (void)ScopeValue::read_from(stream);
100 }
101 assert(result->length() == length, "inconsistent debug information");
102 return result;
103 }
104
105
106 GrowableArray<MonitorValue*>* ScopeDesc::decode_monitor_values(int decode_offset) {
107 if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
108 DebugInfoReadStream* stream = stream_at(decode_offset);
109 int length = stream->read_int();
110 GrowableArray<MonitorValue*>* result = new GrowableArray<MonitorValue*> (length);
111 for (int index = 0; index < length; index++) {
112 result->push(new MonitorValue(stream));
113 }
114 return result;
115 }
116
117 DebugInfoReadStream* ScopeDesc::stream_at(int decode_offset) const {
118 return new DebugInfoReadStream(_code, decode_offset, _objects);
119 }
|