(javastring_print): Likewise.
* src/vm/stringlocal.h
* src/native/vm/java_lang_String.c: Removed.
* src/native/vm/java_lang_String.h: Likewise.
* src/native/vm/cldc1.1/java_lang_String.c (intern): Use
javastring_intern.
* src/native/vm/java_lang_Class.c (native/vm/java_lang_String.h):
Removed.
* src/native/vm/gnu/java_lang_VMString.c (native/vm/java_lang_String.h):
Removed.
(intern): Use javastring_intern.
* src/native/vm/sun/jvm.c (native/vm/java_lang_String.h): Removed.
(JVM_GetSystemPackage): Added debug output.
* src/native/vm/reflect.c (native/vm/java_lang_String.h): Removed.
(reflect_field_new): Use javastring_intern.
(reflect_method_new): Likewise.
* src/native/vm/Makefile.am (libnativevm_la_SOURCES): Removed
java_lang_String.[ch].
java_lang_Object.h \
java_lang_Runtime.c \
java_lang_Runtime.h \
- java_lang_String.c \
- java_lang_String.h \
java_lang_Thread.c \
java_lang_Thread.h \
$(JAVA_LANG_REFLECT_CONSTRUCTOR_SOURCES) \
*/
JNIEXPORT java_lang_String* JNICALL Java_java_lang_String_intern(JNIEnv *env, java_lang_String *this)
{
- java_handle_t *o;
- java_handle_chararray_t *value;
- int32_t offset;
- int32_t count;
-
if (this == NULL)
return NULL;
-
- LLNI_field_get_val(this, offset, offset);
- LLNI_field_get_val(this, count, count);
- LLNI_field_get_ref(this, value, value);
-
- /* search table so identical strings will get identical pointers */
-
- o = literalstring_u2(value, count, offset, true);
- return (java_lang_String *) o;
+ return (java_lang_String *) javastring_intern((java_handle_t *) this);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMString.c 8017 2007-06-05 23:46:59Z twisti $
+ $Id: java_lang_VMString.c 8357 2007-08-19 22:59:43Z twisti $
*/
#include "native/include/java_lang_String.h"
#include "native/include/java_lang_VMString.h"
-#include "native/vm/java_lang_String.h"
-
#include "vm/stringlocal.h"
*/
JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMString_intern(JNIEnv *env, jclass clazz, java_lang_String *str)
{
- return _Jv_java_lang_String_intern(str);
+ if (str == NULL)
+ return NULL;
+
+ return (java_lang_String *) javastring_intern((java_handle_t *) str);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Class.c 8341 2007-08-17 21:32:01Z michi $
+ $Id: java_lang_Class.c 8357 2007-08-19 22:59:43Z twisti $
*/
#endif
#include "native/vm/java_lang_Class.h"
-#include "native/vm/java_lang_String.h"
#if defined(ENABLE_JAVASE)
# include "native/vm/reflect.h"
+++ /dev/null
-/* src/native/vm/java_lang_String.c
-
- Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
- C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
- E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
- J. Wenninger, Institut f. Computersprachen - TU Wien
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
- $Id: java_lang_VMString.c 7910 2007-05-16 08:02:52Z twisti $
-
-*/
-
-
-#include "config.h"
-
-#include <stdlib.h>
-
-#include "native/jni.h"
-#include "native/llni.h"
-
-#include "native/include/java_lang_String.h"
-
-#include "vm/stringlocal.h"
-
-
-/*
- * Class: java/lang/String
- * Method: intern
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-java_lang_String *_Jv_java_lang_String_intern(java_lang_String *s)
-{
- java_handle_t *o;
-
- if (s == NULL)
- return NULL;
-
- /* search table so identical strings will get identical pointers */
-
- o = literalstring_u2(LLNI_field_direct(s, value), LLNI_field_direct(s, count), LLNI_field_direct(s, offset), true);
-
- return (java_lang_String *) o;
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
+++ /dev/null
-/* src/native/vm/java_lang_String.h - java/lang/String functions
-
- Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
- R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
- C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
- Institut f. Computersprachen - TU Wien
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
- $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
-
-*/
-
-
-#ifndef _JV_JAVA_LANG_STRING_H
-#define _JV_JAVA_LANG_STRING_H
-
-#include "config.h"
-#include "vm/types.h"
-
-#include "native/jni.h"
-
-#include "native/include/java_lang_String.h"
-
-
-/* function prototypes ********************************************************/
-
-java_lang_String *_Jv_java_lang_String_intern(java_lang_String *s);
-
-#endif /* _JV_JAVA_LANG_STRING_H */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: reflect.c 8343 2007-08-17 21:39:32Z michi $
+ $Id: reflect.c 8357 2007-08-19 22:59:43Z twisti $
*/
#include "native/include/java_lang_reflect_Field.h"
#include "native/include/java_lang_reflect_Method.h"
-#include "native/vm/java_lang_String.h"
#include "native/vm/reflect.h"
#include "vm/builtin.h"
/* The name needs to be interned */
/* XXX implement me better! */
- LLNI_field_set_ref(rf, name , _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name)));
+ LLNI_field_set_ref(rf, name , javastring_intern((java_lang_String *) javastring_new(f->name)));
LLNI_field_set_val(rf, slot , slot);
LLNI_field_set_ref(rf, annotations , field_get_annotations(f));
/* The name needs to be interned */
/* XXX implement me better! */
- LLNI_field_set_ref(rf, name , _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name)));
+ LLNI_field_set_ref(rf, name , javastring_intern((java_lang_String *) javastring_new(f->name)));
LLNI_field_set_cls(rf, type , (java_lang_Class *) field_get_type(f));
LLNI_field_set_val(rf, modifiers , f->flags);
LLNI_field_set_val(rf, slot , slot);
/* The name needs to be interned */
/* XXX implement me better! */
- LLNI_field_set_ref(rm, name , _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name)));
+ LLNI_field_set_ref(rm, name , javastring_intern((java_lang_String *) javastring_new(m->name)));
LLNI_field_set_val(rm, slot , slot);
LLNI_field_set_ref(rm, annotations , method_get_annotations(m));
LLNI_field_set_ref(rm, parameterAnnotations, method_get_parameterannotations(m));
/* The name needs to be interned */
/* XXX implement me better! */
- LLNI_field_set_ref(rm, name , _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name)));
+ LLNI_field_set_ref(rm, name , javastring_intern((java_lang_String *) javastring_new(m->name)));
LLNI_field_set_ref(rm, parameterTypes , method_get_parametertypearray(m));
LLNI_field_set_cls(rm, returnType , (java_lang_Class *) method_returntype_get(m));
LLNI_field_set_ref(rm, exceptionTypes , method_get_exceptionarray(m));
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jvm.c 8349 2007-08-19 15:16:39Z panzi $
+ $Id: jvm.c 8357 2007-08-19 22:59:43Z twisti $
*/
#include "native/vm/java_lang_ClassLoader.h"
#include "native/vm/java_lang_Object.h"
#include "native/vm/java_lang_Runtime.h"
-#include "native/vm/java_lang_String.h"
#include "native/vm/java_lang_Thread.h"
#include "native/vm/java_lang_reflect_Constructor.h"
#include "native/vm/java_lang_reflect_Method.h"
jstring JVM_GetSystemPackage(JNIEnv *env, jstring name)
{
- log_println("JVM_GetSystemPackage: IMPLEMENT ME!");
+ log_println("JVM_GetSystemPackage(env=%p, name=%p)");
+ javastring_print(name);
+ printf("\n");
+
+ return NULL;
}
jstring JVM_InternString(JNIEnv *env, jstring str)
{
-#if PRINTJVM
- log_println("JVM_InternString: str=%p", str);
-#endif
- return (jstring) _Jv_java_lang_String_intern((java_lang_String *) str);
+ TRACEJVMCALLS("JVM_InternString(env=%p, str=%p)", env, str);
+
+ return (jstring) javastring_intern((java_handle_t *) str);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: string.c 8343 2007-08-17 21:39:32Z michi $
+ $Id: string.c 8357 2007-08-19 22:59:43Z twisti $
*/
}
+/* javastring_intern ***********************************************************
+
+ Intern the given Java string.
+
+*******************************************************************************/
+
+java_handle_t *javastring_intern(java_handle_t *s)
+{
+ java_lang_String *so;
+ java_chararray_t *value;
+ int32_t count;
+ int32_t offset;
+/* java_lang_String *o; */
+ java_object_t *o;
+
+ so = (java_lang_String *) s;
+
+ value = LLNI_field_direct(so, value);
+ count = LLNI_field_direct(so, count);
+ offset = LLNI_field_direct(so, offset);
+
+ o = literalstring_u2(value, count, offset, true);
+
+ return o;
+}
+
+
+/* javastring_print ************************************************************
+
+ Print the given Java string.
+
+*******************************************************************************/
+
+void javastring_print(java_handle_t *s)
+{
+ java_lang_String *so;
+ java_chararray_t *value;
+ int32_t count;
+ int32_t offset;
+ uint16_t c;
+ int i;
+
+ so = (java_lang_String *) s;
+
+ value = LLNI_field_direct(so, value);
+ count = LLNI_field_direct(so, count);
+ offset = LLNI_field_direct(so, offset);
+
+ for (i = offset; i < offset + count; i++) {
+ c = LLNI_array_direct(value, i);
+ putchar(c);
+ }
+}
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stringlocal.h 8318 2007-08-16 10:05:34Z michi $
+ $Id: stringlocal.h 8357 2007-08-19 22:59:43Z twisti $
*/
/* dispose a javastring */
void literalstring_free(java_object_t*);
+java_handle_t *javastring_intern(java_handle_t *s);
+void javastring_print(java_handle_t *s);
+
#endif /* _STRINGLOCAL_H */