Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: headers.c 6286 2007-01-10 10:03:38Z twisti $
+ $Id: dummy.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "config.h"
+#include <assert.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#if defined(ENABLE_THREADS)
-# include <pthread.h>
-#endif
-
#include "toolbox/logging.h"
-#include "vm/types.h"
-
#include "vm/global.h"
+#include "vm/primitive.h"
#include "vm/vm.h"
-#include "vm/jit/code.h"
-
#include "vmcore/class.h"
#include "vmcore/method.h"
#include "vmcore/utf8.h"
+#include "vmcore/classcache.h"
+#include "vmcore/loader.h"
/* global variables ***********************************************************/
char *_Jv_bootclasspath;
-void compiler_lock()
-{
-}
-
-void compiler_unlock()
-{
-}
-
java_objectheader *javastring_new_slash_to_dot(utf *u)
{
vm_abort("javastring_new_slash_to_dot");
}
bool access_is_accessible_member(classinfo *referer, classinfo *declarer,
- s4 memberflags)
+ int32_t memberflags)
{
vm_abort("access_is_accessible_member");
abort();
}
+void asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out)
+{
+ abort();
+}
+
+void intrp_asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out)
+{
+ abort();
+}
+
/* builtin ********************************************************************/
return NULL;
}
-s4 builtin_isanysubclass(classinfo *sub, classinfo *super)
+int32_t builtin_isanysubclass(classinfo *sub, classinfo *super)
{
abort();
return NULL;
}
+java_objectarray *builtin_anewarray(int32_t size, classinfo *componentclass)
+{
+ abort();
+
+ return NULL;
+}
+
/* code ***********************************************************************/
}
+methodinfo *code_get_methodinfo_for_pv(u1 *pv)
+{
+ return NULL;
+}
+
+
/* codegen ********************************************************************/
-codeinfo *codegen_createnativestub(functionptr f, methodinfo *m)
+u1 *codegen_generate_stub_compiler(methodinfo *m)
{
return NULL;
}
-u1 *createcompilerstub(methodinfo *m)
+codeinfo *codegen_generate_stub_native(methodinfo *m, functionptr f)
{
return NULL;
}
void exceptions_print_current_exception(void)
{
+ abort();
}
void exceptions_throw_abstractmethoderror(void)
abort();
}
-void exceptions_throw_outofmemoryerror(void)
+void exceptions_throw_noclassdeffounderror_wrong_name(classinfo *c, utf *name)
{
- fprintf(stderr, "java.lang.OutOfMemoryError\n");
+ fprintf(stderr, "java.lang.NoClassDefFoundError: ");
+ utf_fprint_printable_ascii(stderr, c->name);
+ fprintf(stderr, " (wrong name: ");
+ utf_fprint_printable_ascii(stderr, name);
+ fprintf(stderr, ")\n");
abort();
}
abort();
}
-void exceptions_throw_illegalaccessexception(classinfo *c)
+void exceptions_throw_classnotfoundexception(utf *name)
{
- fprintf(stderr, "java.lang.IllegalAccessException: ");
-
- if (c != NULL)
- utf_fprint_printable_ascii_classname(stderr, c->name);
-
+ fprintf(stderr, "java.lang.ClassNotFoundException: ");
+ utf_fprint_printable_ascii(stderr, name);
fputc('\n', stderr);
abort();
abort();
}
-void classnotfoundexception_to_noclassdeffounderror(void)
-{
- /* Can that one happen? */
-
- abort();
-}
-
/* finalizer ******************************************************************/
/* gc *************************************************************************/
-s8 gc_get_heap_size(void)
+int64_t gc_get_heap_size(void)
{
return 0;
}
-s8 gc_get_free_bytes(void)
+int64_t gc_get_free_bytes(void)
{
return 0;
}
-s8 gc_get_total_bytes(void)
+int64_t gc_get_total_bytes(void)
{
return 0;
}
-s8 gc_get_max_heap_size(void)
+int64_t gc_get_max_heap_size(void)
{
return 0;
}
/* heap ***********************************************************************/
-void *heap_alloc_uncollectable(u4 bytelength)
+void *heap_alloc_uncollectable(uint32_t bytelength)
{
return calloc(bytelength, 1);
}
{
}
+void md_param_alloc_native(methoddesc *md)
+{
+}
+
/* memory *********************************************************************/
-void *mem_alloc(s4 size)
+void *mem_alloc(int32_t size)
{
/* real implementation in src/mm/memory.c clears memory */
return calloc(size, 1);
}
-void *mem_realloc(void *src, s4 len1, s4 len2)
+void *mem_realloc(void *src, int32_t len1, int32_t len2)
{
return realloc(src, len2);
}
-void mem_free(void *m, s4 size)
+void mem_free(void *m, int32_t size)
{
free(m);
}
-void *dump_alloc(s4 size)
+void *dump_alloc(int32_t size)
{
return malloc(size);
}
-void dump_release(s4 size)
+void dump_release(int32_t size)
{
}
-s4 dump_size(void)
+int32_t dump_size(void)
{
return 0;
}
+/* primitive ******************************************************************/
+
+classinfo *primitive_class_get_by_type(int type)
+{
+ abort();
+ return NULL;
+}
+
+classinfo *primitive_class_get_by_char(char ch)
+{
+ abort();
+ return NULL;
+}
+
+
/* properties *****************************************************************/
+void properties_add(char *key, char *value)
+{
+}
+
char *properties_get(char *key)
{
return NULL;
}
-/* stacktrace *****************************************************************/
+/* resolve ********************************************************************/
-java_objectarray *stacktrace_getClassContext()
+bool resolve_class_from_typedesc(typedesc *d, bool checkaccess, bool link, classinfo **result)
{
- return NULL;
+ abort();
+
+ return false;
}
+/* stupid resolving implementation used by resolve_classref_or_classinfo_eager */
+/* This function does eager resolving without any access checks. */
-/* threads ********************************************************************/
+static classinfo * dummy_resolve_class_from_name(classinfo *referer,
+ utf *classname,
+ bool checkaccess)
+{
+ classinfo *cls = NULL;
+ char *utf_ptr;
+ int len;
+
+ assert(referer);
+ assert(classname);
+
+ /* lookup if this class has already been loaded */
+
+ cls = classcache_lookup(referer->classloader, classname);
+
+ if (!cls) {
+ /* resolve array types */
+
+ if (classname->text[0] == '[') {
+ utf_ptr = classname->text + 1;
+ len = classname->blength - 1;
+
+ /* classname is an array type name */
+
+ switch (*utf_ptr) {
+ case 'L':
+ utf_ptr++;
+ len -= 2;
+ /* FALLTHROUGH */
+ case '[':
+ /* the component type is a reference type */
+ /* resolve the component type */
+ if ((cls = dummy_resolve_class_from_name(referer,
+ utf_new(utf_ptr,len),
+ checkaccess)) == NULL)
+ return NULL; /* exception */
-pthread_key_t threads_current_threadobject_key;
+ /* create the array class */
+ cls = class_array_of(cls,false);
+ if (!cls)
+ return NULL; /* exception */
+ }
+ }
-ptrint threads_get_current_tid(void)
+ /* load the class */
+ if (!cls) {
+ if (!(cls = load_class_from_classloader(classname,
+ referer->classloader)))
+ return false; /* exception */
+ }
+ }
+
+ /* the class is now loaded */
+ assert(cls);
+ assert(cls->state & CLASS_LOADED);
+
+ return cls;
+}
+
+
+classinfo * resolve_classref_or_classinfo_eager(classref_or_classinfo cls,
+ bool checkaccess)
{
- return 0;
+ classinfo *c;
+
+ assert(cls.any);
+
+ if (IS_CLASSREF(cls)) {
+ /* we must resolve this reference */
+
+ if ((c = dummy_resolve_class_from_name(cls.ref->referer, cls.ref->name,
+ checkaccess)) == NULL)
+ return NULL;
+ }
+ else {
+ /* cls has already been resolved */
+ c = cls.cls;
+ }
+
+ assert(c);
+ assert(c->state & CLASS_LOADED);
+
+ /* succeeded */
+ return c;
+}
+
+
+/* stacktrace *****************************************************************/
+
+java_objectarray *stacktrace_getClassContext()
+{
+ return NULL;
}
-/* typeinfo *******************************************************************/
+/* threads ********************************************************************/
-bool typeinfo_init_class(typeinfo *info, classref_or_classinfo c)
+intptr_t threads_get_current_tid(void)
{
- return true;
+ return 0;
}
-void typeinfo_init_classinfo(typeinfo *info, classinfo *c)
+void threads_cast_stopworld(void)
{
}
-typecheck_result typeinfo_is_assignable_to_class(typeinfo *value, classref_or_classinfo dest)
+void threads_cast_startworld(void)
{
- return typecheck_TRUE;
}
/* vm *************************************************************************/
+void vm_printconfig(void)
+{
+}
+
void vm_abort(const char *text, ...)
{
va_list ap;