comparison src/share/vm/classfile/javaClasses.cpp @ 2044:06f017f7daa7

Merge.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Fri, 07 Jan 2011 18:18:08 +0100
parents 017cd8bce8a8
children 3582bf76420e
comparison
equal deleted inserted replaced
1942:00bc9eaf0e24 2044:06f017f7daa7
1 /* 1 /*
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 # include "incls/_precompiled.incl" 25 #include "precompiled.hpp"
26 # include "incls/_javaClasses.cpp.incl" 26 #include "classfile/javaClasses.hpp"
27 #include "classfile/symbolTable.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "code/debugInfo.hpp"
30 #include "code/pcDesc.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/oopFactory.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "memory/universe.inline.hpp"
35 #include "oops/instanceKlass.hpp"
36 #include "oops/klass.hpp"
37 #include "oops/klassOop.hpp"
38 #include "oops/methodOop.hpp"
39 #include "oops/symbolOop.hpp"
40 #include "oops/typeArrayOop.hpp"
41 #include "runtime/fieldDescriptor.hpp"
42 #include "runtime/handles.inline.hpp"
43 #include "runtime/interfaceSupport.hpp"
44 #include "runtime/java.hpp"
45 #include "runtime/javaCalls.hpp"
46 #include "runtime/safepoint.hpp"
47 #include "runtime/vframe.hpp"
48 #include "utilities/preserveException.hpp"
49 #ifdef TARGET_OS_FAMILY_linux
50 # include "thread_linux.inline.hpp"
51 #endif
52 #ifdef TARGET_OS_FAMILY_solaris
53 # include "thread_solaris.inline.hpp"
54 #endif
55 #ifdef TARGET_OS_FAMILY_windows
56 # include "thread_windows.inline.hpp"
57 #endif
27 58
28 static bool find_field(instanceKlass* ik, 59 static bool find_field(instanceKlass* ik,
29 symbolOop name_symbol, symbolOop signature_symbol, 60 symbolOop name_symbol, symbolOop signature_symbol,
30 fieldDescriptor* fd, 61 fieldDescriptor* fd,
31 bool allow_super = false) { 62 bool allow_super = false) {
149 typedef jstring (*to_java_string_fn_t)(JNIEnv*, const char *); 180 typedef jstring (*to_java_string_fn_t)(JNIEnv*, const char *);
150 static to_java_string_fn_t _to_java_string_fn = NULL; 181 static to_java_string_fn_t _to_java_string_fn = NULL;
151 182
152 if (_to_java_string_fn == NULL) { 183 if (_to_java_string_fn == NULL) {
153 void *lib_handle = os::native_java_library(); 184 void *lib_handle = os::native_java_library();
154 _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, hpi::dll_lookup(lib_handle, "NewStringPlatform")); 185 _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "NewStringPlatform"));
155 if (_to_java_string_fn == NULL) { 186 if (_to_java_string_fn == NULL) {
156 fatal("NewStringPlatform missing"); 187 fatal("NewStringPlatform missing");
157 } 188 }
158 } 189 }
159 190
174 typedef char* (*to_platform_string_fn_t)(JNIEnv*, jstring, bool*); 205 typedef char* (*to_platform_string_fn_t)(JNIEnv*, jstring, bool*);
175 static to_platform_string_fn_t _to_platform_string_fn = NULL; 206 static to_platform_string_fn_t _to_platform_string_fn = NULL;
176 207
177 if (_to_platform_string_fn == NULL) { 208 if (_to_platform_string_fn == NULL) {
178 void *lib_handle = os::native_java_library(); 209 void *lib_handle = os::native_java_library();
179 _to_platform_string_fn = CAST_TO_FN_PTR(to_platform_string_fn_t, hpi::dll_lookup(lib_handle, "GetStringPlatformChars")); 210 _to_platform_string_fn = CAST_TO_FN_PTR(to_platform_string_fn_t, os::dll_lookup(lib_handle, "GetStringPlatformChars"));
180 if (_to_platform_string_fn == NULL) { 211 if (_to_platform_string_fn == NULL) {
181 fatal("GetStringPlatformChars missing"); 212 fatal("GetStringPlatformChars missing");
182 } 213 }
183 } 214 }
184 215
278 typeArrayOop value = java_lang_String::value(java_string); 309 typeArrayOop value = java_lang_String::value(java_string);
279 int offset = java_lang_String::offset(java_string); 310 int offset = java_lang_String::offset(java_string);
280 int length = java_lang_String::length(java_string); 311 int length = java_lang_String::length(java_string);
281 jchar* position = (length == 0) ? NULL : value->char_at_addr(offset); 312 jchar* position = (length == 0) ? NULL : value->char_at_addr(offset);
282 return UNICODE::as_utf8(position, length); 313 return UNICODE::as_utf8(position, length);
314 }
315
316 char* java_lang_String::as_utf8_string(oop java_string, char* buf, int buflen) {
317 typeArrayOop value = java_lang_String::value(java_string);
318 int offset = java_lang_String::offset(java_string);
319 int length = java_lang_String::length(java_string);
320 jchar* position = (length == 0) ? NULL : value->char_at_addr(offset);
321 return UNICODE::as_utf8(position, length, buf, buflen);
283 } 322 }
284 323
285 char* java_lang_String::as_utf8_string(oop java_string, int start, int len) { 324 char* java_lang_String::as_utf8_string(oop java_string, int start, int len) {
286 typeArrayOop value = java_lang_String::value(java_string); 325 typeArrayOop value = java_lang_String::value(java_string);
287 int offset = java_lang_String::offset(java_string); 326 int offset = java_lang_String::offset(java_string);