Merged revisions 8056-8122 via svnmerge from
authormichi <none@none>
Wed, 20 Jun 2007 23:50:55 +0000 (23:50 +0000)
committermichi <none@none>
Wed, 20 Jun 2007 23:50:55 +0000 (23:50 +0000)
svn+ssh://michi@c1.complang.tuwien.ac.at/ahome/cacao/svn/cacao/trunk

........
  r8058 | twisti | 2007-06-10 21:30:25 +0200 (Sun, 10 Jun 2007) | 2 lines

  * src/native/jni.c (_Jv_jni_vmargs_from_objectarray): Indent.
........
  r8059 | twisti | 2007-06-10 21:31:28 +0200 (Sun, 10 Jun 2007) | 4 lines

  * src/vm/vm.c (vm_vmargs_from_valist): Use TYPE_-defines instead of
  PRIMITIVETYPE_ ones.
  (vm_vmargs_from_jvalue): Likewise.
........
  r8060 | twisti | 2007-06-10 22:00:40 +0200 (Sun, 10 Jun 2007) | 48 lines

  * src/vm/global.h (PRIMITIVETYPE_*): Removed.
  (ARRAYTYPE_*): Likewise.

  * src/vm/jit/verify/typecheck-typeinferer.c (vmcore/primitive.h): Added.
  * src/vm/jit/verify/typecheck.c: Likewise.
  * src/vm/jit/verify/typecheck-stackbased.c: Likewise.
  * src/vm/jit/verify/typeinfo.c: Likewise.
  * src/vm/builtin.c: Likewise.
  * src/native/jni.c: Likewise.
  * src/native/vm/gnu/java_lang_VMClassLoader.c: Likewise.
  * src/native/vm/gnu/java_lang_reflect_Field.c: Likewise.
  * src/vmcore/descriptor.c: Likewise.

  * src/vm/string.c (vmcore/primitive.h): Added.
  (stringtable_update): Use new primitive functions.

  * src/vm/resolve.c: Likewise.
  (resolve_class_from_typedesc): Use new primitive functions.

  * src/vm/vm.c (vmcore/primitive.h): Added.
  (vm_create): Call primitive_init.

  * src/native/vm/java_lang_Class.c (vmcore/primitive.h): Added.
  (isPrimitive): Use primitive_class_is_primitive.
  (getDeclaringClass): Likewise.
  (getDeclaredClasses): Likewise.
  (getComponentType): Use primitive_class_get_by_type.

  * src/vmcore/class.c (class_is_primitive): Removed.
  (class_primitive_get): Removed.
  * src/vmcore/class.c: Likewise.

  * src/vmcore/primitive.c: New file.
  * src/vmcore/primitive.h: Likewise.

  * src/vmcore/Makefile.am (libvmcore_la_SOURCES): Added primitive.[ch].

  * src/vmcore/linker.c (vmcore/primitive.h): Added.
  (primitivetype_table): Removed.
  (linker_init): Removed link_primitivetype_table call.
  (link_primitivetype_table): Removed.

  * src/vmcore/linker.h (primitivetypeinfo): Removed.
  (primitivetype_table): Removed.

  * src/vm/jit/verify/typecheck-builtins.inc: Removed Contact, Authors
  from header.
........
  r8061 | twisti | 2007-06-11 09:59:36 +0200 (Mon, 11 Jun 2007) | 3 lines

  * src/vmcore/primitive.c (primitive_class_get_by_char): New function.
  * src/vmcore/primitive.h (primitive_class_get_by_char): Added.
........
  r8062 | twisti | 2007-06-11 10:12:14 +0200 (Mon, 11 Jun 2007) | 59 lines

  * src/vm/resolve.c (resolve_class_from_name): Call
  exceptions_classnotfoundexception_to_noclassdeffounderror in exception
  case.

  * src/vm/exceptions.c (vmcore/method.h): Added.
  (exceptions_throw_utf_throwable): Added object-initialize code.
  (exceptions_throw_utf_exception): Likewise.
  (exceptions_throw_noclassdeffounderror_cause): New function.
  (classnotfoundexception_to_noclassdeffounderror): Renamed to
  exceptions_classnotfoundexception_to_noclassdeffounderror.
  (exceptions_print_stacktrace): Don't use exceptionptr directly.

  * src/vm/exceptions.h (exceptions_throw_noclassdeffounderror_cause):
  Added.
  (classnotfoundexception_to_noclassdeffounderror): Renamed to
  exceptions_classnotfoundexception_to_noclassdeffounderror.

  * src/vm/vm.c (opts): Added XX:.
  (vm_create): Likewise.
  (vm_run): Call exceptions_throw_noclassdeffounderror_cause when
  main-class is not found.

  * src/native/vm/java_lang_Class.c (forName): Don't convert exception.

  * src/native/vm/gnu/java_lang_VMClassLoader.c (getPrimitiveClass): Use
  primitive_class_get_by_char.
  (loadClass): Don't convert exception.

  * src/native/native.c (native_new_and_init_string): Use
  class_findmethod instead of class_resolveclassmethod.
  (native_new_and_init_throwable): Removed.
  (native_new_and_init_exception): Likewise.

  * src/native/native.h (native_new_and_init_throwable): Removed.
  (native_new_and_init_exception): Likewise.

  * src/vmcore/class.c (class_array_of): Smaller code changes.

  * src/vmcore/loader.c (vmcore/primitive.h): Added.
  (load_class_from_classloader): Don't convert exception.
  (load_class_bootstrap): Throw ClassNotFoundException instead of
  NoClassDefFoundError.
  (load_newly_created_array): Likewise, check if primitive-array type is
  valid.

  * src/vmcore/utf8.c (utf_initCause): Added.
  (utf_java_lang_Throwable__java_lang_Throwable): Likewise.
  (utf8_init): Initialize new variables.

  * src/vmcore/utf8.h (utf_initCause): Added.
  (utf_java_lang_Throwable__java_lang_Throwable): Likewise.

  * src/cacaoh/dummy.c (exceptions_throw_classnotfoundexception): New
  function.
  (classnotfoundexception_to_noclassdeffounderror): Removed.

  * src/vmcore/options.c (options_xx): New function.
  * src/vmcore/options.h (options_xx): Added.
........
  r8063 | twisti | 2007-06-11 16:44:58 +0200 (Mon, 11 Jun 2007) | 6 lines

  * src/vmcore/method.c (method_returntype_get): New function.
  * src/vmcore/method.h (method_returntype_get): Added.

  * src/native/vm/gnu/java_lang_reflect_Method.c (getReturnType): Use
  method_returntype_get.
........
  r8064 | twisti | 2007-06-11 17:11:01 +0200 (Mon, 11 Jun 2007) | 11 lines

  * src/native/vm/java_lang_reflect_Method.c: New file.
  * src/native/vm/java_lang_reflect_Method.h: Likewise.

  * src/native/vm/Makefile.am [ENABLE_JAVASE]
  (JAVA_LANG_REFLECT_METHOD_SOURCES): Added
  (libnativevm_la_SOURCES): Added JAVA_LANG_REFLECT_METHOD_SOURCES.

  * src/native/vm/gnu/java_lang_reflect_Method.c
  (native/vm/java_lang_reflect_Method.h): Added.
  (invokeNative): Use _Jv_java_lang_reflect_Method_invoke.
........
  r8065 | pm | 2007-06-11 17:22:09 +0200 (Mon, 11 Jun 2007) | 3 lines

  * src/vm/jit/s390/emit.c (emit_load_s1_notzero, emit_load_s2_notzero, emit_load_s1_but, emit_load_s2_but): Correctly handle float regissters.
  * src/vm/jit/s390/tests/dacapo.status: Include dacapo lusearch results.
........
  r8066 | twisti | 2007-06-12 11:08:12 +0200 (Tue, 12 Jun 2007) | 4 lines

  * src/vm/vm.c (opts): Added OPT_EA, OPT_DA.
  (usage): Print help for OPT_EA, OPT_DA.
  (vm_create): Ignore OPT_EA, OPT_DA.
........
  r8067 | twisti | 2007-06-12 14:32:18 +0200 (Tue, 12 Jun 2007) | 4 lines

  * src/native/vm/gnu/java_lang_reflect_Constructor.c (constructNative):
  Added asserts for declaringClass and slot.
  * src/native/vm/gnu/java_lang_reflect_Method.c (invokeNative): Likewise.
........
  r8068 | pm | 2007-06-12 17:50:35 +0200 (Tue, 12 Jun 2007) | 5 lines

  * src/vm/jits/390/codegen.h (N_BRC_BACK_PATCH, N_LTEBR, N_LTDBR, N_LTXBR, DD_0, ..., DD_3): added, (M_CVTFI, M_CVTDI) changed to round to nearest.
  * src/vm/jits/390/codegen.c (codegen_emit): In ICMD_F2I and ICMD_D2I correct handling of corner cases, ICMD_LALOAD fix.
  * src/vm/jit/s390/md.c (md_dump_context): Include information on java method in dump.
  * src/vm/jits/390/tests/dacapo.status: Noted dacapo eclipse results.
........
  r8069 | twisti | 2007-06-13 16:08:24 +0200 (Wed, 13 Jun 2007) | 4 lines

  * src/native/jni.c (stdint.h): Added.
  (_Jv_jni_vmargs_from_objectarray): Use stdint-types, use global class
  variables.
........
  r8070 | twisti | 2007-06-13 16:26:41 +0200 (Wed, 13 Jun 2007) | 16 lines

  * src/native/jni.c (_Jv_jni_vmargs_from_objectarray): Removed.
  (_Jv_jni_invokeNative): Use vm_vmargs_from_objectarray.

  * src/vm/vm.c (stdint.h): Added.
  (native/include/java_lang_Byte.h)
  (native/include/java_lang_Character.h)
  (native/include/java_lang_Short.h)
  (native/include/java_lang_Integer.h)
  (native/include/java_lang_Boolean.h)
  (native/include/java_lang_Long.h)
  (native/include/java_lang_Float.h)
  (native/include/java_lang_Double.h): Likewise.
  (vm_vmargs_from_objectarray): New function.

  * src/vm/vm.h (vm_vmargs_from_objectarray): Added.
........
  r8071 | twisti | 2007-06-13 19:37:55 +0200 (Wed, 13 Jun 2007) | 3 lines

  * src/vm/jit/tools/genoffsets.c (main): Removed some obsolete stuff.
  * src/vm/jit/m68k/md.c (md_init): Removed offobjvftbl check.
........
  r8072 | twisti | 2007-06-13 20:31:19 +0200 (Wed, 13 Jun 2007) | 4 lines

  * tests/regression/native/testarguments.java,
  tests/regression/native/testarguments.c,
  tests/regression/native/testarguments.output: Added address test.
........
  r8073 | twisti | 2007-06-13 23:54:27 +0200 (Wed, 13 Jun 2007) | 4 lines

  * src/vm/jit/tools/genoffsets.c (vmcore/class.h): Removed.
  (vmcore/linker.h): Likewise.
  (vmcore/method.h): Likewise.
........
  r8074 | twisti | 2007-06-14 00:27:17 +0200 (Thu, 14 Jun 2007) | 43 lines

  * src/vm/jit/mips/asmpart.S (asm_vm_call_method): Rewritten for new
  argument passing.

  * src/vm/jit/mips/md-abi.c (stdarg.h): Added.
  (mm/memory.h): Likewise.
  (md_param_alloc): Set pd->index.

  * src/vm/jit/asmpart.h (stdint.h): Added new function prototypes.

  * src/vm/vm.c (md-abi.h): Added.
  (vm_array_store_int): New function.
  (vm_array_store_lng): Likewise.
  (vm_array_store_flt): Likewise.
  (vm_array_store_dbl): Likewise.
  (vm_array_store_adr): Likewise.
  (vm_array_from_valist): Likewise.
  (vm_array_from_jvalue): Likewise.
  (vm_array_from_objectarray): Likewise.
  (vm_call_method_valist): New version added.
  (vm_call_method_jvalue): Likewise.
  (vm_call_array): New function.
  (vm_call_int_array): Likewise.
  (vm_call_method_int_valist): New version added.
  (vm_call_method_int_jvalue): Likewise.
  (vm_call_method_long_valist): Likewise.
  (vm_call_method_long_jvalue): Likewise.
  (vm_call_long_array): New function.
  (vm_call_method_float_vmarg): Added vm_abort.
  (vm_call_method_double_vmarg): Likwise.

  * src/vm/vm.h (stdarg.h): Added.
  (vmcore/class.h): Likewise.
  (vmcore/method.h): Likewise.
  (vm_array_from_objectarray): Likewise.
  (vm_call_array): Likewise.
  (vm_call_int_array): Likewise.
  (vm_call_long_array): Likewise.

  * src/native/jni.c (_Jv_jni_invokeNative): Added new version.

  * src/vmcore/descriptor.h (stdint.h): Added.
  (paramdesc): Added index field (this is temporarily).
........
  r8075 | twisti | 2007-06-14 02:38:53 +0200 (Thu, 14 Jun 2007) | 3 lines

  * src/vm/jit/mips/asmpart.S (asm_vm_call_method) [!WORDS_BIGENDIAN]:
  Fixed bug (use lw instead of ld), better code in the stack copy loop.
........
  r8076 | twisti | 2007-06-14 11:35:31 +0200 (Thu, 14 Jun 2007) | 2 lines

  * src/vm/vm.c: Fixed typos.
........
  r8077 | twisti | 2007-06-14 11:44:12 +0200 (Thu, 14 Jun 2007) | 8 lines

  * src/vm/vm.c (arch.h): Added.
  (vm/jit/abi-asm.h): Likewise.
  (vm_array_store_int): Use ARG_CNT define.
  (vm_array_store_dbl): Likewise.
  (vm_array_store_flt): Likewise.
  (vm_array_store_dbl): Likewise.
  (vm_array_store_adr) [HAS_ADDRESS_REGISTER_FILE]: Changed offset.
........
  r8078 | twisti | 2007-06-14 12:20:02 +0200 (Thu, 14 Jun 2007) | 2 lines

  * src/vm/vm.c (vm_call_method_long_vmarg): Removed vm_abort.
........
  r8079 | twisti | 2007-06-14 13:06:48 +0200 (Thu, 14 Jun 2007) | 3 lines

  * src/vm/vm.c (vm_array_from_objectarray): For TYPE_ADR param can be
  NULL, that's ok (jboss is a testcase for that).
........
  r8080 | twisti | 2007-06-14 13:12:11 +0200 (Thu, 14 Jun 2007) | 10 lines

  * src/vm/jit/x86_64/asmpart.S (asm_vm_call_method): Rewritten for new
  argument passing.

  * src/vm/jit/x86_64/md-abi.c (md_param_alloc): Set pd->index.

  * src/vm/vm.c: Added __X86_64__ ifdef.
  * src/vm/vm.h: Likewise.
  * src/native/jni.c: Likewise.
  * src/vm/jit/asmpart.h: Likewise.
........
  r8081 | tbfg | 2007-06-14 14:07:03 +0200 (Thu, 14 Jun 2007) | 4 lines

  src/vm/jit/m68k/disass.c: Changed bfd_mach_mcf_isa_b_float_emac to
  bfd_mach_mcfv4e as needed for newer binutils.
........
  r8082 | tbfg | 2007-06-14 14:10:49 +0200 (Thu, 14 Jun 2007) | 6 lines

  * src/vm/jit/emit-common.c: Added emit_branch statistics.
  * src/vmcore/statistics.c: Likewise.
  * src/vmcore/statistics.h: Added count_emit_branch,
  count_emit_branch_8bit, count_emit_branch_16bit,
  count_emit_branch_32bit, count_emit_branch_64bit.
........
  r8085 | tbfg | 2007-06-14 17:12:54 +0200 (Thu, 14 Jun 2007) | 2 lines

  * src/vm/jit/emit-common.c: Fixed warning related to STATISTICS.
........
  r8086 | twisti | 2007-06-14 17:31:54 +0200 (Thu, 14 Jun 2007) | 3 lines

  * src/vmcore/loader.c: Removed commented
  exceptions_throw_noclassdeffounderror calls.
........
  r8087 | twisti | 2007-06-14 18:01:12 +0200 (Thu, 14 Jun 2007) | 6 lines

  * src/vm/exceptions.c (exceptions_get_exception)
  (exceptions_set_exception, exceptions_clear_exception)
  (exceptions_get_and_clear_exception): Moved these low leve function to
  the top of the file.
  * src/vm/exceptions.h: Likewise.
........
  r8088 | twisti | 2007-06-14 18:05:42 +0200 (Thu, 14 Jun 2007) | 2 lines

  * src/native/vm/java_lang_Class.c (forName): Removed unused variables.
........
  r8089 | twisti | 2007-06-14 18:06:31 +0200 (Thu, 14 Jun 2007) | 2 lines

  * src/native/vm/java_lang_Class.c: Added Id keyword.
........
  r8090 | twisti | 2007-06-14 18:07:37 +0200 (Thu, 14 Jun 2007) | 3 lines

  * src/vm/exceptions.c: Don't use exceptionptr directly anymore, access
  it only with functions.
........
  r8091 | twisti | 2007-06-14 18:10:33 +0200 (Thu, 14 Jun 2007) | 3 lines

  * src/threads/native/threads.c: Don't use exceptionptr directly
  anymore.
........
  r8092 | twisti | 2007-06-14 18:12:35 +0200 (Thu, 14 Jun 2007) | 3 lines

  * src/native/native.c (native_findfunction): Use
  exceptions_throw_unsatisfiedlinkerror.
........
  r8093 | twisti | 2007-06-14 18:51:44 +0200 (Thu, 14 Jun 2007) | 5 lines

  * src/vm/jit/emit-common.c (emit_bccz) [STATISTICS]: Is called
  ENABLE_STATISTICS.
  (emit_label_bccz): Likewise.
  (emit_label): Likewise.
........
  r8094 | ajordan | 2007-06-16 03:15:41 +0200 (Sat, 16 Jun 2007) | 15 lines

  * src/vmcore/statistics.h: Added more fine grained spill statistics.
  * src/vmcore/statistics.c: Likewise.

  * src/vm/jit/jit.h: New defines for spill statistics. Old ones are deprecated,
  won't increase the counters.

  * src/vm/jit/codegen-common.c (codegen_increase): Defined SPARC64 for
  2-instr-patcher-stub-call workaround.
  (codegen_add_patch_ref): Likewise.
  (codegen_reg_of_var): Removed obsolete spill counting.

  * src/vm/jit/sparc64/emit.c: Changed for new spill statistics.
  * src/vm/jit/sparc64/linux/md-os.c (md_critical_section_restart): Fixed.
........
  r8095 | ajordan | 2007-06-16 21:56:19 +0200 (Sat, 16 Jun 2007) | 6 lines

  * src/vm/jit/sparc64/codegen.c (codegen_emit): Improved integer argument passing
  by swapping variable allocation instead of copying.

  * src/vm/jit/sparc64/md-abi.h: Turned %i0 into saved reg.
  * src/vm/jit/sparc64/md-abi.c: Likewise.
........
  r8096 | pm | 2007-06-17 15:45:58 +0200 (Sun, 17 Jun 2007) | 8 lines

  * src/vm/jit/s390/asmpart.S
  src/vm/jit/s390/codegen.h,
  src/vm/jit/s390/codegen.c,
  src/vm/jit/s390/emit.c,
  src/vm/jit/s390/md.c,
  src/vm/jit/s390/patcher.c,
  src/vm/jit/s390/tests/dacapo.status: Optimized loads from data segment: the procedure vector now always points 4092 bytes before the data segment, so a lot of loads have a positive displacement. Removed dead code.
........
  r8097 | pm | 2007-06-17 16:50:16 +0200 (Sun, 17 Jun 2007) | 3 lines

  * src/vm/jit/s390/codegen.c (codegen_emit): More data segment load optimalisations.
  * src/vm/jit/s390/md.c (md_get_method_patch_address): Adapt to changes in codegen_emit.
........
  r8099 | tbfg | 2007-06-18 20:26:58 +0200 (Mon, 18 Jun 2007) | 20 lines

  * src/vm/jit/powerpc64/linux/md-abi.c (md_param_alloc): Set index.

  * src/vm/jit/powerpc64/asmpart.S (asm_vm_call_method): New parameter
  format, do not call asm_jit_compile any more.

  * src/vm/jit/asmpart.h: Enable new parameter format function
  prototypes.

  * src/vm/vm.h: Likewise.

  * src/vm/vm.c (vm_array_store_int): Although ppc64 is big endian
  do not big endianize the new parameter format.
  (vm_array_store_flt): Likewise.
  (vm_array_store_adr): Likewise.
  (vm_vmargs_from_valist): ppc64 like alpha uses doubles everywhere.
  (vm_vmargs_from_jvalue): When HAS_ADDRESS_REGISTER_FILE is defined
  address register arguments are between float and memuse.

  * src/native/jni.c: Enable new parameter function calling.
........
  r8100 | twisti | 2007-06-18 22:18:14 +0200 (Mon, 18 Jun 2007) | 7 lines

  * src/vm/exceptions.c (exceptions_throw_utf_throwable): Call
  (Ljava/lang/Throwable;)V initializer and resolve the method with
  class_resolveclassmethod to get possible exceptions.
  (exceptions_throw_utf_cause): New function.
  (exceptions_throw_noclassdeffounderror_cause): Use
  exceptions_throw_utf_cause.
........
  r8101 | twisti | 2007-06-19 20:07:59 +0200 (Tue, 19 Jun 2007) | 4 lines

  * src/cacaoh/dummy.c [ENABLE_THREADS] (pthread.h): Removed.
  (threads/threads-common.h): Added.
  [ENABLE_THREADS] (threads_current_threadobject_key): Added #ifdef.
........
  r8102 | twisti | 2007-06-19 20:09:16 +0200 (Tue, 19 Jun 2007) | 2 lines

  * src/cacaoh/dummy.c: Added Id keyword.
........
  r8103 | twisti | 2007-06-19 21:43:00 +0200 (Tue, 19 Jun 2007) | 21 lines

  * src/native/vm/nativevm.c (nativevm_init)
  [ENABLE_JAVASE && WITH_CLASSPATH_GNU]: Call
  _Jv_java_util_concurrent_atomic_AtomicLong_init.

  * src/native/vm/Makefile.am [ENABLE_JAVASE]
  (JAVA_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_SOURCES): Added.
  (libnativevm_la_SOURCES): Added
  JAVA_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_SOURCES.

  * src/native/vm/java_util_concurrent_atomic_AtomicLong.c: New file.
  * src/native/vm/java_util_concurrent_atomic_AtomicLong.h: Likewise.

  * src/native/vm/gnu/Makefile.am (libnativevmcore_la_SOURCES): Added
  java_util_concurrent_atomic_AtomicLong.c.

  * src/native/vm/gnu/java_util_concurrent_atomic_AtomicLong.c: New
  file.

  * src/native/include/Makefile.am (JAVASE_HEADER_FILES): Added
  java_util_concurrent_atomic_AtomicLong.h.
........
  r8104 | twisti | 2007-06-19 23:15:00 +0200 (Tue, 19 Jun 2007) | 5 lines

  * src/cacaoh/dummy.c (stdint.h): Added.
  (vm/types.h): Removed and replaced all old types with stdint ones.
  (threads/threads-common.h): Removed.
  [ENABLE_THREADS] (threads_current_threadobject_key): Removed.
........
  r8105 | twisti | 2007-06-19 23:47:51 +0200 (Tue, 19 Jun 2007) | 3 lines

  * src/cacaoh/headers.c (stdint.h): Added and use stdint-types.
  (vm/types.h): Removed.
........
  r8106 | twisti | 2007-06-20 00:50:17 +0200 (Wed, 20 Jun 2007) | 11 lines

  * src/vm/vm.c (vm_call_float_array): New function.
  (vm_call_method_float_valist): Likewise.
  (vm_call_method_float_jvalue): Likewise.
  (vm_call_double_array): Likewise.
  (vm_call_method_double_valist): Likewise.
  (vm_call_method_double_jvalue): Likewise.

  * src/vm/vm.h: Defined new functions.
  * src/vm/jit/asmpart.h: Likewise.
  * src/native/jni.c: Use new functions.
........
  r8107 | twisti | 2007-06-20 13:11:59 +0200 (Wed, 20 Jun 2007) | 3 lines

  * src/vm/vm.c (vm_array_store_int) [SIZEOF_VOID_P == 4]: Only do the
  integer shift on 32-bit architectures.
........
  r8108 | ajordan | 2007-06-20 14:05:26 +0200 (Wed, 20 Jun 2007) | 11 lines

  * src/vm/jit/sparc64/md-abi.c (md_param_alloc): Added pd->index setting.

  * src/vm/jit/sparc64/asmpart.S (asm_vm_call_method): Get parameters from
  new array.

  * src/vm/jit/asmpart.h: Enable new parameter passing for SPARC64.
  * src/vm/vm.h: Likewise.
  * src/vm/vm.c: Likewise.
  (vm_array_store_flt): For SPARC, shift float arguments on stack to low word too.
........
  r8109 | twisti | 2007-06-20 14:22:56 +0200 (Wed, 20 Jun 2007) | 3 lines

  * src/native/vm/nativevm.h [ENABLE_JAVASE && WITH_CLASSPATH_GNU]:
  Added _Jv_java_util_concurrent_atomic_AtomicLong_init.
........
  r8110 | twisti | 2007-06-20 14:24:32 +0200 (Wed, 20 Jun 2007) | 3 lines

  * src/cacaoh/cacaoh.c (HEAP_MAXSIZE, HEAP_STARTSIZE): Removed.
  (main): Removed heapmaxsize, heapstartsize.
........
  r8111 | twisti | 2007-06-20 15:51:38 +0200 (Wed, 20 Jun 2007) | 10 lines

  * src/native/vm/gnu/gnu_java_lang_management_VMClassLoadingMXBeanImpl.c,
  src/native/vm/gnu/gnu_java_lang_management_VMRuntimeMXBeanImpl.c,
  src/native/vm/gnu/gnu_java_lang_management_VMThreadMXBeanImpl.c,
  src/native/vm/gnu/java_lang_VMObject.c,
  src/native/vm/gnu/java_lang_VMRuntime.c,
  src/native/vm/gnu/java_lang_VMThread.c,
  src/native/vm/gnu/java_lang_reflect_Field.c,
  src/native/vm/sun_misc_Unsafe.c: Use stdint-types because of conflicts
  with generated header files.
........
  r8112 | twisti | 2007-06-20 19:54:36 +0200 (Wed, 20 Jun 2007) | 28 lines

  * src/vm/vm.c (XXusage): Removed -verbose:memory.
  (vm_create): Likewise.

  * src/mm/memory.c (memory_thread): Rewritten to use new variables.

  * src/vmcore/options.c (errno.h): Added.
  (stdint.h): Likewise
  (stdio.h): Likewise.
  (stdlib.h): Likewise.
  (opt_verbosememory): Removed.
  (opt_ProfileGCMemoryUsage): Added.
  (opt_ProfileMemoryUsage): Likewise.
  (opt_ProfileMemoryUsageGNUPlot): Likewise.
  (options_XX): Likewise.
  (options_xx): Implemented.

  * src/vmcore/options.h (stdint.h): Added.
  (option_t): Likewise.
  (opt_ProfileGCMemoryUsage): Likewise.
  (opt_ProfileMemoryUsage): Likewise.
  (opt_ProfileMemoryUsageGNUPlot): Likewise.
  (options_xx): Changed signature.

  * src/vmcore/statistics.c (statistics_print_gc_memory_usage):
  Rewritten to use new variables and GNU Plot output.

  * configure.ac (AC_CHECK_FUNCS): Added atoi, atol, strchr, strncmp.
........
  r8113 | twisti | 2007-06-20 20:05:39 +0200 (Wed, 20 Jun 2007) | 5 lines

  * src/vmcore/statistics.c (statistics_print_gc_memory_usage): Call
  fflush.

  * configure.ac (AC_CHECK_FUNCS): Added fflush, fopen, fprintf.
........
  r8114 | twisti | 2007-06-20 20:57:41 +0200 (Wed, 20 Jun 2007) | 3 lines

  * src/threads/threads-common.c (threads_preinit): Added another
  linuxthreads check.
........
  r8115 | michi | 2007-06-20 21:14:05 +0200 (Wed, 20 Jun 2007) | 41 lines

  * src/vm/vm.c (vm_array_store_int, vm_array_store_adr, vm_array_store_lng,
  vm_array_store_flt, vm_array_store_dbl): Uses pd->index for inmemory arguments.

  * src/vm/jit/allocator/simplereg.c: The regoff value is a real offset
  (multiplied by the stackslot size) for inmemory variables now.

  * src/vm/jit/arm/md-abi.c (md_param_alloc): Set pd->regoff as described above.
  * src/vm/jit/arm/emit.c: Adapted to above changes.
  * src/vm/jit/arm/codegen.c: Adapted to above changes.

  * src/vm/jit/powerpc/linux/md-abi.c,
  * src/vm/jit/powerpc/netbsd/md-abi.c,
  * src/vm/jit/powerpc/emit.c,
  * src/vm/jit/powerpc/darwin/md-abi.c,
  * src/vm/jit/powerpc/codegen.c,
  * src/vm/jit/sparc64/emit.c,
  * src/vm/jit/sparc64/md-abi.h,
  * src/vm/jit/sparc64/codegen.c,
  * src/vm/jit/sparc64/md-abi.c,
  * src/vm/jit/alpha/emit.c,
  * src/vm/jit/alpha/codegen.c,
  * src/vm/jit/alpha/md-abi.c,
  * src/vm/jit/s390/emit.c,
  * src/vm/jit/s390/codegen.c,
  * src/vm/jit/s390/md-abi.c,
  * src/vm/jit/mips/emit.c,
  * src/vm/jit/mips/codegen.c,
  * src/vm/jit/mips/md-abi.c,
  * src/vm/jit/m68k/emit.c,
  * src/vm/jit/m68k/linux/md-abi.c,
  * src/vm/jit/m68k/codegen.c,
  * src/vm/jit/powerpc64/linux/md-abi.c,
  * src/vm/jit/powerpc64/emit.c,
  * src/vm/jit/powerpc64/codegen.c,
  * src/vm/jit/i386/emit.c,
  * src/vm/jit/i386/codegen.c,
  * src/vm/jit/i386/md-abi.c,
  * src/vm/jit/x86_64/emit.c,
  * src/vm/jit/x86_64/codegen.c,
  * src/vm/jit/x86_64/md-abi.c: Likewise.
........
  r8116 | michi | 2007-06-20 22:30:56 +0200 (Wed, 20 Jun 2007) | 5 lines

  * src/vm/jit/arm/codegen.c (codegen_emit, codegen_emit_stub_native):
  Changed cd->stackframesize from wordcount to bytecount.

  * src/vm/jit/arm/emit.c (emit_verbosecall_enter): Adapted to above change.
........
  r8117 | pm | 2007-06-20 23:20:53 +0200 (Wed, 20 Jun 2007) | 3 lines

  * src/vm/jit/s390/codegen.h,
  src/vm/jit/s390/codegen.c (codegen_emit): Support another hercules bug in F2D.
........
  r8119 | twisti | 2007-06-21 00:05:10 +0200 (Thu, 21 Jun 2007) | 3 lines

  * src/vmcore/statistics.c (statistics_print_gc_memory_usage):
  Different print-format for different pointer-sizes.
........
  r8120 | twisti | 2007-06-21 00:11:24 +0200 (Thu, 21 Jun 2007) | 13 lines

  * src/vmcore/options.c (opt_verboseexception): Removed.
  (opt_TraceExceptions): Added.
  (options_xx): Handle OPT_TraceExceptions.

  * src/vmcore/options.h (opt_verboseexception): Removed.
  (opt_TraceExceptions): Added.

  * src/vm/exceptions.c (exceptions_handle_exception): Replaced
  opt_verboseexception with opt_TraceExceptions.

  * src/vm/vm.c (XXusage): Removed opt_verboseexception.
  (vm_create): Likewise.
........
  r8121 | michi | 2007-06-21 01:32:34 +0200 (Thu, 21 Jun 2007) | 7 lines

  * src/vmcore/options.c [ENABLE_REPLACEMENT] (opt_TraceReplacement): Added.
  (options_xx) [ENABLE_REPLACEMENT]: Handle OPT_TraceReplacement.

  * src/vmcore/options.h [ENABLE_REPLACEMENT] (opt_TraceReplacement): Added.

  * src/vm/jit/replace.c: Use opt_TraceReplacement mentioned above.
........

--HG--
branch : exact-gc

118 files changed:
configure.ac
src/cacaoh/cacaoh.c
src/cacaoh/dummy.c
src/cacaoh/headers.c
src/mm/memory.c
src/native/include/Makefile.am
src/native/jni.c
src/native/native.c
src/native/native.h
src/native/vm/Makefile.am
src/native/vm/gnu/Makefile.am
src/native/vm/gnu/gnu_java_lang_management_VMClassLoadingMXBeanImpl.c
src/native/vm/gnu/gnu_java_lang_management_VMRuntimeMXBeanImpl.c
src/native/vm/gnu/gnu_java_lang_management_VMThreadMXBeanImpl.c
src/native/vm/gnu/java_lang_VMClassLoader.c
src/native/vm/gnu/java_lang_VMObject.c
src/native/vm/gnu/java_lang_VMRuntime.c
src/native/vm/gnu/java_lang_VMThread.c
src/native/vm/gnu/java_lang_reflect_Constructor.c
src/native/vm/gnu/java_lang_reflect_Field.c
src/native/vm/gnu/java_lang_reflect_Method.c
src/native/vm/gnu/java_util_concurrent_atomic_AtomicLong.c [new file with mode: 0644]
src/native/vm/java_lang_Class.c
src/native/vm/java_lang_reflect_Method.c [new file with mode: 0644]
src/native/vm/java_lang_reflect_Method.h [new file with mode: 0644]
src/native/vm/java_util_concurrent_atomic_AtomicLong.c [new file with mode: 0644]
src/native/vm/java_util_concurrent_atomic_AtomicLong.h [new file with mode: 0644]
src/native/vm/nativevm.c
src/native/vm/nativevm.h
src/native/vm/sun_misc_Unsafe.c
src/threads/native/threads.c
src/threads/threads-common.c
src/vm/builtin.c
src/vm/exceptions.c
src/vm/exceptions.h
src/vm/global.h
src/vm/jit/allocator/simplereg.c
src/vm/jit/alpha/codegen.c
src/vm/jit/alpha/emit.c
src/vm/jit/alpha/md-abi.c
src/vm/jit/arm/codegen.c
src/vm/jit/arm/emit.c
src/vm/jit/arm/md-abi.c
src/vm/jit/asmpart.h
src/vm/jit/codegen-common.c
src/vm/jit/emit-common.c
src/vm/jit/i386/codegen.c
src/vm/jit/i386/emit.c
src/vm/jit/i386/md-abi.c
src/vm/jit/jit.h
src/vm/jit/m68k/codegen.c
src/vm/jit/m68k/disass.c
src/vm/jit/m68k/emit.c
src/vm/jit/m68k/linux/md-abi.c
src/vm/jit/m68k/md.c
src/vm/jit/mips/asmpart.S
src/vm/jit/mips/codegen.c
src/vm/jit/mips/emit.c
src/vm/jit/mips/md-abi.c
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc/darwin/md-abi.c
src/vm/jit/powerpc/emit.c
src/vm/jit/powerpc/linux/md-abi.c
src/vm/jit/powerpc/netbsd/md-abi.c
src/vm/jit/powerpc64/asmpart.S
src/vm/jit/powerpc64/codegen.c
src/vm/jit/powerpc64/emit.c
src/vm/jit/powerpc64/linux/md-abi.c
src/vm/jit/replace.c
src/vm/jit/s390/asmpart.S
src/vm/jit/s390/codegen.c
src/vm/jit/s390/codegen.h
src/vm/jit/s390/emit.c
src/vm/jit/s390/md-abi.c
src/vm/jit/s390/md.c
src/vm/jit/s390/patcher.c
src/vm/jit/s390/tests/dacapo.status
src/vm/jit/sparc64/asmpart.S
src/vm/jit/sparc64/codegen.c
src/vm/jit/sparc64/emit.c
src/vm/jit/sparc64/linux/md-os.c
src/vm/jit/sparc64/md-abi.c
src/vm/jit/sparc64/md-abi.h
src/vm/jit/tools/genoffsets.c
src/vm/jit/verify/typecheck-builtins.inc
src/vm/jit/verify/typecheck-stackbased.c
src/vm/jit/verify/typecheck-typeinferer.c
src/vm/jit/verify/typecheck.c
src/vm/jit/verify/typeinfo.c
src/vm/jit/x86_64/asmpart.S
src/vm/jit/x86_64/codegen.c
src/vm/jit/x86_64/emit.c
src/vm/jit/x86_64/md-abi.c
src/vm/resolve.c
src/vm/string.c
src/vm/vm.c
src/vm/vm.h
src/vmcore/Makefile.am
src/vmcore/class.c
src/vmcore/class.h
src/vmcore/descriptor.c
src/vmcore/descriptor.h
src/vmcore/linker.c
src/vmcore/linker.h
src/vmcore/loader.c
src/vmcore/method.c
src/vmcore/method.h
src/vmcore/options.c
src/vmcore/options.h
src/vmcore/primitive.c [new file with mode: 0644]
src/vmcore/primitive.h [new file with mode: 0644]
src/vmcore/statistics.c
src/vmcore/statistics.h
src/vmcore/utf8.c
src/vmcore/utf8.h
tests/regression/native/testarguments.c
tests/regression/native/testarguments.java
tests/regression/native/testarguments.output

index a725e4f62eff63f8146915eedb2bc883b644daa2..a6c4c4cd25ab2df4d4e165a63b517a44b38f5667 100644 (file)
@@ -22,7 +22,7 @@ dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 dnl 02110-1301, USA.
 dnl 
-dnl $Id: configure.ac 8056 2007-06-10 14:49:57Z michi $
+dnl $Id: configure.ac 8123 2007-06-20 23:50:55Z michi $
 
 dnl Process this file with autoconf to produce a configure script.
 
@@ -253,8 +253,13 @@ AC_FUNC_MEMCMP
 AC_FUNC_MMAP
 
 dnl keep them alpha-sorted!
+AC_CHECK_FUNCS([atoi])
+AC_CHECK_FUNCS([atol])
 AC_CHECK_FUNCS([calloc])
 AC_CHECK_FUNCS([confstr])
+AC_CHECK_FUNCS([fflush])
+AC_CHECK_FUNCS([fopen])
+AC_CHECK_FUNCS([fprintf])
 AC_CHECK_FUNCS([free])
 AC_CHECK_FUNCS([fstat])
 AC_CHECK_FUNCS([getcwd])
@@ -271,8 +276,10 @@ AC_CHECK_FUNCS([mprotect])
 AC_CHECK_FUNCS([open])
 AC_CHECK_FUNCS([scandir])
 AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS([strchr])
 AC_CHECK_FUNCS([strdup])
 AC_CHECK_FUNCS([strerror])
+AC_CHECK_FUNCS([strncmp])
 AC_CHECK_FUNCS([strstr])
 AC_CHECK_FUNCS([time])
 
index 757c14450ef2dc7de59387212c36688aa4d0b21a..0ac8546e50376cb0615f5c0012ea3c4aa7d2bf0f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: cacaoh.c 7246 2007-01-29 18:49:05Z twisti $
+   $Id: cacaoh.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 #include "vmcore/suck.h"
 
 
-/* define heap sizes **********************************************************/
-
-#define HEAP_MAXSIZE      2 * 1024 * 1024   /* default 2MB                    */
-#define HEAP_STARTSIZE         100 * 1024   /* default 100kB                  */
-
-
 /* define cacaoh options ******************************************************/
 
 enum {
@@ -163,8 +157,6 @@ int main(int argc, char **argv)
        char *classpath;
        char *cp;
        s4    cplen;
-       u4    heapmaxsize;
-       u4    heapstartsize;
 
        if (argc < 2)
                usage();
@@ -214,9 +206,6 @@ int main(int argc, char **argv)
        opt_verbose = false;
        opt_directory = NULL;
 
-       heapmaxsize = HEAP_MAXSIZE;
-       heapstartsize = HEAP_STARTSIZE;
-
 
        /* parse the options ******************************************************/
 
index fdc819330ab8b4bc48810e9cf81a6d22a76affa9..9efdeca24e66a053e46e88efdb989f8277fbd53a 100644 (file)
    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 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
 #include "config.h"
 
+#include <assert.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <assert.h>
-
-#if defined(ENABLE_THREADS)
-# include <pthread.h>
-#endif
 
 #include "toolbox/logging.h"
 
-#include "vm/types.h"
-
 #include "vm/global.h"
 #include "vm/vm.h"
 
@@ -73,7 +68,7 @@ bool access_is_accessible_class(classinfo *referer, classinfo *cls)
 }
 
 bool access_is_accessible_member(classinfo *referer, classinfo *declarer,
-                                                                s4 memberflags)
+                                                                int32_t memberflags)
 {
        vm_abort("access_is_accessible_member");
 
@@ -113,7 +108,7 @@ java_objectheader *builtin_clone(void *env, java_objectheader *o)
        return NULL;
 }
 
-s4 builtin_isanysubclass(classinfo *sub, classinfo *super)
+int32_t builtin_isanysubclass(classinfo *sub, classinfo *super)
 {
        abort();
 
@@ -127,7 +122,7 @@ java_objectheader *builtin_new(classinfo *c)
        return NULL;
 }
 
-java_objectarray *builtin_anewarray(s4 size, classinfo *componentclass)
+java_objectarray *builtin_anewarray(int32_t size, classinfo *componentclass)
 {
        abort();
 
@@ -330,16 +325,18 @@ void exceptions_throw_unsupportedclassversionerror(classinfo *c,
        abort();
 }
 
-void exceptions_throw_nullpointerexception(void)
+void exceptions_throw_classnotfoundexception(utf *name)
 {
-       fprintf(stderr, "java.lang.NullPointerException\n");
+       fprintf(stderr, "java.lang.ClassNotFoundException: ");
+       utf_fprint_printable_ascii(stderr, name);
+       fputc('\n', stderr);
 
        abort();
 }
 
-void classnotfoundexception_to_noclassdeffounderror(void)
+void exceptions_throw_nullpointerexception(void)
 {
-       /* Can that one happen? */
+       fprintf(stderr, "java.lang.NullPointerException\n");
 
        abort();
 }
@@ -364,22 +361,22 @@ void gc_reference_register(java_objectheader **ref)
 {
 }
 
-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;
 }
@@ -387,7 +384,7 @@ s8 gc_get_max_heap_size(void)
 
 /* heap ***********************************************************************/
 
-void *heap_alloc_uncollectable(u4 bytelength)
+void *heap_alloc_uncollectable(uint32_t bytelength)
 {
        return calloc(bytelength, 1);
 }
@@ -432,33 +429,33 @@ void md_param_alloc(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;
 }
@@ -581,9 +578,7 @@ java_objectarray *stacktrace_getClassContext()
 
 /* threads ********************************************************************/
 
-pthread_key_t threads_current_threadobject_key;
-
-ptrint threads_get_current_tid(void)
+intptr_t threads_get_current_tid(void)
 {
        return 0;
 }
index f84f2b2fbd07021037f745b45099e1f5157e33c0..1016e30fd9206e511609afbedd80e71c5adf92f1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: headers.c 7483 2007-03-08 13:17:40Z michi $
+   $Id: headers.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 #include <assert.h>
 #include <ctype.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "vm/types.h"
-
 #if defined(ENABLE_THREADS)
 # if defined(__DARWIN__)
 #  include <signal.h>
@@ -66,7 +65,7 @@
 
 chain *ident_chain;     /* chain with method and field names in current class */
 FILE *file = NULL;
-static u4 outputsize;
+static uint32_t outputsize;
 static bool dopadding;
 
 
@@ -92,14 +91,19 @@ void printID(utf *u)
 }
 
 
-static void addoutputsize (int len)
+static void addoutputsize(int len)
 {
-       u4 newsize,i;
-       if (!dopadding) return;
+       uint32_t newsize;
+       int32_t  i;
+
+       if (!dopadding)
+               return;
 
        newsize = MEMORY_ALIGN(outputsize, len);
        
-       for (i = outputsize; i < newsize; i++) fprintf(file, "   u1 pad%d\n", (int) i);
+       for (i = outputsize; i < newsize; i++)
+               fprintf(file, "   uint8_t pad%d\n", (int) i);
+
        outputsize = newsize;
 }
 
@@ -107,7 +111,7 @@ static void addoutputsize (int len)
 void printOverloadPart(utf *desc)
 {
        char *utf_ptr=desc->text;
-       u2 c;
+       uint16_t c;
 
        fprintf(file, "__");
 
@@ -143,26 +147,31 @@ void printOverloadPart(utf *desc)
 
 static char *printtype(char *utf_ptr)
 {
-       u2 c;
+       uint16_t c;
 
        switch (utf_nextu2(&utf_ptr)) {
-       case 'V': fprintf (file, "void");
+       case 'V':
+               fprintf(file, "void");
                break;
        case 'I':
        case 'S':
        case 'B':
        case 'C':
-       case 'Z': addoutputsize (4);
-               fprintf (file, "s4");
+       case 'Z':
+               addoutputsize(4);
+               fprintf(file, "int32_t");
                break;
-       case 'J': addoutputsize (8);
-               fprintf (file, "s8");
+       case 'J':
+               addoutputsize(8);
+               fprintf(file, "int64_t");
                break;
-       case 'F': addoutputsize (4);
-               fprintf (file, "float");
+       case 'F':
+               addoutputsize(4);
+               fprintf(file, "float");
                break;
-       case 'D': addoutputsize (8);
-               fprintf (file, "double");
+       case 'D':
+               addoutputsize(8);
+               fprintf(file, "double");
                break;
        case '[':
                addoutputsize ( sizeof(java_arrayheader*) ); 
@@ -227,7 +236,7 @@ static int searchidentchain_utf(utf *ident)
 
 static void printfields(classinfo *c)
 {
-       u4 i;
+       int32_t i;
        fieldinfo *f;
        int ident_count;
        
@@ -264,7 +273,7 @@ static void printfields(classinfo *c)
 void printmethod(methodinfo *m)
 {
        char *utf_ptr;
-       u2 paramnum = 1;
+       int32_t paramnum = 1;
 
        /* search for return-type in descriptor */      
        utf_ptr = m->descriptor->text;
@@ -324,7 +333,7 @@ void printmethod(methodinfo *m)
 
 void gen_header_filename(char *buffer, utf *u)
 {
-       s4 i;
+       int32_t i;
   
        for (i = 0; i < utf_get_number_of_u2s(u); i++) {
                if ((u->text[i] == '/') || (u->text[i] == '$')) {
@@ -345,9 +354,9 @@ void headerfile_generate(classinfo *c, char *opt_directory)
        char header_filename[1024] = "";
        char classname[1024]; 
        char uclassname[1024];
-       u2 i;
+       int32_t i;
        methodinfo *m;                  
-       u2 j;
+       int32_t j;
        methodinfo *m2;
        bool nativelyoverloaded;
 
@@ -458,7 +467,7 @@ void print_classname(classinfo *clazz)
        utf *u = clazz->name;
     char *endpos  = u->text + u->blength;
     char *utf_ptr = u->text; 
-       u2 c;
+       uint16_t c;
 
     while (utf_ptr < endpos) {
                if ((c = utf_nextu2(&utf_ptr)) == '_')
index 481afd66868d5fa41b7f892a92c06d5060d71096..26c2aea738be148227ab5c0654de7a36a9abc6bb 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: memory.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: memory.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -363,23 +363,38 @@ void mem_free(void *m, s4 size)
 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
 static void memory_thread(void)
 {
+       int32_t seconds;
+
+       /* If both arguments are specified, use the value of
+          ProfileMemoryUsage. */
+
+       if (opt_ProfileGCMemoryUsage)
+               seconds = opt_ProfileGCMemoryUsage;
+
+       if (opt_ProfileMemoryUsage)
+               seconds = opt_ProfileMemoryUsage;
+
        while (true) {
-               /* sleep thread for 2 seconds */
+               /* sleep thread */
 
-               threads_sleep(2 * 1000, 0);
+               threads_sleep(seconds * 1000, 0);
 
 # if defined(ENABLE_STATISTICS)
-               /* print current date and time */
+               /* Print current date and time (only when we print to the
+                  stdout). */
 
-               statistics_print_date();
+               if (!opt_ProfileMemoryUsageGNUPlot)
+                       statistics_print_date();
 
                /* print memory usage */
 
-               statistics_print_memory_usage();
+               if (opt_ProfileMemoryUsage)
+                       statistics_print_memory_usage();
 
                /* print GC memory usage */
 
-               statistics_print_gc_memory_usage();
+               if (opt_ProfileGCMemoryUsage)
+                       statistics_print_gc_memory_usage();
 # endif
        }
 }
index a739c1987a6645f00948f6e142c8f5f5fe1d37cf..4c65432b4e0a628de0919dc4561c3843e960e828 100644 (file)
@@ -22,7 +22,7 @@
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ## 02110-1301, USA.
 ##
-## $Id: Makefile.am 7940 2007-05-23 09:42:08Z michi $
+## $Id: Makefile.am 8123 2007-06-20 23:50:55Z michi $
 
 ## Process this file with automake to produce Makefile.in
 
@@ -67,6 +67,7 @@ JAVASE_HEADER_FILES = \
        java_nio_Buffer.h \
        java_nio_DirectByteBufferImpl.h \
        java_security_ProtectionDomain.h \
+       java_util_concurrent_atomic_AtomicLong.h \
        sun_misc_Unsafe.h
 
 JAVAME_CLDC1_1_HEADER_FILES = \
index d51531bd8bb3b360e1fb87f8d753d811271746be..6d715ec8373d734b5b019543a14a85ed1fd220f7 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: jni.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: jni.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 #include <string.h>
 
 #include "vm/types.h"
@@ -93,6 +94,7 @@
 #include "vm/exceptions.h"
 #include "vm/global.h"
 #include "vm/initialize.h"
+#include "vm/resolve.h"
 #include "vm/stringlocal.h"
 #include "vm/vm.h"
 
 
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
 #include "vmcore/statistics.h"
 
 
@@ -277,184 +279,6 @@ bool jni_free_localref_table(void)
 }
 
 
-/* _Jv_jni_vmargs_from_objectarray *********************************************
-
-   XXX
-
-*******************************************************************************/
-
-static bool _Jv_jni_vmargs_from_objectarray(java_objectheader *o,
-                                                                                       methoddesc *descr,
-                                                                                       vm_arg *vmargs,
-                                                                                       java_objectarray *params)
-{
-       java_objectheader *param;
-       s4                 paramcount;
-       typedesc          *paramtypes;
-       classinfo         *c;
-       s4                 i;
-       s4                 j;
-       s8                 value;
-
-       paramcount = descr->paramcount;
-       paramtypes = descr->paramtypes;
-
-       /* if method is non-static fill first block and skip `this' pointer */
-
-       i = 0;
-
-       if (o != NULL) {
-               /* this pointer */
-               vmargs[0].type   = TYPE_ADR;
-               vmargs[0].data.l = (u8) (ptrint) o;
-
-               paramtypes++;
-               paramcount--;
-               i++;
-       }
-
-       for (j = 0; j < paramcount; i++, j++, paramtypes++) {
-               switch (paramtypes->type) {
-               /* primitive types */
-               case TYPE_INT:
-               case TYPE_LNG:
-               case TYPE_FLT:
-               case TYPE_DBL:
-                       param = params->data[j];
-
-                       if (param == NULL)
-                               goto illegal_arg;
-
-                       /* internally used data type */
-                       vmargs[i].type = paramtypes->type;
-
-                       /* convert the value according to its declared type */
-
-                       c = param->vftbl->class;
-
-                       switch (paramtypes->decltype) {
-                       case PRIMITIVETYPE_BOOLEAN:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       value = (s8) ((java_lang_Boolean *) param)->value;
-                               else
-                                       goto illegal_arg;
-
-                               vmargs[i].data.l = value;
-                               break;
-
-                       case PRIMITIVETYPE_BYTE:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       value = (s8) ((java_lang_Byte *) param)->value;
-                               else
-                                       goto illegal_arg;
-
-                               vmargs[i].data.l = value;
-                               break;
-
-                       case PRIMITIVETYPE_CHAR:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       value = (s8) ((java_lang_Character *) param)->value;
-                               else
-                                       goto illegal_arg;
-
-                               vmargs[i].data.l = value;
-                               break;
-
-                       case PRIMITIVETYPE_SHORT:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       value = (s8) ((java_lang_Short *) param)->value;
-                               else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
-                                       value = (s8) ((java_lang_Byte *) param)->value;
-                               else
-                                       goto illegal_arg;
-
-                               vmargs[i].data.l = value;
-                               break;
-
-                       case PRIMITIVETYPE_INT:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       value = (s8) ((java_lang_Integer *) param)->value;
-                               else if (c == primitivetype_table[PRIMITIVETYPE_SHORT].class_wrap)
-                                       value = (s8) ((java_lang_Short *) param)->value;
-                               else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
-                                       value = (s8) ((java_lang_Byte *) param)->value;
-                               else
-                                       goto illegal_arg;
-
-                               vmargs[i].data.l = value;
-                               break;
-
-                       case PRIMITIVETYPE_LONG:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       value = (s8) ((java_lang_Long *) param)->value;
-                               else if (c == primitivetype_table[PRIMITIVETYPE_INT].class_wrap)
-                                       value = (s8) ((java_lang_Integer *) param)->value;
-                               else if (c == primitivetype_table[PRIMITIVETYPE_SHORT].class_wrap)
-                                       value = (s8) ((java_lang_Short *) param)->value;
-                               else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
-                                       value = (s8) ((java_lang_Byte *) param)->value;
-                               else
-                                       goto illegal_arg;
-
-                               vmargs[i].data.l = value;
-                               break;
-
-                       case PRIMITIVETYPE_FLOAT:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
-                               else
-                                       goto illegal_arg;
-                               break;
-
-                       case PRIMITIVETYPE_DOUBLE:
-                               if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       vmargs[i].data.d = (jdouble) ((java_lang_Double *) param)->value;
-                               else if (c == primitivetype_table[PRIMITIVETYPE_FLOAT].class_wrap)
-                                       vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
-                               else
-                                       goto illegal_arg;
-                               break;
-
-                       default:
-                               goto illegal_arg;
-                       }
-                       break;
-               
-                       case TYPE_ADR:
-                               if (!resolve_class_from_typedesc(paramtypes, true, true, &c))
-                                       return false;
-
-                               if (params->data[j] != 0) {
-                                       if (paramtypes->arraydim > 0) {
-                                               if (!builtin_arrayinstanceof(params->data[j], c))
-                                                       goto illegal_arg;
-
-                                       } else {
-                                               if (!builtin_instanceof(params->data[j], c))
-                                                       goto illegal_arg;
-                                       }
-                               }
-
-                               vmargs[i].type   = TYPE_ADR;
-                               vmargs[i].data.l = (u8) (ptrint) params->data[j];
-                               break;
-
-                       default:
-                               goto illegal_arg;
-               }
-       }
-
-/*     if (rettype) */
-/*             *rettype = descr->returntype.decltype; */
-
-       return true;
-
-illegal_arg:
-       exceptions_throw_illegalargumentexception();
-       return false;
-}
-
-
 /* _Jv_jni_CallObjectMethod ****************************************************
 
    Internal function to call Java Object methods.
@@ -980,6 +804,7 @@ static void _Jv_jni_CallVoidMethodA(java_objectheader *o, vftbl_t *vftbl,
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
 java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                                                                                java_objectarray *params)
 {
@@ -1044,7 +869,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
 
        vmargs = MNEW(vm_arg, argcount);
 
-       if (!_Jv_jni_vmargs_from_objectarray(o, resm->parseddesc, vmargs, params)) {
+       if (!vm_vmargs_from_objectarray(resm, o, vmargs, params)) {
                MFREE(vmargs, vm_arg, argcount);
                return NULL;
        }
@@ -1203,6 +1028,245 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
 
        return ro;
 }
+#else
+java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
+                                                                               java_objectarray *params)
+{
+       methodinfo        *resm;
+       java_objectheader *ro;
+       s4                 argcount;
+       s4                 paramcount;
+       java_objectheader *xptr;
+       int32_t            dumpsize;
+       uint64_t          *array;
+
+       if (m == NULL) {
+               exceptions_throw_nullpointerexception();
+               return NULL;
+       }
+
+       argcount = m->parseddesc->paramcount;
+       paramcount = argcount;
+
+       /* if method is non-static, remove the `this' pointer */
+
+       if (!(m->flags & ACC_STATIC))
+               paramcount--;
+
+       /* For instance methods the object has to be an instance of the
+          class the method belongs to. For static methods the obj
+          parameter is ignored. */
+
+       if (!(m->flags & ACC_STATIC) && o && (!builtin_instanceof(o, m->class))) {
+               exceptions_throw_illegalargumentexception();
+               return NULL;
+       }
+
+       /* check if we got the right number of arguments */
+
+       if (((params == NULL) && (paramcount != 0)) ||
+               (params && (params->header.size != paramcount))) 
+       {
+               exceptions_throw_illegalargumentexception();
+               return NULL;
+       }
+
+       /* for instance methods we need an object */
+
+       if (!(m->flags & ACC_STATIC) && (o == NULL)) {
+               /* XXX not sure if that is the correct exception */
+               exceptions_throw_nullpointerexception();
+               return NULL;
+       }
+
+       /* for static methods, zero object to make subsequent code simpler */
+       if (m->flags & ACC_STATIC)
+               o = NULL;
+
+       if (o != NULL) {
+               /* for instance methods we must do a vftbl lookup */
+               resm = method_vftbl_lookup(o->vftbl, m);
+       }
+       else {
+               /* for static methods, just for convenience */
+               resm = m;
+       }
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a object-array */
+
+       array = vm_array_from_objectarray(resm, o, params);
+
+       if (array == NULL) {
+               /* release dump area */
+
+               dump_release(dumpsize);
+
+               return NULL;
+       }
+
+       switch (resm->parseddesc->returntype.decltype) {
+       case TYPE_VOID:
+               (void) vm_call_array(resm, array);
+
+               ro = NULL;
+               break;
+
+       case PRIMITIVETYPE_BOOLEAN: {
+               s4 i;
+               java_lang_Boolean *bo;
+
+               i = vm_call_int_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Boolean);
+
+               /* setting the value of the object direct */
+
+               bo = (java_lang_Boolean *) ro;
+               bo->value = i;
+       }
+       break;
+
+       case PRIMITIVETYPE_BYTE: {
+               s4 i;
+               java_lang_Byte *bo;
+
+               i = vm_call_int_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Byte);
+
+               /* setting the value of the object direct */
+
+               bo = (java_lang_Byte *) ro;
+               bo->value = i;
+       }
+       break;
+
+       case PRIMITIVETYPE_CHAR: {
+               s4 i;
+               java_lang_Character *co;
+
+               i = vm_call_int_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Character);
+
+               /* setting the value of the object direct */
+
+               co = (java_lang_Character *) ro;
+               co->value = i;
+       }
+       break;
+
+       case PRIMITIVETYPE_SHORT: {
+               s4 i;
+               java_lang_Short *so;
+
+               i = vm_call_int_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Short);
+
+               /* setting the value of the object direct */
+
+               so = (java_lang_Short *) ro;
+               so->value = i;
+       }
+       break;
+
+       case PRIMITIVETYPE_INT: {
+               s4 i;
+               java_lang_Integer *io;
+
+               i = vm_call_int_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Integer);
+
+               /* setting the value of the object direct */
+
+               io = (java_lang_Integer *) ro;
+               io->value = i;
+       }
+       break;
+
+       case PRIMITIVETYPE_LONG: {
+               s8 l;
+               java_lang_Long *lo;
+
+               l = vm_call_long_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Long);
+
+               /* setting the value of the object direct */
+
+               lo = (java_lang_Long *) ro;
+               lo->value = l;
+       }
+       break;
+
+       case PRIMITIVETYPE_FLOAT: {
+               float f;
+               java_lang_Float *fo;
+
+               f = vm_call_float_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Float);
+
+               /* setting the value of the object direct */
+
+               fo = (java_lang_Float *) ro;
+               fo->value = f;
+       }
+       break;
+
+       case PRIMITIVETYPE_DOUBLE: {
+               double d;
+               java_lang_Double *_do;
+
+               d = vm_call_double_array(resm, array);
+
+               ro = builtin_new(class_java_lang_Double);
+
+               /* setting the value of the object direct */
+
+               _do = (java_lang_Double *) ro;
+               _do->value = d;
+       }
+       break;
+
+       case TYPE_ADR:
+               ro = vm_call_array(resm, array);
+               break;
+
+       default:
+               /* if this happens the exception has already been set by
+                  fill_callblock_from_objectarray */
+
+               /* release dump area */
+
+               dump_release(dumpsize);
+
+               return NULL;
+       }
+
+       xptr = exceptions_get_exception();
+
+       if (xptr != NULL) {
+               /* clear exception pointer, we are calling JIT code again */
+
+               exceptions_clear_exception();
+
+               exceptions_throw_invocationtargetexception(xptr);
+       }
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return ro;
+}
+#endif
 
 
 /* GetVersion ******************************************************************
index c4a0dfa6445979a29c1b98053c5e01b4ec3ce0f8..7184bc7e0e54c1df5299571bafd07278aa4e6d07 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: native.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: native.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -741,9 +741,7 @@ functionptr native_findfunction(utf *cname, utf *mname, utf *desc,
 
        /* no function was found, throw exception */
 
-       *exceptionptr =
-                       new_exception_utfmessage(string_java_lang_UnsatisfiedLinkError,
-                                                                        mname);
+       exceptions_throw_unsatisfiedlinkerror(mname);
 
        return NULL;
 }
@@ -905,11 +903,7 @@ java_objectheader *native_new_and_init_string(classinfo *c, java_objectheader *s
 
        /* find initializer */
 
-       m = class_resolveclassmethod(c,
-                                                                utf_init,
-                                                                utf_java_lang_String__void,
-                                                                NULL,
-                                                                true);
+       m = class_findmethod(c, utf_init, utf_java_lang_String__void);
 
        /* initializer not found */
 
@@ -924,70 +918,6 @@ java_objectheader *native_new_and_init_string(classinfo *c, java_objectheader *s
 }
 
 
-java_objectheader *native_new_and_init_throwable(classinfo *c, java_objectheader *t)
-{
-       java_objectheader *o;
-       methodinfo        *m;
-
-       if (c == NULL)
-               vm_abort("native_new_and_init_throwable: c == NULL");
-
-       /* create object */
-
-       o = builtin_new(c);
-       
-       if (o == NULL)
-               return NULL;
-
-       /* find initializer */
-
-       m = class_findmethod(c, utf_init, utf_java_lang_Throwable__void);
-                                                     
-       /* initializer not found */
-
-       if (m == NULL)
-               return NULL;
-
-       /* call initializer */
-
-       (void) vm_call_method(m, o, t);
-
-       return o;
-}
-
-
-java_objectheader *native_new_and_init_exception(classinfo *c, java_objectheader *e)
-{
-       java_objectheader *o;
-       methodinfo        *m;
-
-       if (c == NULL)
-               vm_abort("native_new_and_init_exception: c == NULL");
-
-       /* create object */
-
-       o = builtin_new(c);
-       
-       if (o == NULL)
-               return NULL;
-
-       /* find initializer */
-
-       m = class_findmethod(c, utf_init, utf_java_lang_Exception__V);
-                                                     
-       /* initializer not found */
-
-       if (m == NULL)
-               return NULL;
-
-       /* call initializer */
-
-       (void) vm_call_method(m, o, e);
-
-       return 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
index 5ca77ba420af1f6adea72ff822b3aad80660ba83..0373bbbbab4ef3f52a41d7f60b202f2d47242f96 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: native.h 8056 2007-06-10 14:49:57Z michi $
+   $Id: native.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -141,12 +141,6 @@ java_objectheader *native_new_and_init(classinfo *c);
 java_objectheader *native_new_and_init_string(classinfo *c,
                                                                                          java_objectheader *s);
 
-java_objectheader *native_new_and_init_throwable(classinfo *c,
-                                                                                                java_objectheader *t);
-
-java_objectheader *native_new_and_init_exception(classinfo *c,
-                                                                                                java_objectheader *e);
-
 #endif /* _NATIVE_H */
 
 
index 1705453c092ab00e04e9dcdd2db051a155d49e81..5cd7dee95a3dfd33821c44042301d26555586f57 100644 (file)
@@ -59,6 +59,14 @@ JAVA_LANG_REFLECT_CONSTRUCTOR_SOURCES = \
        java_lang_reflect_Constructor.c \
        java_lang_reflect_Constructor.h
 
+JAVA_LANG_REFLECT_METHOD_SOURCES = \
+       java_lang_reflect_Method.c \
+       java_lang_reflect_Method.h
+
+JAVA_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_SOURCES = \
+       java_util_concurrent_atomic_AtomicLong.c \
+       java_util_concurrent_atomic_AtomicLong.h
+
 SUN_MISC_UNSAFE_SOURCES = \
        sun_misc_Unsafe.c
 endif
@@ -82,6 +90,8 @@ libnativevm_la_SOURCES = \
        java_lang_Thread.c \
        java_lang_Thread.h \
        $(JAVA_LANG_REFLECT_CONSTRUCTOR_SOURCES) \
+       $(JAVA_LANG_REFLECT_METHOD_SOURCES) \
+       $(JAVA_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_SOURCES) \
        $(SUN_MISC_UNSAFE_SOURCES)
 
 libnativevm_la_LIBADD = \
index 781155261701bcfb3e238cc4560b1144b095510c..d7ea29e40d23ecd451b91a4536a8ab9ef1b9fd6c 100644 (file)
@@ -26,7 +26,7 @@
 ##
 ## Authors: Christian Thalinger
 ##
-## $Id: Makefile.am 8027 2007-06-07 10:30:33Z michi $
+## $Id: Makefile.am 8123 2007-06-20 23:50:55Z michi $
 
 ## Process this file with automake to produce Makefile.in
 
@@ -62,7 +62,8 @@ libnativevmcore_la_SOURCES = \
        java_lang_reflect_Field.c \
        java_lang_reflect_Method.c \
        java_lang_reflect_VMProxy.c \
-       java_security_VMAccessController.c
+       java_security_VMAccessController.c \
+       java_util_concurrent_atomic_AtomicLong.c
 
 if ENABLE_JVMTI
 libjdwp_la_SOURCES = \
index 2ec54697410ac263bfde74a119c5436ac0a5b679..0deb76facdb55006eb752eb6c80b9f1767a65000 100644 (file)
@@ -28,7 +28,8 @@
 
 
 #include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
 
 #include "mm/gc-common.h"
 
 #include "vm/vm.h"
 
 #include "vmcore/classcache.h"
+#include "vmcore/utf8.h"
 
 
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "getLoadedClassCount",   "()I",  (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount   },
-       { "getUnloadedClassCount", "()J",  (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount },
-       { "isVerbose",             "()Z",  (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose             },
-       { "setVerbose",            "(Z)V", (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose            },
+       { "getLoadedClassCount",   "()I",  (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount   },
+       { "getUnloadedClassCount", "()J",  (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount },
+       { "isVerbose",             "()Z",  (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose             },
+       { "setVerbose",            "(Z)V", (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose            },
 };
 
 
@@ -75,9 +77,9 @@ void _Jv_gnu_java_lang_management_VMClassLoadingMXBeanImpl_init(void)
  * Method:    getLoadedClassCount
  * Signature: ()I
  */
-JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount(JNIEnv *env, jclass clazz)
 {
-       s4 count;
+       int32_t count;
 
        count = classcache_get_loaded_class_count();
 
@@ -90,7 +92,7 @@ JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getL
  * Method:    getUnloadedClassCount
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount(JNIEnv *env, jclass clazz)
 {
        log_println("Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount: IMPLEMENT ME!");
 
@@ -103,7 +105,7 @@ JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getU
  * Method:    isVerbose
  * Signature: ()Z
  */
-JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose(JNIEnv *env, jclass clazz)
 {
        return _Jv_jvm->Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_verbose;
 }
@@ -114,7 +116,7 @@ JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVe
  * Method:    setVerbose
  * Signature: (Z)V
  */
-JNIEXPORT void JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose(JNIEnv *env, jclass clazz, s4 verbose)
+JNIEXPORT void JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose(JNIEnv *env, jclass clazz, int32_t verbose)
 {
        _Jv_jvm->Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_verbose = verbose;
 }
index d66e5d7d000433825cf07f6bc044f637f8fc0146..990e7d96016745c90f768351b1d2877720754f3c 100644 (file)
@@ -28,7 +28,8 @@
 
 
 #include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
 
 #include "native/jni.h"
 #include "native/native.h"
 #include "vm/vm.h"
 
 #include "vmcore/class.h"
+#include "vmcore/utf8.h"
 
 
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "getInputArguments", "()[Ljava/lang/String;", (void *) (ptrint) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getInputArguments },
-       { "getStartTime",      "()J",                   (void *) (ptrint) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime      },
+       { "getInputArguments", "()[Ljava/lang/String;", (void *) (intptr_t) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getInputArguments },
+       { "getStartTime",      "()J",                   (void *) (intptr_t) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime      },
 };
 
 
@@ -84,7 +86,7 @@ JNIEXPORT java_objectarray* JNICALL Java_gnu_java_lang_management_VMRuntimeMXBea
  * Method:    getStartTime
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime(JNIEnv *env, jclass clazz)
 {
        return _Jv_jvm->starttime;
 }
index 62b92a92b52a83c0d21cf377a415342a74786280..44047f27c02ff61b66020a175c936cca1085258c 100644 (file)
@@ -28,7 +28,8 @@
 
 
 #include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
 
 #include "mm/gc-common.h"
 
 #include "vm/vm.h"
 
 #include "vmcore/classcache.h"
+#include "vmcore/utf8.h"
 
 
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "findMonitorDeadlockedThreads", "()[J",                                  (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_findMonitorDeadlockedThreads },
-       { "getCurrentThreadCpuTime",      "()J",                                   (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime      },
-       { "getCurrentThreadUserTime",     "()J",                                   (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime     },
-       { "getPeakThreadCount",           "()I",                                   (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount           },
-       { "getThreadCpuTime",             "(J)J",                                  (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime             },
-       { "getThreadInfoForId",           "(JI)Ljava/lang/management/ThreadInfo;", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId           },
-       { "getThreadUserTime",            "(J)J",                                  (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime            },
-       { "getTotalStartedThreadCount",   "()J",                                   (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount   },
-       { "resetPeakThreadCount",         "()V",                                   (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_resetPeakThreadCount         },
+       { "findMonitorDeadlockedThreads", "()[J",                                  (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_findMonitorDeadlockedThreads },
+       { "getCurrentThreadCpuTime",      "()J",                                   (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime      },
+       { "getCurrentThreadUserTime",     "()J",                                   (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime     },
+       { "getPeakThreadCount",           "()I",                                   (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount           },
+       { "getThreadCpuTime",             "(J)J",                                  (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime             },
+       { "getThreadInfoForId",           "(JI)Ljava/lang/management/ThreadInfo;", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId           },
+       { "getThreadUserTime",            "(J)J",                                  (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime            },
+       { "getTotalStartedThreadCount",   "()J",                                   (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount   },
+       { "resetPeakThreadCount",         "()V",                                   (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_resetPeakThreadCount         },
 };
 
 
@@ -96,7 +98,7 @@ JNIEXPORT java_longarray* JNICALL Java_gnu_java_lang_management_VMThreadMXBeanIm
  * Method:    getCurrentThreadCpuTime
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime(JNIEnv *env, jclass clazz)
 {
        log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime: IMPLEMENT ME!");
 
@@ -109,7 +111,7 @@ JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrent
  * Method:    getCurrentThreadUserTime
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime(JNIEnv *env, jclass clazz)
 {
        log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime: IMPLEMENT ME!");
 
@@ -122,7 +124,7 @@ JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrent
  * Method:    getPeakThreadCount
  * Signature: ()I
  */
-JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount(JNIEnv *env, jclass clazz)
 {
        return _Jv_jvm->java_lang_management_ThreadMXBean_PeakThreadCount;
 }
@@ -133,7 +135,7 @@ JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThr
  * Method:    getThreadCpuTime
  * Signature: (J)J
  */
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime(JNIEnv *env, jclass clazz, s8 id)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime(JNIEnv *env, jclass clazz, int64_t id)
 {
        log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime: IMPLEMENT ME!");
 
@@ -146,7 +148,7 @@ JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadC
  * Method:    getThreadInfoForId
  * Signature: (JI)Ljava/lang/management/ThreadInfo;
  */
-JNIEXPORT java_lang_management_ThreadInfo* JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId(JNIEnv *env, jclass clazz, s8 id, s4 maxDepth)
+JNIEXPORT java_lang_management_ThreadInfo* JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId(JNIEnv *env, jclass clazz, int64_t id, int32_t maxDepth)
 {
        log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId: IMPLEMENT ME!");
 
@@ -159,7 +161,7 @@ JNIEXPORT java_lang_management_ThreadInfo* JNICALL Java_gnu_java_lang_management
  * Method:    getThreadUserTime
  * Signature: (J)J
  */
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime(JNIEnv *env, jclass clazz, s8 par1)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime(JNIEnv *env, jclass clazz, int64_t par1)
 {
        log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime: IMPLEMENT ME!");
 
@@ -172,7 +174,7 @@ JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadU
  * Method:    getTotalStartedThreadCount
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount(JNIEnv *env, jclass clazz)
 {
        return _Jv_jvm->java_lang_management_ThreadMXBean_TotalStartedThreadCount;
 }
index 1e64194254282c5004338c3c9d4ca838492ee121..d5149fd3e4423d3de30bda5782b124be965f6e8e 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_VMClassLoader.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: java_lang_VMClassLoader.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -63,6 +63,7 @@
 #include "vmcore/linker.h"
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
+#include "vmcore/primitive.h"
 #include "vmcore/statistics.h"
 #include "vmcore/suck.h"
 #include "vmcore/zip.h"
@@ -120,45 +121,14 @@ JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClassLoader_defineClass(JNIE
 JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClassLoader_getPrimitiveClass(JNIEnv *env, jclass clazz, s4 type)
 {
        classinfo *c;
-       s4         index;
-
-       /* get primitive class */
-
-       switch (type) {
-       case 'I':
-               index = PRIMITIVETYPE_INT;
-               break;
-       case 'J':
-               index = PRIMITIVETYPE_LONG;
-               break;
-       case 'F':
-               index = PRIMITIVETYPE_FLOAT;
-               break;
-       case 'D':
-               index = PRIMITIVETYPE_DOUBLE;
-               break;
-       case 'B':
-               index = PRIMITIVETYPE_BYTE;
-               break;
-       case 'C':
-               index = PRIMITIVETYPE_CHAR;
-               break;
-       case 'S':
-               index = PRIMITIVETYPE_SHORT;
-               break;
-       case 'Z':
-               index = PRIMITIVETYPE_BOOLEAN;
-               break;
-       case 'V':
-               index = PRIMITIVETYPE_VOID;
-               break;
-       default:
-               exceptions_throw_noclassdeffounderror(utf_null);
+
+       c = primitive_class_get_by_char(type);
+
+       if (c == NULL) {
+               exceptions_throw_classnotfoundexception(utf_null);
                return NULL;
        }
 
-       c = primitivetype_table[index].class_primitive;
-
        return (java_lang_Class *) c;
 }
 
@@ -195,9 +165,8 @@ JNIEXPORT void JNICALL Java_java_lang_VMClassLoader_resolveClass(JNIEnv *env, jc
  */
 JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClassLoader_loadClass(JNIEnv *env, jclass clazz, java_lang_String *name, s4 resolve)
 {
-       classinfo         *c;
-       utf               *u;
-       java_objectheader *xptr;
+       classinfo *c;
+       utf       *u;
 
        if (name == NULL) {
                exceptions_throw_nullpointerexception();
@@ -213,33 +182,15 @@ JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClassLoader_loadClass(JNIEnv
        c = load_class_bootstrap(u);
 
        if (c == NULL)
-               goto exception;
+               return NULL;
 
        /* resolve class -- if requested */
 
 /*     if (resolve) */
                if (!link_class(c))
-                       goto exception;
+                       return NULL;
 
        return (java_lang_Class *) c;
-
- exception:
-       xptr = exceptions_get_exception();
-
-       c = xptr->vftbl->class;
-       
-       /* if the exception is a NoClassDefFoundError, we replace it with a
-          ClassNotFoundException, otherwise return the exception */
-
-       if (c == class_java_lang_NoClassDefFoundError) {
-               /* clear exceptionptr, because builtin_new checks for 
-                  ExceptionInInitializerError */
-               exceptions_clear_exception();
-
-               exceptions_throw_classnotfoundexception(u);
-       }
-
-       return NULL;
 }
 
 
index f3e9fe1baa5a5d2fb4ecec318996c09d3bfe981f..0b43d38c1f285e1c095c6e144431f08268b00828 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_VMObject.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: java_lang_VMObject.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
 #include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
 
 #include "native/jni.h"
 #include "native/native.h"
 
 #include "native/vm/java_lang_Object.h"
 
+#include "vmcore/utf8.h"
+
 
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "getClass",  "(Ljava/lang/Object;)Ljava/lang/Class;",     (void *) (ptrint) &Java_java_lang_VMObject_getClass  },
-       { "clone",     "(Ljava/lang/Cloneable;)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_VMObject_clone     },
-       { "notify",    "(Ljava/lang/Object;)V",                     (void *) (ptrint) &Java_java_lang_VMObject_notify    },
-       { "notifyAll", "(Ljava/lang/Object;)V",                     (void *) (ptrint) &Java_java_lang_VMObject_notifyAll },
-       { "wait",      "(Ljava/lang/Object;JI)V",                   (void *) (ptrint) &Java_java_lang_VMObject_wait      },
+       { "getClass",  "(Ljava/lang/Object;)Ljava/lang/Class;",     (void *) (intptr_t) &Java_java_lang_VMObject_getClass  },
+       { "clone",     "(Ljava/lang/Cloneable;)Ljava/lang/Object;", (void *) (intptr_t) &Java_java_lang_VMObject_clone     },
+       { "notify",    "(Ljava/lang/Object;)V",                     (void *) (intptr_t) &Java_java_lang_VMObject_notify    },
+       { "notifyAll", "(Ljava/lang/Object;)V",                     (void *) (intptr_t) &Java_java_lang_VMObject_notifyAll },
+       { "wait",      "(Ljava/lang/Object;JI)V",                   (void *) (intptr_t) &Java_java_lang_VMObject_wait      },
 };
 
 
@@ -118,7 +121,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMObject_notifyAll(JNIEnv *env, jclass cla
  * Method:    wait
  * Signature: (Ljava/lang/Object;JI)V
  */
-JNIEXPORT void JNICALL Java_java_lang_VMObject_wait(JNIEnv *env, jclass clazz, java_lang_Object *o, s8 ms, s4 ns)
+JNIEXPORT void JNICALL Java_java_lang_VMObject_wait(JNIEnv *env, jclass clazz, java_lang_Object *o, int64_t ms, int32_t ns)
 {
        _Jv_java_lang_Object_wait(o, ms, ns);
 }
index 72a30e71b50d96628bb90c38f3803f274fa004bb..ce872606fecb7cb38a9c3295b8bbe36281440be7 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_VMRuntime.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: java_lang_VMRuntime.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -31,6 +31,7 @@
 
 #include <assert.h>
 #include <string.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <sys/utsname.h>
 
@@ -39,8 +40,6 @@
 # include <mach/mach.h>
 #endif
 
-#include "vm/types.h"
-
 #include "mm/gc-common.h"
 #include "mm/memory.h"
 
@@ -61,6 +60,8 @@
 #include "vm/stringlocal.h"
 #include "vm/vm.h"
 
+#include "vmcore/utf8.h"
+
 
 /* this should work on BSD */
 /*
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "exit",                   "(I)V",                                         (void *) (ptrint) &Java_java_lang_VMRuntime_exit                   },
-       { "freeMemory",             "()J",                                          (void *) (ptrint) &Java_java_lang_VMRuntime_freeMemory             },
-       { "totalMemory",            "()J",                                          (void *) (ptrint) &Java_java_lang_VMRuntime_totalMemory            },
-       { "maxMemory",              "()J",                                          (void *) (ptrint) &Java_java_lang_VMRuntime_maxMemory              },
-       { "gc",                     "()V",                                          (void *) (ptrint) &Java_java_lang_VMRuntime_gc                     },
-       { "runFinalization",        "()V",                                          (void *) (ptrint) &Java_java_lang_VMRuntime_runFinalization        },
-       { "runFinalizersOnExit",    "(Z)V",                                         (void *) (ptrint) &Java_java_lang_VMRuntime_runFinalizersOnExit    },
-       { "runFinalizationForExit", "()V",                                          (void *) (ptrint) &Java_java_lang_VMRuntime_runFinalizationForExit },
-       { "traceInstructions",      "(Z)V",                                         (void *) (ptrint) &Java_java_lang_VMRuntime_traceInstructions      },
-       { "traceMethodCalls",       "(Z)V",                                         (void *) (ptrint) &Java_java_lang_VMRuntime_traceMethodCalls       },
-       { "availableProcessors",    "()I",                                          (void *) (ptrint) &Java_java_lang_VMRuntime_availableProcessors    },
-       { "nativeLoad",             "(Ljava/lang/String;Ljava/lang/ClassLoader;)I", (void *) (ptrint) &Java_java_lang_VMRuntime_nativeLoad             },
-       { "mapLibraryName",         "(Ljava/lang/String;)Ljava/lang/String;",       (void *) (ptrint) &Java_java_lang_VMRuntime_mapLibraryName         },
+       { "exit",                   "(I)V",                                         (void *) (intptr_t) &Java_java_lang_VMRuntime_exit                   },
+       { "freeMemory",             "()J",                                          (void *) (intptr_t) &Java_java_lang_VMRuntime_freeMemory             },
+       { "totalMemory",            "()J",                                          (void *) (intptr_t) &Java_java_lang_VMRuntime_totalMemory            },
+       { "maxMemory",              "()J",                                          (void *) (intptr_t) &Java_java_lang_VMRuntime_maxMemory              },
+       { "gc",                     "()V",                                          (void *) (intptr_t) &Java_java_lang_VMRuntime_gc                     },
+       { "runFinalization",        "()V",                                          (void *) (intptr_t) &Java_java_lang_VMRuntime_runFinalization        },
+       { "runFinalizersOnExit",    "(Z)V",                                         (void *) (intptr_t) &Java_java_lang_VMRuntime_runFinalizersOnExit    },
+       { "runFinalizationForExit", "()V",                                          (void *) (intptr_t) &Java_java_lang_VMRuntime_runFinalizationForExit },
+       { "traceInstructions",      "(Z)V",                                         (void *) (intptr_t) &Java_java_lang_VMRuntime_traceInstructions      },
+       { "traceMethodCalls",       "(Z)V",                                         (void *) (intptr_t) &Java_java_lang_VMRuntime_traceMethodCalls       },
+       { "availableProcessors",    "()I",                                          (void *) (intptr_t) &Java_java_lang_VMRuntime_availableProcessors    },
+       { "nativeLoad",             "(Ljava/lang/String;Ljava/lang/ClassLoader;)I", (void *) (intptr_t) &Java_java_lang_VMRuntime_nativeLoad             },
+       { "mapLibraryName",         "(Ljava/lang/String;)Ljava/lang/String;",       (void *) (intptr_t) &Java_java_lang_VMRuntime_mapLibraryName         },
 };
 
 
@@ -110,7 +111,7 @@ void _Jv_java_lang_VMRuntime_init(void)
  * Method:    exit
  * Signature: (I)V
  */
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz, s4 status)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz, int32_t status)
 {
        _Jv_java_lang_Runtime_exit(status);
 }
@@ -121,7 +122,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz,
  * Method:    freeMemory
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass clazz)
 {
        return _Jv_java_lang_Runtime_freeMemory();
 }
@@ -132,7 +133,7 @@ JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass cla
  * Method:    totalMemory
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass clazz)
 {
        return _Jv_java_lang_Runtime_totalMemory();
 }
@@ -143,7 +144,7 @@ JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass cl
  * Method:    maxMemory
  * Signature: ()J
  */
-JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_maxMemory(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_java_lang_VMRuntime_maxMemory(JNIEnv *env, jclass clazz)
 {
        return gc_get_max_heap_size();
 }
@@ -176,7 +177,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalization(JNIEnv *env, jcl
  * Method:    runFinalizersOnExit
  * Signature: (Z)V
  */
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizersOnExit(JNIEnv *env, jclass clazz, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizersOnExit(JNIEnv *env, jclass clazz, int32_t value)
 {
        _Jv_java_lang_Runtime_runFinalizersOnExit(value);
 }
@@ -205,7 +206,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizationForExit(JNIEnv *e
  * Method:    traceInstructions
  * Signature: (Z)V
  */
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, jclass clazz, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, jclass clazz, int32_t par1)
 {
        /* not supported */
 }
@@ -216,7 +217,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, j
  * Method:    traceMethodCalls
  * Signature: (Z)V
  */
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jclass clazz, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jclass clazz, int32_t par1)
 {
        /* not supported */
 }
@@ -227,13 +228,13 @@ JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jc
  * Method:    availableProcessors
  * Signature: ()I
  */
-JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, jclass clazz)
 {
 #if defined(_SC_NPROC_ONLN)
-       return (s4) sysconf(_SC_NPROC_ONLN);
+       return (int32_t) sysconf(_SC_NPROC_ONLN);
 
 #elif defined(_SC_NPROCESSORS_ONLN)
-       return (s4) sysconf(_SC_NPROCESSORS_ONLN);
+       return (int32_t) sysconf(_SC_NPROCESSORS_ONLN);
 
 #elif defined(__DARWIN__)
        /* this should work in BSD */
@@ -246,7 +247,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, j
        len = sizeof(ncpu);
        rc = sysctl(mib, 2, &ncpu, &len, NULL, 0);
 
-       return (s4) ncpu;
+       return (int32_t) ncpu;
        */
 
        host_basic_info_data_t hinfo;
@@ -260,7 +261,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, j
                return -1;
        }
 
-    return (s4) hinfo.avail_cpus;
+    return (int32_t) hinfo.avail_cpus;
 
 #else
        return 1;
@@ -273,7 +274,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, j
  * Method:    nativeLoad
  * Signature: (Ljava/lang/String;Ljava/lang/ClassLoader;)I
  */
-JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_nativeLoad(JNIEnv *env, jclass clazz, java_lang_String *libname, java_lang_ClassLoader *loader)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMRuntime_nativeLoad(JNIEnv *env, jclass clazz, java_lang_String *libname, java_lang_ClassLoader *loader)
 {
        java_objectheader *cl;
 
@@ -296,8 +297,8 @@ JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMRuntime_mapLibraryName(JNIE
 {
        utf               *u;
        char              *buffer;
-       s4                 buffer_len;
-       s4                 dumpsize;
+       int32_t            buffer_len;
+       int32_t            dumpsize;
        java_objectheader *o;
 
        if (libname == NULL) {
index b257a97e541afd80e63455d0382f648834d02189..124c41f0edad5cb8e2c4d69401a4752afe22a5ef 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_VMThread.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: java_lang_VMThread.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
 #include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
 
 #include "native/jni.h"
 #include "native/native.h"
 
 #include "native/vm/java_lang_Thread.h"
 
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#endif
+#include "threads/threads-common.h"
+
+#include "vmcore/utf8.h"
 
 
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "countStackFrames",  "()I",                      (void *) (ptrint) &Java_java_lang_VMThread_countStackFrames  },
-       { "start",             "(J)V",                     (void *) (ptrint) &Java_java_lang_VMThread_start             },
-       { "interrupt",         "()V",                      (void *) (ptrint) &Java_java_lang_VMThread_interrupt         },
-       { "isInterrupted",     "()Z",                      (void *) (ptrint) &Java_java_lang_VMThread_isInterrupted     },
-       { "suspend",           "()V",                      (void *) (ptrint) &Java_java_lang_VMThread_suspend           },
-       { "resume",            "()V",                      (void *) (ptrint) &Java_java_lang_VMThread_resume            },
-       { "nativeSetPriority", "(I)V",                     (void *) (ptrint) &Java_java_lang_VMThread_nativeSetPriority },
-       { "nativeStop",        "(Ljava/lang/Throwable;)V", (void *) (ptrint) &Java_java_lang_VMThread_nativeStop        },
-       { "currentThread",     "()Ljava/lang/Thread;",     (void *) (ptrint) &Java_java_lang_VMThread_currentThread     },
-       { "yield",             "()V",                      (void *) (ptrint) &Java_java_lang_VMThread_yield             },
-       { "interrupted",       "()Z",                      (void *) (ptrint) &Java_java_lang_VMThread_interrupted       },
-       { "holdsLock",         "(Ljava/lang/Object;)Z",    (void *) (ptrint) &Java_java_lang_VMThread_holdsLock         },
-       { "getState",          "()Ljava/lang/String;",     (void *) (ptrint) &Java_java_lang_VMThread_getState          },
+       { "countStackFrames",  "()I",                      (void *) (intptr_t) &Java_java_lang_VMThread_countStackFrames  },
+       { "start",             "(J)V",                     (void *) (intptr_t) &Java_java_lang_VMThread_start             },
+       { "interrupt",         "()V",                      (void *) (intptr_t) &Java_java_lang_VMThread_interrupt         },
+       { "isInterrupted",     "()Z",                      (void *) (intptr_t) &Java_java_lang_VMThread_isInterrupted     },
+       { "suspend",           "()V",                      (void *) (intptr_t) &Java_java_lang_VMThread_suspend           },
+       { "resume",            "()V",                      (void *) (intptr_t) &Java_java_lang_VMThread_resume            },
+       { "nativeSetPriority", "(I)V",                     (void *) (intptr_t) &Java_java_lang_VMThread_nativeSetPriority },
+       { "nativeStop",        "(Ljava/lang/Throwable;)V", (void *) (intptr_t) &Java_java_lang_VMThread_nativeStop        },
+       { "currentThread",     "()Ljava/lang/Thread;",     (void *) (intptr_t) &Java_java_lang_VMThread_currentThread     },
+       { "yield",             "()V",                      (void *) (intptr_t) &Java_java_lang_VMThread_yield             },
+       { "interrupted",       "()Z",                      (void *) (intptr_t) &Java_java_lang_VMThread_interrupted       },
+       { "holdsLock",         "(Ljava/lang/Object;)Z",    (void *) (intptr_t) &Java_java_lang_VMThread_holdsLock         },
+       { "getState",          "()Ljava/lang/String;",     (void *) (intptr_t) &Java_java_lang_VMThread_getState          },
 };
 
 
@@ -88,7 +89,7 @@ void _Jv_java_lang_VMThread_init(void)
  * Method:    countStackFrames
  * Signature: ()I
  */
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
 {
     return _Jv_java_lang_Thread_countStackFrames(this->thread);
 }
@@ -99,7 +100,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_
  * Method:    start
  * Signature: (J)V
  */
-JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, s8 stacksize)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, int64_t stacksize)
 {
        _Jv_java_lang_Thread_start(this->thread, stacksize);
 }
@@ -121,7 +122,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, java_lang_
  * Method:    isInterrupted
  * Signature: ()Z
  */
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
 {
        return _Jv_java_lang_Thread_isInterrupted(this->thread);
 }
@@ -154,7 +155,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, java_lang_VMT
  * Method:    nativeSetPriority
  * Signature: (I)V
  */
-JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, s4 priority)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, int32_t priority)
 {
        _Jv_java_lang_Thread_setPriority(this->thread, priority);
 }
@@ -198,7 +199,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz)
  * Method:    interrupted
  * Signature: ()Z
  */
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
 {
        return _Jv_java_lang_Thread_interrupted();
 }
@@ -209,7 +210,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass cla
  * Method:    holdsLock
  * Signature: (Ljava/lang/Object;)Z
  */
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
 {
        return _Jv_java_lang_Thread_holdsLock(o);
 }
index 9c028f5391d18454b6f9413d6a869f7a99aefec7..b4a3531223b2025f49542ae4f0a9d20d61f617c9 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Constructor.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: java_lang_reflect_Constructor.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -81,6 +81,11 @@ void _Jv_java_lang_reflect_Constructor_init(void)
  */
 JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_constructNative(JNIEnv *env, java_lang_reflect_Constructor *this, java_objectarray *args, java_lang_Class *declaringClass, s4 slot)
 {
+       /* just to be sure */
+
+       assert(this->clazz == declaringClass);
+       assert(this->slot  == slot);
+
        return _Jv_java_lang_reflect_Constructor_newInstance(env, this, args);
 }
 
index e4364b7d7c5d229ff249de241e8018c53d88ec08..66871ef729622d2cd25a74de1a34ec9b99f0b81d 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Field.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: java_lang_reflect_Field.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -30,8 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
-
-#include "vm/types.h"
+#include <stdint.h>
 
 #include "native/jni.h"
 #include "native/native.h"
 #include "vm/exceptions.h"
 #include "vm/global.h"
 #include "vm/initialize.h"
+#include "vm/resolve.h"
 #include "vm/stringlocal.h"
 
 #include "vm/jit/stacktrace.h"
 
 #include "vmcore/loader.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
 #include "vmcore/utf8.h"
 
 
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "getModifiersInternal", "()I",                                     (void *) (ptrint) &Java_java_lang_reflect_Field_getModifiersInternal },
-       { "getType",              "()Ljava/lang/Class;",                     (void *) (ptrint) &Java_java_lang_reflect_Field_getType              },
-       { "get",                  "(Ljava/lang/Object;)Ljava/lang/Object;",  (void *) (ptrint) &Java_java_lang_reflect_Field_get                  },
-       { "getBoolean",           "(Ljava/lang/Object;)Z",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getBoolean           },
-       { "getByte",              "(Ljava/lang/Object;)B",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getByte              },
-       { "getChar",              "(Ljava/lang/Object;)C",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getChar              },
-       { "getShort",             "(Ljava/lang/Object;)S",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getShort             },
-       { "getInt",               "(Ljava/lang/Object;)I",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getInt               },
-       { "getLong",              "(Ljava/lang/Object;)J",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getLong              },
-       { "getFloat",             "(Ljava/lang/Object;)F",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getFloat             },
-       { "getDouble",            "(Ljava/lang/Object;)D",                   (void *) (ptrint) &Java_java_lang_reflect_Field_getDouble            },
-       { "set",                  "(Ljava/lang/Object;Ljava/lang/Object;)V", (void *) (ptrint) &Java_java_lang_reflect_Field_set                  },
-       { "setBoolean",           "(Ljava/lang/Object;Z)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setBoolean           },
-       { "setByte",              "(Ljava/lang/Object;B)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setByte              },
-       { "setChar",              "(Ljava/lang/Object;C)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setChar              },
-       { "setShort",             "(Ljava/lang/Object;S)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setShort             },
-       { "setInt",               "(Ljava/lang/Object;I)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setInt               },
-       { "setLong",              "(Ljava/lang/Object;J)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setLong              },
-       { "setFloat",             "(Ljava/lang/Object;F)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setFloat             },
-       { "setDouble",            "(Ljava/lang/Object;D)V",                  (void *) (ptrint) &Java_java_lang_reflect_Field_setDouble            },
-       { "getSignature",         "()Ljava/lang/String;",                    (void *) (ptrint) &Java_java_lang_reflect_Field_getSignature         },
+       { "getModifiersInternal", "()I",                                     (void *) (intptr_t) &Java_java_lang_reflect_Field_getModifiersInternal },
+       { "getType",              "()Ljava/lang/Class;",                     (void *) (intptr_t) &Java_java_lang_reflect_Field_getType              },
+       { "get",                  "(Ljava/lang/Object;)Ljava/lang/Object;",  (void *) (intptr_t) &Java_java_lang_reflect_Field_get                  },
+       { "getBoolean",           "(Ljava/lang/Object;)Z",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getBoolean           },
+       { "getByte",              "(Ljava/lang/Object;)B",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getByte              },
+       { "getChar",              "(Ljava/lang/Object;)C",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getChar              },
+       { "getShort",             "(Ljava/lang/Object;)S",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getShort             },
+       { "getInt",               "(Ljava/lang/Object;)I",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getInt               },
+       { "getLong",              "(Ljava/lang/Object;)J",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getLong              },
+       { "getFloat",             "(Ljava/lang/Object;)F",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getFloat             },
+       { "getDouble",            "(Ljava/lang/Object;)D",                   (void *) (intptr_t) &Java_java_lang_reflect_Field_getDouble            },
+       { "set",                  "(Ljava/lang/Object;Ljava/lang/Object;)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_set                  },
+       { "setBoolean",           "(Ljava/lang/Object;Z)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setBoolean           },
+       { "setByte",              "(Ljava/lang/Object;B)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setByte              },
+       { "setChar",              "(Ljava/lang/Object;C)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setChar              },
+       { "setShort",             "(Ljava/lang/Object;S)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setShort             },
+       { "setInt",               "(Ljava/lang/Object;I)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setInt               },
+       { "setLong",              "(Ljava/lang/Object;J)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setLong              },
+       { "setFloat",             "(Ljava/lang/Object;F)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setFloat             },
+       { "setDouble",            "(Ljava/lang/Object;D)V",                  (void *) (intptr_t) &Java_java_lang_reflect_Field_setDouble            },
+       { "getSignature",         "()Ljava/lang/String;",                    (void *) (intptr_t) &Java_java_lang_reflect_Field_getSignature         },
 };
 
 
@@ -165,7 +165,7 @@ static void *cacao_get_field_address(java_lang_reflect_Field *this,
                }
        
                if (builtin_instanceof((java_objectheader *) o, c))
-                       return (void *) ((ptrint) o + f->offset);
+                       return (void *) ((intptr_t) o + f->offset);
        }
 
        /* exception path */
@@ -181,7 +181,7 @@ static void *cacao_get_field_address(java_lang_reflect_Field *this,
  * Method:    getModifiersInternal
  * Signature: ()I
  */
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getModifiersInternal(JNIEnv *env, java_lang_reflect_Field *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getModifiersInternal(JNIEnv *env, java_lang_reflect_Field *this)
 {
        classinfo *c;
        fieldinfo *f;
@@ -247,7 +247,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
 
                /* set the object value */
 
-               bo->value = *((s4 *) addr);
+               bo->value = *((int32_t *) addr);
 
                /* return the wrapped object */
 
@@ -260,7 +260,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
                if (!(bo = (java_lang_Byte *) builtin_new(class_java_lang_Byte)))
                        return NULL;
 
-               bo->value = *((s4 *) addr);
+               bo->value = *((int32_t *) addr);
 
                return (java_lang_Object *) bo;
        }
@@ -271,7 +271,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
                if (!(co = (java_lang_Character *) builtin_new(class_java_lang_Character)))
                        return NULL;
 
-               co->value = *((s4 *) addr);
+               co->value = *((int32_t *) addr);
 
                return (java_lang_Object *) co;
        }
@@ -282,7 +282,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
                if (!(so = (java_lang_Short *) builtin_new(class_java_lang_Short)))
                        return NULL;
 
-               so->value = (s4) *((s4 *) addr);
+               so->value = (int32_t) *((int32_t *) addr);
 
                return (java_lang_Object *) so;
        }
@@ -293,7 +293,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
                if (!(io = (java_lang_Integer *) builtin_new(class_java_lang_Integer)))
                        return NULL;
 
-               io->value = *((s4 *) addr);
+               io->value = *((int32_t *) addr);
 
                return (java_lang_Object *) io;
        }
@@ -304,7 +304,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
                if (!(lo = (java_lang_Long *) builtin_new(class_java_lang_Long)))
                        return NULL;
 
-               lo->value = *((s8 *) addr);
+               lo->value = *((int64_t *) addr);
 
                return (java_lang_Object *) lo;
        }
@@ -350,7 +350,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
  * Method:    getBoolean
  * Signature: (Ljava/lang/Object;)Z
  */
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
 {
        classinfo *c;
        fieldinfo *f;
@@ -370,7 +370,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getBoolean(JNIEnv *env, java_l
 
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_BOOLEAN:
-               return (s4) *((s4 *) addr);
+               return (int32_t) *((int32_t *) addr);
        default:
                exceptions_throw_illegalargumentexception();
                return 0;
@@ -383,7 +383,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getBoolean(JNIEnv *env, java_l
  * Method:    getByte
  * Signature: (Ljava/lang/Object;)B
  */
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
 {
        classinfo *c;
        fieldinfo *f;
@@ -403,7 +403,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang
 
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_BYTE:
-               return (s4) *((s4 *) addr);
+               return (int32_t) *((int32_t *) addr);
        default:
                exceptions_throw_illegalargumentexception();
                return 0;
@@ -416,7 +416,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang
  * Method:    getChar
  * Signature: (Ljava/lang/Object;)C
  */
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
 {
        classinfo *c;
        fieldinfo *f;
@@ -436,7 +436,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang
 
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_CHAR:
-               return (s4) *((s4 *) addr);
+               return (int32_t) *((int32_t *) addr);
        default:
                exceptions_throw_illegalargumentexception();
                return 0;
@@ -449,7 +449,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang
  * Method:    getShort
  * Signature: (Ljava/lang/Object;)S
  */
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
 {
        classinfo *c;
        fieldinfo *f;
@@ -470,7 +470,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lan
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_BYTE:
        case PRIMITIVETYPE_SHORT:
-               return (s4) *((s4 *) addr);
+               return (int32_t) *((int32_t *) addr);
        default:
                exceptions_throw_illegalargumentexception();
                return 0;
@@ -483,7 +483,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lan
  * Method:    getInt
  * Signature: (Ljava/lang/Object;)I
  */
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang_reflect_Field *this, java_lang_Object *o)
 {
        classinfo *c;
        fieldinfo *f;
@@ -506,7 +506,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang
        case PRIMITIVETYPE_CHAR:
        case PRIMITIVETYPE_SHORT:
        case PRIMITIVETYPE_INT:
-               return (s4) *((s4 *) addr);
+               return (int32_t) *((int32_t *) addr);
        default:
                exceptions_throw_illegalargumentexception();
                return 0;
@@ -519,7 +519,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang
  * Method:    getLong
  * Signature: (Ljava/lang/Object;)J
  */
-JNIEXPORT s8 JNICALL Java_java_lang_reflect_Field_getLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int64_t JNICALL Java_java_lang_reflect_Field_getLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
 {
        classinfo *c;
        fieldinfo *f;
@@ -542,9 +542,9 @@ JNIEXPORT s8 JNICALL Java_java_lang_reflect_Field_getLong(JNIEnv *env, java_lang
        case PRIMITIVETYPE_CHAR:
        case PRIMITIVETYPE_SHORT:
        case PRIMITIVETYPE_INT:
-               return (s8) *((s4 *) addr);
+               return (int64_t) *((int32_t *) addr);
        case PRIMITIVETYPE_LONG:
-               return (s8) *((s8 *) addr);
+               return (int64_t) *((int64_t *) addr);
        default:
                exceptions_throw_illegalargumentexception();
                return 0;
@@ -580,9 +580,9 @@ JNIEXPORT float JNICALL Java_java_lang_reflect_Field_getFloat(JNIEnv *env, java_
        case PRIMITIVETYPE_CHAR:
        case PRIMITIVETYPE_SHORT:
        case PRIMITIVETYPE_INT:
-               return (float) *((s4 *) addr);
+               return (float) *((int32_t *) addr);
        case PRIMITIVETYPE_LONG:
-               return (float) *((s8 *) addr);
+               return (float) *((int64_t *) addr);
        case PRIMITIVETYPE_FLOAT:
                return (float) *((float *) addr);
        default:
@@ -620,9 +620,9 @@ JNIEXPORT double JNICALL Java_java_lang_reflect_Field_getDouble(JNIEnv *env , ja
        case PRIMITIVETYPE_CHAR:
        case PRIMITIVETYPE_SHORT:
        case PRIMITIVETYPE_INT:
-               return (double) *((s4 *) addr);
+               return (double) *((int32_t *) addr);
        case PRIMITIVETYPE_LONG:
-               return (double) *((s8 *) addr);
+               return (double) *((int64_t *) addr);
        case PRIMITIVETYPE_FLOAT:
                return (double) *((float *) addr);
        case PRIMITIVETYPE_DOUBLE:
@@ -670,7 +670,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
 
        switch (df->parseddesc->decltype) {
        case PRIMITIVETYPE_BOOLEAN: {
-               s4 val;
+               int32_t val;
 
                /* determine the field to read the value */
 
@@ -686,12 +686,12 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
                        return;
                }
 
-               *((s4 *) faddr) = val;
+               *((int32_t *) faddr) = val;
                return;
        }
 
        case PRIMITIVETYPE_BYTE: {
-               s4 val;
+               int32_t val;
 
                if ((sc == NULL) || !(sf = class_findfield(sc, utf_value, utf_B)))
                        break;
@@ -705,12 +705,12 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
                        return;
                }
 
-               *((s4 *) faddr) = val;
+               *((int32_t *) faddr) = val;
                return;
        }
 
        case PRIMITIVETYPE_CHAR: {
-               s4 val;
+               int32_t val;
 
                if ((sc == NULL) || !(sf = class_findfield(sc, utf_value, utf_C)))
                        break;
@@ -724,12 +724,12 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
                        return;
                }
 
-               *((s4 *) faddr) = val;
+               *((int32_t *) faddr) = val;
                return;
        }
 
        case PRIMITIVETYPE_SHORT: {
-               s4 val;
+               int32_t val;
 
                /* get field only by name, it can be one of B, S */
 
@@ -748,12 +748,12 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
                        return;
                }
 
-               *((s4 *) faddr) = val;
+               *((int32_t *) faddr) = val;
                return;
        }
 
        case PRIMITIVETYPE_INT: {
-               s4 val;
+               int32_t val;
 
                /* get field only by name, it can be one of B, S, C, I */
 
@@ -778,12 +778,12 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
                        return;
                }
 
-               *((s4 *) faddr) = val;
+               *((int32_t *) faddr) = val;
                return;
        }
 
        case PRIMITIVETYPE_LONG: {
-               s8 val;
+               int64_t val;
 
                /* get field only by name, it can be one of B, S, C, I, J */
 
@@ -811,7 +811,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
                        return;
                }
 
-               *((s8 *) faddr) = val;
+               *((int64_t *) faddr) = val;
                return;
        }
 
@@ -912,7 +912,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
  * Method:    setBoolean
  * Signature: (Ljava/lang/Object;Z)V
  */
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
 {
        classinfo *c;
        fieldinfo *f;
@@ -932,7 +932,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean(JNIEnv *env, java
 
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_BOOLEAN:
-               *((s4 *) addr) = value;
+               *((int32_t *) addr) = value;
                break;
        default:
                exceptions_throw_illegalargumentexception();
@@ -947,7 +947,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean(JNIEnv *env, java
  * Method:    setByte
  * Signature: (Ljava/lang/Object;B)V
  */
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
 {
        classinfo *c;
        fieldinfo *f;
@@ -969,10 +969,10 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte(JNIEnv *env, java_la
        case PRIMITIVETYPE_BYTE:
        case PRIMITIVETYPE_SHORT:
        case PRIMITIVETYPE_INT:
-               *((s4 *) addr) = value;
+               *((int32_t *) addr) = value;
                break;
        case PRIMITIVETYPE_LONG:
-               *((s8 *) addr) = value;
+               *((int64_t *) addr) = value;
                break;
        case PRIMITIVETYPE_FLOAT:
                *((float *) addr) = value;
@@ -993,7 +993,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte(JNIEnv *env, java_la
  * Method:    setChar
  * Signature: (Ljava/lang/Object;C)V
  */
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
 {
        classinfo *c;
        fieldinfo *f;
@@ -1014,10 +1014,10 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar(JNIEnv *env, java_la
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_CHAR:
        case PRIMITIVETYPE_INT:
-               *((s4 *) addr) = value;
+               *((int32_t *) addr) = value;
                break;
        case PRIMITIVETYPE_LONG:
-               *((s8 *) addr) = value;
+               *((int64_t *) addr) = value;
                break;
        case PRIMITIVETYPE_FLOAT:
                *((float *) addr) = value;
@@ -1038,7 +1038,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar(JNIEnv *env, java_la
  * Method:    setShort
  * Signature: (Ljava/lang/Object;S)V
  */
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
 {
        classinfo *c;
        fieldinfo *f;
@@ -1059,10 +1059,10 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort(JNIEnv *env, java_l
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_SHORT:
        case PRIMITIVETYPE_INT:
-               *((s4 *) addr) = value;
+               *((int32_t *) addr) = value;
                break;
        case PRIMITIVETYPE_LONG:
-               *((s8 *) addr) = value;
+               *((int64_t *) addr) = value;
                break;
        case PRIMITIVETYPE_FLOAT:
                *((float *) addr) = value;
@@ -1083,7 +1083,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort(JNIEnv *env, java_l
  * Method:    setInt
  * Signature: (Ljava/lang/Object;I)V
  */
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
 {
        classinfo *c;
        fieldinfo *f;
@@ -1103,10 +1103,10 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt(JNIEnv *env, java_lan
 
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_INT:
-               *((s4 *) addr) = value;
+               *((int32_t *) addr) = value;
                break;
        case PRIMITIVETYPE_LONG:
-               *((s8 *) addr) = value;
+               *((int64_t *) addr) = value;
                break;
        case PRIMITIVETYPE_FLOAT:
                *((float *) addr) = value;
@@ -1127,7 +1127,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt(JNIEnv *env, java_lan
  * Method:    setLong
  * Signature: (Ljava/lang/Object;J)V
  */
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s8 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int64_t value)
 {
        classinfo *c;
        fieldinfo *f;
@@ -1147,7 +1147,7 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong(JNIEnv *env, java_la
 
        switch (f->parseddesc->decltype) {
        case PRIMITIVETYPE_LONG:
-               *((s8 *) addr) = value;
+               *((int64_t *) addr) = value;
                break;
        case PRIMITIVETYPE_FLOAT:
                *((float *) addr) = value;
index 4e710d8e1df62eb9b6ba0654b16846195fc59e86..ea9ccaab842d5cec982c0ca1a773099e9fcb49f0 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Method.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: java_lang_reflect_Method.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -42,6 +42,8 @@
 
 #include "native/include/java_lang_reflect_Method.h"
 
+#include "native/vm/java_lang_reflect_Method.h"
+
 #include "vm/access.h"
 #include "vm/global.h"
 #include "vm/builtin.h"
@@ -50,6 +52,8 @@
 #include "vm/resolve.h"
 #include "vm/stringlocal.h"
 
+#include "vmcore/method.h"
+
 
 /* native methods implemented by this file ************************************/
 
@@ -105,17 +109,14 @@ JNIEXPORT java_lang_Class* JNICALL Java_java_lang_reflect_Method_getReturnType(J
 {
        classinfo  *c;
        methodinfo *m;
-       typedesc   *td;
+       classinfo  *result;
 
        c = (classinfo *) this->declaringClass;
        m = &(c->methods[this->slot]);
 
-       td = &(m->parseddesc->returntype);
+       result = method_returntype_get(m);
 
-       if (!resolve_class_from_typedesc(td, true, false, &c))
-               return NULL;
-
-       return (java_lang_Class *) c;
+       return (java_lang_Class *) result;
 }
 
 
@@ -160,30 +161,12 @@ JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Method_getExceptionTy
  */
 JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Method_invokeNative(JNIEnv *env, java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args, java_lang_Class *declaringClass, s4 slot)
 {
-       classinfo        *c;
-       methodinfo       *m;
-
-       c = (classinfo *) declaringClass;
-       m = &(c->methods[slot]);
-
-       /* check method access */
-
-       /* check if we should bypass security checks (AccessibleObject) */
-
-       if (this->flag == false) {
-               if (!access_check_method(m, 1))
-                       return NULL;
-       }
-
-       /* check if method class is initialized */
-
-       if (!(c->state & CLASS_INITIALIZED))
-               if (!initialize_class(c))
-                       return NULL;
+       /* just to be sure */
 
-       /* call the Java method via a helper function */
+       assert(this->declaringClass == declaringClass);
+       assert(this->slot           == slot);
 
-       return (java_lang_Object *) _Jv_jni_invokeNative(m, (jobject) o, args);
+       return _Jv_java_lang_reflect_Method_invoke(this, o, args);
 }
 
 
diff --git a/src/native/vm/gnu/java_util_concurrent_atomic_AtomicLong.c b/src/native/vm/gnu/java_util_concurrent_atomic_AtomicLong.c
new file mode 100644 (file)
index 0000000..48d9f53
--- /dev/null
@@ -0,0 +1,76 @@
+/* src/native/vm/gnu/java_util_concurrent_atomic_AtomicLong.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 8017 2007-06-05 23:46:59Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "native/jni.h"
+#include "native/native.h"
+
+#include "native/vm/java_util_concurrent_atomic_AtomicLong.h"
+
+#include "vmcore/utf8.h"
+
+
+/* native methods implemented by this file ************************************/
+
+static JNINativeMethod methods[] = {
+       { "VMSupportsCS8", "()Z", (void *) (intptr_t) &_Jv_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8 },
+};
+
+
+/* _Jv_java_util_concurrent_atomic_AtomicLong_init *****************************
+
+   Register native functions.
+
+*******************************************************************************/
+
+void _Jv_java_util_concurrent_atomic_AtomicLong_init(void)
+{
+       utf *u;
+
+       u = utf_new_char("java/util/concurrent/atomic/AtomicLong");
+
+       native_method_register(u, methods, NATIVE_METHODS_COUNT);
+}
+
+
+/*
+ * 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:
+ */
index a203d5ecb722675846c18f3bdd63d48a99b31bcc..c434a5afeab59848705b4069672a3bd79f2a9cf9 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_VMClass.c 6131 2006-12-06 22:15:57Z twisti $
+   $Id: java_lang_Class.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -66,6 +66,7 @@
 
 #include "vmcore/class.h"
 #include "vmcore/loader.h"
+#include "vmcore/primitive.h"
 
 
 /*
@@ -116,8 +117,6 @@ java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name)
        utf               *ufile;
        utf               *uname;
        classinfo         *c;
-       java_objectheader *xptr;
-       classinfo         *xclass;
        u2                *pos;
        s4                 i;
 
@@ -154,24 +153,8 @@ java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name)
        c = load_class_bootstrap(ufile);
 #endif
 
-       if (c == NULL) {
-               xptr = exceptions_get_exception();
-
-               xclass = xptr->vftbl->class;
-
-               /* if the exception is a NoClassDefFoundError, we replace it with a
-                  ClassNotFoundException, otherwise return the exception */
-
-               if (xclass == class_java_lang_NoClassDefFoundError) {
-                       /* clear exceptionptr, because builtin_new checks for 
-                          ExceptionInInitializerError */
-                       exceptions_clear_exception();
-
-                       exceptions_throw_classnotfoundexception(uname);
-               }
-
+       if (c == NULL)
            return NULL;
-       }
 
        /* link, ... */
 
@@ -273,7 +256,7 @@ s4 _Jv_java_lang_Class_isPrimitive(java_lang_Class *klass)
 
        c = (classinfo *) klass;
 
-       result = class_is_primitive(c);
+       result = primitive_class_is_primitive(c);
 
        return result;
 }
@@ -375,7 +358,7 @@ java_lang_Class *_Jv_java_lang_Class_getComponentType(java_lang_Class *klass)
        if (desc->arraytype == ARRAYTYPE_OBJECT)
                comp = desc->componentvftbl->class;
        else
-               comp = primitivetype_table[desc->arraytype].class_primitive;
+               comp = primitive_class_get_by_type(desc->arraytype);
                
        return (java_lang_Class *) comp;
 }
@@ -443,7 +426,7 @@ java_lang_Class *_Jv_java_lang_Class_getDeclaringClass(java_lang_Class *klass)
 
        c = (classinfo *) klass;
 
-       if (!class_is_primitive(c) && (c->name->text[0] != '[')) {
+       if (!primitive_class_is_primitive(c) && (c->name->text[0] != '[')) {
                if (c->innerclasscount == 0)  /* no innerclasses exist */
                        return NULL;
     
@@ -498,7 +481,7 @@ java_objectarray *_Jv_java_lang_Class_getDeclaredClasses(java_lang_Class *klass,
        c = (classinfo *) klass;
        declaredclasscount = 0;
 
-       if (!class_is_primitive(c) && (c->name->text[0] != '[')) {
+       if (!primitive_class_is_primitive(c) && (c->name->text[0] != '[')) {
                /* determine number of declared classes */
 
                for (i = 0; i < c->innerclasscount; i++) {
diff --git a/src/native/vm/java_lang_reflect_Method.c b/src/native/vm/java_lang_reflect_Method.c
new file mode 100644 (file)
index 0000000..9d3f3d1
--- /dev/null
@@ -0,0 +1,96 @@
+/* src/native/vm/java_lang_reflect_Method.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_reflect_Method.c 8063 2007-06-11 14:44:58Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+
+#include "vm/types.h"
+
+#include "native/jni.h"
+#include "native/native.h"
+
+#include "native/include/java_lang_Object.h"
+
+#include "native/include/java_lang_reflect_Method.h"
+
+#include "vm/access.h"
+#include "vm/builtin.h"
+#include "vm/initialize.h"
+
+#include "vmcore/class.h"
+#include "vmcore/method.h"
+
+
+/*
+ * Class:     java/lang/reflect/Method
+ * Method:    invoke
+ * Signature: (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
+ */
+java_lang_Object *_Jv_java_lang_reflect_Method_invoke(java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args)
+{
+       classinfo  *c;
+       methodinfo *m;
+
+       c = (classinfo *) this->declaringClass;
+       m = &(c->methods[this->slot]);
+
+       /* check method access */
+
+       /* check if we should bypass security checks (AccessibleObject) */
+
+       if (this->flag == false) {
+               if (!access_check_method(m, 1))
+                       return NULL;
+       }
+
+       /* check if method class is initialized */
+
+       if (!(c->state & CLASS_INITIALIZED))
+               if (!initialize_class(c))
+                       return NULL;
+
+       /* call the Java method via a helper function */
+
+       return (java_lang_Object *) _Jv_jni_invokeNative(m, (jobject) o, args);
+}
+
+
+/*
+ * 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:
+ */
diff --git a/src/native/vm/java_lang_reflect_Method.h b/src/native/vm/java_lang_reflect_Method.h
new file mode 100644 (file)
index 0000000..516591b
--- /dev/null
@@ -0,0 +1,64 @@
+/* src/native/vm/java_lang_reflect_Method.h
+
+   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_REFLECT_METHOD_H
+#define _JV_JAVA_LANG_REFLECT_METHOD_H
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "native/jni.h"
+
+#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_reflect_Method.h"
+
+#include "native/vm/java_lang_reflect_Method.h"
+
+#include "vm/global.h"
+
+
+/* function prototypes ********************************************************/
+
+java_lang_Object *_Jv_java_lang_reflect_Method_invoke(java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args);
+
+#endif /* _JV_JAVA_LANG_REFLECT_METHOD_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:
+ */
diff --git a/src/native/vm/java_util_concurrent_atomic_AtomicLong.c b/src/native/vm/java_util_concurrent_atomic_AtomicLong.c
new file mode 100644 (file)
index 0000000..378834d
--- /dev/null
@@ -0,0 +1,61 @@
+/* src/native/vm/java_util_concurrent_atomic_AtomicLong.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_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "native/jni.h"
+
+
+/*
+ * Class:     java/util/concurrent/atomic/AtomicLong
+ * Method:    VMSupportsCS8
+ * Signature: ()Z
+ */
+JNIEXPORT int32_t JNICALL _Jv_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8(JNIEnv *env, jclass clazz)
+{
+       /* IMPLEMENT ME */
+
+       return 0;
+}
+
+
+/*
+ * 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:
+ */
diff --git a/src/native/vm/java_util_concurrent_atomic_AtomicLong.h b/src/native/vm/java_util_concurrent_atomic_AtomicLong.h
new file mode 100644 (file)
index 0000000..944f0d3
--- /dev/null
@@ -0,0 +1,58 @@
+/* src/native/vm/java_util_concurrent_atomic_AtomicLong.h
+
+   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_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_H
+#define _JV_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_H
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "native/jni.h"
+
+
+/* function prototypes ********************************************************/
+
+int32_t _Jv_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8(JNIEnv *env, jclass clazz);
+
+#endif /* _JV_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_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:
+ */
index 196cac4d8f96ec3ed5d057376ad1abc6b3ece31a..6c81da05559fe18c928b6a59c61d09a5882ff586 100644 (file)
@@ -67,6 +67,7 @@ bool nativevm_init(void)
        _Jv_java_lang_reflect_Method_init();
        _Jv_java_lang_reflect_VMProxy_init();
        _Jv_java_security_VMAccessController_init();
+       _Jv_java_util_concurrent_atomic_AtomicLong_init();
        _Jv_sun_misc_Unsafe_init();
 
 # else
index d6497f916f8355d8c00d2a52edbea409895d622c..edddff327941187fe862a33559e37fc920612c75 100644 (file)
@@ -64,6 +64,7 @@ void _Jv_java_lang_reflect_Field_init();
 void _Jv_java_lang_reflect_Method_init();
 void _Jv_java_lang_reflect_VMProxy_init();
 void _Jv_java_security_VMAccessController_init();
+void _Jv_java_util_concurrent_atomic_AtomicLong_init();
 void _Jv_sun_misc_Unsafe_init();
 
 # else
index 6825dd649d197174f7b459f70b9d2a25e7fb77f3..82c54860ec76022bf9aa27f75891bdb8887c0e0c 100644 (file)
@@ -28,7 +28,8 @@
 
 
 #include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
 
 #include "native/jni.h"
 #include "native/native.h"
 
 #include "native/include/sun_misc_Unsafe.h"
 
+#include "vmcore/utf8.h"
+
 
 /* native methods implemented by this file ************************************/
 
 static JNINativeMethod methods[] = {
-       { "objectFieldOffset",    "(Ljava/lang/reflect/Field;)J",                               (void *) (ptrint) &Java_sun_misc_Unsafe_objectFieldOffset    },
-       { "compareAndSwapInt",    "(Ljava/lang/Object;JII)Z",                                   (void *) (ptrint) &Java_sun_misc_Unsafe_compareAndSwapInt    },
+       { "objectFieldOffset",    "(Ljava/lang/reflect/Field;)J",                               (void *) (intptr_t) &Java_sun_misc_Unsafe_objectFieldOffset    },
+       { "compareAndSwapInt",    "(Ljava/lang/Object;JII)Z",                                   (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapInt    },
 #if 0
-       { "compareAndSwapLong",   "(Ljava/lang/Object;JJJ)Z",                                   (void *) (ptrint) &Java_sun_misc_Unsafe_compareAndSwapLong   },
-       { "compareAndSwapObject", "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", (void *) (ptrint) &Java_sun_misc_Unsafe_compareAndSwapObject },
-       { "putOrderedInt",        "(Ljava/lang/Object;JI)V",                                    (void *) (ptrint) &Java_sun_misc_Unsafe_putOrderedInt        },
-       { "putOrderedLong",       "(Ljava/lang/Object;JJ)V",                                    (void *) (ptrint) &Java_sun_misc_Unsafe_putOrderedLong       },
-       { "putOrderedObject",     "(Ljava/lang/Object;JLjava/lang/Object;)V",                   (void *) (ptrint) &Java_sun_misc_Unsafe_putOrderedObject     },
-       { "putIntVolatile",       "(Ljava/lang/Object;JI)V",                                    (void *) (ptrint) &Java_sun_misc_Unsafe_putIntVolatile       },
-       { "getIntVolatile",       "(Ljava/lang/Object;J)I",                                     (void *) (ptrint) &Java_sun_misc_Unsafe_getIntVolatile       },
-       { "putLongVolatile",      "(Ljava/lang/Object;JJ)V",                                    (void *) (ptrint) &Java_sun_misc_Unsafe_putLongVolatile      },
-       { "putLong",              "(Ljava/lang/Object;JJ)V",                                    (void *) (ptrint) &Java_sun_misc_Unsafe_putLong              },
-       { "getLongVolatile",      "(Ljava/lang/Object;J)J",                                     (void *) (ptrint) &Java_sun_misc_Unsafe_getLongVolatile      },
-       { "getLong",              "(Ljava/lang/Object;J)J",                                     (void *) (ptrint) &Java_sun_misc_Unsafe_getLong              },
-       { "putObjectVolatile",    "(Ljava/lang/Object;JLjava/lang/Object;)V",                   (void *) (ptrint) &Java_sun_misc_Unsafe_putObjectVolatile    },
-       { "putObject",            "(Ljava/lang/Object;JLjava/lang/Object;)V",                   (void *) (ptrint) &Java_sun_misc_Unsafe_putObject            },
-       { "getObjectVolatile",    "(Ljava/lang/Object;J)Ljava/lang/Object;",                    (void *) (ptrint) &Java_sun_misc_Unsafe_getObjectVolatile    },
-       { "arrayBaseOffset",      "(Ljava/lang/Class;)I",                                       (void *) (ptrint) &Java_sun_misc_Unsafe_arrayBaseOffset      },
-       { "arrayIndexScale",      "(Ljava/lang/Class;)I",                                       (void *) (ptrint) &Java_sun_misc_Unsafe_arrayIndexScale      },
-       { "unpark",               "(Ljava/lang/Thread;)V",                                      (void *) (ptrint) &Java_sun_misc_Unsafe_unpark               },
-       { "park",                 "(ZJ)V",                                                      (void *) (ptrint) &Java_sun_misc_Unsafe_park                 },
+       { "compareAndSwapLong",   "(Ljava/lang/Object;JJJ)Z",                                   (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapLong   },
+       { "compareAndSwapObject", "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapObject },
+       { "putOrderedInt",        "(Ljava/lang/Object;JI)V",                                    (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedInt        },
+       { "putOrderedLong",       "(Ljava/lang/Object;JJ)V",                                    (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedLong       },
+       { "putOrderedObject",     "(Ljava/lang/Object;JLjava/lang/Object;)V",                   (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedObject     },
+       { "putIntVolatile",       "(Ljava/lang/Object;JI)V",                                    (void *) (intptr_t) &Java_sun_misc_Unsafe_putIntVolatile       },
+       { "getIntVolatile",       "(Ljava/lang/Object;J)I",                                     (void *) (intptr_t) &Java_sun_misc_Unsafe_getIntVolatile       },
+       { "putLongVolatile",      "(Ljava/lang/Object;JJ)V",                                    (void *) (intptr_t) &Java_sun_misc_Unsafe_putLongVolatile      },
+       { "putLong",              "(Ljava/lang/Object;JJ)V",                                    (void *) (intptr_t) &Java_sun_misc_Unsafe_putLong              },
+       { "getLongVolatile",      "(Ljava/lang/Object;J)J",                                     (void *) (intptr_t) &Java_sun_misc_Unsafe_getLongVolatile      },
+       { "getLong",              "(Ljava/lang/Object;J)J",                                     (void *) (intptr_t) &Java_sun_misc_Unsafe_getLong              },
+       { "putObjectVolatile",    "(Ljava/lang/Object;JLjava/lang/Object;)V",                   (void *) (intptr_t) &Java_sun_misc_Unsafe_putObjectVolatile    },
+       { "putObject",            "(Ljava/lang/Object;JLjava/lang/Object;)V",                   (void *) (intptr_t) &Java_sun_misc_Unsafe_putObject            },
+       { "getObjectVolatile",    "(Ljava/lang/Object;J)Ljava/lang/Object;",                    (void *) (intptr_t) &Java_sun_misc_Unsafe_getObjectVolatile    },
+       { "arrayBaseOffset",      "(Ljava/lang/Class;)I",                                       (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayBaseOffset      },
+       { "arrayIndexScale",      "(Ljava/lang/Class;)I",                                       (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayIndexScale      },
+       { "unpark",               "(Ljava/lang/Thread;)V",                                      (void *) (intptr_t) &Java_sun_misc_Unsafe_unpark               },
+       { "park",                 "(ZJ)V",                                                      (void *) (intptr_t) &Java_sun_misc_Unsafe_park                 },
 #endif
 };
 
@@ -89,7 +92,7 @@ void _Jv_sun_misc_Unsafe_init(void)
  * Method:    objectFieldOffset
  * Signature: (Ljava/lang/reflect/Field;)J
  */
-JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_misc_Unsafe* this, java_lang_reflect_Field* field)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_misc_Unsafe* this, java_lang_reflect_Field* field)
 {
        classinfo *c;
        fieldinfo *f;
@@ -97,7 +100,7 @@ JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_mis
        c = (classinfo *) field->declaringClass;
        f = &c->fields[field->slot];
 
-       return (s8) f->offset;
+       return (int64_t) f->offset;
 }
 
 
@@ -106,12 +109,12 @@ JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_mis
  * Method:    compareAndSwapInt
  * Signature: (Ljava/lang/Object;JII)Z
  */
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_misc_Unsafe* this, java_lang_Object* obj, s8 offset, s4 expect, s4 update)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_misc_Unsafe* this, java_lang_Object* obj, int64_t offset, int32_t expect, int32_t update)
 {
-       s4 *p;
-       s4  value;
+       int32_t *p;
+       int32_t  value;
 
-       p = (s4 *) (((u1 *) obj) + offset);
+       p = (int32_t *) (((u1 *) obj) + offset);
 
        /* XXX this should be atomic */
 
@@ -133,7 +136,7 @@ JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_mis
  * Method:    compareAndSwapLong
  * Signature: (Ljava/lang/Object;JJJ)Z
  */
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3, s8 par4)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3, int64_t par4)
 {
 }
 
@@ -143,7 +146,7 @@ JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, struct
  * Method:    compareAndSwapObject
  * Signature: (Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z
  */
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3, struct java_lang_Object* par4)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3, struct java_lang_Object* par4)
 {
 }
 
@@ -153,7 +156,7 @@ JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, stru
  * Method:    putOrderedInt
  * Signature: (Ljava/lang/Object;JI)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s4 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int32_t par3)
 {
 }
 
@@ -163,7 +166,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, struct su
  * Method:    putOrderedLong
  * Signature: (Ljava/lang/Object;JJ)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
 {
 }
 
@@ -173,7 +176,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, struct s
  * Method:    putOrderedObject
  * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
 {
 }
 
@@ -183,7 +186,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, struct
  * Method:    putIntVolatile
  * Signature: (Ljava/lang/Object;JI)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s4 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int32_t par3)
 {
 }
 
@@ -193,7 +196,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, struct s
  * Method:    getIntVolatile
  * Signature: (Ljava/lang/Object;J)I
  */
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
 {
 }
 
@@ -203,7 +206,7 @@ JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, struct sun
  * Method:    putLongVolatile
  * Signature: (Ljava/lang/Object;JJ)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
 {
 }
 
@@ -213,7 +216,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, struct
  * Method:    putLong
  * Signature: (Ljava/lang/Object;JJ)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
 {
 }
 
@@ -223,7 +226,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong(JNIEnv *env, struct sun_misc
  * Method:    getLongVolatile
  * Signature: (Ljava/lang/Object;J)J
  */
-JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
 {
 }
 
@@ -233,7 +236,7 @@ JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, struct su
  * Method:    getLong
  * Signature: (Ljava/lang/Object;J)J
  */
-JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_getLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
 {
 }
 
@@ -243,7 +246,7 @@ JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_getLong(JNIEnv *env, struct sun_misc_U
  * Method:    putObjectVolatile
  * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
 {
 }
 
@@ -253,7 +256,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, struc
  * Method:    putObject
  * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
 {
 }
 
@@ -263,7 +266,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, struct sun_mi
  * Method:    getObjectVolatile
  * Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
  */
-JNIEXPORT struct java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT struct java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
 {
 }
 
@@ -273,7 +276,7 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatil
  * Method:    arrayBaseOffset
  * Signature: (Ljava/lang/Class;)I
  */
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
 {
 }
 
@@ -283,7 +286,7 @@ JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, struct su
  * Method:    arrayIndexScale
  * Signature: (Ljava/lang/Class;)I
  */
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
 {
 }
 
@@ -303,7 +306,7 @@ JNIEXPORT void JNICALL Java_sun_misc_Unsafe_unpark(JNIEnv *env, struct sun_misc_
  * Method:    park
  * Signature: (ZJ)V
  */
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, struct sun_misc_Unsafe* this, s4 par1, s8 par2)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, struct sun_misc_Unsafe* this, int32_t par1, int64_t par2)
 {
 }
 #endif
index adbb7779e7e964ba47c47db1981ae2a528173c25..fe0c80ea7ae3bbc90e7e486bd67ca8f5b4f05a9b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads.c 8052 2007-06-10 13:44:33Z michi $
+   $Id: threads.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -967,7 +967,7 @@ bool threads_init(void)
        (void) vm_call_method(method_thread_init, o, threadname);
 #endif
 
-       if (*exceptionptr)
+       if (exceptions_get_exception())
                return false;
 
 #if defined(ENABLE_JAVASE)
@@ -985,7 +985,7 @@ bool threads_init(void)
 
        (void) vm_call_method(m, o, t);
 
-       if (*exceptionptr)
+       if (exceptions_get_exception())
                return false;
 #endif
 
@@ -1425,7 +1425,7 @@ bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
        (void) vm_call_method(method_thread_init, o, s);
 #endif
 
-       if (*exceptionptr)
+       if (exceptions_get_exception())
                return false;
 
 #if defined(ENABLE_JAVASE)
@@ -1445,7 +1445,7 @@ bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 
        (void) vm_call_method(m, o, t);
 
-       if (*exceptionptr)
+       if (exceptions_get_exception())
                return false;
 #endif
 
@@ -1492,7 +1492,7 @@ bool threads_detach_thread(threadobject *thread)
 
                (void) vm_call_method(m, o, t);
 
-               if (*exceptionptr)
+               if (exceptions_get_exception())
                        return false;
        }
 #endif
index f47ac39d6ed1dc816c1c52b743f7cd48b51933d0..ce7d159ec44f4de530a23dbbadccee935266be51 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads-common.c 8052 2007-06-10 13:44:33Z michi $
+   $Id: threads-common.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -111,12 +111,19 @@ void threads_preinit(void)
 # if defined(_CS_GNU_LIBPTHREAD_VERSION)
        len = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, (size_t) 0);
 
-       pathbuf = MNEW(char, len);
+       /* Some systems return as length 0 (maybe cross-compilation
+          related).  In this case we also fall back to linuxthreads. */
 
-       (void) confstr(_CS_GNU_LIBPTHREAD_VERSION, pathbuf, len);
+       if (len > 0) {
+               pathbuf = MNEW(char, len);
 
-       if (strstr(pathbuf, "NPTL") != NULL)
-               threads_pthreads_implementation_nptl = true;
+               (void) confstr(_CS_GNU_LIBPTHREAD_VERSION, pathbuf, len);
+
+               if (strstr(pathbuf, "NPTL") != NULL)
+                       threads_pthreads_implementation_nptl = true;
+               else
+                       threads_pthreads_implementation_nptl = false;
+       }
        else
                threads_pthreads_implementation_nptl = false;
 # else
index a5fc298c9acd0b22b994a1cca88d95faf35488ac..bd776f0f2c72a1b5e5c9291308b8bd40b38855a0 100644 (file)
@@ -28,7 +28,7 @@
    calls instead of machine instructions, using the C calling
    convention.
 
-   $Id: builtin.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: builtin.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -76,6 +76,7 @@
 #include "vmcore/class.h"
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
+#include "vmcore/primitive.h"
 #include "vmcore/rt-timing.h"
 
 #if defined(ENABLE_VMLOG)
@@ -1105,9 +1106,9 @@ java_doublearray *builtin_newarray_double(s4 size)
    passed in an array of longs.
 
    Arguments:
-       n............number of dimensions to create
-       arrayvftbl...vftbl of the array class
-       dims.........array containing the size of each dimension to create
+       n.............number of dimensions to create
+       arrayclass....the array class
+       dims..........array containing the size of each dimension to create
 
    Return value: pointer to the array or NULL if no memory is
    available
index 79dca438c8ca953ade9307b6a5c90e75786e8f3b..981240d4fd113ac81311790f588619c7260ec9b8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: exceptions.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: exceptions.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -44,6 +44,7 @@
 
 #include "native/jni.h"
 #include "native/native.h"
+
 #include "native/include/java_lang_String.h"
 #include "native/include/java_lang_Throwable.h"
 
@@ -67,6 +68,7 @@
 
 #include "vmcore/class.h"
 #include "vmcore/loader.h"
+#include "vmcore/method.h"
 #include "vmcore/options.h"
 
 #if defined(ENABLE_VMLOG)
@@ -189,6 +191,71 @@ bool exceptions_init(void)
 }
 
 
+/* exceptions_get_exception ****************************************************
+
+   Returns the current exception pointer of the current thread.
+
+*******************************************************************************/
+
+java_objectheader *exceptions_get_exception(void)
+{
+       /* return the exception */
+
+       return *exceptionptr;
+}
+
+
+/* exceptions_set_exception ****************************************************
+
+   Sets the exception pointer of the current thread.
+
+*******************************************************************************/
+
+void exceptions_set_exception(java_objectheader *o)
+{
+       /* set the exception */
+
+       *exceptionptr = o;
+}
+
+
+/* exceptions_clear_exception **************************************************
+
+   Clears the current exception pointer of the current thread.
+
+*******************************************************************************/
+
+void exceptions_clear_exception(void)
+{
+       exceptions_set_exception(NULL);
+}
+
+
+/* exceptions_get_and_clear_exception ******************************************
+
+   Gets the exception pointer of the current thread and clears it.
+   This function may return NULL.
+
+*******************************************************************************/
+
+java_objectheader *exceptions_get_and_clear_exception(void)
+{
+       java_objectheader *o;
+
+       /* get the exception */
+
+       o = exceptions_get_exception();
+
+       /* and clear the exception */
+
+       exceptions_clear_exception();
+
+       /* return the exception */
+
+       return o;
+}
+
+
 /* exceptions_new_class ********************************************************
 
    Creates an exception object from the given class and initalizes it.
@@ -205,7 +272,7 @@ static java_objectheader *exceptions_new_class(classinfo *c)
        o = native_new_and_init(c);
 
        if (o == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        return o;
 }
@@ -228,7 +295,7 @@ static java_objectheader *exceptions_new_utf(utf *classname)
        c = load_class_bootstrap(classname);
 
        if (c == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        o = exceptions_new_class(c);
 
@@ -255,7 +322,7 @@ static void exceptions_throw_class(classinfo *c)
        if (o == NULL)
                return;
 
-       *exceptionptr = o;
+       exceptions_set_exception(o);
 }
 
 
@@ -296,20 +363,39 @@ static void exceptions_throw_utf(utf *classname)
 static void exceptions_throw_utf_throwable(utf *classname,
                                                                                   java_objectheader *cause)
 {
-       java_objectheader *o;
-       classinfo         *c;
-   
+       classinfo           *c;
+       java_objectheader   *o;
+       methodinfo          *m;
+       java_lang_Throwable *object;
+
+       object = (java_lang_Throwable *) cause;
+
        c = load_class_bootstrap(classname);
 
        if (c == NULL)
                return;
 
-       o = native_new_and_init_throwable(c, cause);
+       /* create object */
 
+       o = builtin_new(c);
+       
        if (o == NULL)
                return;
 
-       *exceptionptr = o;
+       /* call initializer */
+
+       m = class_resolveclassmethod(c,
+                                                                utf_init,
+                                                                utf_java_lang_Throwable__void,
+                                                                NULL,
+                                                                true);
+                                                     
+       if (m == NULL)
+               return;
+
+       (void) vm_call_method(m, o, cause);
+
+       exceptions_set_exception(o);
 }
 
 
@@ -327,20 +413,98 @@ static void exceptions_throw_utf_throwable(utf *classname,
 static void exceptions_throw_utf_exception(utf *classname,
                                                                                   java_objectheader *exception)
 {
-       java_objectheader *o;
        classinfo         *c;
-   
+       java_objectheader *o;
+       methodinfo        *m;
+
        c = load_class_bootstrap(classname);
 
        if (c == NULL)
                return;
 
-       o = native_new_and_init_exception(c, exception);
+       /* create object */
 
+       o = builtin_new(c);
+       
        if (o == NULL)
                return;
 
-       *exceptionptr = o;
+       /* call initializer */
+
+       m = class_resolveclassmethod(c,
+                                                                utf_init,
+                                                                utf_java_lang_Exception__V,
+                                                                NULL,
+                                                                true);
+                                                     
+       if (m == NULL)
+               return;
+
+       (void) vm_call_method(m, o, exception);
+
+       exceptions_set_exception(o);
+}
+
+
+/* exceptions_throw_utf_cause **************************************************
+
+   Creates an exception object with the given name and initalizes it
+   with the given java/lang/Throwable exception with initCause.
+
+   IN:
+      classname....class name in UTF-8
+         cause........the given Throwable
+
+*******************************************************************************/
+
+static void exceptions_throw_utf_cause(utf *classname, java_objectheader *cause)
+{
+       classinfo           *c;
+       java_objectheader   *o;
+       methodinfo          *m;
+       java_lang_Throwable *object;
+
+       object = (java_lang_Throwable *) cause;
+
+       c = load_class_bootstrap(classname);
+
+       if (c == NULL)
+               return;
+
+       /* create object */
+
+       o = builtin_new(c);
+       
+       if (o == NULL)
+               return;
+
+       /* call initializer */
+
+       m = class_resolveclassmethod(c,
+                                                                utf_init,
+                                                                utf_java_lang_String__void,
+                                                                NULL,
+                                                                true);
+                                                     
+       if (m == NULL)
+               return;
+
+       (void) vm_call_method(m, o, object->detailMessage);
+
+       /* call initCause */
+
+       m = class_resolveclassmethod(c,
+                                                                utf_initCause,
+                                                                utf_java_lang_Throwable__java_lang_Throwable,
+                                                                NULL,
+                                                                true);
+
+       if (m == NULL)
+               return;
+
+       (void) vm_call_method(m, o, cause);
+
+       exceptions_set_exception(o);
 }
 
 
@@ -368,12 +532,12 @@ static java_objectheader *exceptions_new_utf_javastring(utf *classname,
        c = load_class_bootstrap(classname);
 
        if (c == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        o = native_new_and_init_string(c, message);
 
        if (o == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        return o;
 }
@@ -397,12 +561,12 @@ static java_objectheader *exceptions_new_class_utf(classinfo *c, utf *message)
        s = javastring_new(message);
 
        if (s == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        o = native_new_and_init_string(c, s);
 
        if (o == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        return o;
 }
@@ -431,7 +595,7 @@ static java_objectheader *exceptions_new_utf_utf(utf *classname, utf *message)
        c = load_class_bootstrap(classname);
 
        if (c == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        o = exceptions_new_class_utf(c, message);
 
@@ -452,7 +616,11 @@ static java_objectheader *exceptions_new_utf_utf(utf *classname, utf *message)
 
 static void exceptions_throw_class_utf(classinfo *c, utf *message)
 {
-       *exceptionptr = exceptions_new_class_utf(c, message);
+       java_objectheader *o;
+
+       o = exceptions_new_class_utf(c, message);
+
+       exceptions_set_exception(o);
 }
 
 
@@ -469,7 +637,11 @@ static void exceptions_throw_class_utf(classinfo *c, utf *message)
 
 static void exceptions_throw_utf_utf(utf *classname, utf *message)
 {
-       *exceptionptr = exceptions_new_utf_utf(classname, message);
+       java_objectheader *o;
+
+       o = exceptions_new_utf_utf(classname, message);
+
+       exceptions_set_exception(o);
 }
 
 
@@ -682,13 +854,24 @@ void exceptions_throw_noclassdeffounderror(utf *name)
 }
 
 
+/* exceptions_throw_noclassdeffounderror_cause *********************************
+
+   Generates and throws a java.lang.NoClassDefFoundError with the
+   given cause.
+
+*******************************************************************************/
+
+void exceptions_throw_noclassdeffounderror_cause(java_objectheader *cause)
+{
+       exceptions_throw_utf_cause(utf_java_lang_NoClassDefFoundError, cause);
+}
+
+
 /* exceptions_throw_noclassdeffounderror_wrong_name ****************************
 
    Generates and throws a java.lang.NoClassDefFoundError with a
    specific message:
 
-
-
    IN:
       name.........name of the class not found as a utf *
 
@@ -718,51 +901,6 @@ void exceptions_throw_noclassdeffounderror_wrong_name(classinfo *c, utf *name)
 }
 
 
-/* classnotfoundexception_to_noclassdeffounderror ******************************
-
-   Check the *exceptionptr for a ClassNotFoundException. If it is one,
-   convert it to a NoClassDefFoundError.
-
-*******************************************************************************/
-
-void classnotfoundexception_to_noclassdeffounderror(void)
-{
-       java_objectheader   *xptr;
-       java_objectheader   *cause;
-       java_lang_Throwable *t;
-       java_objectheader   *s;
-
-       /* get the cause */
-
-       cause = *exceptionptr;
-
-       /* convert ClassNotFoundException's to NoClassDefFoundError's */
-
-       if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
-               /* clear exception, because we are calling jit code again */
-
-               *exceptionptr = NULL;
-
-               /* create new error */
-
-               t = (java_lang_Throwable *) cause;
-               s = (java_objectheader *) t->detailMessage;
-
-               xptr = exceptions_new_utf_javastring(utf_java_lang_NoClassDefFoundError,
-                                                                                        s);
-
-               /* we had an exception while creating the error */
-
-               if (*exceptionptr)
-                       return;
-
-               /* set new exception */
-
-               *exceptionptr = xptr;
-       }
-}
-
-
 /* exceptions_throw_exceptionininitializererror ********************************
 
    Generates and throws a java.lang.ExceptionInInitializerError for
@@ -920,7 +1058,7 @@ void exceptions_throw_linkageerror(const char *message, classinfo *c)
        if (o == NULL)
                return;
 
-       *exceptionptr = o;
+       exceptions_set_exception(o);
 }
 
 
@@ -1272,18 +1410,18 @@ java_objectheader *exceptions_new_arrayindexoutofboundsexception(s4 index)
                                                                 true);
 
        if (m == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        s = vm_call_method(m, NULL, index);
 
        if (s == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        o = exceptions_new_utf_javastring(utf_java_lang_ArrayIndexOutOfBoundsException,
                                                                          s);
 
        if (o == NULL)
-               return *exceptionptr;
+               return exceptions_get_exception();
 
        return o;
 }
@@ -1494,45 +1632,48 @@ void exceptions_throw_stringindexoutofboundsexception(void)
 }
 
 
-/* exceptions_get_exception ****************************************************
+/* exceptions_classnotfoundexception_to_noclassdeffounderror *******************
 
-   Returns the current exception pointer of the current thread.
+   Check the exception for a ClassNotFoundException. If it is one,
+   convert it to a NoClassDefFoundError.
 
 *******************************************************************************/
 
-java_objectheader *exceptions_get_exception(void)
+void exceptions_classnotfoundexception_to_noclassdeffounderror(void)
 {
-       /* return the exception */
+       java_objectheader   *o;
+       java_objectheader   *cause;
+       java_lang_Throwable *object;
+       java_objectheader   *s;
 
-       return *exceptionptr;
-}
+       /* get the cause */
 
+       cause = exceptions_get_exception();
 
-/* exceptions_set_exception ****************************************************
-
-   Sets the exception pointer of the current thread.
+       /* convert ClassNotFoundException's to NoClassDefFoundError's */
 
-*******************************************************************************/
+       if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
+               /* clear exception, because we are calling jit code again */
 
-void exceptions_set_exception(java_objectheader *o)
-{
-       /* set the exception */
+               exceptions_clear_exception();
 
-       *exceptionptr = o;
-}
+               /* create new error */
 
+               object = (java_lang_Throwable *) cause;
+               s      = (java_objectheader *) object->detailMessage;
 
-/* exceptions_clear_exception **************************************************
+               o = exceptions_new_utf_javastring(utf_java_lang_NoClassDefFoundError,
+                                                                                 s);
 
-   Clears the current exception pointer of the current thread.
+               /* we had an exception while creating the error */
 
-*******************************************************************************/
+               if (exceptions_get_exception())
+                       return;
 
-void exceptions_clear_exception(void)
-{
-       /* and clear the exception */
+               /* set new exception */
 
-       *exceptionptr = NULL;
+               exceptions_set_exception(o);
+       }
 }
 
 
@@ -1550,12 +1691,9 @@ java_objectheader *exceptions_fillinstacktrace(void)
 
        /* get exception */
 
-       o = *exceptionptr;
-       assert(o);
-
-       /* clear exception */
+       o = exceptions_get_and_clear_exception();
 
-       *exceptionptr = NULL;
+       assert(o);
 
        /* resolve methodinfo pointer from exception object */
 
@@ -1581,36 +1719,6 @@ java_objectheader *exceptions_fillinstacktrace(void)
 }
 
 
-/* exceptions_get_and_clear_exception ******************************************
-
-   Gets the exception pointer of the current thread and clears it.
-   This function may return NULL.
-
-*******************************************************************************/
-
-java_objectheader *exceptions_get_and_clear_exception(void)
-{
-       java_objectheader **p;
-       java_objectheader  *e;
-
-       /* get the pointer of the exception pointer */
-
-       p = exceptionptr;
-
-       /* get the exception */
-
-       e = *p;
-
-       /* and clear the exception */
-
-       *p = NULL;
-
-       /* return the exception */
-
-       return e;
-}
-
-
 /* exceptions_new_hardware_exception *******************************************
 
    Creates the correct exception for a hardware-exception thrown and
@@ -1746,7 +1854,7 @@ u1 *exceptions_handle_exception(java_objectheader *xptr, u1 *xpc, u1 *pv, u1 *sp
 #if !defined(NDEBUG)
        /* print exception trace */
 
-       if (opt_verbose || opt_verbosecall || opt_verboseexception)
+       if (opt_verbose || opt_verbosecall || opt_TraceExceptions)
                builtin_trace_exception(xptr, m, xpc, 1);
 #endif
 
@@ -1782,7 +1890,7 @@ u1 *exceptions_handle_exception(java_objectheader *xptr, u1 *xpc, u1 *pv, u1 *sp
                                vmlog_cacao_catch(xptr);
 #endif
 
-                               if (opt_verboseexception) {
+                               if (opt_TraceExceptions) {
                                        exceptions_print_exception(xptr);
                                        stacktrace_print_trace(xptr);
                                }
@@ -1843,7 +1951,7 @@ u1 *exceptions_handle_exception(java_objectheader *xptr, u1 *xpc, u1 *pv, u1 *sp
                                vmlog_cacao_catch(xptr);
 #endif
 
-                               if (opt_verboseexception) {
+                               if (opt_TraceExceptions) {
                                        exceptions_print_exception(xptr);
                                        stacktrace_print_trace(xptr);
                                }
@@ -1953,11 +2061,11 @@ void exceptions_print_exception(java_objectheader *xptr)
 
 void exceptions_print_current_exception(void)
 {
-       java_objectheader *xptr;
+       java_objectheader *o;
 
-       xptr = *exceptionptr;
+       o = exceptions_get_exception();
 
-       exceptions_print_exception(xptr);
+       exceptions_print_exception(o);
 }
 
 
@@ -1980,15 +2088,13 @@ void exceptions_print_stacktrace(void)
 
        /* get original exception */
 
-       oxptr = *exceptionptr;
+       oxptr = exceptions_get_and_clear_exception();
 
        if (oxptr == NULL)
                vm_abort("exceptions_print_stacktrace: no exception thrown");
 
        /* clear exception, because we are calling jit code again */
 
-       *exceptionptr = NULL;
-
        c = oxptr->vftbl->class;
 
        /* find the printStackTrace() method */
@@ -2014,7 +2120,7 @@ void exceptions_print_stacktrace(void)
           have a serious problem while printStackTrace. But may
           be another exception, so print it. */
 
-       xptr = *exceptionptr;
+       xptr = exceptions_get_exception();
 
        if (xptr != NULL) {
                fprintf(stderr, "Exception while printStackTrace(): ");
index bd58a9270697b36e5a7a56d09870e62941c5f318..e9fc1e6db69a778e161777ecb372ac3b5b3e0f0f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: exceptions.h 8056 2007-06-10 14:49:57Z michi $
+   $Id: exceptions.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
 /* function prototypes ********************************************************/
 
-/* load and link exceptions used in the system */
-bool exceptions_init(void);
+bool               exceptions_init(void);
 
-/* initialize new exceptions */
+java_objectheader *exceptions_get_exception(void);
+void               exceptions_set_exception(java_objectheader *o);
+void               exceptions_clear_exception(void);
+java_objectheader *exceptions_get_and_clear_exception(void);
 
 java_objectheader *new_exception_utfmessage(const char *classname,
                                                                                        utf *message);
@@ -89,6 +91,7 @@ void exceptions_throw_classcircularityerror(classinfo *c);
 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
 void exceptions_throw_classnotfoundexception(utf *name);
 void exceptions_throw_noclassdeffounderror(utf *name);
+void exceptions_throw_noclassdeffounderror_cause(java_objectheader *cause);
 void exceptions_throw_noclassdeffounderror_wrong_name(classinfo *c, utf *name);
 void exceptions_throw_linkageerror(const char *message, classinfo *c);
 void exceptions_throw_nosuchfielderror(classinfo *c, utf *name);
@@ -126,14 +129,9 @@ void exceptions_throw_nullpointerexception(void);
 void exceptions_throw_privilegedactionexception(java_objectheader *cause);
 void exceptions_throw_stringindexoutofboundsexception(void);
 
-java_objectheader *exceptions_fillinstacktrace(void);
-
-void classnotfoundexception_to_noclassdeffounderror(void);
+void exceptions_classnotfoundexception_to_noclassdeffounderror(void);
 
-java_objectheader *exceptions_get_exception(void);
-void               exceptions_set_exception(java_objectheader *o);
-void               exceptions_clear_exception(void);
-java_objectheader *exceptions_get_and_clear_exception(void);
+java_objectheader *exceptions_fillinstacktrace(void);
 
 java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val);
 
index a86c6d49ce396d5ad1ef494ba5a45ec96c63ba85..cc62ecce12c24ec64d1722547f947ffb3a508a14 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: global.h 7940 2007-05-23 09:42:08Z michi $
+   $Id: global.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -115,29 +115,6 @@ typedef struct java_objectarray java_objectarray;
 #define IS_VOID_TYPE(a)         ((a) == TYPE_VOID)
 
 
-/* primitive data types *******************************************************/
-
-/* These values are used in parsed descriptors and in some other
-   places were the different types handled internally as TYPE_INT have
-   to be distinguished. */
-
-#define PRIMITIVETYPE_COUNT  11  /* number of primitive types (+ dummies)     */
-
-/* CAUTION: Don't change the numerical values! These constants are
-   used as indices into the primitive type table. */
-
-#define PRIMITIVETYPE_INT     TYPE_INT
-#define PRIMITIVETYPE_LONG    TYPE_LNG
-#define PRIMITIVETYPE_FLOAT   TYPE_FLT
-#define PRIMITIVETYPE_DOUBLE  TYPE_DBL
-#define PRIMITIVETYPE_DUMMY1  TYPE_ADR     /* not used! */
-#define PRIMITIVETYPE_BYTE    5
-#define PRIMITIVETYPE_CHAR    6
-#define PRIMITIVETYPE_SHORT   7
-#define PRIMITIVETYPE_BOOLEAN 8
-#define PRIMITIVETYPE_DUMMY2  9            /* not used! */
-#define PRIMITIVETYPE_VOID    TYPE_VOID
-
 /* some Java related defines **************************************************/
 
 #define JAVA_VERSION    "1.5.0"         /* this version is supported by CACAO */
@@ -248,20 +225,6 @@ struct java_objectheader {             /* header for all objects              */
        which is referenced by the vftbl.
 */
 
-/* CAUTION: Don't change the numerical values! These constants (with
- * the exception of ARRAYTYPE_OBJECT) are used as indices in the
- * primitive type table.
- */
-#define ARRAYTYPE_INT      PRIMITIVETYPE_INT
-#define ARRAYTYPE_LONG     PRIMITIVETYPE_LONG
-#define ARRAYTYPE_FLOAT    PRIMITIVETYPE_FLOAT
-#define ARRAYTYPE_DOUBLE   PRIMITIVETYPE_DOUBLE
-#define ARRAYTYPE_BYTE     PRIMITIVETYPE_BYTE
-#define ARRAYTYPE_CHAR     PRIMITIVETYPE_CHAR
-#define ARRAYTYPE_SHORT    PRIMITIVETYPE_SHORT
-#define ARRAYTYPE_BOOLEAN  PRIMITIVETYPE_BOOLEAN
-#define ARRAYTYPE_OBJECT   PRIMITIVETYPE_VOID     /* don't use as index! */
-
 typedef struct java_arrayheader {       /* header for all arrays              */
        java_objectheader objheader;        /* object header                      */
        s4 size;                            /* array size                         */
index cb7d743f473829af359d6d1bc2d8d3e28f866f9d..3d057aa1daa8c7885eb52a5f388ef2c98af34633 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.
 
-   $Id: simplereg.c 7766 2007-04-19 13:24:48Z michi $
+   $Id: simplereg.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -66,6 +66,15 @@ static void simplereg_allocate_locals(jitdata *jd);
 static void simplereg_allocate_temporaries(jitdata *jd);
 
 
+/* size of a stackslot used by the internal ABI */
+
+#if defined(HAS_4BYTE_STACKSLOT)
+# define SIZE_OF_STACKSLOT 4
+#else 
+# define SIZE_OF_STACKSLOT 8
+#endif
+
+
 /* total number of registers */
 
 #if defined(HAS_ADDRESS_REGISTER_FILE)
@@ -201,7 +210,7 @@ static void simplereg_allocate_temporaries(jitdata *jd);
 
 #define NEW_MEM_SLOT(r)                                              \
     do {                                                             \
-        (r) = rd->memuse;                                            \
+        (r) = rd->memuse * SIZE_OF_STACKSLOT;                        \
         rd->memuse += memneeded + 1;                                 \
     } while (0)
 
@@ -209,7 +218,7 @@ static void simplereg_allocate_temporaries(jitdata *jd);
     do {                                                             \
         if ( (memneeded) && (rd->memuse & 1))                        \
             rd->memuse++;                                            \
-        (r) = rd->memuse;                                            \
+        (r) = rd->memuse * SIZE_OF_STACKSLOT;                        \
         rd->memuse += memneeded + 1;                                 \
     } while (0)
 
@@ -219,7 +228,7 @@ static void simplereg_allocate_temporaries(jitdata *jd);
                        PUSH_BACK(rd->freemem, rd->freememtop, rd->memuse);      \
             rd->memuse++;                                            \
                }                                                            \
-        (r) = rd->memuse;                                            \
+        (r) = rd->memuse * SIZE_OF_STACKSLOT;                        \
         rd->memuse += memneeded + 1;                                 \
     } while (0)
 
@@ -401,7 +410,7 @@ static void simplereg_allocate_interfaces(jitdata *jd)
                                        } 
                                        else {
                                                flags |= INMEMORY;
-                                               regoff = rd->memuse++;
+                                               regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
                                        }                                               
                                } 
                                else /* !IS_ADR_TYPE */
@@ -483,7 +492,7 @@ static void simplereg_allocate_interfaces(jitdata *jd)
                                        }
                                        else {
                                                flags |= INMEMORY;
-                                               regoff = rd->memuse++;
+                                               regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
                                        }                                               
                                } 
                                else
@@ -645,7 +654,7 @@ static void simplereg_allocate_locals_leafmethod(jitdata *jd)
                                }
                                else {
                                        v->flags |= INMEMORY;
-                                       v->vv.regoff = rd->memuse++;
+                                       v->vv.regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
                                }                                               
                        } 
                        else {
@@ -816,7 +825,7 @@ static void simplereg_allocate_locals(jitdata *jd)
                                        }
                                        else {
                                                v->flags = INMEMORY;
-                                               v->vv.regoff = rd->memuse++;
+                                               v->vv.regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
                                        }
                                } 
                                else {
@@ -1167,12 +1176,12 @@ static void simplereg_free(registerdata *rd, s4 flags, s4 regoff, s4 type)
 
        /* if this is a copy of another variable, just decrement the copy counter */
 
-       /* XXX split reg/mem variables on arm may need special handling here */
-
        if (flags & INMEMORY) {
                if (flags & INOUT)
                        return;
 
+               #warning this will be more efficient if we divide it by SIZE_OF_STACKSLOT
+
                if (regoff < rd->memcopycountsize && rd->memcopycount[regoff]) {
                        rd->memcopycount[regoff]--;
                        return;
index 419ba3728a845c604ba62cecf291a54020dbb1e0..4ecb6e6d0f68999847adfadc74744e62134522a1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -215,13 +215,13 @@ bool codegen_emit(jitdata *jd)
                                if (!IS_INMEMORY(var->flags))
                                        M_INTMOVE(s1, var->vv.regoff);
                                else
-                                       M_LST(s1, REG_SP, var->vv.regoff * 8);
+                                       M_LST(s1, REG_SP, var->vv.regoff);
                        }
                        else {                                   /* stack arguments       */
                                if (!IS_INMEMORY(var->flags))
-                                       M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) *8);
+                                       M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                else
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                        }
                }
                else {                                       /* floating args         */
@@ -233,9 +233,9 @@ bool codegen_emit(jitdata *jd)
                        }
                        else {                                   /* stack arguments       */
                                if (!(var->flags & INMEMORY))
-                                       M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                       M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                else
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                        }
                }
        }
@@ -2583,7 +2583,7 @@ gen_method:
                                        }
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                               M_LST(s1, REG_SP, d * 8);
+                                               M_LST(s1, REG_SP, d);
                                        }
                                }
                                else {
@@ -2593,7 +2593,7 @@ gen_method:
                                        }
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_FTMP1);
-                                               M_DST(s1, REG_SP, d * 8);
+                                               M_DST(s1, REG_SP, d);
                                        }
                                }
                        }
@@ -3246,13 +3246,13 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                if (!nmd->params[j].inmemory)
                                        M_INTMOVE(s1, s2);
                                else
-                                       M_LST(s1, REG_SP, s2 * 8);
+                                       M_LST(s1, REG_SP, s2);
                        }
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
                                s2 = nmd->params[j].regoff;
-                               M_LLD(REG_ITMP1, REG_SP, s1 * 8);
-                               M_LST(REG_ITMP1, REG_SP, s2 * 8);
+                               M_LLD(REG_ITMP1, REG_SP, s1);
+                               M_LST(REG_ITMP1, REG_SP, s2);
                        }
                }
                else {
@@ -3264,19 +3264,19 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                        M_FLTMOVE(s1, s2);
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DST(s1, REG_SP, s2 * 8);
+                                               M_DST(s1, REG_SP, s2);
                                        else
-                                               M_FST(s1, REG_SP, s2 * 8);
+                                               M_FST(s1, REG_SP, s2);
                                }
                        }
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
                                s2 = nmd->params[j].regoff;
-                               M_DLD(REG_FTMP1, REG_SP, s1 * 8);
+                               M_DLD(REG_FTMP1, REG_SP, s1);
                                if (IS_2_WORD_TYPE(t))
-                                       M_DST(REG_FTMP1, REG_SP, s2 * 8);
+                                       M_DST(REG_FTMP1, REG_SP, s2);
                                else
-                                       M_FST(REG_FTMP1, REG_SP, s2 * 8);
+                                       M_FST(REG_FTMP1, REG_SP, s2);
                        }
                }
        }
index ee50adde72b66bca4fe55ff200bb3f3b74a27ca5..0c93184cca1e9cb023a3cdbfc87c89d7031be59d 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -73,7 +73,7 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 8;
+               disp = src->vv.regoff;
 
                switch (src->type) {
                case TYPE_INT:
@@ -116,7 +116,7 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
        if (IS_INMEMORY(dst->flags)) {
                COUNT_SPILLS;
 
-               disp = dst->vv.regoff * 8;
+               disp = dst->vv.regoff;
 
                switch (dst->type) {
                case TYPE_INT:
index bea1801ce65f82caeaa4d87b38f0397ea9bcdb8a..457b23d9b0b054e8505fbb0bc0424bbb60e288df 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 7723 2007-04-16 18:03:08Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -180,7 +180,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -195,7 +195,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
index bbbc6465c72f314c12e0cec0683b75f262dedf4d..9de8ea042e5c7ed0683e1bd196cd61816774e375 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7940 2007-05-23 09:42:08Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -129,19 +129,19 @@ bool codegen_emit(jitdata *jd)
                spilledregs_num++;
 #endif
 
-       cd->stackframesize = spilledregs_num + savedregs_num;
+       cd->stackframesize = (spilledregs_num + savedregs_num) * 4;
 
        /* XXX QUICK FIX: We shouldn't align the stack in Java code, but
           only in native stubs. */
        /* align stack to 8-byte */
 
-       cd->stackframesize = (cd->stackframesize + 1) & ~1;
+       cd->stackframesize = (cd->stackframesize + 4) & ~4;
 
        /* SECTION: Method Header */
        /* create method header */
 
        (void) dseg_add_unique_address(cd, code);              /* CodeinfoPointer */
-       (void) dseg_add_unique_s4(cd, cd->stackframesize * 4); /* FrameSize       */
+       (void) dseg_add_unique_s4(cd, cd->stackframesize);     /* FrameSize       */
 
 #if defined(ENABLE_THREADS)
        /* IsSync contains the offset relative to the stack pointer for the
@@ -193,8 +193,8 @@ bool codegen_emit(jitdata *jd)
 
        /* create additional stack frame for spilled variables (if necessary) */
 
-       if ((cd->stackframesize - savedregs_num) > 0)
-               M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - savedregs_num);
+       if ((cd->stackframesize / 4 - savedregs_num) > 0)
+               M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - savedregs_num);
 
        /* take arguments out of register or stack frame */
 
@@ -225,17 +225,17 @@ bool codegen_emit(jitdata *jd)
                                }
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_LST(s1, REG_SP, var->vv.regoff);
                                        else
-                                               M_IST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_IST(s1, REG_SP, var->vv.regoff);
                                }
                        }
                        else {                                   /* stack arguments       */
                                if (!(var->flags & INMEMORY)) {      /* stack arg -> register */
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_LLD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
                                        else
-                                               M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_ILD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
                                }
                                else {                               /* stack arg -> spilled  */
                                        /* Reuse Memory Position on Caller Stack */
@@ -251,17 +251,17 @@ bool codegen_emit(jitdata *jd)
                                }
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_LST(s1, REG_SP, var->vv.regoff);
                                        else
-                                               M_IST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_IST(s1, REG_SP, var->vv.regoff);
                                }
                        }
                        else {
                                if (!(var->flags & INMEMORY)) {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_DLD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
                                        else
-                                               M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_FLD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
                                }
                                else {
                                        /* Reuse Memory Position on Caller Stack */
@@ -2158,8 +2158,8 @@ bool codegen_emit(jitdata *jd)
 
                        /* deallocate stackframe for spilled variables */
 
-                       if ((cd->stackframesize - savedregs_num) > 0)
-                               M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - savedregs_num);
+                       if ((cd->stackframesize / 4 - savedregs_num) > 0)
+                               M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - savedregs_num);
 
                        /* restore callee saved registers + do return */
 
@@ -2228,11 +2228,11 @@ bool codegen_emit(jitdata *jd)
                                        else {
                                                if (IS_2_WORD_TYPE(var->type)) {
                                                        s1 = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
-                                                       M_LST(s1, REG_SP, d * 4);
+                                                       M_LST(s1, REG_SP, d);
                                                }
                                                else {
                                                        s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                                       M_IST(s1, REG_SP, d * 4);
+                                                       M_IST(s1, REG_SP, d);
                                                }
                                        }
 #if !defined(ENABLE_SOFTFLOAT)
@@ -2245,9 +2245,9 @@ bool codegen_emit(jitdata *jd)
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_FTMP1);
                                                if (IS_2_WORD_TYPE(var->type))
-                                                       M_DST(s1, REG_SP, d * 4);
+                                                       M_DST(s1, REG_SP, d);
                                                else
-                                                       M_FST(s1, REG_SP, d * 4);
+                                                       M_FST(s1, REG_SP, d);
                                        }
                                }
 #endif /* !defined(ENABLE_SOFTFLOAT) */
@@ -2925,20 +2925,21 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 
        /* calculate stackframe size */
 
-       cd->stackframesize = 
+       cd->stackframesize = 
                1 +                                                /* return address  */
                sizeof(stackframeinfo) / SIZEOF_VOID_P +           /* stackframeinfo  */
                sizeof(localref_table) / SIZEOF_VOID_P +           /* localref_table  */
-               nmd->memuse;                                       /* stack arguments */
+               nmd->memuse                                        /* stack arguments */
+               ) * 4;
 
        /* align stack to 8-byte */
 
-       cd->stackframesize = (cd->stackframesize + 1) & ~1;
+       cd->stackframesize = (cd->stackframesize + 4) & ~4;
 
        /* create method header */
 
        (void) dseg_add_unique_address(cd, code);              /* CodeinfoPointer */
-       (void) dseg_add_unique_s4(cd, cd->stackframesize * 4); /* FrameSize       */
+       (void) dseg_add_unique_s4(cd, cd->stackframesize);     /* FrameSize       */
        (void) dseg_add_unique_s4(cd, 0);                      /* IsSync          */
        (void) dseg_add_unique_s4(cd, 0);                      /* IsLeaf          */
        (void) dseg_add_unique_s4(cd, 0);                      /* IntSave         */
@@ -2949,7 +2950,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
        /* generate stub code */
 
        M_STMFD(1<<REG_LR, REG_SP);
-       M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - 1);
+       M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - 1);
 
 #if !defined(NDEBUG)
        if (JITDATA_HAS_FLAG_VERBOSECALL(jd))
@@ -2977,11 +2978,11 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 
        /* create native stackframe info */
 
-       assert(IS_IMM(4*4 + cd->stackframesize * 4));
-       M_ADD_IMM(REG_A0, REG_SP, 4*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
+       assert(IS_IMM(4*4 + cd->stackframesize));
+       M_ADD_IMM(REG_A0, REG_SP, 4*4 + cd->stackframesize - SIZEOF_VOID_P);
        M_MOV(REG_A1, REG_PV);
-       M_ADD_IMM(REG_A2, REG_SP, 4*4 + cd->stackframesize * 4);
-       M_LDR_INTERN(REG_A3, REG_SP, 4*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
+       M_ADD_IMM(REG_A2, REG_SP, 4*4 + cd->stackframesize);
+       M_LDR_INTERN(REG_A3, REG_SP, 4*4 + cd->stackframesize - SIZEOF_VOID_P);
        disp = dseg_add_functionptr(cd, codegen_start_native_call);
        M_DSEG_BRANCH(disp);
 
@@ -3022,9 +3023,9 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                        }
                        else {
                                if (IS_2_WORD_TYPE(t))
-                                       M_LST(s1, REG_SP, s2 * 4);
+                                       M_LST(s1, REG_SP, s2);
                                else
-                                       M_IST(s1, REG_SP, s2 * 4);
+                                       M_IST(s1, REG_SP, s2);
                        }
                }
                else {
@@ -3032,12 +3033,12 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                        s2 = nmd->params[j].regoff;
 
                        if (IS_2_WORD_TYPE(t)) {
-                               M_LLD(REG_ITMP12_PACKED, REG_SP, s1 * 4);
-                               M_LST(REG_ITMP12_PACKED, REG_SP, s2 * 4);
+                               M_LLD(REG_ITMP12_PACKED, REG_SP, s1);
+                               M_LST(REG_ITMP12_PACKED, REG_SP, s2);
                        }
                        else {
-                               M_ILD(REG_ITMP1, REG_SP, s1 * 4);
-                               M_IST(REG_ITMP1, REG_SP, s2 * 4);
+                               M_ILD(REG_ITMP1, REG_SP, s1);
+                               M_IST(REG_ITMP1, REG_SP, s2);
                        }
                }
        }
@@ -3094,7 +3095,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 
        M_STMFD(BITMASK_RESULT, REG_SP);
 
-       M_ADD_IMM(REG_A0, REG_SP, 2*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
+       M_ADD_IMM(REG_A0, REG_SP, 2*4 + cd->stackframesize - SIZEOF_VOID_P);
        disp = dseg_add_functionptr(cd, codegen_finish_native_call);
        M_DSEG_BRANCH(disp);
        s1 = (s4) (cd->mcodeptr - cd->mcodebase);
@@ -3105,7 +3106,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 
        /* finish stub code, but do not yet return to caller */
 
-       M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - 1);
+       M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - 1);
        M_LDMFD(1<<REG_LR, REG_SP);
 
        /* check for exception */
index 10f80399ff23cbcafb8be7d27f75d4759e75cfb4..fe099ad4d37ee0bd4b55c5e87c372baa7c688737 100644 (file)
@@ -73,7 +73,7 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (src->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
 #if defined(ENABLE_SOFTFLOAT)
                switch (src->type) {
@@ -139,7 +139,7 @@ s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (src->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
 #if defined(__ARMEL__)
                M_ILD(tempreg, REG_SP, disp);
@@ -177,7 +177,7 @@ s4 emit_load_high(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (src->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
 #if defined(__ARMEL__)
                M_ILD(tempreg, REG_SP, disp + 4);
@@ -212,7 +212,7 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
        if (dst->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = dst->vv.regoff * 4;
+               disp = dst->vv.regoff;
 
 #if defined(ENABLE_SOFTFLOAT)
                switch (dst->type) {
@@ -749,7 +749,7 @@ void emit_verbosecall_enter(jitdata *jd)
        M_STMFD(BITMASK_ARGS | (1<<REG_LR) | (1<<REG_PV), REG_SP);
        M_SUB_IMM(REG_SP, REG_SP, (2 + 2 + 1 + 1) * 4); /* space for a3, a4 and m */
 
-       stackframesize += 6 + 2 + 2 + 1 + 1;
+       stackframesize += (6 + 2 + 2 + 1 + 1) * 4;
 
        /* prepare args for tracer */
 
@@ -776,9 +776,9 @@ void emit_verbosecall_enter(jitdata *jd)
                        s2 = md->params[i].regoff + stackframesize;
 
                        if (IS_2_WORD_TYPE(t))
-                               M_LLD(s1, REG_SP, s2 * 4);
+                               M_LLD(s1, REG_SP, s2);
                        else {
-                               M_ILD(GET_LOW_REG(s1), REG_SP, s2 * 4);
+                               M_ILD(GET_LOW_REG(s1), REG_SP, s2);
                                M_MOV_IMM(GET_HIGH_REG(s1), 0);
                        }
                }
index 995fcc0d714fd707b681ce6f826b4128a3daca5e..3f59b7b0b15f2b759fd2f105dbb17c30c0295ab6 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 7940 2007-05-23 09:42:08Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -155,7 +155,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -184,7 +184,7 @@ void md_param_alloc(methoddesc *md)
                                ALIGN_2(stacksize);
 
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                stacksize    += 2;
                        }
                        break;
@@ -247,7 +247,7 @@ void md_param_alloc_native(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -291,7 +291,7 @@ void md_param_alloc_native(methoddesc *md)
                                ALIGN_2(stacksize);
 #endif
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                reguse        = INT_ARG_CNT;
                                stacksize    += 2;
                        }
index e4ea69a38d067bb4695ce78cb9fc80554ba5d686..013006f717117eeea906cc83f8c0e9b05c9169e4 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.h 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -31,6 +31,9 @@
 #define _ASMPART_H
 
 #include "config.h"
+
+#include <stdint.h>
+
 #include "vm/types.h"
 
 #if defined(ENABLE_THREADS)
@@ -86,9 +89,9 @@ s4   asm_md_init(void);
 void asm_call_jit_compiler(void);
 
 #if defined(ENABLE_JIT)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 java_objectheader *asm_vm_call_method(methodinfo *m, s4 vmargscount,
                                                                          vm_arg *vmargs);
-
 s4     asm_vm_call_method_int(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 s8     asm_vm_call_method_long(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 float  asm_vm_call_method_float(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
@@ -96,10 +99,19 @@ double asm_vm_call_method_double(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 
 void   asm_vm_call_method_exception_handler(void);
 
-/* asm_vm_call_method_end is a dummy symbol marking the end of the asm_vm_call_method
- * function and is used to insert the coderange into the avl tree.
- */
 void   asm_vm_call_method_end(void);
+#else
+java_objectheader *asm_vm_call_method(void *pv, uint64_t *array, int32_t stackargs);
+int32_t            asm_vm_call_method_int(void *pv, uint64_t *array, int32_t stackargs);
+
+int64_t            asm_vm_call_method_long(void *pv, uint64_t *array, int32_t stackargs);
+float              asm_vm_call_method_float(void *pv, uint64_t *array, int32_t stackargs);
+double             asm_vm_call_method_double(void *pv, uint64_t *array, int32_t stackargs);
+
+void   asm_vm_call_method_exception_handler(void);
+void   asm_vm_call_method_end(void);
+#endif
+
 #endif
 
 #if defined(ENABLE_INTRP)
index 401b3edd52e7c8cb98508d98c722baa3ac981f4e..bb0c42166e2bd5c4754466156dd27182c2c4aa60 100644 (file)
@@ -39,7 +39,7 @@
    memory. All functions writing values into the data area return the offset
    relative the begin of the code area (start of procedure).   
 
-   $Id: codegen-common.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: codegen-common.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -375,7 +375,8 @@ void codegen_increase(codegendata *cd)
 
        cd->mcodeptr = cd->mcodebase + (cd->mcodeptr - oldmcodebase);
 
-#if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(__M68K__) || defined(ENABLE_INTRP)
+#if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(__M68K__) || defined(ENABLE_INTRP) \
+ || defined(__SPARC_64__)
        /* adjust the pointer to the last patcher position */
 
        if (cd->lastmcodeptr != NULL)
@@ -553,7 +554,8 @@ void codegen_add_patch_ref(codegendata *cd, functionptr patcher, voidptr ref,
        }
 #endif
 
-#if defined(ENABLE_JIT) && (defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(__M68K__))
+#if defined(ENABLE_JIT) && (defined(__I386__) || defined(__M68K__) || defined(__MIPS__) \
+ || defined(__SPARC_64__) || defined(__X86_64__))
 
        /* On some architectures the patcher stub call instruction might
           be longer than the actual instruction generated.  On this
@@ -832,6 +834,7 @@ u1 *codegen_get_pv_from_pc(u1 *pc)
                log_println("PC=0x%08x", pc);
 #endif
                log_println("");
+               assert(0);
                log_println("Dumping the current stacktrace:");
 
 #if defined(ENABLE_THREADS)
@@ -1671,11 +1674,6 @@ s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum)
        if (!(v->flags & INMEMORY))
                return v->vv.regoff;
 
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_spills_read++;
-#endif
-
        return tempregnum;
 }
 
index dec288b7d3e9fe827a5330b539bc3374fe85dc55..c02566c5396a6db4f2efa38c1041c710087faa48 100644 (file)
@@ -270,6 +270,16 @@ void emit_bccz(codegendata *cd, basicblock *target, s4 condition, s4 reg, u4 opt
                branchmpc = cd->mcodeptr - cd->mcodebase;
                disp      = target->mpc - branchmpc;
 
+#if defined(ENABLE_STATISTICS)
+               count_emit_branch++;
+               if ((int8_t)disp == disp)  count_emit_branch_8bit++; 
+               else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+               else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+# if SIZEOF_VOID_P == 8
+               else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+# endif
+#endif
+
                emit_branch(cd, disp, condition, reg, options);
        }
        else {
@@ -481,6 +491,16 @@ void emit_label_bccz(codegendata *cd, s4 label, s4 condition, s4 reg, u4 options
                mpc  = cd->mcodeptr - cd->mcodebase;
                disp = br->mpc - mpc;
 
+#if defined(ENABLE_STATISTICS)
+               count_emit_branch++;
+               if ((int8_t)disp == disp)  count_emit_branch_8bit++; 
+               else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+               else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+# if SIZEOF_VOID_P == 8
+               else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+# endif
+#endif
+
                emit_branch(cd, disp, condition, reg, options);
 
                /* now remove the branch reference */
@@ -542,6 +562,16 @@ void emit_label(codegendata *cd, s4 label)
                mcodeptr     = cd->mcodeptr;
                cd->mcodeptr = cd->mcodebase + br->mpc;
 
+#if defined(ENABLE_STATISTICS)
+               count_emit_branch++;
+               if ((int8_t)disp == disp)  count_emit_branch_8bit++; 
+               else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+               else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+# if SIZEOF_VOID_P == 8
+               else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+# endif
+#endif
+
                emit_branch(cd, disp, br->condition, br->reg, br->options);
 
                /* restore mcodeptr */
index 63569536890682e24859a8b35d8887049664f47d..af72bad2185301993dc3e1317c2b937b05845520 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8039 2007-06-07 13:46:55Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -265,7 +265,7 @@ bool codegen_emit(jitdata *jd)
                        else {                                   /* stack arguments       */
                                if (!(var->flags & INMEMORY)) {      /* stack arg -> register */
                                        emit_mov_membase_reg(           /* + 4 for return address */
-                                          cd, REG_SP, (cd->stackframesize + s1) * 4 + 4, var->vv.regoff);
+                                          cd, REG_SP, cd->stackframesize * 4 + s1 + 4, var->vv.regoff);
                                                                        /* + 4 for return address */
                                } 
                                else {                               /* stack arg -> spilled  */
@@ -274,15 +274,15 @@ bool codegen_emit(jitdata *jd)
                                                /* no copy avoiding by now possible with SSA */
                                                if (ls != NULL) {
                                                        emit_mov_membase_reg(   /* + 4 for return address */
-                                                                cd, REG_SP, (cd->stackframesize + s1) * 4 + 4,
+                                                                cd, REG_SP, cd->stackframesize * 4 + s1 + 4,
                                                                 REG_ITMP1);    
                                                        emit_mov_reg_membase(
-                                                                cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+                                                                cd, REG_ITMP1, REG_SP, var->vv.regoff);
                                                }
                                                else 
 #endif /*defined(ENABLE_SSA)*/
                                                                  /* reuse Stackslotand avoid copying */
-                                                       var->vv.regoff = cd->stackframesize + s1 + 1;
+                                                       var->vv.regoff = cd->stackframesize * 4 + s1 + 4;
 
                                        } 
                                        else {
@@ -290,20 +290,20 @@ bool codegen_emit(jitdata *jd)
                                                /* no copy avoiding by now possible with SSA */
                                                if (ls != NULL) {
                                                        emit_mov_membase_reg(  /* + 4 for return address */
-                                                                cd, REG_SP, (cd->stackframesize + s1) * 4 + 4,
+                                                                cd, REG_SP, cd->stackframesize * 4 + s1 + 4,
                                                                 REG_ITMP1);
                                                        emit_mov_reg_membase(
-                                                                cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+                                                                cd, REG_ITMP1, REG_SP, var->vv.regoff);
                                                        emit_mov_membase_reg(   /* + 4 for return address */
-                                                                 cd, REG_SP, (cd->stackframesize + s1) * 4 + 4 + 4,
+                                                                 cd, REG_SP, cd->stackframesize * 4 + s1 + 4 + 4,
                                                                  REG_ITMP1);             
                                                        emit_mov_reg_membase(
-                                                                cd, REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+                                                                cd, REG_ITMP1, REG_SP, var->vv.regoff + 4);
                                                }
                                                else
 #endif /*defined(ENABLE_SSA)*/
                                                                  /* reuse Stackslotand avoid copying */
-                                                       var->vv.regoff = cd->stackframesize + s1 + 1;
+                                                       var->vv.regoff = cd->stackframesize * 4 + s1 + 4;
                                        }
                                }
                        }
@@ -323,14 +323,14 @@ bool codegen_emit(jitdata *jd)
                                if (!(var->flags & INMEMORY)) {      /* stack-arg -> register */
                                        if (t == TYPE_FLT) {
                                                emit_flds_membase(
-                            cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
+                            cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
                                                assert(0);
 /*                                             emit_fstp_reg(cd, var->vv.regoff + fpu_st_offset); */
 
                                        } 
                                        else {
                                                emit_fldl_membase(
-                            cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
+                            cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
                                                assert(0);
 /*                                             emit_fstp_reg(cd, var->vv.regoff + fpu_st_offset); */
                                        }
@@ -340,24 +340,24 @@ bool codegen_emit(jitdata *jd)
                                        /* no copy avoiding by now possible with SSA */
                                        if (ls != NULL) {
                                                emit_mov_membase_reg(
-                                                cd, REG_SP, (cd->stackframesize + s1) * 4 + 4, REG_ITMP1);
+                                                cd, REG_SP, cd->stackframesize * 4 + s1 + 4, REG_ITMP1);
                                                emit_mov_reg_membase(
-                                                                        cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+                                                                        cd, REG_ITMP1, REG_SP, var->vv.regoff);
                                                if (t == TYPE_FLT) {
                                                        emit_flds_membase(
-                                                                 cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
-                                                       emit_fstps_membase(cd, REG_SP, var->vv.regoff * 4);
+                                                                 cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                                       emit_fstps_membase(cd, REG_SP, var->vv.regoff);
                                                } 
                                                else {
                                                        emit_fldl_membase(
-                                                                 cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
-                                                       emit_fstpl_membase(cd, REG_SP, var->vv.regoff * 4);
+                                                                 cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                                       emit_fstpl_membase(cd, REG_SP, var->vv.regoff);
                                                }
                                        }
                                        else
 #endif /*defined(ENABLE_SSA)*/
                                                                  /* reuse Stackslotand avoid copying */
-                                               var->vv.regoff = cd->stackframesize + s1 + 1;
+                                               var->vv.regoff = cd->stackframesize * 4 + s1 + 4;
                                }
                        }
                }
@@ -1573,7 +1573,7 @@ bool codegen_emit(jitdata *jd)
                        d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
 
                        if (var->flags & INMEMORY) {
-                               emit_fildl_membase(cd, REG_SP, var->vv.regoff * 4);
+                               emit_fildl_membase(cd, REG_SP, var->vv.regoff);
                        } else {
                                /* XXX not thread safe! */
                                disp = dseg_add_unique_s4(cd, 0);
@@ -1592,7 +1592,7 @@ bool codegen_emit(jitdata *jd)
                        var = VAROP(iptr->s1);
                        d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
                        if (var->flags & INMEMORY) {
-                               emit_fildll_membase(cd, REG_SP, var->vv.regoff * 4);
+                               emit_fildll_membase(cd, REG_SP, var->vv.regoff);
 
                        } else {
                                log_text("L2F: longs have to be in memory");
@@ -1617,19 +1617,19 @@ bool codegen_emit(jitdata *jd)
                        var1 = VAROP(iptr->s1);
 
                        if (var->flags & INMEMORY) {
-                               emit_fistpl_membase(cd, REG_SP, var->vv.regoff * 4);
+                               emit_fistpl_membase(cd, REG_SP, var->vv.regoff);
 
                                /* Round to nearest, 53-bit mode, exceptions masked */
                                disp = dseg_add_s4(cd, 0x027f);
                                emit_fldcw_membase(cd, REG_ITMP1, disp);
 
                                emit_alu_imm_membase(cd, ALU_CMP, 0x80000000, 
-                                                                        REG_SP, var->vv.regoff * 4);
+                                                                        REG_SP, var->vv.regoff);
 
                                disp = 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2 + 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
 
                        } else {
                                /* XXX not thread safe! */
@@ -1644,19 +1644,19 @@ bool codegen_emit(jitdata *jd)
                                emit_alu_imm_reg(cd, ALU_CMP, 0x80000000, var->vv.regoff);
 
                                disp = 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2 + ((REG_RESULT == var->vv.regoff) ? 0 : 2);
                        }
 
                        emit_jcc(cd, CC_NE, disp);
 
                        /* XXX: change this when we use registers */
-                       emit_flds_membase(cd, REG_SP, var1->vv.regoff * 4);
+                       emit_flds_membase(cd, REG_SP, var1->vv.regoff);
                        emit_mov_imm_reg(cd, (ptrint) asm_builtin_f2i, REG_ITMP1);
                        emit_call_reg(cd, REG_ITMP1);
 
                        if (var->flags & INMEMORY) {
-                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
 
                        } else {
                                M_INTMOVE(REG_RESULT, var->vv.regoff);
@@ -1679,19 +1679,19 @@ bool codegen_emit(jitdata *jd)
                        var1 = VAROP(iptr->s1);
 
                        if (var->flags & INMEMORY) {
-                               emit_fistpl_membase(cd, REG_SP, var->vv.regoff * 4);
+                               emit_fistpl_membase(cd, REG_SP, var->vv.regoff);
 
                                /* Round to nearest, 53-bit mode, exceptions masked */
                                disp = dseg_add_s4(cd, 0x027f);
                                emit_fldcw_membase(cd, REG_ITMP1, disp);
 
                                emit_alu_imm_membase(cd, ALU_CMP, 0x80000000, 
-                                                                        REG_SP, var->vv.regoff * 4);
+                                                                        REG_SP, var->vv.regoff);
 
                                disp = 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2 + 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
 
                        } else {
                                /* XXX not thread safe! */
@@ -1706,19 +1706,19 @@ bool codegen_emit(jitdata *jd)
                                emit_alu_imm_reg(cd, ALU_CMP, 0x80000000, var->vv.regoff);
 
                                disp = 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2 + ((REG_RESULT == var->vv.regoff) ? 0 : 2);
                        }
 
                        emit_jcc(cd, CC_NE, disp);
 
                        /* XXX: change this when we use registers */
-                       emit_fldl_membase(cd, REG_SP, var1->vv.regoff * 4);
+                       emit_fldl_membase(cd, REG_SP, var1->vv.regoff);
                        emit_mov_imm_reg(cd, (ptrint) asm_builtin_d2i, REG_ITMP1);
                        emit_call_reg(cd, REG_ITMP1);
 
                        if (var->flags & INMEMORY) {
-                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
                        } else {
                                M_INTMOVE(REG_RESULT, var->vv.regoff);
                        }
@@ -1740,44 +1740,44 @@ bool codegen_emit(jitdata *jd)
                        var1 = VAROP(iptr->s1);
 
                        if (var->flags & INMEMORY) {
-                               emit_fistpll_membase(cd, REG_SP, var->vv.regoff * 4);
+                               emit_fistpll_membase(cd, REG_SP, var->vv.regoff);
 
                                /* Round to nearest, 53-bit mode, exceptions masked */
                                disp = dseg_add_s4(cd, 0x027f);
                                emit_fldcw_membase(cd, REG_ITMP1, disp);
 
                                emit_alu_imm_membase(cd, ALU_CMP, 0x80000000, 
-                                                                        REG_SP, var->vv.regoff * 4 + 4);
+                                                                        REG_SP, var->vv.regoff + 4);
 
                                disp = 6 + 4;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
                                disp += 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2;
                                disp += 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
                                disp += 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4 + 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff + 4);
 
                                emit_jcc(cd, CC_NE, disp);
 
                                emit_alu_imm_membase(cd, ALU_CMP, 0, 
-                                                                        REG_SP, var->vv.regoff * 4);
+                                                                        REG_SP, var->vv.regoff);
 
                                disp = 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2 + 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
 
                                emit_jcc(cd, CC_NE, disp);
 
                                /* XXX: change this when we use registers */
-                               emit_flds_membase(cd, REG_SP, var1->vv.regoff * 4);
+                               emit_flds_membase(cd, REG_SP, var1->vv.regoff);
                                emit_mov_imm_reg(cd, (ptrint) asm_builtin_f2l, REG_ITMP1);
                                emit_call_reg(cd, REG_ITMP1);
-                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
                                emit_mov_reg_membase(cd, REG_RESULT2, 
-                                                                        REG_SP, var->vv.regoff * 4 + 4);
+                                                                        REG_SP, var->vv.regoff + 4);
 
                        } else {
                                log_text("F2L: longs have to be in memory");
@@ -1801,43 +1801,43 @@ bool codegen_emit(jitdata *jd)
                        var1 = VAROP(iptr->s1);
 
                        if (var->flags & INMEMORY) {
-                               emit_fistpll_membase(cd, REG_SP, var->vv.regoff * 4);
+                               emit_fistpll_membase(cd, REG_SP, var->vv.regoff);
 
                                /* Round to nearest, 53-bit mode, exceptions masked */
                                disp = dseg_add_s4(cd, 0x027f);
                                emit_fldcw_membase(cd, REG_ITMP1, disp);
 
                                emit_alu_imm_membase(cd, ALU_CMP, 0x80000000, 
-                                                                        REG_SP, var->vv.regoff * 4 + 4);
+                                                                        REG_SP, var->vv.regoff + 4);
 
                                disp = 6 + 4;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
                                disp += 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2;
                                disp += 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
                                disp += 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4 + 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff + 4);
 
                                emit_jcc(cd, CC_NE, disp);
 
-                               emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, var->vv.regoff * 4);
+                               emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, var->vv.regoff);
 
                                disp = 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
                                disp += 5 + 2 + 3;
-                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+                               CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
 
                                emit_jcc(cd, CC_NE, disp);
 
                                /* XXX: change this when we use registers */
-                               emit_fldl_membase(cd, REG_SP, var1->vv.regoff * 4);
+                               emit_fldl_membase(cd, REG_SP, var1->vv.regoff);
                                emit_mov_imm_reg(cd, (ptrint) asm_builtin_d2l, REG_ITMP1);
                                emit_call_reg(cd, REG_ITMP1);
-                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+                               emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
                                emit_mov_reg_membase(cd, REG_RESULT2, 
-                                                                        REG_SP, var->vv.regoff * 4 + 4);
+                                                                        REG_SP, var->vv.regoff + 4);
 
                        } else {
                                log_text("D2L: longs have to be in memory");
@@ -1980,10 +1980,10 @@ bool codegen_emit(jitdata *jd)
                        assert(var->flags & INMEMORY);
                        emit_mov_memindex_reg(cd, OFFSET(java_longarray, data[0]), 
                                                                  s1, s2, 3, REG_ITMP3);
-                       emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff * 4);
+                       emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff);
                        emit_mov_memindex_reg(cd, OFFSET(java_longarray, data[0]) + 4, 
                                                                  s1, s2, 3, REG_ITMP3);
-                       emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff * 4 + 4);
+                       emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff + 4);
                        break;
 
                case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
@@ -2080,10 +2080,10 @@ bool codegen_emit(jitdata *jd)
                        var = VAROP(iptr->sx.s23.s3);
 
                        assert(var->flags & INMEMORY);
-                       emit_mov_membase_reg(cd, REG_SP, var->vv.regoff * 4, REG_ITMP3);
+                       emit_mov_membase_reg(cd, REG_SP, var->vv.regoff, REG_ITMP3);
                        emit_mov_reg_memindex(cd, REG_ITMP3, OFFSET(java_longarray, data[0])
                                                                  , s1, s2, 3);
-                       emit_mov_membase_reg(cd, REG_SP, var->vv.regoff * 4 + 4, REG_ITMP3);
+                       emit_mov_membase_reg(cd, REG_SP, var->vv.regoff + 4, REG_ITMP3);
                        emit_mov_reg_memindex(cd, REG_ITMP3,
                                                            OFFSET(java_longarray, data[0]) + 4, s1, s2, 3);
                        break;
@@ -2953,10 +2953,10 @@ gen_method:
                                        } else {
                                                if (IS_2_WORD_TYPE(var->type)) {
                                                        d = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
-                                                       M_LST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_LST(d, REG_SP, md->params[s3].regoff);
                                                } else {
                                                        d = emit_load(jd, iptr, var, REG_ITMP1);
-                                                       M_IST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_IST(d, REG_SP, md->params[s3].regoff);
                                                }
                                        }
 
@@ -2969,9 +2969,9 @@ gen_method:
                                        } else {
                                                d = emit_load(jd, iptr, var, REG_FTMP1);
                                                if (IS_2_WORD_TYPE(var->type))
-                                                       M_DST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_DST(d, REG_SP, md->params[s3].regoff);
                                                else
-                                                       M_FST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_FST(d, REG_SP, md->params[s3].regoff);
                                        }
                                }
                        } /* end of for */
@@ -3402,7 +3402,7 @@ gen_method:
                                /* Already Preallocated? */
                                if (!(var->flags & PREALLOC)) {
                                        if (var->flags & INMEMORY) {
-                                               M_ILD(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+                                               M_ILD(REG_ITMP1, REG_SP, var->vv.regoff);
                                                M_IST(REG_ITMP1, REG_SP, (s1 + 3) * 4);
                                        }
                                        else
@@ -3821,8 +3821,8 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                if (!md->params[i].inmemory) {
                        /* no integer argument registers */
                } else {       /* float/double in memory can be copied like int/longs */
-                       s1 = (md->params[i].regoff + cd->stackframesize + 1) * 4;
-                       s2 = nmd->params[j].regoff * 4;
+                       s1 = md->params[i].regoff + cd->stackframesize * 4 + 4;
+                       s2 = nmd->params[j].regoff;
 
                        M_ILD(REG_ITMP1, REG_SP, s1);
                        M_IST(REG_ITMP1, REG_SP, s2);
index 87ef9d1d64a995951f9044d80e76f274218c18b3..3bbf45e3d9ec6f3a5028c3647833433d985c56c8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -73,7 +73,7 @@ inline s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                switch (src->type) {
                case TYPE_INT:
@@ -124,7 +124,7 @@ inline s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src,s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                M_ILD(tempreg, REG_SP, disp);
 
@@ -158,7 +158,7 @@ inline s4 emit_load_high(jitdata *jd, instruction *iptr,varinfo *src,s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                M_ILD(tempreg, REG_SP, disp + 4);
 
@@ -189,7 +189,7 @@ inline void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
        if (IS_INMEMORY(dst->flags)) {
                COUNT_SPILLS;
 
-               disp = dst->vv.regoff * 4;
+               disp = dst->vv.regoff;
 
                switch (dst->type) {
                case TYPE_INT:
@@ -231,7 +231,7 @@ inline void emit_store_low(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
        if (IS_INMEMORY(dst->flags)) {
                COUNT_SPILLS;
-               M_IST(GET_LOW_REG(d), REG_SP, dst->vv.regoff * 4);
+               M_IST(GET_LOW_REG(d), REG_SP, dst->vv.regoff);
        }
 }
 
@@ -255,7 +255,7 @@ inline void emit_store_high(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
        if (IS_INMEMORY(dst->flags)) {
                COUNT_SPILLS;
-               M_IST(GET_HIGH_REG(d), REG_SP, dst->vv.regoff * 4 + 4);
+               M_IST(GET_HIGH_REG(d), REG_SP, dst->vv.regoff + 4);
        }
 }
 
index 80c6017a6d1036588236956c15185ccde664dc88..1978c8a282b11364c8d5a3184a3d535cc02d0ed7 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 7723 2007-04-16 18:03:08Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -114,7 +114,7 @@ void md_param_alloc(methoddesc *md)
 
        for (i = 0; i < md->paramcount; i++, pd++) {
                pd->inmemory = true;
-               pd->regoff = stacksize;
+               pd->regoff = stacksize * 4;
                stacksize += IS_2_WORD_TYPE(md->paramtypes[i].type) ? 2 : 1;
        }
 
index f0e61094bf9cfa63bc897a120111f1b64d45f163..95015104d3c0aabf11b2856d68ced8a812661090 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: jit.h 7766 2007-04-19 13:24:48Z michi $
+   $Id: jit.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -81,10 +81,26 @@ typedef struct exception_entry exception_entry;
 
 #if defined(ENABLE_STATISTICS)
 # define COUNT(x)        (x)++
-# define COUNT_SPILLS    count_spills++
+# define COUNT_SPILLS             /* use COUNT_(READ|WRITE)_SPILLS instead */
+# define COUNT_READ_SPILLS(var) \
+       switch(var->type) { \
+       case TYPE_FLT: count_spills_read_flt++; break; \
+       case TYPE_DBL: count_spills_read_dbl++; break; \
+       default: count_spills_read_ila++; break; \
+       }
+
+# define COUNT_WRITE_SPILLS(var) \
+       switch(var->type) { \
+       case TYPE_FLT: count_spills_write_flt++; break; \
+       case TYPE_DBL: count_spills_write_dbl++; break; \
+       default: count_spills_write_ila++; break; \
+       }
+
 #else
-# define COUNT(x)        /* nothing */
-# define COUNT_SPILLS    /* nothing */
+# define COUNT(x)                /* nothing */
+# define COUNT_SPILLS            /* nothing */
+# define COUNT_READ_SPILLS(x)    /* nothing */
+# define COUNT_WRITE_SPILLS(x)   /* nothing */
 #endif
 
 typedef struct interface_info interface_info;
index ef96bb9bc5343bbb6b7b223ec8d47b132b354aa4..08c3b84da775a08096a90d14c39eb67f551a6fab 100644 (file)
@@ -215,21 +215,21 @@ bool codegen_emit(jitdata *jd)
                        case TYPE_INT:
                                if (!IS_INMEMORY(var->flags)) {      /* stack arg -> register */
                                        if (IS_2_WORD_TYPE(t))  {
-                                               M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+                                               M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
                                        } else {
-                                               M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+                                               M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
                                        }
                                } else {                             /* stack arg -> spilled  */
 #if 1
-                                       M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
-                                       M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+                                       M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                       M_IST(REG_ITMP1, REG_SP, var->vv.regoff);
                                        if (IS_2_WORD_TYPE(t)) {
-                                               M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4 + 4);
-                                               M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+                                               M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4 + 4);
+                                               M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
                                        }
 #else
                                        /* Reuse Memory Position on Caller Stack */
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 4 + s1;
 #endif
                                } 
                                break;
@@ -238,36 +238,36 @@ bool codegen_emit(jitdata *jd)
                        case TYPE_DBL:
                                if (!IS_INMEMORY(var->flags)) {      /* stack-arg -> register */
                                        if (IS_2_WORD_TYPE(t))  {
-                                               M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+                                               M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
                                        } else {
-                                               M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+                                               M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
                                        }
                                } else {                             /* stack-arg -> spilled  */
 #if 1
                                        if (IS_2_WORD_TYPE(t)) {
-                                               M_DLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
-                                               M_DST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+                                               M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                               M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
                                        } else {
-                                               M_FLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
-                                               M_FST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+                                               M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                               M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
                                        }
 #else
                                        /* Reuse Memory Position on Caller Stack */
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 4 + s1;
 #endif
                                }
                                break;
 #endif /* SOFTFLOAT */
                        case TYPE_ADR:
                                if (!IS_INMEMORY(var->flags)) {      /* stack-arg -> register */
-                                       M_ALD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+                                       M_ALD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
                                } else {                             /* stack-arg -> spilled  */
 #if 1
-                                       M_ALD(REG_ATMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
-                                       M_AST(REG_ATMP1, REG_SP, var->vv.regoff * 4);
+                                       M_ALD(REG_ATMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                       M_AST(REG_ATMP1, REG_SP, var->vv.regoff);
 #else
                                /* Reuse Memory Position on Caller Stack */
-                               var->vv.regoff = cd->stackframesize + s1;
+                               var->vv.regoff = cd->stackframesize * 4 + s1;
 #endif
                                }
                                break;
@@ -1666,27 +1666,27 @@ bool codegen_emit(jitdata *jd)
 #endif
                                        case TYPE_LNG:
                                                d = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
-                                               M_LST(d, REG_SP, md->params[s3].regoff*4);
+                                               M_LST(d, REG_SP, md->params[s3].regoff);
                                                break;
 #if defined(ENABLE_SOFTFLOAT)
                                        case TYPE_FLT:
 #endif
                                        case TYPE_INT:
                                                d = emit_load(jd, iptr, var, REG_ITMP1);
-                                               M_IST(d, REG_SP, md->params[s3].regoff*4);
+                                               M_IST(d, REG_SP, md->params[s3].regoff);
                                                break;
                                        case TYPE_ADR:
                                                d = emit_load(jd, iptr, var, REG_ATMP1);
-                                               M_AST(d, REG_SP, md->params[s3].regoff*4);
+                                               M_AST(d, REG_SP, md->params[s3].regoff);
                                                break;
 #if !defined(ENABLE_SOFTFLOAT)
                                        case TYPE_FLT:
                                                d = emit_load(jd, iptr, var, REG_FTMP1);
-                                               M_FST(d, REG_SP, md->params[s3].regoff*4);
+                                               M_FST(d, REG_SP, md->params[s3].regoff);
                                                break;
                                        case TYPE_DBL:
                                                d = emit_load(jd, iptr, var, REG_FTMP1);
-                                               M_DST(d, REG_SP, md->params[s3].regoff*4);
+                                               M_DST(d, REG_SP, md->params[s3].regoff);
                                                break;
 #endif
                                        default:
@@ -2670,8 +2670,8 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                /* all arguments via stack */
                assert(md->params[i].inmemory);                                         
 
-               s1 = (md->params[i].regoff + cd->stackframesize + 1) * 4;
-               s2 = nmd->params[j].regoff * 4;
+               s1 = md->params[i].regoff + cd->stackframesize * 4 + 4;
+               s2 = nmd->params[j].regoff;
 
                /* simply copy argument stack */
                M_ILD(REG_ITMP1, REG_SP, s1);
index fd830e4eb66caec346799e64e26bae77c92dd5d9..10155725b96c5d30f7519d9ea8c94086a1f6df8e 100644 (file)
@@ -59,7 +59,7 @@ u1 *disassinstr(u1 *code)
                /* setting the struct members must be done after
                   INIT_DISASSEMBLE_INFO */
 
-               info.mach             = bfd_mach_mcf_isa_b_float_emac;  /* this is optimistic */
+               info.mach             = bfd_mach_mcfv4e;        /* this is optimistic */
                info.read_memory_func = &disass_buffer_read_memory;
 
                disass_initialized = 1;
index c4b603df0d6cc555824620c116c0ed851e9672da..7da510fb5206c5606455f00dc1d70d18b2f46d42 100644 (file)
@@ -166,23 +166,23 @@ inline void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
                        case TYPE_DBL:
 #endif
                        case TYPE_LNG:
-                               M_LST(d, REG_SP, dst->vv.regoff * 4);
+                               M_LST(d, REG_SP, dst->vv.regoff);
                                break;
 #if defined(ENABLE_SOFTFLOAT)
                        case TYPE_FLT:
 #endif
                        case TYPE_INT:
-                               M_IST(d, REG_SP, dst->vv.regoff * 4);
+                               M_IST(d, REG_SP, dst->vv.regoff);
                                break;
                        case TYPE_ADR:
-                               M_AST(d, REG_SP, dst->vv.regoff * 4);
+                               M_AST(d, REG_SP, dst->vv.regoff);
                                break;
 #if !defined(ENABLE_SOFTFLOAT)
                        case TYPE_DBL:
-                               M_DST(d, REG_SP, dst->vv.regoff * 4);
+                               M_DST(d, REG_SP, dst->vv.regoff);
                                break;
                        case TYPE_FLT:
-                               M_FST(d, REG_SP, dst->vv.regoff * 4);
+                               M_FST(d, REG_SP, dst->vv.regoff);
                                break;
 #endif
                        default:
@@ -211,7 +211,7 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
        
                switch (src->type)      {
 #if defined(ENABLE_SOFTFLOAT)
@@ -354,7 +354,7 @@ s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
                M_ILD(tempreg, REG_SP, disp + 4);
                reg = tempreg;
        } else {
@@ -378,7 +378,7 @@ s4 emit_load_high(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
 
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
                M_ILD(tempreg, REG_SP, disp);
                reg = tempreg;
        } else {
index 4a90563ca16495ab30964e604d46165f729c138e..3a46003a8c0340fbc5e1d3acfcbcbda5c7060fb2 100644 (file)
@@ -115,7 +115,7 @@ void md_param_alloc(methoddesc *md)
 
        for (i=0; i<md->paramcount; i++, pd++)  {
                pd->inmemory = true;
-               pd->regoff = stacksize;
+               pd->regoff = stacksize * 4;
                stacksize += IS_2_WORD_TYPE(md->paramtypes[i].type) ? 2:1;
        }
 
index 0feb53eb7ad36b8042402e828ea1cf247b3d7fbf..7b6371ba7a036b7886e4408a3d0506f05baa1dfb 100644 (file)
@@ -53,7 +53,6 @@
 void md_init(void) 
 {
        assert(sizeof(vm_arg) == sizevmarg);
-       assert(OFFSET(java_objectheader, vftbl) == offobjvftbl);
        assert(OFFSET(vftbl_t, baseval) == offbaseval);
        assert(OFFSET(vftbl_t, diffval) == offdiffval);
        assert(OFFSET(vm_arg, type) == offvmargtype);
index f61f6ea0ce456fdc08128f4ddbd0211ebe6a2249..e717082f3e9130174dbb3b0ccd4e90c5a5b8f1db 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 8027 2007-06-07 10:30:33Z michi $
+   $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -145,7 +145,8 @@ asm_vm_call_method_double:
 L_asm_vm_call_method_compute_pv:
        aaddiu  pv,ra,-4*4
 
-       ast     s7,3*8(sp)
+       ast     s0,3*8(sp)                /* save callee saved register           */
+       ast     a0,4*8(sp)                /* save method PV                       */
 
 #if SIZEOF_VOID_P == 8
        sdc1    fss0,5*8(sp)              /* save non JavaABI saved flt registers */
@@ -156,146 +157,84 @@ L_asm_vm_call_method_compute_pv:
        sdc1    fss5,10*8(sp)
 #endif
 
-       ast     a0,4*8(sp)                /* save method pointer for compiler     */
-
-       move    t0,a2                     /* address of first block               */
-       move    s7,a1                     /* argument count                       */
-       blez    s7,calljava_argsloaded
-       nop
+       move    t0,a1                     /* address of data structure            */
+       move    t1,a2                     /* stack argument count                 */
+       move    s0,sp                     /* save stack pointer                   */
 
 #if SIZEOF_VOID_P == 8
 
-       ald     a0,offvmargdata(t0)
-       ldc1    fa0,offvmargdata(t0)
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-       nop
-
-       ald     a1,offvmargdata+sizevmarg*1(t0)
-       ldc1    fa1,offvmargdata+sizevmarg*1(t0)
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-       nop
-
-       ald     a2,offvmargdata+sizevmarg*2(t0)
-       ldc1    fa2,offvmargdata+sizevmarg*2(t0)
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-       nop
-
-       ald     a3,offvmargdata+sizevmarg*3(t0)
-       ldc1    fa3,offvmargdata+sizevmarg*3(t0)
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-       nop
-
-       ald     a4,offvmargdata+sizevmarg*4(t0)
-       ldc1    fa4,offvmargdata+sizevmarg*4(t0)
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-       nop
-
-       ald     a5,offvmargdata+sizevmarg*5(t0)
-       ldc1    fa5,offvmargdata+sizevmarg*5(t0)
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-       nop
-
-       ald     a6,offvmargdata+sizevmarg*6(t0)
-       ldc1    fa6,offvmargdata+sizevmarg*6(t0)
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-       nop
-
-       ald     a7,offvmargdata+sizevmarg*7(t0)
-       ldc1    fa7,offvmargdata+sizevmarg*7(t0)
-       aaddi   s7,s7,-1
+       ld      a0,0*8(t0)
+       ld      a1,1*8(t0)
+       ld      a2,2*8(t0)
+       ld      a3,3*8(t0)
+       ld      a4,4*8(t0)
+       ld      a5,5*8(t0)
+       ld      a6,6*8(t0)
+       ld      a7,7*8(t0)
+
+       ldc1    fa0,8*8(t0)
+       ldc1    fa1,9*8(t0)
+       ldc1    fa2,10*8(t0)
+       ldc1    fa3,11*8(t0)
+       ldc1    fa4,12*8(t0)
+       ldc1    fa5,13*8(t0)
+       ldc1    fa6,14*8(t0)
+       ldc1    fa7,15*8(t0)
 
 #else /* SIZEOF_VOID_P == 8 */
 
-#if WORDS_BIGENDIAN == 1
-       ald     a0,offvmargdata+4(t0)
-#else
-       ald     a0,offvmargdata(t0)
-#endif
-#if !defined(ENABLE_SOFT_FLOAT)
-       ldc1    fa0,offvmargdata(t0)
-#endif
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-
-#if WORDS_BIGENDIAN == 1
-       ald     a1,offvmargdata+4+sizevmarg*1(t0)
-#else
-       ald     a1,offvmargdata+sizevmarg*1(t0)
-#endif
-#if !defined(ENABLE_SOFT_FLOAT)
-       ldc1    fa1,offvmargdata+sizevmarg*1(t0)
-#endif
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
-
-#if WORDS_BIGENDIAN == 1
-       ald     a2,offvmargdata+4+sizevmarg*2(t0)
-#else
-       ald     a2,offvmargdata+sizevmarg*2(t0)
-#endif
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
+# if WORDS_BIGENDIAN == 1
+       lw      a0,0*8+4(t0)
+       lw      a1,1*8+4(t0)
+       lw      a2,2*8+4(t0)
+       lw      a3,3*8+4(t0)
+# else
+       lw      a0,0*8(t0)
+       lw      a1,1*8(t0)
+       lw      a2,2*8(t0)
+       lw      a3,3*8(t0)
+# endif
 
-#if WORDS_BIGENDIAN == 1
-       ald     a3,offvmargdata+4+sizevmarg*3(t0)
-#else
-       ald     a3,offvmargdata+sizevmarg*3(t0)
-#endif
-       aaddi   s7,s7,-1
-       blez    s7,calljava_argsloaded
+# if !defined(ENABLE_SOFT_FLOAT)
+       ldc1    fa0,4*8(t0)
+       ldc1    fa1,5*8(t0)
+# endif
 
 #endif /* SIZEOF_VOID_P == 8 */
 
-calljava_argsloaded:
-       move    t4,sp                     /* save stack pointer                   */
-       blez    s7,calljava_nocopy
+       beqz    t1,L_asm_vm_call_method_stack_copy_done
        nop
 
-#if SIZEOF_VOID_P == 4
-       aaddiu  s7,s7,4                   /* add stack space for 4 arguments      */
-#endif
-       subu    t1,zero,s7                /* remaining argument count (negative)  */
-       sll     t2,t1,3                   /* calculate stackframe size            */
-       aaddu   sp,sp,t2                  /* create stackframe                    */
-       aaddu   t2,t2,t4                  /* also set temp sp                     */
-#if SIZEOF_VOID_P == 4
-       aaddiu  t2,t2,4*4                 /* skip stack space for 4 arguments     */
-       addiu   t1,t1,4
-#endif
+       sll     t2,t1,3                   /* calculate stackframe size (* 8)      */
+       asubu   sp,sp,t2                  /* create stackframe                    */
+       move    t2,sp                     /* temporary stack pointer              */
 
-calljava_copyloop:
+L_asm_vm_call_method_stack_copy_loop:
 #if SIZEOF_VOID_P == 8
-       ald     t3,offvmargdata+sizevmarg*8(t0)
+       ld      t3,16*8(t0)               /* load argument                        */
+       sd      t3,0(t2)                  /* store argument on stack              */
 #else
-# if WORDS_BIGENDIAN == 1
-       ald     t3,offvmargdata+4+sizevmarg*4(t0)
+# if !defined(ENABLE_SOFT_FLOAT)
+       lw      t3,6*8+0(t0)              /* load argument                        */
+       lw      t4,6*8+4(t0)
+       sw      t3,0(t2)                  /* store argument on stack              */
+       sw      t4,4(t2)
 # else
-       ald     t3,offvmargdata+sizevmarg*4(t0)
+#  error implement me
 # endif
 #endif
-       ast     t3,0(t2)                  /* store argument on stack              */
-       addi    t1,t1,1                   /* count 1 argument                     */
-       aaddi   t0,t0,sizevmarg           /* load address of next block           */
-       aaddi   t2,t2,8                   /* increase stack position              */
-       bnez    t1,calljava_copyloop      /* all arguments copied?                */
-       nop
 
-calljava_nocopy:
-       ald     itmp1,4*8(t4)             /* pass method pointer via itmp1        */
+       aaddi   t1,t1,-1                  /* subtract 1 argument                  */
+       aaddi   t0,t0,8                   /* load address of next argument        */
+       aaddi   t2,t2,8                   /* increase stack pointer               */
 
-       ala     mptr,asm_call_jit_compiler/* fake virtual function call (2 instr) */
-       ast     mptr,2*8(t4)              /* store function address               */
-       ala     mptr,1*8(t4)              /* set method pointer                   */
+       bgtz    t1,L_asm_vm_call_method_stack_copy_loop
+       nop
 
-       ald     pv,1*8(mptr)              /* method call as in Java               */
-       jalr    pv                        /* call JIT compiler                    */
+L_asm_vm_call_method_stack_copy_done:
+       ala     mptr,4*8(s0)              /* get address of PV                    */
+       ald     pv,0*8(mptr)              /* load PV                              */
+       jalr    pv
        nop
 L_asm_vm_call_method_recompute_pv:
 #if SIZEOF_VOID_P == 8
@@ -306,13 +245,12 @@ L_asm_vm_call_method_recompute_pv:
 
        .set    reorder                   /* XXX we need to recompute pv          */
 
-       sll     t1,s7,3                   /* remove argument stackframe           */
-       aaddu   sp,sp,t1
+       move    sp,s0                     /* restore stack pointer                */
 
 calljava_return2:
        ald     ra,0*8(sp)                /* restore return address               */
        ald     pv,1*8(sp)                /* restore procedure vector             */
-       ald     s7,3*8(sp)
+       ald     s0,3*8(sp)
 
 #if SIZEOF_VOID_P == 8
        ldc1    fss0,5*8(sp)              /* restore non JavaABI saved flt regs   */
@@ -327,8 +265,7 @@ calljava_return2:
        j       ra                        /* return                               */
 
 asm_vm_call_method_exception_handler:
-       sll     t1,s7,3                   /* remove stackframe                    */
-       aaddu   sp,sp,t1
+       move    sp,s0                     /* restore stack pointer                */
 #if SIZEOF_VOID_P == 4
        aaddiu  sp,sp,-4*4                /* reserve space for 1 argument         */
 #endif
index e406b8e3d6b9898e21d049deea653302ca586a97..6294fff9443af4ff22e5f57f8618a27997d3a0b5 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -222,7 +222,7 @@ bool codegen_emit(jitdata *jd)
                                if (!(var->flags & INMEMORY))
                                        M_INTMOVE(s1, var->vv.regoff);
                                else
-                                       M_LST(s1, REG_SP, var->vv.regoff * 8);
+                                       M_LST(s1, REG_SP, var->vv.regoff);
 #else
                                if (!(var->flags & INMEMORY)) {
                                        if (IS_2_WORD_TYPE(t))
@@ -232,25 +232,25 @@ bool codegen_emit(jitdata *jd)
                                }
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LST(s1, REG_SP, var->vv.regoff * 8);
+                                               M_LST(s1, REG_SP, var->vv.regoff);
                                        else
-                                               M_IST(s1, REG_SP, var->vv.regoff * 8);
+                                               M_IST(s1, REG_SP, var->vv.regoff);
                                }
 #endif
                        }
                        else {                                   /* stack arguments       */
                                if (!(var->flags & INMEMORY)) {
 #if SIZEOF_VOID_P == 8
-                                       M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                       M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
 #else
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                               M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                        else
-                                               M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                               M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
 #endif
                                }
                                else
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                        }
                }
                else {                                       /* floating args         */
@@ -263,20 +263,20 @@ bool codegen_emit(jitdata *jd)
                                }
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DST(s1, REG_SP, var->vv.regoff * 8);
+                                               M_DST(s1, REG_SP, var->vv.regoff);
                                        else
-                                               M_FST(s1, REG_SP, var->vv.regoff * 8);
+                                               M_FST(s1, REG_SP, var->vv.regoff);
                                }
                        }
                        else {
                                if (!(var->flags & INMEMORY)) {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                               M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                        else
-                                               M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                               M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                }
                                else
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                        }
                }
        }
@@ -3056,7 +3056,7 @@ gen_method:
                                        }
                                        else  {
                                                s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                               M_LST(s1, REG_SP, d * 8);
+                                               M_LST(s1, REG_SP, d);
                                        }
 #else
                                        if (!md->params[s3].inmemory) {
@@ -3070,11 +3070,11 @@ gen_method:
                                        else {
                                                if (IS_2_WORD_TYPE(var->type)) {
                                                        s1 = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
-                                                       M_LST(s1, REG_SP, d * 8);
+                                                       M_LST(s1, REG_SP, d);
                                                }
                                                else {
                                                        s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                                       M_IST(s1, REG_SP, d * 8);
+                                                       M_IST(s1, REG_SP, d);
                                                }
                                        }
 #endif
@@ -3090,9 +3090,9 @@ gen_method:
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_FTMP1);
                                                if (IS_2_WORD_TYPE(var->type))
-                                                       M_DST(s1, REG_SP, d * 8);
+                                                       M_DST(s1, REG_SP, d);
                                                else
-                                                       M_FST(s1, REG_SP, d * 8);
+                                                       M_FST(s1, REG_SP, d);
                                        }
                                }
                        }
@@ -3818,30 +3818,30 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                }
                                else {
 #if SIZEOF_VOID_P == 8
-                                       M_LST(s1, REG_SP, s2 * 8);
+                                       M_LST(s1, REG_SP, s2);
 #else
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LST(s1, REG_SP, s2 * 4);
+                                               M_LST(s1, REG_SP, s2);
                                        else
-                                               M_IST(s1, REG_SP, s2 * 4);
+                                               M_IST(s1, REG_SP, s2);
 #endif
                                }
                        }
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
                                s2 = nmd->params[j].regoff;
 
 #if SIZEOF_VOID_P == 8
-                               M_LLD(REG_ITMP1, REG_SP, s1 * 8);
-                               M_LST(REG_ITMP1, REG_SP, s2 * 8);
+                               M_LLD(REG_ITMP1, REG_SP, s1);
+                               M_LST(REG_ITMP1, REG_SP, s2);
 #else
                                if (IS_2_WORD_TYPE(t)) {
-                                       M_LLD(REG_ITMP12_PACKED, REG_SP, s1 * 8);
-                                       M_LST(REG_ITMP12_PACKED, REG_SP, s2 * 4);
+                                       M_LLD(REG_ITMP12_PACKED, REG_SP, s1);
+                                       M_LST(REG_ITMP12_PACKED, REG_SP, s2);
                                }
                                else {
-                                       M_ILD(REG_ITMP1, REG_SP, s1 * 8);
-                                       M_IST(REG_ITMP1, REG_SP, s2 * 4);
+                                       M_ILD(REG_ITMP1, REG_SP, s1);
+                                       M_IST(REG_ITMP1, REG_SP, s2);
                                }
 #endif
                        }
@@ -3878,42 +3878,42 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                else {
 #if SIZEOF_VOID_P == 8
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DST(s1, REG_SP, s2 * 8);
+                                               M_DST(s1, REG_SP, s2);
                                        else
-                                               M_FST(s1, REG_SP, s2 * 8);
+                                               M_FST(s1, REG_SP, s2);
 #else
                                        /* s1 may have been originally in 2 int registers,
                                           but was moved out by the native function
                                           argument(s), just get low register */
 
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DST(GET_LOW_REG(s1), REG_SP, s2 * 4);
+                                               M_DST(GET_LOW_REG(s1), REG_SP, s2);
                                        else
-                                               M_FST(GET_LOW_REG(s1), REG_SP, s2 * 4);
+                                               M_FST(GET_LOW_REG(s1), REG_SP, s2);
 #endif
                                }
                        }
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
                                s2 = nmd->params[j].regoff;
 
 #if SIZEOF_VOID_P == 8
                                if (IS_2_WORD_TYPE(t)) {
-                                       M_DLD(REG_FTMP1, REG_SP, s1 * 8);
-                                       M_DST(REG_FTMP1, REG_SP, s2 * 8);
+                                       M_DLD(REG_FTMP1, REG_SP, s1);
+                                       M_DST(REG_FTMP1, REG_SP, s2);
                                }
                                else {
-                                       M_FLD(REG_FTMP1, REG_SP, s1 * 8);
-                                       M_FST(REG_FTMP1, REG_SP, s2 * 8);
+                                       M_FLD(REG_FTMP1, REG_SP, s1);
+                                       M_FST(REG_FTMP1, REG_SP, s2);
                                }
 #else
                                if (IS_2_WORD_TYPE(t)) {
-                                       M_DLD(REG_FTMP1, REG_SP, s1 * 8);
-                                       M_DST(REG_FTMP1, REG_SP, s2 * 4);
+                                       M_DLD(REG_FTMP1, REG_SP, s1);
+                                       M_DST(REG_FTMP1, REG_SP, s2);
                                }
                                else {
-                                       M_FLD(REG_FTMP1, REG_SP, s1 * 8);
-                                       M_FST(REG_FTMP1, REG_SP, s2 * 4);
+                                       M_FLD(REG_FTMP1, REG_SP, s1);
+                                       M_FST(REG_FTMP1, REG_SP, s2);
                                }
 #endif
                        }
index 1a5b3cbd4aa9669593b60958d0f26f592b7e1804..d3352fbcdb666c482fe8c6728f58161cc15b51a3 100644 (file)
@@ -74,7 +74,7 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (src->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 8;
+               disp = src->vv.regoff;
 
                switch (src->type) {
 #if SIZEOF_VOID_P == 8
@@ -133,7 +133,7 @@ s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (src->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 8;
+               disp = src->vv.regoff;
 
 #if WORDS_BIGENDIAN == 1
                M_ILD(tempreg, REG_SP, disp + 4);
@@ -173,7 +173,7 @@ s4 emit_load_high(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (src->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 8;
+               disp = src->vv.regoff;
 
 #if WORDS_BIGENDIAN == 1
                M_ILD(tempreg, REG_SP, disp);
@@ -209,7 +209,7 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
        if (dst->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = dst->vv.regoff * 8;
+               disp = dst->vv.regoff;
 
                switch (dst->type) {
 #if SIZEOF_VOID_P == 8
index 07b9619fdc6eacd96f555d39a8b5d5680502dabe..f7c89bd4b9ca41e246e6c6c7f988a39e89f5f18c 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
 #include "config.h"
+
+#include <stdarg.h>
+
 #include "vm/types.h"
 
 #include "vm/jit/mips/md-abi.h"
 
+#include "mm/memory.h"
+
 #include "vm/global.h"
 
 #include "vm/jit/abi.h"
 
 #include "vmcore/descriptor.h"
+#include "vmcore/method.h"
 
 
 /* register descripton array **************************************************/
@@ -289,7 +295,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -304,7 +310,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -331,13 +337,15 @@ void md_param_alloc(methoddesc *md)
                case TYPE_ADR:
                        if (reguse < INT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index    = reguse;
                                pd->regoff   = abi_registers_integer_argument[reguse];
                                reguse++;
                                md->argintreguse = reguse;
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->index    = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -348,10 +356,12 @@ void md_param_alloc(methoddesc *md)
                        if (reguse < INT_ARG_CNT) {
                                pd->inmemory = false;
 #  if WORDS_BIGENDIAN == 1
+                               pd->index    = PACK_REGS(reguse + 1, reguse);
                                pd->regoff   =
                                        PACK_REGS(abi_registers_integer_argument[reguse + 1],
                                                          abi_registers_integer_argument[reguse]);
 #  else
+                               pd->index    = PACK_REGS(reguse, reguse + 1);
                                pd->regoff   =
                                        PACK_REGS(abi_registers_integer_argument[reguse],
                                                          abi_registers_integer_argument[reguse + 1]);
@@ -361,7 +371,8 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->index    = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -370,13 +381,15 @@ void md_param_alloc(methoddesc *md)
                case TYPE_DBL:
                        if (reguse < FLT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index    = reguse;
                                pd->regoff   = abi_registers_float_argument[reguse];
                                reguse++;
                                md->argfltreguse = reguse;
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->index    = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -405,7 +418,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 8;
                        }
                        stacksize++;
                        break;
@@ -430,7 +443,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 8;
                        }
                        stacksize += 2;
                        break;
@@ -530,7 +543,7 @@ void md_param_alloc_native(methoddesc *md)
                                        ALIGN_2(stacksize);
 
                                        pd->inmemory = true;
-                                       pd->regoff   = stacksize;
+                                       pd->regoff   = stacksize * 4;
                                }
                                stacksize += 2;
                        }
@@ -545,7 +558,7 @@ void md_param_alloc_native(methoddesc *md)
                                }
                                else {
                                        pd->inmemory = true;
-                                       pd->regoff   = stacksize;
+                                       pd->regoff   = stacksize * 4;
                                }
                                stacksize++;
                        }
@@ -570,7 +583,7 @@ void md_param_alloc_native(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                        }
                        stacksize++;
                        break;
@@ -594,7 +607,7 @@ void md_param_alloc_native(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                        }
                        stacksize += 2;
                        break;
index 9bb705c19f6fc1c861a206fce176f3d2c5192936..bdae06faa6b955033669e6a5e1fce8e2e2c61b0b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -255,29 +255,29 @@ bool codegen_emit(jitdata *jd)
                                }
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_LST(s1, REG_SP, var->vv.regoff);
                                        else
-                                               M_IST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_IST(s1, REG_SP, var->vv.regoff);
                                }
                        }
                        else {
                                if (!IS_INMEMORY(var->flags)) {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
                                        else
-                                               M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
                                }
                                else {
 #if 1
-                                       M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4);
-                                       M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+                                       M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1);
+                                       M_IST(REG_ITMP1, REG_SP, var->vv.regoff);
                                        if (IS_2_WORD_TYPE(t)) {
-                                               M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4 +4);
-                                               M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+                                               M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                               M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
                                        }
 #else
                                        /* Reuse Memory Position on Caller Stack */
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 4 + s1;
 #endif
                                }
                        }
@@ -288,32 +288,32 @@ bool codegen_emit(jitdata *jd)
                                        M_FLTMOVE(s1, var->vv.regoff);
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_DST(s1, REG_SP, var->vv.regoff);
                                        else
-                                               M_FST(s1, REG_SP, var->vv.regoff * 4);
+                                               M_FST(s1, REG_SP, var->vv.regoff);
                                }
                        }
                        else {
                                if (!IS_INMEMORY(var->flags)) {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
                                        else
-                                               M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
                                }
                                else {
 #if 1
                                        if (IS_2_WORD_TYPE(t)) {
-                                               M_DLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
-                                               M_DST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+                                               M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+                                               M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
                                                var->vv.regoff = cd->stackframesize + s1;
 
                                        } else {
-                                               M_FLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
-                                               M_FST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+                                               M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+                                               M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
                                        }
 #else
                                        /* Reuse Memory Position on Caller Stack */
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 4 + s1;
 #endif
                                }
                        }
@@ -2414,11 +2414,11 @@ gen_method:
                                        else {
                                                if (IS_2_WORD_TYPE(var->type)) {
                                                        s1 = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
-                                                       M_LST(s1, REG_SP, d * 4);
+                                                       M_LST(s1, REG_SP, d);
                                                }
                                                else {
                                                        s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                                       M_IST(s1, REG_SP, d * 4);
+                                                       M_IST(s1, REG_SP, d);
                                                }
                                        }
                                }
@@ -2430,9 +2430,9 @@ gen_method:
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_FTMP1);
                                                if (IS_2_WORD_TYPE(var->type))
-                                                       M_DST(s1, REG_SP, d * 4);
+                                                       M_DST(s1, REG_SP, d);
                                                else
-                                                       M_FST(s1, REG_SP, d * 4);
+                                                       M_FST(s1, REG_SP, d);
                                        }
                                }
                        }
@@ -3132,22 +3132,22 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                }
                                else {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LST(s1, REG_SP, s2 * 4);
+                                               M_LST(s1, REG_SP, s2);
                                        else
-                                               M_IST(s1, REG_SP, s2 * 4);
+                                               M_IST(s1, REG_SP, s2);
                                }
                        }
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 4;
                                s2 = nmd->params[j].regoff;
 
-                               M_ILD(REG_ITMP1, REG_SP, s1 * 4);
+                               M_ILD(REG_ITMP1, REG_SP, s1);
                                if (IS_2_WORD_TYPE(t))
-                                       M_ILD(REG_ITMP2, REG_SP, s1 * 4 + 4);
+                                       M_ILD(REG_ITMP2, REG_SP, s1 + 4);
 
-                               M_IST(REG_ITMP1, REG_SP, s2 * 4);
+                               M_IST(REG_ITMP1, REG_SP, s2);
                                if (IS_2_WORD_TYPE(t))
-                                       M_IST(REG_ITMP2, REG_SP, s2 * 4 + 4);
+                                       M_IST(REG_ITMP2, REG_SP, s2 + 4);
                        }
                }
                else {
@@ -3155,16 +3155,16 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                           argument registers keep unchanged. */
 
                        if (md->params[i].inmemory) {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 4;
                                s2 = nmd->params[j].regoff;
 
                                if (IS_2_WORD_TYPE(t)) {
-                                       M_DLD(REG_FTMP1, REG_SP, s1 * 4);
-                                       M_DST(REG_FTMP1, REG_SP, s2 * 4);
+                                       M_DLD(REG_FTMP1, REG_SP, s1);
+                                       M_DST(REG_FTMP1, REG_SP, s2);
                                }
                                else {
-                                       M_FLD(REG_FTMP1, REG_SP, s1 * 4);
-                                       M_FST(REG_FTMP1, REG_SP, s2 * 4);
+                                       M_FLD(REG_FTMP1, REG_SP, s1);
+                                       M_FST(REG_FTMP1, REG_SP, s2);
                                }
                        }
                }
index de337a4f90e2b3a9972ed226109f89a72b3b1064..548622a67ec2a9077563fff74da18e797254babf 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -202,7 +202,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                        }
                        stacksize++;
                        break;
@@ -217,7 +217,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                                iarg         = INT_ARG_CNT;
                        }
                        stacksize += 2;
@@ -232,7 +232,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                        }
                        stacksize++;
                        break;
@@ -246,7 +246,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->regoff   = stacksize * 4;
                        }
                        stacksize += 2;
                        break;
index a08f1ae73b480059a01625d8b856716a68cae9f3..e5db9ae4d1c7660fccaf74d644ccbb75fed3ac4f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -74,7 +74,7 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                switch (src->type) {
                case TYPE_INT:
@@ -124,7 +124,7 @@ s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                M_ILD(tempreg, REG_SP, disp + 4);
 
@@ -158,7 +158,7 @@ s4 emit_load_high(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                M_ILD(tempreg, REG_SP, disp);
 
@@ -189,7 +189,7 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
        if (IS_INMEMORY(dst->flags)) {
                COUNT_SPILLS;
 
-               disp = dst->vv.regoff * 4;
+               disp = dst->vv.regoff;
 
                switch (dst->type) {
                case TYPE_INT:
@@ -778,7 +778,7 @@ void emit_verbosecall_enter(jitdata *jd)
                                }
                        }
                        else {
-                               s1 = (md->params[p].regoff + cd->stackframesize) * 4 
+                               s1 = md->params[p].regoff + cd->stackframesize * 4 
                                        + stack_size;
                                if (IS_2_WORD_TYPE(t)) {
                                        M_ILD(REG_ITMP2, REG_SP, s1);
index 0db6f9efe4b8b99ba790f0f57acc2cc6b248c35f..39670401f249df5a91fe76f50cc08cbb6cda69f1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -207,7 +207,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -224,7 +224,7 @@ void md_param_alloc(methoddesc *md)
                        else {
                                _ALIGN(stacksize);
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                iarg          = INT_ARG_CNT;
                                stacksize    += 2;
                        }
@@ -238,7 +238,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -252,7 +252,7 @@ void md_param_alloc(methoddesc *md)
                        else {
                                _ALIGN(stacksize);
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                stacksize    += 2;
                        }
                        break;
index 4f656aeba0c68e7666c5cee688090e56fd1940a1..9e8181666be7bda357ce911a8af7fdc3d4c73cac 100644 (file)
@@ -127,7 +127,7 @@ void md_param_alloc(methoddesc *md)
                                iarg++;
                        } else {
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -141,7 +141,7 @@ void md_param_alloc(methoddesc *md)
                        } else {
                                _ALIGN(stacksize);
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                iarg = INT_ARG_CNT;
                                stacksize += 2;
                        }
@@ -153,7 +153,7 @@ void md_param_alloc(methoddesc *md)
                                farg++;
                        } else {
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -165,7 +165,7 @@ void md_param_alloc(methoddesc *md)
                        } else {
                                _ALIGN(stacksize);
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                stacksize += 2;
                        }
                        break;
index 186289e554c161848fa8f69c612f343d7f6b4f70..89d2606ad7581fb5e1c54b34ce5a5b46eba7c256 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7918 2007-05-20 20:42:18Z michi $
+   $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 #include "vm/jit/methodheader.h"
 #include "vm/jit/powerpc64/offsets.h"
 
-.section ".toc","aw"
-.section ".text"
-
-       .align 2        
-
-
 /* export functions ***********************************************************/
 
        .globl asm_vm_call_method_exception_handler
@@ -67,7 +61,6 @@
        .globl asm_criticalsections
        .globl asm_getclassvalues_atomic
 
-
 /* asm_vm_call_method **********************************************************
 *                                                                              *
 *   This function calls a Java-method (which possibly needs compilation)       *
@@ -83,7 +76,7 @@
 *******************************************************************************/
        /* this is the method header see src/vm/jit/methodheader.h */
 
-       .align  8
+       .align  3
 
        .quad   0                           /* catch type all                     */
        .quad   0                           /* handler pc                         */
        stfd    ftmp1,13*8(sp)            /* registers f14-f31 are callee saved   */
        stfd    ftmp2,14*8(sp)
 
-       SAVE_TEMPORARY_REGISTERS(15)     
-
-       mr      itmp2,a1                  /* arg count                            */
-       mr      itmp1,a2                  /* pointer to arg block                 */
 
-       mr      t4,itmp2                  /* save argument count                  */
-       mr      t5,itmp1                  /* save argument block pointer          */
-
-       mr      s0,sp                     /* save current sp to s0                */
+       SAVE_TEMPORARY_REGISTERS(15)     
+       mr      s0, r1                  /* save stack pointer */
 
-       addi    itmp1,itmp1,-sizevmarg    /* initialize pointer (smaller code)    */
-       addi    itmp2,itmp2,1             /* initialize argument count            */
-       li      t0,0                      /* initialize integer argument counter  */
-       li      t1,0                      /* initialize float argument counter    */
-       li      t6,0                      /* initialize integer register counter  */
-       li      t3,8                      /* initialize PA counter*/
+       /* a1 contains a pointer to a unit64_t structure filled with all INT_ARG_REG,
+       followed by ADR_ARG_CNT and FLT_ARG_CNT, afterwards what else needs to be copied onto
+       the stack 
+       a2 contains the number of additional stack slots to be copied
+       */
 
 L_register_copy:
-       addi    itmp1,itmp1,sizevmarg     /* goto next argument block             */
-       addi    itmp2,itmp2,-1            /* argument count - 1                   */
-       mr.     itmp2,itmp2
-       beq     L_register_copy_done
-
-       addi    t3,t3,-1                  /* uses a PA slot                       */
-       lwz     itmp3,offvmargtype+4(itmp1)
-       andi.   r0,itmp3,0x0002           /* is this a float/double type?         */
-       bne     L_register_handle_float
-       
-L_register_handle_int:
-       cmpwi   t6,INT_ARG_CNT            /* are we out of integer argument       */
-       beq     L_register_copy           /* registers? yes, next loop            */
-
-       cmpwi   itmp3,0x0004              /* is it TYPE_ADR? */
-       beq     L_register_handle_long
-
-       andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
-       bne     L_register_handle_long
-
-       lis     itmp3,L_jumptable_int@highest           /* load 64bit address   */
-       ori     itmp3,itmp3,L_jumptable_int@higher
-       rldicr  itmp3,itmp3,32,31
-       oris    itmp3,itmp3,L_jumptable_int@h
-       ori     itmp3,itmp3,L_jumptable_int@l
-       b       L_register_do_copy_longint
-
-L_register_handle_long:
-
-       lis     itmp3,L_jumptable_long@highest          /* load 64bit address   */
-       ori     itmp3,itmp3,L_jumptable_long@higher
-       rldicr  itmp3,itmp3,32,31
-       oris    itmp3,itmp3,L_jumptable_long@h
-       ori     itmp3,itmp3,L_jumptable_long@l
-
-L_register_do_copy_longint:
-       slwi    t2,t6,3                   /* multiple of 8-bytes                  */
-       add     itmp3,itmp3,t2            /* calculate address of jumptable       */
-       ld      itmp3,0(itmp3)            /* load function address                */
-       mtctr   itmp3
-       addi    t0,t0,1                   /* integer argument counter             */
-       addi    t6,t6,1                   /* integer argument register counter    */
-       bctr
-
-L_register_handle_float:
-       cmpwi   t1,FLT_ARG_CNT            /* are we out of float argument         */
-       beq     L_register_copy           /* registers? yes, next loop            */
-
-       andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
-       bne     L_register_handle_double
-
-       lis     itmp3,L_jumptable_float@highest         /* load 64bit address   */
-       ori     itmp3,itmp3,L_jumptable_float@higher
-       rldicr  itmp3,itmp3,32,31
-       oris    itmp3,itmp3,L_jumptable_float@h
-       ori     itmp3,itmp3,L_jumptable_float@l
-       b L_register_do_copy_floatdouble
-
-L_register_handle_double:
-
-       lis     itmp3,L_jumptable_double@highest                /* load 64bit address   */
-       ori     itmp3,itmp3,L_jumptable_double@higher
-       rldicr  itmp3,itmp3,32,31
-       oris    itmp3,itmp3,L_jumptable_double@h
-       ori     itmp3,itmp3,L_jumptable_double@l
-
-
-L_register_do_copy_floatdouble:
-
-       slwi    t2,t1,3                   /* multiple of 8-bytes                  */
-       add     itmp3,itmp3,t2            /* calculate address of jumptable       */
-       ld      itmp3,0(itmp3)            /* load function address                */
-       mtctr   itmp3
-       addi    t1,t1,1                   /* float argument counter               */
-       mr.     t3,t3                     /* are we still in PA ?                 */
-       blt     L_float_not_uses_PA 
-       addi    t6,t6,1                   /* if so it uses an interger arg reg    */
-L_float_not_uses_PA:
-       bctr
-
-
-L_register_copy_done:
-       subi    sp,sp,PA_SIZE             /* PA_SIZE are used by definition       */
-                                         /* calculate remaining arguments        */
-       sub     itmp3,t4,t0               /* - integer arguments in registers     */
-       sub     itmp3,itmp3,t1            /* - float arguments in registers       */
-       mr.     itmp3,itmp3
-       beq     L_stack_copy_done
-
-       mr      itmp2,t4                  /* restore argument count               */
-       mr      itmp1,t5                  /* restore argument block pointer       */
+       mr      t1, a1
+       mr      t2, a2
+
+       ld      a0 ,  0*8(t1)
+       ld      a1 ,  1*8(t1)
+       ld      a2 ,  2*8(t1)
+       ld      a3 ,  3*8(t1)
+       ld      a4 ,  4*8(t1)
+       ld      a5 ,  5*8(t1)
+       ld      a6 ,  6*8(t1)
+       ld      a7 ,  7*8(t1)
+
+       lfd     fa0 , 8*8(t1)
+       lfd     fa1 , 9*8(t1)
+       lfd     fa2 ,10*8(t1)
+       lfd     fa3 ,11*8(t1)
+       lfd     fa4 ,12*8(t1)
+       lfd     fa5 ,13*8(t1)
+       lfd     fa6 ,14*8(t1)
+       lfd     fa7 ,15*8(t1)
+       lfd     fa8 ,16*8(t1)
+       lfd     fa9 ,17*8(t1)
+       lfd     fa10,18*8(t1)
+       lfd     fa11,19*8(t1)
+       lfd     fa12,20*8(t1)
+
+       mr.     t2,t2
+       beq L_stack_copy_done
+
+L_stack_copy:
+       addi    t1,t1,20*8              /* before first possible stack slot arg */
+       mr      t3,t2                   /* argument counter */
+       sldi    t2,t2,8                 /* calculate size of stack */
+       sub     sp,sp,t2                /* increase the stack */
+       mr      t2,sp                   /* t2 points to bottom of stack now */
 
-       slwi    t4,itmp3,3                /* XXX use 8-bytes slots for now        */
-       addi    t4,t4,LA_SIZE             /* add size of linkage area             */
-       sub     sp,sp,t4
-
-       mr      t6,sp                     /* use t6 as temporary sp               */
-       addi    t6,t6,LA_SIZE             /* skip linkage area                    */
-
-       addi    itmp1,itmp1,-sizevmarg    /* initialize pointer (smaller code)    */
-       addi    itmp2,itmp2,1             /* initialize argument count            */
-       li      t3,8                      /* initialize PA counter                */
-       addi    t6,t6,-8                  /* make code simpler                    */
-       
 L_stack_copy_loop:
-       addi    itmp1,itmp1,sizevmarg     /* goto next argument block             */
-       addi    itmp2,itmp2,-1            /* argument count - 1                   */
-       mr.     itmp2,itmp2
-       beq     L_stack_copy_done
-       addi    t6,t6,8                   /* increase stack */
-L_stack_not_uses_PA:
-
-       lwz     itmp3,offvmargtype+4(itmp1)
-       andi.   r0,itmp3,0x0002           /* is this a float/double type?         */
-       bne     L_stack_handle_float
-
-L_stack_handle_int:
-       addi    t0,t0,-1                  /* arguments assigned to registers      */
-       mr.     t0,t0
-       bge     L_stack_copy_loop
-
-       andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
-       bne     L_stack_handle_long
-
-       lwa     itmp3,offvmargdata+4(itmp1) /* get integer argument               */
-       std     itmp3,0(t6)               /* and store it on the stack            */
-       b       L_stack_copy_loop
-
-L_stack_handle_long:
-       ld      itmp3,offvmargdata+0(itmp1) /* get long argument                  */
-       std     itmp3,0(t6)               /* and store it on the stack            */
-       b       L_stack_copy_loop
-               
-L_stack_handle_float:
-       addi    t1,t1,-1                  /* arguments assigned to registers      */
-       mr.     t1,t1
-       bge     L_stack_copy_loop
-
-       andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
-       bne     L_stack_handle_double
-
-       lfs     ftmp3,offvmargdata(itmp1) /* get float argument                   */
-       stfd    ftmp3,0(t6)               /* and store it on the stack            */
-       b       L_stack_copy_loop
-
-L_stack_handle_double:
-       lfd     ftmp3,offvmargdata(itmp1) /* get double argument                  */
-       stfd    ftmp3,0(t6)               /* and store it on the stack            */
-       b       L_stack_copy_loop
+       addi    t1,t1,8                 /* next possible stack slot to copy */
+       mr.     t3,t3                   /* more stack slots to copy ? */
+       beq     L_stack_copy_done
+       ld      itmp3, 0(t1)
+       std     itmp3, 0(t2)
+       addi    t2,t2,8
+       addi    t3,t3,-1
+       b L_stack_copy_loop
 
 L_stack_copy_done:
-       ld      itmp1,9*8(s0)             /* pass method pointer via tmp1         */
-
-       lis     mptr,L_asm_call_jit_compiler@highest    /* load 64bit address   */
-       ori     mptr,mptr,L_asm_call_jit_compiler@higher
-       rldicr  mptr,mptr,32,31
-       oris    mptr,mptr,L_asm_call_jit_compiler@h
-       ori     mptr,mptr,L_asm_call_jit_compiler@l
-       std     mptr,7*8(s0)
-       addi    mptr,s0,7*8
-
-       ld      pv,0*8(mptr)
+       mr      itmp1, s0               /* fake invokevirtual invocation */
+       addi    itmp1, itmp1, 9*8       /* address of methods pv */
+       ld      pv,0*8(itmp1)
        mtctr   pv
        bctrl
 1:
        mflr    itmp1
-
        addi    pv,itmp1,(.asm_vm_call_method - 1b)@l
 
 L_asm_vm_call_method_return:
@@ -362,212 +235,6 @@ asm_vm_call_method_exception_handler:
        bl      builtin_throw_exception
        b       L_asm_vm_call_method_return
 
-
-       .data
-       .align  8
-
-L_jumptable_int:
-       .quad   L_handle_a0
-       .quad   L_handle_a1
-       .quad   L_handle_a2
-       .quad   L_handle_a3
-       .quad   L_handle_a4
-       .quad   L_handle_a5
-       .quad   L_handle_a6
-       .quad   L_handle_a7
-
-       .text
-       .align  4
-
-L_handle_a0:
-       lwa     a0,offvmargdata+4(itmp1)
-       b       L_register_copy
-L_handle_a1:
-       lwa     a1,offvmargdata+4(itmp1)
-       b       L_register_copy
-L_handle_a2:
-       lwa     a2,offvmargdata+4(itmp1)
-       b       L_register_copy
-L_handle_a3:
-       lwa     a3,offvmargdata+4(itmp1)
-       b       L_register_copy
-L_handle_a4:
-       lwa     a4,offvmargdata+4(itmp1)
-       b       L_register_copy
-L_handle_a5:
-       lwa     a5,offvmargdata+4(itmp1)
-       b       L_register_copy
-L_handle_a6:
-       lwa     a6,offvmargdata+4(itmp1)
-       b       L_register_copy
-L_handle_a7:
-       lwa     a7,offvmargdata+4(itmp1)
-       b       L_register_copy
-
-
-       .data
-       .align  8
-
-L_jumptable_long:
-       .quad   L_handle_a0l
-       .quad   L_handle_a1l
-       .quad   L_handle_a2l
-       .quad   L_handle_a3l
-       .quad   L_handle_a4l
-       .quad   L_handle_a5l
-       .quad   L_handle_a6l
-       .quad   L_handle_a7l
-
-       .text
-       .align  4
-
-L_handle_a0l:
-       ld     a0,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_a1l:
-       ld     a1,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_a2l:
-       ld     a2,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_a3l:
-       ld     a3,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_a4l:
-       ld     a4,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_a5l:
-       ld     a5,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_a6l:
-       ld     a6,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_a7l:
-       ld     a7,offvmargdata(itmp1)
-       b       L_register_copy
-
-       .data
-       .align  8
-
-L_jumptable_float:
-       .quad   L_handle_fa0
-       .quad   L_handle_fa1
-       .quad   L_handle_fa2
-       .quad   L_handle_fa3
-       .quad   L_handle_fa4
-       .quad   L_handle_fa5
-       .quad   L_handle_fa6
-       .quad   L_handle_fa7
-       .quad   L_handle_fa8
-       .quad   L_handle_fa9
-       .quad   L_handle_fa10
-       .quad   L_handle_fa11
-       .quad   L_handle_fa12
-
-       .text
-       .align  4
-
-L_handle_fa0:
-       lfs     fa0,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa1:
-       lfs     fa1,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa2:
-       lfs     fa2,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa3:
-       lfs     fa3,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa4:
-       lfs     fa4,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa5:
-       lfs     fa5,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa6:
-       lfs     fa6,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa7:
-       lfs     fa7,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa8:
-       lfs     fa8,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa9:
-       lfs     fa9,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa10:
-       lfs     fa10,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa11:
-       lfs     fa11,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fa12:
-       lfs     fa12,offvmargdata(itmp1)
-       b       L_register_copy
-
-       .data
-       .align  8
-
-L_jumptable_double:
-       .quad   L_handle_fda0
-       .quad   L_handle_fda1
-       .quad   L_handle_fda2
-       .quad   L_handle_fda3
-       .quad   L_handle_fda4
-       .quad   L_handle_fda5
-       .quad   L_handle_fda6
-       .quad   L_handle_fda7
-       .quad   L_handle_fda8
-       .quad   L_handle_fda9
-       .quad   L_handle_fda10
-       .quad   L_handle_fda11
-       .quad   L_handle_fda12
-
-       .text
-       .align  4
-
-L_handle_fda0:
-       lfd     fa0,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda1:
-       lfd     fa1,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda2:
-       lfd     fa2,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda3:
-       lfd     fa3,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda4:
-       lfd     fa4,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda5:
-       lfd     fa5,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda6:
-       lfd     fa6,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda7:
-       lfd     fa7,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda8:
-       lfd     fa8,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda9:
-       lfd     fa9,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda10:
-       lfd     fa10,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda11:
-       lfd     fa11,offvmargdata(itmp1)
-       b       L_register_copy
-L_handle_fda12:
-       lfd     fa12,offvmargdata(itmp1)
-       b       L_register_copy
-
 asm_vm_call_method_end:
        nop
 
index 662514a261f8974f5a5d19eb260e7cf0784c5ed7..8e2bc29642692d7ad6765cf154d5d7407cd032da 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -227,13 +227,13 @@ bool codegen_emit(jitdata *jd)
                                if (!IS_INMEMORY(var->flags))
                                        M_INTMOVE(s1, var->vv.regoff);
                                else
-                                       M_LST(s1, REG_SP, var->vv.regoff * 8);
+                                       M_LST(s1, REG_SP, var->vv.regoff);
                        }
                        else {
                                if (!IS_INMEMORY(var->flags))
-                                       M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                       M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                else
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                        }
                }
                else {
@@ -241,17 +241,17 @@ bool codegen_emit(jitdata *jd)
                                if (!IS_INMEMORY(var->flags))
                                        M_FLTMOVE(s1, var->vv.regoff);
                                else
-                                       M_DST(s1, REG_SP, var->vv.regoff * 8);
+                                       M_DST(s1, REG_SP, var->vv.regoff);
                        }
                        else {
                                if (!(var->flags & INMEMORY)) {
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                               M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                        else
-                                               M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+                                               M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
                                }
                                else
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                        }
                }
        }
@@ -2160,7 +2160,7 @@ gen_method:
                                        }
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                               M_LST(s1, REG_SP, d * 8);
+                                               M_LST(s1, REG_SP, d);
                                        }
                                }
                                else {
@@ -2170,7 +2170,7 @@ gen_method:
                                        }
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_FTMP1);
-                                               M_DST(s1, REG_SP, d * 8);
+                                               M_DST(s1, REG_SP, d);
                                        }
                                }
                        }
@@ -2859,14 +2859,14 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                if (!nmd->params[j].inmemory)
                                        M_INTMOVE(s1, s2);
                                else
-                                       M_LST(s1, REG_SP, s2 * 8);
+                                       M_LST(s1, REG_SP, s2);
                        }
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
                                s2 = nmd->params[j].regoff;
 
-                               M_LLD(REG_ITMP1, REG_SP, s1 * 8);
-                               M_LST(REG_ITMP1, REG_SP, s2 * 8);
+                               M_LLD(REG_ITMP1, REG_SP, s1);
+                               M_LST(REG_ITMP1, REG_SP, s2);
                        }
                }
                else {
@@ -2874,15 +2874,15 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                           argument registers keep unchanged. */
 
                        if (md->params[i].inmemory) {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
                                s2 = nmd->params[j].regoff;
 
-                               M_DLD(REG_FTMP1, REG_SP, s1 * 8);
+                               M_DLD(REG_FTMP1, REG_SP, s1);
 
                                if (IS_2_WORD_TYPE(t))
-                                       M_DST(REG_FTMP1, REG_SP, s2 * 8);
+                                       M_DST(REG_FTMP1, REG_SP, s2);
                                else
-                                       M_FST(REG_FTMP1, REG_SP, s2 * 8 + 4);
+                                       M_FST(REG_FTMP1, REG_SP, s2 + 4);
                        }
                }
        }
index 35bffbf9fbcaad981f9aa4312847430afaafb2ab..4a8dc9bf644d62291c48c4309a1f823ba03f66f9 100644 (file)
@@ -71,7 +71,7 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (src->flags & INMEMORY) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 8;
+               disp = src->vv.regoff;
 
                if (IS_FLT_DBL_TYPE(src->type)) {
                        M_DLD(tempreg, REG_SP, disp);
@@ -107,10 +107,10 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
                COUNT_SPILLS;
 
                if (IS_FLT_DBL_TYPE(dst->type)) {
-                       M_DST(d, REG_SP, dst->vv.regoff * 8);
+                       M_DST(d, REG_SP, dst->vv.regoff);
                }
                else {
-                       M_LST(d, REG_SP, dst->vv.regoff * 8);
+                       M_LST(d, REG_SP, dst->vv.regoff);
                }
        }
 }
@@ -255,7 +255,7 @@ void emit_verbosecall_enter(jitdata *jd)
                        if (!md->params[p].inmemory) { /* Param in Arg Reg */
                                M_LST(md->params[p].regoff, REG_SP, LA_SIZE + PA_SIZE + 8 + p * 8);
                        } else { /* Param on Stack */
-                               s1 = (md->params[p].regoff + cd->stackframesize) * 8 + stack_size;
+                               s1 = md->params[p].regoff + cd->stackframesize * 8 + stack_size;
                                M_LLD(REG_ITMP2, REG_SP, s1);
                                M_LST(REG_ITMP2, REG_SP, LA_SIZE + PA_SIZE + 8 + p * 8);
                        }
index 9c291ca4b9916d6415a70cef66a177f7d2dd3834..2a6c5e418966d71a3a4f1141fad39938f6a83dd6 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 7727 2007-04-16 21:18:43Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -206,18 +206,21 @@ void md_param_alloc(methoddesc *md)
                case TYPE_ADR:
                        if (iarg < INT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index = iarg;
                                pd->regoff   = abi_registers_integer_argument[iarg];
                                iarg++;
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize + stackcount;
+                               pd->index = stacksize + stackcount;
+                               pd->regoff   = (stacksize + stackcount) * 8;
                        }
                        break;
                case TYPE_FLT:
                case TYPE_DBL:
                        if (farg < FLT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index = farg;
                                pd->regoff   = abi_registers_float_argument[farg];
                                farg++;
                                if (arg < INT_ARG_CNT) {
@@ -226,7 +229,8 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize + stackcount ;
+                               pd->index = stacksize + stackcount;
+                               pd->regoff   = (stacksize + stackcount) * 8;
                        }
                        break;
                default:
index dc0face63d123ff34870d45423aa2d454066fe52..4a3bfa4715f1c87b57f63b2fa138498f71b78563 100644 (file)
@@ -109,17 +109,14 @@ typedef u8 stackslot_t;
 
 /*** debugging ****************************************************************/
 
-/*#define REPLACE_VERBOSE*/
-
 #if !defined(NDEBUG)
 static void java_value_print(s4 type, replace_val_t value);
 static void replace_stackframeinfo_println(stackframeinfo *sfi);
 #endif
 
-#if !defined(NDEBUG) && defined(REPLACE_VERBOSE)
-int replace_verbose = 0;
-#define DOLOG(code)        do{ if (replace_verbose > 1) { code; } } while(0)
-#define DOLOG_SHORT(code)  do{ if (replace_verbose > 0) { code; } } while(0)
+#if !defined(NDEBUG)
+#define DOLOG(code)        do{ if (opt_TraceReplacement > 1) { code; } } while(0)
+#define DOLOG_SHORT(code)  do{ if (opt_TraceReplacement > 0) { code; } } while(0)
 #else
 #define DOLOG(code)
 #define DOLOG_SHORT(code)
index 10e78011854d64cfc952e891966b0dd6a0826a43..f7950a786221885bfdec0722f3211d2978ce7f00 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7918 2007-05-20 20:42:18Z michi $
+   $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -583,6 +583,7 @@ L_ahe_bras2:
        lr      xpc,v0                      /* move handlerpc into xpc            */
        l       xptr,0*4(sp)                /* restore exception pointer          */
        l       pv,2*4(sp)                  /* restore PV                         */
+       ahi     pv,-0xffc                   /* offset PV */
        l       %r0,4*4(sp)                 /* get maybe-leaf flag                */
        ahi     sp,(6*4)                    /* free stack frame                   */
 
@@ -737,7 +738,7 @@ asm_patcher_wrapper:
        /* pass arguments */
 
        la      a0, apw_sfs(sp)             /* pass SP of patcher stub */
-       lr      a1, pv                      /* pass PV (if NULL, use findmethod)  */
+       la      a1, 0xffc(pv)               /* pass PV (if NULL, use findmethod)  */
        lhi     a2, 0                       /* pass RA                            */
 
        /* call patcher_wrapper */
@@ -903,70 +904,7 @@ asm_replacement_in:
 
        /* jump to new code */
        ret
-
-
-/* asm_builtin_x2x *************************************************************
-*                                                                              *
-*   Wrapper functions for float to int corner cases                            *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_f2i:
-       sub     $(ARG_CNT*8),sp
-       
-       SAVE_ARGUMENT_REGISTERS(0)
-       
-       movq    ftmp1,fa0
-       call    builtin_f2i@PLT
-       
-       RESTORE_ARGUMENT_REGISTERS(0)
-       
-       add     $(ARG_CNT*8),sp
-       ret
-
-
-asm_builtin_f2l:
-       sub     $(ARG_CNT*8),sp
-       
-       SAVE_ARGUMENT_REGISTERS(0)
-       
-       movq    ftmp1,fa0
-       call    builtin_f2l@PLT
-       
-       RESTORE_ARGUMENT_REGISTERS(0)
-       
-       add     $(ARG_CNT*8),sp
-       ret
-
-
-asm_builtin_d2i:
-       sub     $(ARG_CNT*8),sp
-       
-       SAVE_ARGUMENT_REGISTERS(0)
-       
-       movq    ftmp1,fa0
-       call    builtin_d2i@PLT
-       
-       RESTORE_ARGUMENT_REGISTERS(0)
-       
-       add     $(ARG_CNT*8),sp
-       ret
-
-
-asm_builtin_d2l:
-       sub     $(ARG_CNT*8),sp
-       
-       SAVE_ARGUMENT_REGISTERS(0)
-       
-       movq    ftmp1,fa0
-       call    builtin_d2l@PLT
-       
-       RESTORE_ARGUMENT_REGISTERS(0)
-       
-       add     $(ARG_CNT*8),sp
-       ret
-
-#endif /* if 0 */
+#endif
 
 /* TODO use move here ? */
 
@@ -993,17 +931,6 @@ asm_criticalsections:
        .long 0
 
 
-/* disable exec-stacks ********************************************************/
-
-#if 0
-
-#if defined(__linux__) && defined(__ELF__)
-       .section .note.GNU-stack,"",%progbits
-#endif
-
-
-#endif /* if 0 */
-
 /*
  * 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
index 6436f7b87841fbe644a50f607fb739119f9feea2..a012bc6a75b0c9e9d7591e50c7cf453fbc6bfc01 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -75,6 +75,7 @@
 #endif
 
 #define OOPS() assert(0);
+#define SUPPORT_HERCULES 1
 
 void panic() { }
 
@@ -202,7 +203,11 @@ bool codegen_emit(jitdata *jd)
                dseg_add_target(cd, ex->handler);
                (void) dseg_add_unique_address(cd, ex->catchtype.any);
        }
-       
+
+       /* Offset PV */
+
+       M_AADD_IMM(N_PV_OFFSET, REG_PV);
+
        /* generate method profiling code */
 
 #if defined(ENABLE_PROFILING)
@@ -271,24 +276,24 @@ bool codegen_emit(jitdata *jd)
 
                                } else {                             /* reg arg -> spilled    */
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LST(s2, REG_SP, var->vv.regoff * 4);
+                                               M_LST(s2, REG_SP, var->vv.regoff);
                                        else
-                                               M_IST(s2, REG_SP, var->vv.regoff * 4);
+                                               M_IST(s2, REG_SP, var->vv.regoff);
                                }
 
                        } else {                                 /* stack arguments       */
                                if (!IS_INMEMORY(var->flags)) {      /* stack arg -> register */
                                        if (IS_2_WORD_TYPE(t))
-                                               M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
                                        else
-                                               M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
 
                                } else {                             /* stack arg -> spilled  */
-                                       M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4);
-                                       M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+                                       M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1);
+                                       M_IST(REG_ITMP1, REG_SP, var->vv.regoff);
                                        if (IS_2_WORD_TYPE(t)) {
-                                               M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4 +4);
-                                               M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+                                               M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+                                               M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
                                        }
                                }
                        }
@@ -301,28 +306,28 @@ bool codegen_emit(jitdata *jd)
 
                                } else {                                         /* reg arg -> spilled    */
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DST(s2, REG_SP, var->vv.regoff * 4);
+                                               M_DST(s2, REG_SP, var->vv.regoff);
                                        else
-                                               M_FST(s2, REG_SP, var->vv.regoff * 4);
+                                               M_FST(s2, REG_SP, var->vv.regoff);
                                }
 
                        } else {                                 /* stack arguments       */
                                if (!IS_INMEMORY(var->flags)) {      /* stack-arg -> register */
                                        if (IS_2_WORD_TYPE(t))
-                                               M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
 
                                        else
-                                               M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+                                               M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
 
                                } else {                             /* stack-arg -> spilled  */
                                        if (IS_2_WORD_TYPE(t)) {
-                                               M_DLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
-                                               M_DST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
-                                               var->vv.regoff = cd->stackframesize + s1;
+                                               M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+                                               M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
+                                               var->vv.regoff = cd->stackframesize * 4 + s1;
 
                                        } else {
-                                               M_FLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
-                                               M_FST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+                                               M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+                                               M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
                                        }
                                }
                        }
@@ -355,7 +360,7 @@ bool codegen_emit(jitdata *jd)
 
                if (m->flags & ACC_STATIC) {
                        disp = dseg_add_address(cd, &m->class->object.header);
-                       M_ALD(REG_A0, REG_PV, disp);
+                       M_ALD_DSEG(REG_A0, disp);
                }
                else {
                        M_TEST(REG_A0);
@@ -364,7 +369,7 @@ bool codegen_emit(jitdata *jd)
                }
 
                disp = dseg_add_functionptr(cd, LOCK_monitor_enter);
-               M_ALD(REG_ITMP3, REG_PV, disp);
+               M_ALD_DSEG(REG_ITMP3, disp);
 
                M_AST(REG_A0, REG_SP, s1 * 4);
 
@@ -524,14 +529,14 @@ bool codegen_emit(jitdata *jd)
                case ICMD_FCONST:     /* ...  ==> ..., constant                       */
                        d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
                        disp = dseg_add_float(cd, iptr->sx.val.f);
-                       M_FLDN(d, REG_PV, disp, REG_ITMP1);
+                       M_FLD_DSEG(d, disp, REG_ITMP1);
                        emit_store_dst(jd, iptr, d);
                        break;
                
                case ICMD_DCONST:     /* ...  ==> ..., constant                       */
                        d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
                        disp = dseg_add_double(cd, iptr->sx.val.d);
-                       M_DLDN(d, REG_PV, disp, REG_ITMP1);
+                       M_DLD_DSEG(d, disp, REG_ITMP1);
                        emit_store_dst(jd, iptr, d);
                        break;
 
@@ -549,13 +554,13 @@ bool codegen_emit(jitdata *jd)
 
 /*                             PROFILE_CYCLE_START; */
 
-                               M_ALD(d, REG_PV, disp);
+                               M_ALD_DSEG(d, disp);
                        } else {
                                if (iptr->sx.val.anyptr == 0) {
                                        M_CLR(d);
                                } else {
                                        disp = dseg_add_unique_address(cd, iptr->sx.val.anyptr);
-                                       M_ALD(d, REG_PV, disp);
+                                       M_ALD_DSEG(d, disp);
                                }
                        }
                        emit_store_dst(jd, iptr, d);
@@ -879,7 +884,7 @@ bool codegen_emit(jitdata *jd)
                                M_IMUL_IMM(iptr->sx.val.i, d);
                        } else {
                                disp = dseg_add_s4(cd, iptr->sx.val.i);
-                               M_ILD(REG_ITMP2, REG_PV, disp);
+                               M_ILD_DSEG(REG_ITMP2, disp);
                                M_IMUL(REG_ITMP2, d);   
                        }
                        emit_store_dst(jd, iptr, d);
@@ -958,7 +963,7 @@ bool codegen_emit(jitdata *jd)
                        /* call builtin */
 
                        M_ASUB_IMM(96, REG_SP);
-                       M_ALD(REG_ITMP3, REG_PV, disp);
+                       M_ALD_DSEG(REG_ITMP3, disp);
                        M_JSR(REG_RA, REG_ITMP3);
                        M_AADD_IMM(96, REG_SP);
 
@@ -1028,7 +1033,7 @@ bool codegen_emit(jitdata *jd)
                                        M_IADD(REG_ITMP1, d);
                                }
 
-                               *(u4 *)ref |= (u4)(cd->mcodeptr - ref) / 2;
+                               N_BRC_BACK_PATCH(ref);
 
                                M_SRA_IMM(iptr->sx.val.i, d);
 
@@ -1511,28 +1516,99 @@ bool codegen_emit(jitdata *jd)
                        break;
 
                case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
-                       s1 = emit_load_s1(jd, iptr, REG_FTMP1);
-                       d = codegen_reg_of_dst(jd, iptr, REG_ITMP3);
-                       M_CVTFI(s1, d);
-                       emit_store_dst(jd, iptr, d);
-                       /* TODO: corner cases ? */
-                       break;
+               case ICMD_D2I:
+                       {
+                               u1 *ref1;
+#ifdef SUPPORT_HERCULES
+                               u1 *ref2, *ref3;
+#endif
 
-               case ICMD_D2I:       /* ..., value  ==> ..., (int) value              */
-                       s1 = emit_load_s1(jd, iptr, REG_FTMP1);
-                       d = codegen_reg_of_dst(jd, iptr, REG_ITMP3);
-                       M_CVTDI(s1, d);
-                       emit_store_dst(jd, iptr, d);
-                       /* TODO: corner cases ? */
-                       break;
+                               s1 = emit_load_s1(jd, iptr, REG_FTMP1);
+                               d = codegen_reg_of_dst(jd, iptr, REG_ITMP3);
+
+                               /* Test if NAN */
+
+                               switch (iptr->opc) {
+                                       case ICMD_F2I:
+                                               N_LTEBR(s1, s1); 
+                                               break;
+                                       case ICMD_D2I:
+                                               N_LTDBR(s1, s1);
+                                               break;
+                               }
+
+                               N_BRC(DD_0 | DD_1 | DD_2, SZ_BRC + SZ_LHI + SZ_BRC); /* Non a NaN */
+                               N_LHI(d, 0); /* Load 0 */
+                               ref1 = cd->mcodeptr;
+                               N_BRC(DD_ANY, 0); /* Exit */
+
+                               /* Convert */
 
+                               switch (iptr->opc) {
+                                       case ICMD_F2I:
+                                               M_CVTFI(s1, d); 
+                                               break;
+                                       case ICMD_D2I:
+                                               M_CVTDI(s1, d); 
+                                               break;
+                               }
+
+#ifdef SUPPORT_HERCULES
+                               /* Hercules does the conversion using a plain C conversion.
+                                * According to manual, real hardware should *NOT* require this.
+                                *
+                                * Corner case: Positive float leads to INT_MIN (overflow).
+                                */
+
+                               switch (iptr->opc) {
+                                       case ICMD_F2I:
+                                               N_LTEBR(s1, s1); 
+                                               break;
+                                       case ICMD_D2I:
+                                               N_LTDBR(s1, s1);
+                                               break;
+                               }
+
+                               ref2 = cd->mcodeptr;
+                               N_BRC(DD_0 | DD_1 | DD_3, 0); /* If operand is positive, continue */
+
+                               M_TEST(d);
+
+                               ref3 = cd->mcodeptr;
+                               M_BGE(0); /* If integer result is negative, continue */
+
+                               disp = dseg_add_s4(cd, 0x7fffffff); /* Load INT_MAX */
+                               M_ILD_DSEG(d, disp);
+#endif
+                               N_BRC_BACK_PATCH(ref1);
+#ifdef SUPPORT_HERCULES
+                               N_BRC_BACK_PATCH(ref2);
+                               N_BRC_BACK_PATCH(ref3);
+#endif
+                               emit_store_dst(jd, iptr, d);
+                       }
                        break;
 
                case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
-                       s1 = emit_load_s1(jd, iptr, REG_FTMP1);
-                       d = codegen_reg_of_dst(jd, iptr, REG_FTMP2);
-                       M_CVTFD(s1, d);
-                       emit_store_dst(jd, iptr, d);
+                       {
+                               u1 *ref;
+                               s1 = emit_load_s1(jd, iptr, REG_FTMP1);
+                               d = codegen_reg_of_dst(jd, iptr, REG_FTMP2);
+#ifdef SUPPORT_HERCULES
+                               N_LTEBR(s1, s1);
+                               ref = cd->mcodeptr;
+                               N_BRC(DD_0 | DD_1 | DD_2, 0); /* Non a NaN */
+                               disp = dseg_add_double(cd, 0.0 / 0.0);
+                               M_DLD_DSEG(d, disp, REG_ITMP1);
+                               emit_label_br(cd, BRANCH_LABEL_1);
+                               N_BRC_BACK_PATCH(ref);
+#endif
+                               M_CVTFD(s1, d);
+#ifdef SUPPORT_HERCULES
+                               emit_label(cd, BRANCH_LABEL_1);
+#endif
+                               emit_store_dst(jd, iptr, d);
+                       }
                        break;
 
                case ICMD_D2F:       /* ..., value  ==> ..., (float) value            */
@@ -1685,6 +1761,13 @@ bool codegen_emit(jitdata *jd)
                        M_INTMOVE(s2, REG_ITMP2);
                        M_SLL_IMM(3, REG_ITMP2); /* scale index by 8 */
 
+                       /* We need to preserve the array address after the first load */
+
+                       if (GET_HIGH_REG(d) == s1) {
+                               M_INTMOVE(s1, REG_ITMP3);
+                               s1 = REG_ITMP3;
+                       }
+
                        N_L(GET_HIGH_REG(d) /* evntl. itmp1 */, OFFSET(java_intarray, data[0]), REG_ITMP2, s1);
                        N_L(GET_LOW_REG(d) /* evntl. itmp2 */, OFFSET(java_intarray, data[0]) + 4, REG_ITMP2, s1);
                        emit_store_dst(jd, iptr, d);
@@ -1845,7 +1928,7 @@ bool codegen_emit(jitdata *jd)
                        M_INTMOVE(s3, REG_A1);
 
                        disp = dseg_add_functionptr(cd, BUILTIN_canstore);
-                       M_ALD(REG_ITMP3, REG_PV, disp);
+                       M_ALD_DSEG(REG_ITMP3, disp);
                        M_ASUB_IMM(96, REG_SP);
                        M_JSR(REG_RA, REG_ITMP3);
                        M_AADD_IMM(96, REG_SP);
@@ -1894,7 +1977,7 @@ bool codegen_emit(jitdata *jd)
                                }
                        }
 
-                       M_ALD(REG_ITMP1, REG_PV, disp);
+                       M_ALD_DSEG(REG_ITMP1, disp);
 
                        switch (fieldtype) {
                        case TYPE_INT:
@@ -1942,7 +2025,7 @@ bool codegen_emit(jitdata *jd)
                                                                                fi->class, disp);
                        }
 
-                       M_ALD(REG_ITMP1, REG_PV, disp);
+                       M_ALD_DSEG(REG_ITMP1, disp);
                        switch (fieldtype) {
                        case TYPE_INT:
                                s1 = emit_load_s1(jd, iptr, REG_ITMP2);
@@ -2103,7 +2186,7 @@ bool codegen_emit(jitdata *jd)
 #endif /* ENABLE_VERIFIER */
 
                        disp = dseg_add_functionptr(cd, asm_handle_exception);
-                       M_ALD(REG_ITMP2, REG_PV, disp);
+                       M_ALD_DSEG(REG_ITMP2, disp);
                        M_JMP(REG_ITMP2_XPC, REG_ITMP2);
                        M_NOP;
 
@@ -2149,8 +2232,12 @@ bool codegen_emit(jitdata *jd)
                                M_ICMP_IMM(s1, iptr->sx.val.i);
                        else {
                                disp = dseg_add_s4(cd, iptr->sx.val.i);
-                               ICONST(REG_ITMP2, disp);
-                               N_C(s1, 0, REG_ITMP2, REG_PV);
+                               if (N_VALID_DSEG_DISP(disp)) {
+                                       N_C(s1, N_DSEG_DISP(disp), RN, REG_PV);
+                               } else {
+                                       ICONST(REG_ITMP2, disp);
+                                       N_C(s1, -N_PV_OFFSET, REG_ITMP2, REG_PV);
+                               }
                        }
 
                        switch (iptr->opc) {
@@ -2193,8 +2280,12 @@ bool codegen_emit(jitdata *jd)
                                M_ICMP_IMM(s1, iptr->sx.val.l >> 32);
                        else {
                                disp = dseg_add_s4(cd, iptr->sx.val.l >> 32);
-                               ICONST(REG_ITMP2, disp);
-                               N_C(s1, 0, REG_ITMP2, REG_PV);
+                               if (N_VALID_DSEG_DISP(disp)) {
+                                       N_C(s1, N_DSEG_DISP(disp), RN, REG_PV);
+                               } else {
+                                       ICONST(REG_ITMP2, disp);
+                                       N_C(s1, -N_PV_OFFSET, REG_ITMP2, REG_PV);
+                               }
                        }
 
                        switch(iptr->opc) {
@@ -2225,8 +2316,12 @@ bool codegen_emit(jitdata *jd)
                        s1 = emit_load_s1_low(jd, iptr, REG_ITMP1);
 
                        disp = dseg_add_s4(cd, (s4)(iptr->sx.val.l & 0xffffffff));
-                       ICONST(REG_ITMP2, disp);
-                       N_CL(s1, 0, REG_ITMP2, REG_PV);
+                       if (N_VALID_DSEG_DISP(disp)) {
+                               N_CL(s1, N_DSEG_DISP(disp), RN, REG_PV);
+                       } else {
+                               ICONST(REG_ITMP2, disp);
+                               N_CL(s1, -N_PV_OFFSET, REG_ITMP2, REG_PV);
+                       }
 
                        switch(iptr->opc) {
                                case ICMD_IF_LLT:
@@ -2475,7 +2570,7 @@ nowperformreturn:
                                M_ALD(REG_A0, REG_SP, rd->memuse * 4);
 
                                disp = dseg_add_functionptr(cd, LOCK_monitor_exit);
-                               M_ALD(REG_ITMP3, REG_PV, disp);
+                               M_ALD_DSEG(REG_ITMP3, disp);
 
                                M_ASUB_IMM(96, REG_SP);
                                M_CALL(REG_ITMP3);
@@ -2570,7 +2665,7 @@ nowperformreturn:
 
                        M_SLL_IMM(2, REG_ITMP1); /* scale by 4 */
                        M_ASUB_IMM(cd->dseglen, REG_ITMP1);
-                       N_L(REG_ITMP1, 0, REG_ITMP1, REG_PV);
+                       N_L(REG_ITMP1, -N_PV_OFFSET, REG_ITMP1, REG_PV);
                        M_JMP(RN, REG_ITMP1);
 
                        break;
@@ -2661,11 +2756,11 @@ gen_method:
                                        else {
                                                if (IS_2_WORD_TYPE(var->type)) {
                                                        d = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
-                                                       M_LST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_LST(d, REG_SP, md->params[s3].regoff);
                                                }
                                                else {
                                                        d = emit_load(jd, iptr, var, REG_ITMP1);
-                                                       M_IST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_IST(d, REG_SP, md->params[s3].regoff);
                                                }
                                        }
                                }
@@ -2678,9 +2773,9 @@ gen_method:
                                        else {
                                                d = emit_load(jd, iptr, var, REG_FTMP1);
                                                if (IS_2_WORD_TYPE(var->type))
-                                                       M_DST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_DST(d, REG_SP, md->params[s3].regoff);
                                                else
-                                                       M_FST(d, REG_SP, md->params[s3].regoff * 4);
+                                                       M_FST(d, REG_SP, md->params[s3].regoff);
                                        }
                                }
                        }
@@ -2690,8 +2785,12 @@ gen_method:
                                disp = dseg_add_functionptr(cd, bte->fp);
 
                                M_ASUB_IMM(96, REG_SP); /* register save area as required by C abi */   
-                               N_LHI(REG_ITMP1, disp);
-                               N_L(REG_PV, 0, REG_ITMP1, REG_PV);
+                               if (N_VALID_DSEG_DISP(disp)) {
+                                       N_L(REG_PV, N_DSEG_DISP(disp), RN, REG_PV);
+                               } else {
+                                       N_LHI(REG_ITMP1, disp);
+                                       N_L(REG_PV, -N_PV_OFFSET, REG_ITMP1, REG_PV);
+                               }
                                break;
 
                        case ICMD_INVOKESPECIAL:
@@ -2711,8 +2810,12 @@ gen_method:
                                else
                                        disp = dseg_add_address(cd, lm->stubroutine);
 
-                               N_LHI(REG_ITMP1, disp);
-                               N_L(REG_PV, 0, REG_ITMP1, REG_PV);
+                               if (N_VALID_DSEG_DISP(disp)) {
+                                       N_L(REG_PV, N_DSEG_DISP(disp), RN, REG_PV);
+                               } else {
+                                       N_LHI(REG_ITMP1, disp);
+                                       N_L(REG_PV, -N_PV_OFFSET, REG_ITMP1, REG_PV);
+                               }
                                break;
 
                        case ICMD_INVOKEVIRTUAL:
@@ -2863,8 +2966,12 @@ gen_method:
                                                                                  disp);
 
                                        ICONST(REG_ITMP2, ACC_INTERFACE);
-                                       ICONST(REG_ITMP3, disp); /* TODO negative displacement */
-                                       N_N(REG_ITMP2, 0, REG_ITMP3, REG_PV);
+                                       if (N_VALID_DSEG_DISP(disp)) {
+                                               N_N(REG_ITMP2, N_DSEG_DISP(disp), RN, REG_PV);
+                                       } else {
+                                               ICONST(REG_ITMP3, disp);
+                                               N_N(REG_ITMP2, -N_PV_OFFSET, REG_ITMP3, REG_PV);
+                                       }
                                        emit_label_beq(cd, LABEL_CLASS);
                                }
 
@@ -2920,14 +3027,14 @@ gen_method:
                                        }
 
                                        M_ALD(REG_ITMP2, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ALD(REG_ITMP3, REG_PV, disp);
+                                       M_ALD_DSEG(REG_ITMP3, disp);
 
                                        CODEGEN_CRITICAL_SECTION_START;
 
                                        M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval));
                                        M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, baseval));
                                        M_ISUB(REG_ITMP3, REG_ITMP2);
-                                       M_ALD(REG_ITMP3, REG_PV, disp);
+                                       M_ALD_DSEG(REG_ITMP3, disp);
                                        M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval));
 
                                        CODEGEN_CRITICAL_SECTION_END;
@@ -2973,9 +3080,9 @@ gen_method:
                                else
                                        disp = dseg_add_address(cd, iptr->sx.s23.s3.c.cls);
 
-                               M_ALD(REG_A1, REG_PV, disp);
+                               M_ALD_DSEG(REG_A1, disp);
                                disp = dseg_add_functionptr(cd, BUILTIN_arraycheckcast);
-                               M_ALD(REG_ITMP1, REG_PV, disp);
+                               M_ALD_DSEG(REG_ITMP1, disp);
                                M_ASUB_IMM(96, REG_SP);
                                M_JSR(REG_RA, REG_ITMP1);
                                M_AADD_IMM(96, REG_SP);
@@ -3057,8 +3164,14 @@ gen_method:
                                                                          iptr->sx.s23.s3.c.ref, disp);
 
                                ICONST(REG_ITMP2, ACC_INTERFACE);
-                               ICONST(REG_ITMP3, disp); /* TODO negative displacement */
-                               N_N(REG_ITMP2, 0, REG_ITMP3, REG_PV);
+
+                               if (N_VALID_DSEG_DISP(disp)) {
+                                       N_N(REG_ITMP2, N_DSEG_DISP(disp), RN, REG_PV);
+                               } else {
+                                       ICONST(REG_ITMP3, disp);
+                                       N_N(REG_ITMP2, -N_PV_OFFSET, REG_ITMP3, REG_PV);
+                               }
+
                                emit_label_beq(cd, LABEL_CLASS);
                        }
 
@@ -3129,7 +3242,7 @@ gen_method:
                                }
 
                                M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                               M_ALD(REG_ITMP2, REG_PV, disp);
+                               M_ALD_DSEG(REG_ITMP2, disp);
 
                                CODEGEN_CRITICAL_SECTION_START;
 
@@ -3208,14 +3321,14 @@ gen_method:
 
                        /* a1 = classinfo */
 
-                       M_ALD(REG_A1, REG_PV, disp);
+                       M_ALD_DSEG(REG_A1, disp);
 
                        /* a2 = pointer to dimensions = stack pointer */
 
                        M_MOV(REG_SP, REG_A2);
 
                        disp = dseg_add_functionptr(cd, BUILTIN_multianewarray);
-                       M_ALD(REG_ITMP1, REG_PV, disp);
+                       M_ALD_DSEG(REG_ITMP1, disp);
                        M_ASUB_IMM(96, REG_SP);
                        M_JSR(REG_RA, REG_ITMP1);
                        M_AADD_IMM(96, REG_SP);
@@ -3288,11 +3401,11 @@ void codegen_emit_stub_compiler(jitdata *jd)
 
        /* don't touch ITMP3 as it cointains the return address */
 
-       M_ISUB_IMM((3 * 4), REG_PV); /* suppress negative displacements */
+       M_AADD_IMM(N_PV_OFFSET, REG_PV); /* suppress negative displacements */
 
-       M_ILD(REG_ITMP1, REG_PV, 1 * 4); /* methodinfo  */
+       M_ILD_DSEG(REG_ITMP1, -2 * SIZEOF_VOID_P); /* methodinfo  */
        /* TODO where is methodpointer loaded into itmp2? is it already inside? */
-       M_ILD(REG_PV, REG_PV, 0 * 4); /* compiler pointer */
+       M_ILD_DSEG(REG_PV, -3 * SIZEOF_VOID_P); /* compiler pointer */
        N_BR(REG_PV);
 }
 
@@ -3386,6 +3499,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
        /* generate stub code */
 
        N_AHI(REG_SP, -(cd->stackframesize * SIZEOF_VOID_P));
+       N_AHI(REG_PV, N_PV_OFFSET);
 
        /* save return address */
 
@@ -3405,7 +3519,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                codegen_add_patch_ref(cd, PATCHER_resolve_native, m, disp);
 #endif
 
-       M_ILD(REG_ITMP1, REG_PV, disp);
+       M_ILD_DSEG(REG_ITMP1, disp);
 
        j = 96 + (nmd->memuse * 4);
 
@@ -3443,12 +3557,12 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
        /* create dynamic stack info */
 
        N_LAE(REG_A0, (cd->stackframesize - 1) * 4, RN, REG_SP); /* datasp */
-       N_LR(REG_A1, REG_PV); /* pv */
+       N_LA(REG_A1, -N_PV_OFFSET, RN, REG_PV); /* pv */
        N_LAE(REG_A2, cd->stackframesize * 4, RN, REG_SP); /* old SP */
        N_L(REG_A3, (cd->stackframesize - 1) * 4, RN, REG_SP); /* return address */
 
        disp = dseg_add_functionptr(cd, codegen_start_native_call);
-       M_ILD(REG_ITMP1, REG_PV, disp);
+       M_ILD_DSEG(REG_ITMP1, disp);
 
        M_CALL(REG_ITMP1); /* call */
 
@@ -3517,24 +3631,24 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                                N_STM(
                                                        GET_HIGH_REG(s1), 
                                                        GET_LOW_REG(s1), 
-                                                       96 + (s2 * 4), REG_SP
+                                                       96 + s2, REG_SP
                                                );
                                        } else {
                                                N_ST(
                                                        s1, 
-                                                       96 + (s2 * 4), RN, REG_SP
+                                                       96 + s2, RN, REG_SP
                                                );
                                        }
                                }
 
                        } else {
-                               s1 = cd->stackframesize + md->params[i].regoff;
+                               s1 = cd->stackframesize * 4 + md->params[i].regoff;
                                s2 = nmd->params[j].regoff;
                                
                                if (IS_2_WORD_TYPE(t)) {
-                                       N_MVC(96 + (s2 * 4), 8, REG_SP, (s1 * 4), REG_SP);
+                                       N_MVC(96 + s2, 8, REG_SP, s1, REG_SP);
                                } else {
-                                       N_MVC(96 + (s2 * 4), 4, REG_SP, (s1 * 4), REG_SP);
+                                       N_MVC(96 + s2, 4, REG_SP, s1, REG_SP);
                                }
                        }
 
@@ -3543,13 +3657,13 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                        /* registers keep unchanged.                                      */
 
                        if (md->params[i].inmemory) {
-                               s1 = cd->stackframesize + md->params[i].regoff;
+                               s1 = cd->stackframesize * 4 + md->params[i].regoff;
                                s2 = nmd->params[j].regoff;
 
                                if (IS_2_WORD_TYPE(t)) {
-                                       N_MVC(96 + (s2 * 4), 8, REG_SP, (s1 * 4), REG_SP);
+                                       N_MVC(96 + s2, 8, REG_SP, s1, REG_SP);
                                } else {
-                                       N_MVC(96 + (s2 * 4), 4, REG_SP, (s1 * 4), REG_SP);
+                                       N_MVC(96 + s2, 4, REG_SP, s1, REG_SP);
                                }
                        }
                }
@@ -3559,13 +3673,13 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 
        if (m->flags & ACC_STATIC) {
                disp = dseg_add_address(cd, m->class);
-               M_ILD(REG_A1, REG_PV, disp);
+               M_ILD_DSEG(REG_A1, disp);
        }
 
        /* put env into first argument register */
 
        disp = dseg_add_address(cd, _Jv_env);
-       M_ILD(REG_A0, REG_PV, disp);
+       M_ILD_DSEG(REG_A0, disp);
 
        /* do the native function call */
 
@@ -3600,7 +3714,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 
        N_LAE(REG_A0, (cd->stackframesize - 1) * 4, RN, REG_SP); /* datasp */
        disp = dseg_add_functionptr(cd, codegen_finish_native_call);
-       M_ILD(REG_ITMP1, REG_PV, disp);
+       M_ALD_DSEG(REG_ITMP1, disp);
        M_CALL(REG_ITMP1);
        N_LR(REG_ITMP3, REG_RESULT);
 
@@ -3650,7 +3764,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 #endif
 
        disp = dseg_add_functionptr(cd, asm_handle_nat_exception);
-       M_ALD(REG_ITMP3, REG_PV, disp);
+       M_ALD_DSEG(REG_ITMP3, disp);
        M_JMP(RN, REG_ITMP3);
 
        /* generate patcher stubs */
index 175c2e9be3a294cc75b8839982c546906edc8dd0..19375ba07e27b7f4d9d54fe5ddd1963258c277ba 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.h 8027 2007-06-07 10:30:33Z michi $
+   $Id: codegen.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 #define N_VALID_DISP(x) ((N_DISP_MIN <= (x)) && ((x) <= N_DISP_MAX))
 #define ASSERT_VALID_DISP(x) assert(N_VALID_DISP(x))
 
+#define N_PV_OFFSET (-0xFFC)
+#define N_DSEG_DISP(x) ((x) - N_PV_OFFSET)
+#define N_VALID_DSEG_DISP(x) N_VALID_DISP(N_DSEG_DISP(x))
+
 #define N_BRANCH_MIN -32768
 #define N_BRANCH_MAX 32767
 #define N_VALID_BRANCH(x) ((N_BRANCH_MIN <= (x)) && ((x) <= N_BRANCH_MAX))
 #define DD_NO 14
 #define DD_ANY 15
 
+#define DD_0 8
+#define DD_1 4
+#define DD_2 2
+#define DD_3 1
+
 /* Misc */
 
 /* Trap instruction.
 #      define N_J(i2) N_BRC(DD_ANY, i2)
 #      define SZ_BRC SZ_RI
 #      define SZ_J SZ_RI
+#      define N_BRC_BACK_PATCH(brc_pos) \
+               do { \
+                       *(u4 *)(brc_pos) |= (u4)(cd->mcodeptr - (brc_pos)) / 2; \
+               } while (0)
 #define N_BRCT(r1, i2) N_RI(0xA7, 0x6, r1, (i2) / 2)
 #define N_BRXH(r1, r3, i2) N_RSI(0x84, r1, r3, (i2) / 2)
 #define N_BRXLE(r1, r3, i2) N_RSI(0x85, r1, r2, (i2) / 2)
 #define N_LCXBR(r1, r2) N_RRE(0xB343, r1, r2)
 
 #define N_LDEBR(r1, r2) N_RRE(0xB304, r1, r2)
+#      define SZ_LDEBR SZ_RRE
 #define N_LXDBR(r1, r2) N_RRE(0xB305, r1, r2)
 #define N_LXEBR(r1, r2) N_RRE(0xB306, r1, r2)
 
 #define N_LDXBR(r1, r2) N_RRE(0xB345, r1, r2)
 #define N_LEXBR(r1, r2) N_RRE(0xB346, r1, r2)
 
+#define N_LTEBR(r1, r2) N_RRE(0xB302, r1, r2)
+#define N_LTDBR(r1, r2) N_RRE(0xB312, r1, r2)
+#define N_LTXBR(r1, r2) N_RRE(0xB342, r1, r2)
+
 #define N_MEEBR(r1, r2) N_RRE(0xB317, r1, r2)
 #define N_MDBR(r1, r2) N_RRE(0xB31C, r1, r2)
 #define N_MXBR(r1, r2) N_RRE(0xB34C, r1, r2)
                } \
        } while (0)
 
+#define M_ILD_DSEG(r, d) M_ILD(r, REG_PV, N_DSEG_DISP(d))
+
 #define M_ALD(r, b, d) M_ILD(r, b, d)
+#define M_ALD_DSEG(r, d) M_ALD(r, REG_PV, N_DSEG_DISP(d))
 
 #define M_LDA(r, b, d) \
        do { \
                        N_LA(r, 0, r, b); \
                } \
        } while (0)
+#define M_LDA_DSEG(r, d) M_LDA(r, REG_PV, N_DSEG_DISP(d))
 
 #define M_FLD(r, b, d) N_LE(r, d, RN, b)
-
 #define M_FLDN(r, b, d, t) _IFNEG( \
        d, \
        N_LHI(t, d); N_LE(r, 0, t, b), \
        N_LE(r, d, RN, b) \
 )
-               
+#define M_FLD_DSEG(r, d, t) M_FLDN(r, REG_PV, N_DSEG_DISP(d), t)
+
 #define M_DLD(r, b, d) N_LD(r, d, RN, b)
 #define M_DLDN(r, b, d, t) _IFNEG( \
        d, \
        N_LHI(t, d); N_LD(r, 0, t, b), \
        N_LD(r, d, RN, b) \
 )
+#define M_DLD_DSEG(r, d, t) M_DLDN(r, REG_PV, N_DSEG_DISP(d), t)
 
 #define M_LLD(r, b, d) _IFNEG( \
        d, \
                N_L(GET_LOW_REG(r), 4, GET_LOW_REG(r), b), \
        N_L(GET_HIGH_REG(r), (d) + 0, RN, b); N_L(GET_LOW_REG(r), (d) + 4, RN, b) \
 )
+#define M_LLD_DSEG(r, d) M_LLD(r, REG_PV, N_DSEG_DISP(d)
 
 /* MOV(a, b) -> mov from A to B */
 
 #define M_DSUB(a, dest) N_SDBR(dest, a)
 #define M_DADD(a, dest) N_ADBR(dest, a)
 #define M_DDIV(a, dest) N_DDBR(dest, a)
-#define M_CVTFI(src, dst) N_CFEBR(dst, 5, src)
-#define M_CVTDI(src, dst) N_CFDBR(dst, 5, src)
+#define M_CVTFI(src, dst) N_CFEBR(dst, 4, src)
+#define M_CVTDI(src, dst) N_CFDBR(dst, 4, src)
 #define M_IADD(a, dest) N_AR(dest, a)
 #define M_AADD(a, dest) N_AR(dest, a)
 #define M_ISUB(a, dest) N_SR(dest, a)
                        N_LHI(reg, i); \
                } else { \
                        disp = dseg_add_s4(cd, (i)); \
-                       M_ILD(reg, REG_PV, disp); \
+                       M_ILD_DSEG(reg, disp); \
                } \
        } while (0) 
 
index 02f961863dfb0e7b5e32afc7651ad62e9b5fd20b..a6bb47f95441630f78d7a669a4f0d0b04c699211 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -75,7 +75,7 @@ __PORTED__ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                if (IS_FLT_DBL_TYPE(src->type)) {
                        if (IS_2_WORD_TYPE(src->type))
@@ -121,15 +121,15 @@ __PORTED__ inline void emit_store(jitdata *jd, instruction *iptr, varinfo *dst,
 
                if (IS_FLT_DBL_TYPE(dst->type)) {
                        if (IS_2_WORD_TYPE(dst->type))
-                               M_DST(d, REG_SP, dst->vv.regoff * 4);
+                               M_DST(d, REG_SP, dst->vv.regoff);
                        else
-                               M_FST(d, REG_SP, dst->vv.regoff * 4);
+                               M_FST(d, REG_SP, dst->vv.regoff);
                }
                else {
                        if (IS_2_WORD_TYPE(dst->type))
-                               M_LST(d, REG_SP, dst->vv.regoff * 4);
+                               M_LST(d, REG_SP, dst->vv.regoff);
                        else
-                               M_IST(d, REG_SP, dst->vv.regoff * 4);
+                               M_IST(d, REG_SP, dst->vv.regoff);
                }
        }
 }
@@ -278,9 +278,9 @@ __PORTED__ void emit_patcher_stubs(jitdata *jd)
 
                        /* Generating long branches */
 
-                       disp = dseg_add_s4(cd, savedmcodeptr - cd->mcodebase);
+                       disp = dseg_add_s4(cd, savedmcodeptr - cd->mcodebase - N_PV_OFFSET);
        
-                       M_ILD(REG_ITMP3, REG_PV, disp);
+                       M_ILD_DSEG(REG_ITMP3, disp);
                        M_AADD(REG_PV, REG_ITMP3);
 
                        /* Do the branch at the end of NOP sequence.
@@ -316,7 +316,7 @@ __PORTED__ void emit_patcher_stubs(jitdata *jd)
                (void) dseg_add_unique_address(cd, lock_get_initial_lock_word());
                disp = dseg_add_unique_address(cd, NULL);                  /* vftbl   */
 
-               M_LDA(REG_ITMP3, REG_PV, disp);
+               M_LDA_DSEG(REG_ITMP3, disp);
                M_AST(REG_ITMP3, REG_SP, 4 * 4);
 #else
                /* nothing to do */
@@ -325,32 +325,32 @@ __PORTED__ void emit_patcher_stubs(jitdata *jd)
                /* move machine code onto stack */
 
                disp = dseg_add_s4(cd, mcode);
-               M_ILD(REG_ITMP3, REG_PV, disp);
+               M_ILD_DSEG(REG_ITMP3, disp);
                M_IST(REG_ITMP3, REG_SP, 3 * 4);
 
                /* move class/method/field reference onto stack */
 
                disp = dseg_add_address(cd, pref->ref);
-               M_ALD(REG_ITMP3, REG_PV, disp);
+               M_ALD_DSEG(REG_ITMP3, disp);
                M_AST(REG_ITMP3, REG_SP, 2 * 4);
 
                /* move data segment displacement onto stack */
 
                disp = dseg_add_s4(cd, pref->disp);
-               M_ILD(REG_ITMP3, REG_PV, disp);
+               M_ILD_DSEG(REG_ITMP3, disp);
                M_IST(REG_ITMP3, REG_SP, 1 * 4);
 
                /* move patcher function pointer onto stack */
 
                disp = dseg_add_functionptr(cd, pref->patcher);
-               M_ALD(REG_ITMP3, REG_PV, disp);
+               M_ALD_DSEG(REG_ITMP3, disp);
                M_AST(REG_ITMP3, REG_SP, 0 * 4);
 
                if (targetdisp == 0) {
                        targetdisp = (cd->mcodeptr) - (cd->mcodebase);
 
                        disp = dseg_add_functionptr(cd, asm_patcher_wrapper);
-                       M_ALD(REG_ITMP3, REG_PV, disp);
+                       M_ALD_DSEG(REG_ITMP3, disp);
                        M_JMP(RN, REG_ITMP3);
                }
                else {
@@ -557,13 +557,13 @@ void emit_verbosecall_enter(jitdata *jd)
        /* Finally load methodinfo argument */
 
        disp = dseg_add_address(cd, m);
-       M_ALD(REG_ITMP2, REG_PV, disp); 
+       M_ALD_DSEG(REG_ITMP2, disp);    
        M_AST(REG_ITMP2, REG_SP, 6 * 8);
 
        /* Call builtin_verbosecall_enter */
 
        disp = dseg_add_address(cd, builtin_verbosecall_enter);
-       M_ALD(REG_ITMP2, REG_PV, disp);
+       M_ALD_DSEG(REG_ITMP2, disp);
        M_ASUB_IMM(96, REG_SP);
        M_CALL(REG_ITMP2);
        M_AADD_IMM(96, REG_SP);
@@ -636,13 +636,13 @@ void emit_verbosecall_exit(jitdata *jd)
        }
 
        disp = dseg_add_address(cd, m);
-       M_ALD(REG_A2, REG_PV, disp);
+       M_ALD_DSEG(REG_A2, disp);
 
        /* REG_FRESULT is REG_FA0, so no need to move */
        M_FLTMOVE(REG_FRESULT, REG_FA1);
 
        disp = dseg_add_address(cd, builtin_verbosecall_exit);
-       M_ALD(REG_ITMP1, REG_PV, disp);
+       M_ALD_DSEG(REG_ITMP1, disp);
        M_ASUB_IMM(96, REG_SP);
        M_CALL(REG_ITMP1);
        M_AADD_IMM(96, REG_SP);
@@ -680,7 +680,7 @@ __PORTED__ s4 emit_load_high(jitdata *jd, instruction *iptr, varinfo *src, s4 te
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                M_ILD(tempreg, REG_SP, disp);
 
@@ -713,7 +713,7 @@ __PORTED__ s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tem
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 4;
+               disp = src->vv.regoff;
 
                M_ILD(tempreg, REG_SP, disp + 4);
 
@@ -740,7 +740,11 @@ s4 emit_load_s2_notzero(jitdata *jd, instruction *iptr, s4 tempreg) {
        codegendata *cd = jd->cd;
        s4 reg = emit_load_s2(jd, iptr, tempreg);
        if (reg == 0) {
-               M_MOV(reg, tempreg);
+               if (IS_FLT_DBL_TYPE(VAROP(iptr->sx.s23.s2)->type)) {
+                       M_FMOV(reg, tempreg);
+               } else {
+                       M_MOV(reg, tempreg);
+               }
                return tempreg;
        } else {
                return reg;
@@ -751,7 +755,11 @@ s4 emit_load_s1_but(jitdata *jd, instruction *iptr, s4 tempreg, s4 notreg) {
        codegendata *cd = jd->cd;
        s4 reg = emit_load_s1(jd, iptr, tempreg);
        if (reg == notreg) {
-               M_MOV(reg, tempreg);
+               if (IS_FLT_DBL_TYPE(VAROP(iptr->s1)->type)) {
+                       M_FMOV(reg, tempreg);
+               } else {
+                       M_MOV(reg, tempreg);
+               }
                return tempreg;
        } else {
                return reg;
@@ -762,7 +770,11 @@ s4 emit_load_s2_but(jitdata *jd, instruction *iptr, s4 tempreg, s4 notreg) {
        codegendata *cd = jd->cd;
        s4 reg = emit_load_s2(jd, iptr, tempreg);
        if (reg == notreg) {
-               M_MOV(reg, tempreg);
+               if (IS_FLT_DBL_TYPE(VAROP(iptr->sx.s23.s2)->type)) {
+                       M_FMOV(reg, tempreg);
+               } else {
+                       M_MOV(reg, tempreg);
+               }
                return tempreg;
        } else {
                return reg;
@@ -963,8 +975,8 @@ void emit_branch(codegendata *cd, s4 disp, s4 condition, s4 reg, u4 opt) {
 
                /* The actual long branch */
 
-               disp = dseg_add_s4(cd, branchmpc + disp);
-               M_ILD(REG_ITMP3, REG_PV, disp);
+               disp = dseg_add_s4(cd, branchmpc + disp - N_PV_OFFSET);
+               M_ILD_DSEG(REG_ITMP3, disp);
                M_AADD(REG_PV, REG_ITMP3);
                M_JMP(RN, REG_ITMP3);
 
@@ -1041,7 +1053,7 @@ void emit_exception_check(codegendata *cd, instruction *iptr) {
 }
 
 void emit_restore_pv(codegendata *cd) {
-       s4 offset;
+       s4 offset, offset_imm;
 
        /*
        N_BASR(REG_PV, RN);
@@ -1056,20 +1068,21 @@ void emit_restore_pv(codegendata *cd) {
        /* Displacement from start of method to here */
 
        offset = (s4) (cd->mcodeptr - cd->mcodebase);
+       offset_imm = -offset - SZ_BASR + N_PV_OFFSET;
 
-       if (N_VALID_IMM(-(offset + SZ_BASR))) {
+       if (N_VALID_IMM(offset_imm)) {
                /* Get program counter */
                N_BASR(REG_PV, RN);
                /* Substract displacement */
-               M_ASUB_IMM(offset + SZ_BASR, REG_PV);
+               M_AADD_IMM(offset_imm, REG_PV);
        } else {
                /* Save program counter and jump over displacement in instruction flow */
                N_BRAS(REG_PV, SZ_BRAS + SZ_LONG);
                /* Place displacement here */
                /* REG_PV points now exactly to this position */
-               N_LONG(offset + SZ_BRAS);
+               N_LONG(-offset - SZ_BRAS + N_PV_OFFSET);
                /* Substract *(REG_PV) from REG_PV */
-               N_S(REG_PV, 0, RN, REG_PV);
+               N_A(REG_PV, 0, RN, REG_PV);
        }
 }
 
index ea839e5c25119df0d7e5dd1f196f6b3615f5f98b..f0f6d13063730ade058aa3552cd9d142e930eeb6 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-abi.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -146,7 +146,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -163,7 +163,7 @@ void md_param_alloc(methoddesc *md)
                        else {
                                /* _ALIGN(stacksize); */
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                iarg          = INT_ARG_CNT;
                                stacksize    += 2;
                        }
@@ -177,7 +177,7 @@ void md_param_alloc(methoddesc *md)
                        }
                        else {
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -191,7 +191,7 @@ void md_param_alloc(methoddesc *md)
                        else {
                                /* _ALIGN(stacksize); */
                                pd->inmemory  = true;
-                               pd->regoff    = stacksize;
+                               pd->regoff    = stacksize * 4;
                                stacksize    += 2;
                        }
                        break;
index 54f8de7119aab4d9e65d6c4048d922b7986cb3fc..8ab9b2a227a45321f401df7a524e3fffca1428ec 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: md.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: md.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -50,6 +50,7 @@
 #include "vm/exceptions.h"
 #include "vm/signallocal.h"
 #include "vm/jit/asmpart.h"
+#include "vm/jit/methodheader.h"
 #include "vm/jit/stacktrace.h"
 
 #if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
@@ -87,6 +88,8 @@ void md_init(void)
 
 void md_dump_context(u1 *pc, mcontext_t *mc) {
        int i;
+       u1 *pv;
+       methodinfo *m;
        
        union {
                u8 l;
@@ -97,6 +100,17 @@ void md_dump_context(u1 *pc, mcontext_t *mc) {
 
        log_println("Program counter: 0x%08X", pc);
 
+       pv = codegen_get_pv_from_pc_nocheck(pc);
+       if (pv == NULL) {
+               log_println("No java method found at location.");
+       } else {
+               m = ((codeinfo *)(pv + CodeinfoPointer))->m;
+               log_println(
+                       "Java method: class %s, method %s, descriptor %s.",
+                       utf_bytes(m->class->name), utf_bytes(m->name), utf_bytes(m->descriptor)
+               );
+       }
+
 #if defined(ENABLE_DISASSEMBLER)
        log_println("Printing instruction at program counter:");
        disassinstr(pc);
@@ -171,7 +185,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
                vm_abort("%s: segmentation fault at %p, aborting.", __FUNCTION__, xpc);
        }
 
-       pv = (u1 *)_mc->gregs[REG_PV];
+       pv = (u1 *)_mc->gregs[REG_PV] - N_PV_OFFSET;
        sp = (u1 *)_mc->gregs[REG_SP];
        ra = xpc;
        type = EXCEPTION_HARDWARE_NULLPOINTER;
@@ -210,7 +224,7 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p) {
                /* bits 3-0 designate the exception type */
                type = xpc[1] & 0xF;  
 
-               pv = (u1 *)_mc->gregs[REG_PV];
+               pv = (u1 *)_mc->gregs[REG_PV] - N_PV_OFFSET;
                sp = (u1 *)_mc->gregs[REG_SP];
                val = (ptrint)_mc->gregs[reg];
 
@@ -281,7 +295,7 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
                } else if (_mc->gregs[r2] == 0) {
                        /* division by 0 */
 
-                       pv = (u1 *)_mc->gregs[REG_PV];
+                       pv = (u1 *)_mc->gregs[REG_PV] - N_PV_OFFSET;
                        sp = (u1 *)_mc->gregs[REG_SP];
                        ra = xpc;
 
@@ -439,7 +453,7 @@ last 2 instructions the same as in invokevirtual
 
 u1 *md_get_method_patch_address(u1 *ra, stackframeinfo *sfi, u1 *mptr)
 {
-       u1  base;
+       u1  base, index;
        s4  offset;
        u1 *pa;                             /* patch address                      */
 
@@ -450,32 +464,48 @@ u1 *md_get_method_patch_address(u1 *ra, stackframeinfo *sfi, u1 *mptr)
        /* get the base register of the load */
 
        base = ra[2] >> 4;
+       index = ra[1] & 0xF;
 
        /* check for the different calls */
 
-       if (base == 0xd) { /* pv relative */
-               /* INVOKESTATIC/SPECIAL */
+       switch (base) {
+               case 0xd:
+                       /* INVOKESTATIC/SPECIAL */
 
-               /* the offset is in the load before the load */
+               
+                       switch (index) {
+                               case 0x0:
+                                       /* the offset is in the load instruction */
+                                       offset = ((*(u2 *)(ra + 2)) & 0xFFF) + N_PV_OFFSET;
+                                       break;
+                               case 0x1:
+                                       /* the offset is in the immediate load before the load */
+                                       offset = *((s2 *) (ra - 2));
+                                       break;
+                               default:
+                                       assert(0);
+                       }
 
-               offset = *((s2 *) (ra - 2));
+                       /* add the offset to the procedure vector */
 
-               /* add the offset to the procedure vector */
+                       pa = sfi->pv + offset;
 
-               pa = sfi->pv + offset;
-       }
-       else if (base == 0xc) { /* mptr relative */
-               /* INVOKEVIRTUAL/INTERFACE */
+                       break;
 
-               offset = *((u2 *)(ra + 2)) & 0xFFF;
+               case 0xc:
+                       /* mptr relative */
+                       /* INVOKEVIRTUAL/INTERFACE */
 
-               /* add offset to method pointer */
-               
-               pa = mptr + offset;
-       }
-       else {
-               /* catch any problems */
-               assert(0); 
+                       offset = *((u2 *)(ra + 2)) & 0xFFF;
+
+                       /* add offset to method pointer */
+                       
+                       pa = mptr + offset;
+                       break;
+               default:
+                       /* catch any problems */
+                       assert(0); 
+                       break;
        }
 
        return pa;
index 5c3cf6709c08d682ce0ce765e237ab3d854dc527..dfbbdfcb33e307865d70fee821370d2138bc6b23 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: patcher.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: patcher.c 8123 2007-06-20 23:50:55Z michi $
 
      GENERATED      PATCHER BRANCH           AFTER PATCH
 
@@ -275,212 +275,6 @@ bool patcher_get_putfield(u1 *sp)
        return true;
 }
 
-
-/* patcher_putfieldconst *******************************************************
-
-   Machine code:
-
-   <patched call position>
-   41 c7 85 00 00 00 00 7b 00 00 00    movl   $0x7b,0x0(%r13)
-
-*******************************************************************************/
-
-bool patcher_putfieldconst(u1 *sp)
-{
-       OOPS();
-       u1               *ra;
-       u8                mcode;
-       unresolved_field *uf;
-       fieldinfo        *fi;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)               *((ptrint *) (sp + 5 * 8));
-       mcode =                      *((u8 *)     (sp + 3 * 8));
-       uf    = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
-
-       /* get the fieldinfo */
-
-       if (!(fi = resolve_field_eager(uf)))
-               return false;
-
-       /* patch back original code */
-
-       *((u8 *) ra) = mcode;
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
-
-       /* patch the field's offset */
-
-       if (IS_2_WORD_TYPE(fi->type) || IS_ADR_TYPE(fi->type)) {
-               /* handle special case when the base register is %r12 */
-
-               if (*(ra + 2) == 0x84) {
-                       *((u4 *) (ra + 4))      = (u4) (fi->offset);
-                       *((u4 *) (ra + 12 + 4)) = (u4) (fi->offset + 4);
-               }
-               else {
-                       *((u4 *) (ra + 3))      = (u4) (fi->offset);
-                       *((u4 *) (ra + 11 + 3)) = (u4) (fi->offset + 4);
-               }
-       }
-       else {
-               /* handle special case when the base register is %r12 */
-
-               if (*(ra + 2) == 0x84)
-                       *((u4 *) (ra + 4)) = (u4) (fi->offset);
-               else
-                       *((u4 *) (ra + 3)) = (u4) (fi->offset);
-       }
-
-       return true;
-}
-
-
-/* patcher_aconst **************************************************************
-
-   Machine code:
-
-   <patched call position>
-   48 bf a0 f0 92 00 00 00 00 00    mov    $0x92f0a0,%rdi
-
-*******************************************************************************/
-
-bool patcher_aconst(u1 *sp)
-{
-       OOPS();
-       u1                *ra;
-       u8                 mcode;
-       constant_classref *cr;
-       classinfo         *c;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)                *((ptrint *) (sp + 5 * 8));
-       mcode =                       *((u8 *)     (sp + 3 * 8));
-       cr    = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
-       /* get the classinfo */
-
-       if (!(c = resolve_classref_eager(cr)))
-               return false;
-
-       /* patch back original code */
-
-       *((u8 *) ra) = mcode;
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
-
-       /* patch the classinfo pointer */
-
-       *((ptrint *) (ra + 2)) = (ptrint) c;
-
-       return true;
-}
-
-
-/* patcher_builtin_multianewarray **********************************************
-
-   Machine code:
-
-   <patched call position>
-   48 bf 02 00 00 00 00 00 00 00    mov    $0x2,%rdi
-   48 be 30 40 b2 00 00 00 00 00    mov    $0xb24030,%rsi
-   48 89 e2                         mov    %rsp,%rdx
-   48 b8 7c 96 4b 00 00 00 00 00    mov    $0x4b967c,%rax
-   48 ff d0                         callq  *%rax
-
-*******************************************************************************/
-
-bool patcher_builtin_multianewarray(u1 *sp)
-{
-       OOPS();
-       u1                *ra;
-       u8                 mcode;
-       constant_classref *cr;
-       classinfo         *c;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)                *((ptrint *) (sp + 5 * 8));
-       mcode =                       *((u8 *)     (sp + 3 * 8));
-       cr    = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
-       /* get the classinfo */
-
-       if (!(c = resolve_classref_eager(cr)))
-               return false;
-
-       /* patch back original code */
-
-       *((u8 *) ra) = mcode;
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
-
-       /* patch the classinfo pointer */
-
-       *((ptrint *) (ra + 10 + 2)) = (ptrint) c;
-
-       return true;
-}
-
-
-/* patcher_builtin_arraycheckcast **********************************************
-
-   Machine code:
-
-   <patched call position>
-   48 be b8 3f b2 00 00 00 00 00    mov    $0xb23fb8,%rsi
-   48 b8 00 00 00 00 00 00 00 00    mov    $0x0,%rax
-   48 ff d0                         callq  *%rax
-
-*******************************************************************************/
-
-bool patcher_builtin_arraycheckcast(u1 *sp)
-{
-       OOPS();
-       u1                *ra;
-       u8                 mcode;
-       constant_classref *cr;
-       classinfo         *c;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)                *((ptrint *) (sp + 5 * 8));
-       mcode =                       *((u8 *)     (sp + 3 * 8));
-       cr    = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
-       /* get the classinfo */
-
-       if (!(c = resolve_classref_eager(cr)))
-               return false;
-
-       /* patch back original code */
-
-       *((u8 *) ra) = mcode;
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
-
-       /* patch the classinfo pointer */
-
-       *((ptrint *) (ra + 2)) = (ptrint) c;
-
-       return true;
-}
-
-
 /* patcher_invokestatic_special ************************************************
 
    Machine code:
@@ -825,102 +619,6 @@ bool patcher_checkcast_instanceof_interface(u1 *sp)
        return true;
 }
 
-
-/* patcher_checkcast_class *****************************************************
-
-   Machine code:
-
-   <patched call position>
-   49 bb 00 00 00 00 00 00 00 00    mov    $0x0,%r11
-   45 8b 92 20 00 00 00             mov    0x20(%r10),%r10d
-   45 8b 9b 20 00 00 00             mov    0x20(%r11),%r11d
-   4d 29 da                         sub    %r11,%r10
-   49 bb 00 00 00 00 00 00 00 00    mov    $0x0,%r11
-
-*******************************************************************************/
-
-bool patcher_checkcast_class(u1 *sp)
-{
-       OOPS();
-       u1                *ra;
-       u8                 mcode;
-       constant_classref *cr;
-       classinfo         *c;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)                *((ptrint *) (sp + 5 * 8));
-       mcode =                       *((u8 *)     (sp + 3 * 8));
-       cr    = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
-       /* get the fieldinfo */
-
-       if (!(c = resolve_classref_eager(cr)))
-               return false;
-
-       /* patch back original code */
-
-       *((u8 *) ra) = mcode;
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
-
-       /* patch super class' vftbl */
-
-       *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
-       *((ptrint *) (ra + 10 + 7 + 7 + 3 + 2)) = (ptrint) c->vftbl;
-
-       return true;
-}
-
-
-/* patcher_instanceof_class ****************************************************
-
-   Machine code:
-
-   <patched call position>
-   49 ba 00 00 00 00 00 00 00 00    mov    $0x0,%r10
-
-*******************************************************************************/
-
-bool patcher_instanceof_class(u1 *sp)
-{
-       OOPS();
-       u1                *ra;
-       u8                 mcode;
-       constant_classref *cr;
-       classinfo         *c;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)                *((ptrint *) (sp + 5 * 8));
-       mcode =                       *((u8 *)     (sp + 3 * 8));
-       cr    = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
-       /* get the fieldinfo */
-
-       if (!(c = resolve_classref_eager(cr)))
-               return false;
-
-       /* patch back original code */
-
-       *((u8 *) ra) = mcode;
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
-
-       /* patch super class' vftbl */
-
-       *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
-
-       return true;
-}
-
-
 /* patcher_clinit **************************************************************
 
    May be used for GET/PUTSTATIC and in native stub.
index 1f423d6f19589fee43d472b03138ccac234379bf..82ce159db6e570bc08781f91c610c72f7ddd0403 100644 (file)
@@ -5,7 +5,7 @@ antlr
        * Wed May  9 23:58:51 CEST 2007: (ibm java) ===== DaCapo antlr PASSED in 269244 msec =====
        * Thu May 10 00:05:50 CEST 2007: ===== DaCapo antlr PASSED in 70164 msec =====
        * Thu May 10 08:54:54 CEST 2007: (ibm java intrp) ===== DaCapo antlr PASSED in 686373 msec =====
-
+       * Sun Jun 17 15:43:49 CEST 2007: ===== DaCapo antlr PASSED in 73151 msec =====
 
 bloat
 
@@ -20,6 +20,8 @@ chart
 eclipse
 
        * executes some of the (non-gui) jdt performance tests for the Eclipse IDE
+       * Mon Jun 11 22:20:00 CEST 2007: ===== DaCapo eclipse PASSED in 1647658 msec =====
+       * Tue Jun 12 19:15:04 CEST 2007: ===== DaCapo eclipse PASSED in 2733857 msec =====
 
 fop
 
@@ -44,6 +46,8 @@ luindex
 lusearch
 
        * Uses lucene to do a text search of keywords over a corpus of data comprising the works of Shakespeare and the King James Bible
+       * Mon Jun 11 17:21:09 CEST 2007: ===== DaCapo lusearch PASSED in 386295 msec =====
+       * Sun Jun 17 15:44:15 CEST 2007: ===== DaCapo lusearch PASSED in 692290 msec =====      * 
 
 pmd
 
@@ -59,3 +63,104 @@ xalan
                => branch to patcher overflow
 
        * HANGUP !
+
+<<<<<<<<<<<<<<<<<<<<<<< Eclispe 10 runs 06.06.2007  >>>>>>>>>>>>>>>>>>>>>>>
+
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+Exception in thread "Java indexing" java.lang.OutOfMemoryError
+   at org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(Util.java:238)
+   at org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(Util.java)
+   at org.eclipse.jdt.internal.core.search.JavaSearchDocument.getCharContents(JavaSearchDocument.java:58)
+   at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexDocument(SourceIndexer.java:87)
+   at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:76)
+   at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java)
+   at org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java)
+   at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java)
+   at java.lang.Thread.run(Thread.java:741)
+   at java.lang.VMThread.run(VMThread.java:148)
+Digest validation failed for stderr.log, expecting 0xda39a3ee5e6b4b0d3255bfef95601890afd80709 found 0xd291dacf7614656c68267e6bb8a3d23fe1815c37
+===== DaCapo eclipse FAILED =====
+Validation FAILED for eclipse small
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 1703309 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2303868 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2458292 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 1642183 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2391901 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 1748244 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2685671 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2100417 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+       AST creation: org.eclipse.jdt.internal.compiler.parser
+Exception in thread "Java indexing" java.lang.OutOfMemoryError
+   at org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(Util.java:238)
+   at org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(Util.java)
+   at org.eclipse.jdt.internal.core.search.JavaSearchDocument.getCharContents(JavaSearchDocument.java:58)
+   at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexDocument(SourceIndexer.java:87)
+   at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:76)
+   at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java)
+   at org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java)
+   at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java)
+   at java.lang.Thread.run(Thread.java:741)
+   at java.lang.VMThread.run(VMThread.java:148)
+Digest validation failed for stderr.log, expecting 0xda39a3ee5e6b4b0d3255bfef95601890afd80709 found 0xd291dacf7614656c68267e6bb8a3d23fe1815c37
+===== DaCapo eclipse FAILED =====
+Validation FAILED for eclipse small
+
+<<<<<<<<<<<<<<<<<<<<<<< End Eclispe 10 runs  >>>>>>>>>>>>>>>>>>>>>>>
index b135b6559702ba31b65dba3cbcb80cfb5d583360..301d7db714de03911b0a8b878ecbf4abf51934d6 100644 (file)
@@ -99,101 +99,52 @@ asm_vm_call_method_float:
 asm_vm_call_method_double:
        
        save %sp,-((JITSTACK_CNT+2)*8),%sp
-       add %sp,JITSTACK,%l1               /* right above window save area */
-
-
-       /* %i1 not needed after _nocopy -> calculate in branch delay */
-
-       brlez %i1, calljava_nocopy
+       add %sp,JITSTACK,%l1               /* pointer to usable stack      */
+
+       /* i0: PV               */
+       /* i1: ptr to arg array */
+       /* i2: num stackargs    */
+
+       ldx [%i1+0*8],%o0
+       ldx [%i1+1*8],%o1
+       ldx [%i1+2*8],%o2
+       ldx [%i1+3*8],%o3
+       ldx [%i1+4*8],%o4
+
+       ldd [%i1+5*8],fa0
+       ldd [%i1+6*8],fa1
+       ldd [%i1+7*8],fa2
+       ldd [%i1+8*8],fa3
+       ldd [%i1+9*8],fa4
+
+       brlez %i2, calljava_nocopy
+       nop /* delay: fill me! */
        
-       dec %i1   /* branch delay */
-       ldx [%i2 + offvmargdata],%o0
-       ldx [%i2 + offvmargtype],%l2
-       cmp %l2,2
-       be,a %xcc,calljava_arg0isfloat
-       ld  [%i2 + offvmargdata],fa0f   /* delay: annulled if branch not taken */
-       ldd [%i2 + offvmargdata],fa0
-calljava_arg0isfloat:
-       brlez %i1,calljava_nocopy
-
-       dec %i1   /* branch delay */
-       ldx [%i2 + (offvmargdata+sizevmarg*1)],%o1
-       ldx [%i2 + (offvmargtype+sizevmarg*1)],%l2
-       cmp %l2,2
-       be,a %xcc,calljava_arg1isfloat
-       ld  [%i2 + (offvmargdata+sizevmarg*1)],fa1f
-       ldd [%i2 + (offvmargdata+sizevmarg*1)],fa1
-calljava_arg1isfloat:
-       brlez %i1,calljava_nocopy
-
-       dec %i1
-       ldx [%i2 + (offvmargdata+sizevmarg*2)],%o2
-       ldx [%i2 + (offvmargtype+sizevmarg*2)],%l2
-       cmp %l2,2
-       be,a %xcc,calljava_arg2isfloat
-       ld  [%i2 + (offvmargdata+sizevmarg*2)],fa2f
-       ldd [%i2 + (offvmargdata+sizevmarg*2)],fa2
-calljava_arg2isfloat:
-       brlez %i1,calljava_nocopy
-
-       dec %i1
-       ldx [%i2 + (offvmargdata+sizevmarg*3)],%o3
-       ldx [%i2 + (offvmargtype+sizevmarg*3)],%l2
-       cmp %l2,2
-       be,a %xcc,calljava_arg3isfloat
-       ld  [%i2 + (offvmargdata+sizevmarg*3)],fa3f
-       ldd [%i2 + (offvmargdata+sizevmarg*3)],fa3
-calljava_arg3isfloat:
-       brlez %i1,calljava_nocopy
-
-       dec %i1
-       ldx [%i2 + (offvmargdata+sizevmarg*4)],%o4
-       ldx [%i2 + (offvmargtype+sizevmarg*4)],%l2
-       cmp %l2,2
-       be,a %xcc,calljava_arg4isfloat
-       ld  [%i2 + (offvmargdata+sizevmarg*4)],fa4f
-       ldd [%i2 + (offvmargdata+sizevmarg*4)],fa4
-calljava_arg4isfloat:
-
-calljava_argsloaded:   
-       brlez %i1, calljava_nocopy
-       nop
-       sllx %i1,3,%l0                     /* remaining args * 8           */
+       sllx %i2,3,%l0                     /* remaining args * 8           */
        sub %sp,%l0,%sp                    /* allocate more stack space    */
        add %sp,JITSTACK,%l1               /* adjust stack begin pointer   */
        
-calljava_copyloop:
-       ldx [%i2 + (offvmargtype+sizevmarg*5)],%l2
-       cmp %l2,2
-       be  %xcc,calljava_copyloop_float
-       nop
-       ldx [%i2 + (offvmargdata+sizevmarg*5)],%l0
-       stx %l0,[%l1]
-       b   calljava_copy_done
-calljava_copyloop_float:
-       ld  [%i2 + (offvmargdata+sizevmarg*5)],%f1      
-       std %f0,[%l1]
-calljava_copy_done:
-       inc sizevmarg,%i2                  /* src++                        */
-       subcc %i1,1,%i1                    /* arg_count--                  */
-       bnz %xcc, calljava_copyloop        /* use cc from previous instr   */
+asm_vm_call_copyloop:
+       ldx [%i1+10*8],%l0                 /* load argument from array     */
+       stx %l0,[%l1]                      /* store argument to stack      */
+
+       inc 8,%i1                          /* src++                        */
+       subcc %i2,1,%i2                    /* arg_count--                  */
+       bnz %xcc, asm_vm_call_copyloop     /* use cc from previous instr   */
        inc 8,%l1                          /* dst++ (delay)                */
-       
+
 
 calljava_nocopy:
        /* set pv, like a java method does */
-       /*      add  ra_caller,(asm_vm_call_method - calljava_nocopy + 8),pv_callee */
        setx  asm_vm_call_method,%l0,pv_callee
        
-       mov   %i0,itmp1         /* pass method info pointer via itmp1 */
+       stx   %i0,[%l1 + 1*8]              /* store PV on stack            */
+       mov   %l1,mptr_itmp2               /* set address of PV (-1*8)     */
        
-       setx  asm_call_jit_compiler,%l0,mptr_itmp2  /* fake virtual function call (2 instr) */
-       stx   mptr_itmp2,[%l1 + 1*8]        /* store function address               */
-       mov   %l1,mptr_itmp2            /* set method pointer                   */
-       
-       ldx  [1*8 + mptr_itmp2], pv_caller          /* method call as in Java               */
-       jmpl pv_caller,ra_caller                      /* call JIT compiler          */
+       ldx  [1*8 + mptr_itmp2], pv_caller /* load PV from stack           */
+       jmpl pv_caller,ra_caller           /* method call as in Java       */
        nop
+
 calljava_jit2:
        /* pretend to restore pv */
        add  ra_caller,(asm_vm_call_method - calljava_jit2 + 8),zero
@@ -326,7 +277,7 @@ asm_handle_exception:
        mov     pv_callee,%g4
 
        /* save bigger stack frame for float args and temps */
-       save    %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+CSTACK_CNT)*8),%sp
+       save    %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+16+CSTACK_CNT)*8),%sp
 
        SAVE_FLOAT_ARGUMENT_REGISTERS(CSTACK_CNT)
        SAVE_FLOAT_TEMPORARY_REGISTERS(CSTACK_CNT+FLT_ARG_CNT)
@@ -417,7 +368,7 @@ asm_patcher_wrapper:
        mov     pv_callee,pv_caller
 
        /* create window and stack frame              */
-       save  %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+CSTACK_CNT+6)*8),%sp
+       save  %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+16+CSTACK_CNT+6)*8),%sp
 
        SAVE_FLOAT_RETURN_REGISTER(CSTACK_CNT)
        SAVE_FLOAT_ARGUMENT_REGISTERS(CSTACK_CNT+1)
index e0c75073404507fb77f791fb08bbaa6456000b81..08f7e426c332c1d4b385789f6f95736f0d525a58 100644 (file)
@@ -141,7 +141,7 @@ bool codegen_emit(jitdata *jd)
 
        {
        s4 i, p, t, l;
-       s4 savedregs_num, localbase;
+       s4 savedregs_num;
 
 #if 0 /* no leaf optimization yet */
        savedregs_num = (jd->isleafmethod) ? 0 : 1;       /* space to save the RA */
@@ -272,24 +272,6 @@ bool codegen_emit(jitdata *jd)
        
        md = m->parseddesc;
 
-       /* when storing locals, use this as base */
-       localbase = JITSTACK;
-       
-       /* since the register allocator does not know about the shifting window
-        * arg regs need to be copied via the stack
-        */
-       if (md->argintreguse > 0) {
-               /* allocate scratch space for copying in to save(i&l) regs */
-               M_SUB_IMM(REG_SP, INT_ARG_CNT * 8, REG_SP);
-               
-               localbase += INT_ARG_CNT * 8;
-               
-               /* XXX could use the param slots on the stack for this! */
-               for (p = 0; p < INT_ARG_CNT; p++)
-                       M_STX(REG_WINDOW_TRANSPOSE(abi_registers_integer_argument[p]), REG_SP, JITSTACK + (p * 8));
-       }
-       
-
        for (p = 0, l = 0; p < md->paramcount; p++) {
                t = md->paramtypes[p].type;
 
@@ -306,31 +288,62 @@ bool codegen_emit(jitdata *jd)
                s1 = md->params[p].regoff;
                
                if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */                        
+
+                       s2 = var->vv.regoff;
                        
                        if (!md->params[p].inmemory) {           /* register arguments    */
-                               /*s2 = rd->argintregs[s1];*/
-                               /*s2 = REG_WINDOW_TRANSPOSE(s2);*/
-                               
-                               /* need the argument index (p) here, not the register number */
+                               s1 = REG_WINDOW_TRANSPOSE(s1);
                                
                                if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
-                                       /*M_INTMOVE(s2, var->vv.regoff);*/                                      
-                                       M_LDX(var->vv.regoff, REG_SP, JITSTACK + (p * 8));
 
-                               } else {                             /* reg arg -> spilled    */
-                                       /*M_STX(s2, REG_SP, (WINSAVE_CNT + var->vv.regoff) * 8);*/
-                                       
-                                       M_LDX(REG_ITMP1, REG_SP, JITSTACK + (p * 8));
-                                       M_STX(REG_ITMP1, REG_SP, localbase + (var->vv.regoff * 8));
+                                       /* the register allocator does not know about the window. */
+                                       /* avoid copying the locals from save to save regs by     */
+                                       /* swapping variables.                                    */
+
+                                       {
+                                       int old_dest = var->vv.regoff;
+                                       int new_dest = p + 24;
+
+                                       /* run through all variables */
+
+                                       for (i = 0; i < jd->varcount; i++) {
+                                               varinfo* uvar = VAR(i);
+
+                                               if (IS_FLT_DBL_TYPE(uvar->type))
+                                                       continue;
+
+                                               s2 = uvar->vv.regoff;
+
+                                               /* free the in reg by moving all other references */
+
+                                               if (s2 == new_dest) {
+                                                       uvar->vv.regoff = old_dest;
+                                                       /*printf("p%d-var[%d]: moved %d -> %d (to free save reg)\n", p, i, s2, old_dest);*/
+                                               }
+
+                                               /* move all variables to the in reg */
+
+                                               if (s2 == old_dest) {
+                                                       uvar->vv.regoff = new_dest;
+                                                       /*printf("p%d-var[%d]: moved %d -> %d (to avoid copy)\n", p, i, s2, new_dest);*/
+                                               }
+                                       }
+                                       }
+
+
+
+                               } 
+                               else {                             /* reg arg -> spilled    */
+                                       M_STX(s1, REG_SP, JITSTACK + var->vv.regoff);
                                }
 
                        } else {                                 /* stack arguments       */
                                if (!(var->flags & INMEMORY)) {      /* stack arg -> register */
-                                       M_LDX(var->vv.regoff, REG_FP, JITSTACK + (s1 * 8));
+                                       M_LDX(var->vv.regoff, REG_FP, JITSTACK + s1);
 
                                } else {                             /* stack arg -> spilled  */
                                        /* add the callers window save registers */
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                                }
                        }
                
@@ -340,27 +353,20 @@ bool codegen_emit(jitdata *jd)
                                        M_FLTMOVE(s1, var->vv.regoff);
 
                                } else {                                         /* reg arg -> spilled    */
-                                       M_DST(s1, REG_SP, localbase + (var->vv.regoff) * 8);
+                                       M_DST(s1, REG_SP, JITSTACK + var->vv.regoff);
                                }
 
                        } else {                                 /* stack arguments       */
                                if (!(var->flags & INMEMORY)) {      /* stack-arg -> register */
-                                       M_DLD(var->vv.regoff, REG_FP, JITSTACK + (s1 * 8));
+                                       M_DLD(var->vv.regoff, REG_FP, JITSTACK + s1);
 
                                } else {                             /* stack-arg -> spilled  */
-                                       var->vv.regoff = cd->stackframesize + s1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1;
                                }
                        }
                }
        } /* end for */
        
-       if (md->argintreguse > 0) {
-               /* release scratch space */
-               M_ADD_IMM(REG_SP, INT_ARG_CNT * 8, REG_SP);
-       }
-
-
-
        
        }
        
@@ -2466,7 +2472,7 @@ gen_method:
                                        } 
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                               M_STX(s1, REG_SP, JITSTACK + d * 8);
+                                               M_STX(s1, REG_SP, JITSTACK + d);
                                        }
                                }
                                else {
@@ -2484,7 +2490,7 @@ gen_method:
                                        }
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_FTMP1);
-                                               M_DST(s1, REG_SP, JITSTACK + d * 8);
+                                               M_DST(s1, REG_SP, JITSTACK + d);
                                        }
                                }
                        }
@@ -3161,8 +3167,8 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                        s2 = nat_argintregs[nmd->params[j].regoff];
                                        M_INTMOVE(s1, s2);
                                } else {
-                                       s2 = nmd->params[j].regoff - 6;
-                                       M_AST(s1, REG_SP, CSTACK + s2 * 8);
+                                       s2 = nmd->params[j].regoff - 6 * 8;
+                                       M_AST(s1, REG_SP, CSTACK + s2);
                                }
 
                        } else {
@@ -3175,10 +3181,10 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                        assert(false); /* path never taken */
                                }
 
-                               s1 = md->params[i].regoff + cd->stackframesize;
-                               s2 = nmd->params[j].regoff - 6;
-                               M_ALD(REG_ITMP1, REG_SP, CSTACK + s1 * 8);
-                               M_AST(REG_ITMP1, REG_SP, CSTACK + s2 * 8);
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
+                               s2 = nmd->params[j].regoff - 6 * 8;
+                               M_ALD(REG_ITMP1, REG_SP, CSTACK + s1);
+                               M_AST(REG_ITMP1, REG_SP, CSTACK + s2);
                        }
 
                } else {
@@ -3210,25 +3216,25 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
 
                        } 
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize;
+                               s1 = md->params[i].regoff + cd->stackframesize * 8;
 
                                if (!nmd->params[j].inmemory) {
 
                                        /* JIT stack -> NAT reg */
 
                                        s2 = nmd->params[j].regoff; 
-                                       M_DLD(s2, REG_SP, CSTACK + s1 * 8);
+                                       M_DLD(s2, REG_SP, CSTACK + s1);
                                }
                                else {
 
                                        /* JIT stack -> NAT stack */
 
-                                       s2 = nmd->params[j].regoff - 6;
+                                       s2 = nmd->params[j].regoff - 6 * 8;
 
                                        /* The FTMP register may already be loaded with args */
                                        /* we know $f0 is unused because of the env pointer  */
-                                       M_DLD(REG_F0, REG_SP, CSTACK + s1 * 8);
-                                       M_DST(REG_F0, REG_SP, CSTACK + s2 * 8);
+                                       M_DLD(REG_F0, REG_SP, CSTACK + s1);
+                                       M_DST(REG_F0, REG_SP, CSTACK + s2);
                                }
                        }
                }
index 03575db907e0781d85f53762d63603e106f3eabe..7eaa9df98a8dcb18b1ef70a12e9dc9833cffe34c 100644 (file)
@@ -73,9 +73,9 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        cd = jd->cd;
 
        if (src->flags & INMEMORY) {
-               COUNT_SPILLS;
+               COUNT_READ_SPILLS(src)
 
-               disp = JITSTACK + src->vv.regoff * 8;
+               disp = JITSTACK + src->vv.regoff;
 
                switch(src->type)
                {
@@ -118,9 +118,9 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
        cd = jd->cd;
 
        if (dst->flags & INMEMORY) {
-               COUNT_SPILLS;
+               COUNT_WRITE_SPILLS(dst)
 
-               disp = JITSTACK + dst->vv.regoff * 8;                   
+               disp = JITSTACK + dst->vv.regoff;
                        
                switch(dst->type)
                {
index 2bae87b45bbdaf043dafa314f29fd9aea717a13d..8607b7fe87b71debcfa1a32dff7322de8d78b035 100644 (file)
@@ -190,20 +190,26 @@ void md_icacheflush(u1 *addr, s4 nbytes)
 
 void md_critical_section_restart(ucontext_t *_uc)
 {
-       mcontext_t *_mc;
+       /* mcontext_t *_mc; */
+       sigcontext *ctx;
        u1         *pc;
        u1         *npc;
 
-       _mc = &_uc->uc_mcontext;
+       printf("ignoring md_critical_section_restart\n");
+       return;
 
-       pc = (u1 *) _mc->mc_gregs[MC_PC];
+       /* again, we are getting sigcontext instead of ucontext */
+       ctx = (sigcontext *) _uc;
+       
+       pc = (u1 *) ctx->sigc_regs.tpc;
 
        npc = critical_find_restart_point(pc);
-       assert(npc);
 
-       _mc->mc_gregs[MC_NPC] = (ptrint) npc;
+       if (npc != NULL) {
+               log_println("md_critical_section_restart: pc=%p, npc=%p", pc, npc);
+               ctx->sigc_regs.tnpc = (ptrint) npc;
+       }
 
-       assert(false); /* test this */
 }
 #endif
        
index a7ea007bd2a0fe38bd54a5d1ef9b4cfeef123f83..3c56b6f942b8a47dde557a3c35ea747141ffee70 100644 (file)
@@ -58,8 +58,8 @@ s4 nregdescint[] = {
        /* l0    l1       l2       l3       l4       l5       l6       l7     */
        REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
        
-       /* i0/v0 i1       i2       i3       i4       pv/i5    fp/i6    ra/i7  */
-       REG_RET, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_RES, REG_RES, REG_RES,
+       /* i0    i1       i2       i3       i4       pv/i5    fp/i6    ra/i7  */
+       REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_RES, REG_RES, REG_RES,
        REG_END
 };
 
@@ -87,6 +87,7 @@ const s4 abi_registers_integer_saved[] = {
        21, /* l5  */
        22, /* l6  */
        23, /* l7  */
+       24, /* i0  */
        25, /* i1  */
        26, /* i2  */
        27, /* i3  */
@@ -165,13 +166,15 @@ void md_param_alloc(methoddesc *md)
                case TYPE_LNG:
                        if (i < INT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index = reguse;
                                pd->regoff   = abi_registers_integer_argument[reguse];
                                reguse++;
                                md->argintreguse = reguse;
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->index = stacksize;
+                               pd->regoff = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -180,13 +183,15 @@ void md_param_alloc(methoddesc *md)
                case TYPE_DBL:
                        if (i < FLT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index = reguse;
                                pd->regoff   = abi_registers_float_argument[reguse];
                                reguse++;
                                md->argfltreguse = reguse;
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->index = stacksize;
+                               pd->regoff = stacksize * 8;
                                stacksize++;
                        }
                        break;
index db7735914cb81e8a53496b75e90cbf398fd2c481..55c434a7e6300bb520e95d4a5a9b5eb4a4b6efdf 100644 (file)
@@ -87,7 +87,7 @@
 
 
 #define INT_REG_CNT     32   /* number of integer registers                   */
-#define INT_SAV_CNT     12   /* number of int callee saved registers          */
+#define INT_SAV_CNT     13   /* number of int callee saved registers          */
 #define INT_ARG_CNT      5   /* number of int argument registers (-1 for PV)  */
 #define INT_TMP_CNT      0   /* int temp registers (%g4-%g5)                  */
 #define INT_RES_CNT     14   /* number of reserved integer registers          */
 
 /* applies when the caller's window was saved */
 #define REG_WINDOW_TRANSPOSE(reg) \
-       (reg + 16)
+       (reg + 16 * 8)
 
 #endif /* _MD_ABI_H */
 
index e4c96020f0f283fe66295b5ae9818616dbbb03c3..5c8da95b312b07433ae5a46dd9600b6acae2472c 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: genoffsets.c 7291 2007-02-06 08:49:08Z twisti $
+   $Id: genoffsets.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 #include "vm/jit/asmpart.h"
 #include "vm/jit/replace.h"
 
-#include "vmcore/class.h"
-#include "vmcore/linker.h"
-#include "vmcore/method.h"
-
 
 int main(int argc, char **argv)
 {
@@ -60,18 +56,11 @@ int main(int argc, char **argv)
 
     printf("\n\n/* define some offsets */\n\n");
 
-       printf("#define offobjvftbl                %3d\n", (s4) OFFSET(java_objectheader, vftbl));
-       printf("\n\n");
-
        printf("/* vftbl_t */\n\n");
        printf("#define offbaseval                 %3d\n", (s4) OFFSET(vftbl_t, baseval));
        printf("#define offdiffval                 %3d\n", (s4) OFFSET(vftbl_t, diffval));
        printf("\n\n");
 
-       printf("/* classinfo */\n\n");
-       printf("#define offclassvftbl              %3d\n", (s4) OFFSET(classinfo, vftbl));
-       printf("\n\n");
-
        printf("#define offvmargtype               %3d\n", (s4) OFFSET(vm_arg, type));
        printf("#define offvmargdata               %3d\n", (s4) OFFSET(vm_arg, data));
        printf("\n\n");
index cd3a8124af3481772032803607573918b3f028a9..9183e4b17dfcc7222119c9098f4778d31df725a7 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Edwin Steiner
-
    $Id$
 
 */
index 382d041a7adf908b117bb6f4c1bbe330f7b92a04..9d3cd85435348f51009d5bc69d660fb6b871c417 100644 (file)
@@ -43,6 +43,8 @@
 #include "vm/jit/stack.h"
 #include "vm/jit/verify/typecheck-common.h"
 
+#include "vmcore/primitive.h"
+
 
 /* this #if runs over the whole file: */
 #if defined(ENABLE_VERIFIER)
index 6a3486adcba0e990dd2755099dd313b994bd0434..d1a690001df1ac94e1e2a297ab5c1563c5ce9c2f 100644 (file)
 #include <string.h>
 
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+
 #include "native/native.h"
 
+#include "toolbox/logging.h"
+
 #include "vm/access.h"
 #include "vm/builtin.h"
 #include "vm/exceptions.h"
+#include "vm/resolve.h"
 #include "vm/vm.h"
 
 #include "vm/jit/patcher.h"
@@ -51,7 +54,7 @@
 
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
 
 #define TYPECHECK_NO_STATISTICS
 #include <typecheck-common.h>
index cf24b0726a3d19ae359ed70cb0e716cec40b495c..8767c35053871469c85f0f823f0383931d080f37 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: typecheck.c 7766 2007-04-19 13:24:48Z michi $
+   $Id: typecheck.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -146,15 +146,17 @@ error reporting.
 #ifdef ENABLE_VERIFIER
 
 #include "mm/memory.h"
+
 #include "native/native.h"
 
 #include "toolbox/logging.h"
 
+#include "vm/access.h"
 #include "vm/builtin.h"
 #include "vm/exceptions.h"
 #include "vm/global.h"
+#include "vm/resolve.h"
 
-#include "vm/access.h"
 #include "vm/jit/jit.h"
 #include "vm/jit/parse.h"
 #include "vm/jit/patcher.h"
@@ -162,7 +164,7 @@ error reporting.
 
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
 
 #include <typecheck-common.h>
 
index e17dfe28bad416ee99f046f5e2261ee5632f2250..8e32e146036a59e90008ce31d280f937965fc0af 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: typeinfo.c 7766 2007-04-19 13:24:48Z michi $
+   $Id: typeinfo.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -36,6 +36,7 @@
 #include "toolbox/logging.h"
 
 #include "vm/exceptions.h"
+#include "vm/resolve.h"
 
 #include "vm/jit/jit.h"
 #include "vm/jit/verify/typeinfo.h"
@@ -43,7 +44,7 @@
 #include "vmcore/class.h"
 #include "vmcore/descriptor.h"
 #include "vmcore/loader.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
 
 
 /* check if a linked class is an array class. Only use for linked classes! */
index 7bfed9729fd25082762a049b5d011518df90d635..bdf498d14c943d0e6aa9dc7628197dd11d358bd3 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7688 2007-04-12 09:05:12Z michi $
+   $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -122,96 +122,58 @@ asm_vm_call_method_double:
        mov     s3,4*8(sp)
        mov     s4,5*8(sp)
 
-       mov     a0,itmp1                    /* move method pointer for compiler   */
-       xor     %rbp,%rbp                   /* set argument stack frame to zero   */
+       mov     a0,6*8(sp)                  /* store method PV                    */
 
-       test    a1,a1                       /* maybe we have no args...           */
-       jle     L_copy_done
+       mov     sp,s0                       /* save stack pointer                 */
 
-       mov     a1,itmp3                    /* arg count                          */
-       mov     a2,itmp2                    /* pointer to arg block               */
+       mov     a1,t0                       /* address of data structure          */
+       mov     a2,itmp1                    /* number of stack arguments          */
 
-       mov     itmp2,%r14                  /* save argument block pointer        */
-       mov     itmp3,%r15                  /* save argument count                */
+       mov     0*8(t0),a0
+       mov     1*8(t0),a1
+       mov     2*8(t0),a2
+       mov     3*8(t0),a3
+       mov     4*8(t0),a4
+       mov     5*8(t0),a5
 
-       sub     $sizevmarg,itmp2            /* initialize pointer (smaller code)  */
-       add     $1,itmp3                    /* initialize argument count          */
-       xor     %r12,%r12                   /* initialize integer argument counter*/
-       xor     %r13,%r13                   /* initialize float argument counter  */
+       movq    6*8(t0),fa0
+       movq    7*8(t0),fa1
+       movq    8*8(t0),fa2
+       movq    9*8(t0),fa3
+       movq    10*8(t0),fa4
+       movq    11*8(t0),fa5
+       movq    12*8(t0),fa6
+       movq    13*8(t0),fa7
 
-L_register_copy:
-       add     $sizevmarg,itmp2            /* goto next argument block           */
-       dec     itmp3                       /* argument count - 1                 */
-       jz      L_register_copy_done
-       andb    $0x02,offvmargtype(itmp2)   /* is this a float/double type?       */
-       jnz     L_register_handle_float     /* yes, handle it                     */
+       cmp     $0,itmp1l
+       je      L_asm_vm_call_method_stack_copy_done
 
-       cmp     $INT_ARG_CNT,%r12           /* are we out of integer argument     */
-       je      L_register_copy             /* register? yes, next loop           */
+       mov     itmp1,itmp2
+       and     $0xfffffffffffffffe,itmp2   /* keep stack 16-byte aligned         */
+       shl     $3,itmp2                    /* calculate stack size               */
+       sub     itmp2,sp                    /* create stack frame                 */
+       mov     sp,itmp2                    /* temporary stack pointer            */
 
-       lea     jumptable_integer(%rip),%rbp
-       mov     0(%rbp,%r12,8),%rbx
-       inc     %r12                      /* integer argument counter + 1         */
-       jmp     *%rbx
+L_asm_vm_call_method_stack_copy_loop:
+       mov     14*8(t0),itmp3              /* load argument                      */
+       mov     itmp3,0(itmp2)              /* store argument on stack            */
 
-L_register_handle_float:
-       cmp     $FLT_ARG_CNT,%r13         /* are we out of float argument         */
-       je      L_register_copy           /* register? yes, next loop             */
+       sub     $1,itmp1l                   /* subtract 1 argument                */
+       add     $8,t0                       /* set address of next argument       */
+       add     $8,itmp2                    /* increase SP                        */
 
-       lea     jumptable_float(%rip),%rbp
-       mov     0(%rbp,%r13,8),%rbx
-       inc     %r13                      /* float argument counter + 1           */
-       jmp     *%rbx
-       
-L_register_copy_done:
-       mov     %r15,%rbp                 /* calculate remaining arguments        */
-       sub     %r12,%rbp                 /* - integer arguments in registers     */
-       sub     %r13,%rbp                 /* - float arguments in registers       */
-       jle     L_copy_done               /* are all assigned to registers?       */
-
-       and     $0xfffffffffffffffe,%rbp  /* keep stack 16-byte aligned           */
-       shl     $3,%rbp                   /* calculate stack size                 */
-       sub     %rbp,sp                   /* stack frame for arguments            */
-       mov     sp,%rbx                   /* use %rbx as temp sp                  */
-
-       sub     $sizevmarg,%r14           /* initialize pointer (smaller code)    */
-       add     $1,%r15                   /* initialize argument count            */
-               
-L_stack_copy_loop:
-       add     $sizevmarg,%r14           /* goto next argument block             */
-       dec     %r15                      /* are there any arguments left?        */
-       jz      L_copy_done               /* no test needed after dec             */
-
-       andb    $0x02,offvmargtype(%r14)    /* is this a float/double type?       */
-       jnz     L_stack_handle_float
-       dec     %r12                        /* arguments assigned to registers    */
-       jge     L_stack_copy_loop
-       jmp     L_stack_copy
-
-L_stack_handle_float:
-       dec     %r13                        /* arguments assigned to registers    */
-       jge     L_stack_copy_loop
-
-L_stack_copy:
-       mov     offvmargdata(%r14),itmp3    /* copy s8 argument onto stack        */
-       mov     itmp3,0(%rbx)
-       add     $8,%rbx                     /* increase sp to next argument       */
-       jmp     L_stack_copy_loop
-
-L_copy_done:
-                                           /* itmp1 still contains method pointer*/
-       lea     L_asm_call_jit_compiler(%rip),mptr
-       mov     sp,itmp3                    /* calculate the old stack pointer    */
-       add     bp,itmp3
-       mov     mptr,6*8(itmp3)
-       lea     (6*8-256)(itmp3),mptr       /* We subtract 256 to force the next  */
+       cmp     $0,itmp1l
+       jg      L_asm_vm_call_method_stack_copy_loop
+
+L_asm_vm_call_method_stack_copy_done:
+       lea     (6*8-256)(s0),mptr          /* We subtract 256 to force the next  */
                                            /* move instruction to have a 32-bit  */
                                            /* offset.                            */
 
-       mov     (0*8+256)(mptr),itmp3       /* method call as in Java             */
-       call    *itmp3                      /* call JIT compiler                  */
+       mov     (0*8+256)(mptr),itmp3       /* load PV                            */
+       call    *itmp3
 
-       add     bp,sp                       /* remove argument stack frame if any */
+       mov     s0,sp                       /* restore SP                         */
 
 L_asm_vm_call_method_return:
        mov     0*8(sp),%rbx                /* restore callee saved registers     */
@@ -228,73 +190,10 @@ asm_vm_call_method_exception_handler:
        call    builtin_throw_exception@PLT
        jmp     L_asm_vm_call_method_return
 
-
-jumptable_integer:
-       .quad   handle_a0
-       .quad   handle_a1
-       .quad   handle_a2
-       .quad   handle_a3
-       .quad   handle_a4
-       .quad   handle_a5
-
-handle_a0:
-       mov     offvmargdata(itmp2),a0
-       jmp     L_register_copy
-handle_a1:
-       mov     offvmargdata(itmp2),a1
-       jmp     L_register_copy
-handle_a2:
-       mov     offvmargdata(itmp2),a2
-       jmp     L_register_copy
-handle_a3:
-       mov     offvmargdata(itmp2),a3
-       jmp     L_register_copy
-handle_a4:
-       mov     offvmargdata(itmp2),a4
-       jmp     L_register_copy
-handle_a5:
-       mov     offvmargdata(itmp2),a5
-       jmp     L_register_copy
-
-
-jumptable_float:
-       .quad   handle_fa0
-       .quad   handle_fa1
-       .quad   handle_fa2
-       .quad   handle_fa3
-       .quad   handle_fa4
-       .quad   handle_fa5
-       .quad   handle_fa6
-       .quad   handle_fa7
-
-handle_fa0:
-       movq    offvmargdata(itmp2),fa0
-       jmp     L_register_copy
-handle_fa1:
-       movq    offvmargdata(itmp2),fa1
-       jmp     L_register_copy
-handle_fa2:
-       movq    offvmargdata(itmp2),fa2
-       jmp     L_register_copy
-handle_fa3:
-       movq    offvmargdata(itmp2),fa3
-       jmp     L_register_copy
-handle_fa4:
-       movq    offvmargdata(itmp2),fa4
-       jmp     L_register_copy
-handle_fa5:
-       movq    offvmargdata(itmp2),fa5
-       jmp     L_register_copy
-handle_fa6:
-       movq    offvmargdata(itmp2),fa6
-       jmp     L_register_copy
-handle_fa7:
-       movq    offvmargdata(itmp2),fa7
-       jmp     L_register_copy
-
 asm_vm_call_method_end:
        nop
 
+
 /****************** function asm_call_jit_compiler *****************************
 *                                                                              *
 *   invokes the compiler for untranslated JavaVM methods.                      *
index 51fb74a7311a6f3963cd8943ecc793fd5f5ef7cb..2f169d62c5ec340e2704eea5c92d6ba23593f002 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8039 2007-06-07 13:46:55Z michi $
+   $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -234,14 +234,14 @@ bool codegen_emit(jitdata *jd)
                                if (!IS_INMEMORY(var->flags))
                                        M_INTMOVE(s1, var->vv.regoff);
                                else
-                                   M_LST(s1, REG_SP, var->vv.regoff * 8);
+                                   M_LST(s1, REG_SP, var->vv.regoff);
                        }
                        else {                                 /* stack arguments       */
                                if (!IS_INMEMORY(var->flags))
                                        /* + 8 for return address */
-                                       M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8 + 8);
+                                       M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1 + 8);
                                else
-                                       var->vv.regoff = cd->stackframesize + s1 + 1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1 + 8;
                        }
                }
                else {                                     /* floating args         */
@@ -249,13 +249,13 @@ bool codegen_emit(jitdata *jd)
                                if (!IS_INMEMORY(var->flags))
                                        M_FLTMOVE(s1, var->vv.regoff);
                                else
-                                       M_DST(s1, REG_SP, var->vv.regoff * 8);
+                                       M_DST(s1, REG_SP, var->vv.regoff);
                        }
                        else {                                 /* stack arguments       */
                                if (!IS_INMEMORY(var->flags))
-                                       M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8 + 8);
+                                       M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1 + 8);
                                else
-                                       var->vv.regoff = cd->stackframesize + s1 + 1;
+                                       var->vv.regoff = cd->stackframesize * 8 + s1 + 8;
                        }
                }
        }
@@ -2394,7 +2394,7 @@ gen_method:
                                        }
                                        else {
                                                s1 = emit_load(jd, iptr, var, REG_ITMP1);
-                                               M_LST(s1, REG_SP, d * 8);
+                                               M_LST(s1, REG_SP, d);
                                        }
                                }
                                else {
@@ -2406,9 +2406,9 @@ gen_method:
                                                s1 = emit_load(jd, iptr, var, REG_FTMP1);
 
                                                if (IS_2_WORD_TYPE(var->type))
-                                                       M_DST(s1, REG_SP, d * 8);
+                                                       M_DST(s1, REG_SP, d);
                                                else
-                                                       M_FST(s1, REG_SP, d * 8);
+                                                       M_FST(s1, REG_SP, d);
                                        }
                                }
                        }
@@ -3251,12 +3251,12 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                                if (!nmd->params[j].inmemory)
                                        M_INTMOVE(s1, s2);
                                else
-                                       M_LST(s1, REG_SP, s2 * 8);
+                                       M_LST(s1, REG_SP, s2);
                        }
                        else {
-                               s1 = md->params[i].regoff + cd->stackframesize + 1;/* +1 (RA) */
-                               M_LLD(REG_ITMP1, REG_SP, s1 * 8);
-                               M_LST(REG_ITMP1, REG_SP, s2 * 8);
+                               s1 = md->params[i].regoff + cd->stackframesize * 8 + 8;/* +1 (RA) */
+                               M_LLD(REG_ITMP1, REG_SP, s1);
+                               M_LST(REG_ITMP1, REG_SP, s2);
                        }
                }
                else {
@@ -3264,15 +3264,15 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f)
                           argument registers keep unchanged. */
 
                        if (md->params[i].inmemory) {
-                               s1 = md->params[i].regoff + cd->stackframesize + 1;/* +1 (RA) */
+                               s1 = md->params[i].regoff + cd->stackframesize * 8 + 8;/* +1 (RA) */
 
                                if (IS_2_WORD_TYPE(t)) {
-                                       M_DLD(REG_FTMP1, REG_SP, s1 * 8);
-                                       M_DST(REG_FTMP1, REG_SP, s2 * 8);
+                                       M_DLD(REG_FTMP1, REG_SP, s1);
+                                       M_DST(REG_FTMP1, REG_SP, s2);
                                }
                                else {
-                                       M_FLD(REG_FTMP1, REG_SP, s1 * 8);
-                                       M_FST(REG_FTMP1, REG_SP, s2 * 8);
+                                       M_FLD(REG_FTMP1, REG_SP, s1);
+                                       M_FST(REG_FTMP1, REG_SP, s2);
                                }
                        }
                }
index 10c6efba064b78dd02b8149468df0d5c9410cd51..356590e3cbca8f422dbb36d30a016ef6aa943dd4 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+   $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -74,7 +74,7 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
        if (IS_INMEMORY(src->flags)) {
                COUNT_SPILLS;
 
-               disp = src->vv.regoff * 8;
+               disp = src->vv.regoff;
 
                switch (src->type) {
                case TYPE_INT:
@@ -151,7 +151,7 @@ inline void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
        if (IS_INMEMORY(dst->flags)) {
                COUNT_SPILLS;
 
-               disp = dst->vv.regoff * 8;
+               disp = dst->vv.regoff;
 
                switch (dst->type) {
                case TYPE_INT:
@@ -815,53 +815,53 @@ void emit_ishift(jitdata *jd, s4 shift_op, instruction *iptr)
        if (IS_INMEMORY(v_dst->flags)) {
                if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
                        if (s1 == d) {
-                               M_ILD(RCX, REG_SP, s2 * 8);
-                               emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+                               M_ILD(RCX, REG_SP, s2);
+                               emit_shiftl_membase(cd, shift_op, REG_SP, d);
 
                        } else {
-                               M_ILD(RCX, REG_SP, s2 * 8);
-                               M_ILD(REG_ITMP2, REG_SP, s1 * 8);
+                               M_ILD(RCX, REG_SP, s2);
+                               M_ILD(REG_ITMP2, REG_SP, s1);
                                emit_shiftl_reg(cd, shift_op, REG_ITMP2);
-                               M_IST(REG_ITMP2, REG_SP, d * 8);
+                               M_IST(REG_ITMP2, REG_SP, d);
                        }
 
                } else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
                        /* s1 may be equal to RCX */
                        if (s1 == RCX) {
                                if (s2 == d) {
-                                       M_ILD(REG_ITMP1, REG_SP, s2 * 8);
-                                       M_IST(s1, REG_SP, d * 8);
+                                       M_ILD(REG_ITMP1, REG_SP, s2);
+                                       M_IST(s1, REG_SP, d);
                                        M_INTMOVE(REG_ITMP1, RCX);
 
                                } else {
-                                       M_IST(s1, REG_SP, d * 8);
-                                       M_ILD(RCX, REG_SP, s2 * 8);
+                                       M_IST(s1, REG_SP, d);
+                                       M_ILD(RCX, REG_SP, s2);
                                }
 
                        } else {
-                               M_ILD(RCX, REG_SP, s2 * 8);
-                               M_IST(s1, REG_SP, d * 8);
+                               M_ILD(RCX, REG_SP, s2);
+                               M_IST(s1, REG_SP, d);
                        }
 
-                       emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+                       emit_shiftl_membase(cd, shift_op, REG_SP, d);
 
                } else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
                        if (s1 == d) {
                                M_INTMOVE(s2, RCX);
-                               emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+                               emit_shiftl_membase(cd, shift_op, REG_SP, d);
 
                        } else {
                                M_INTMOVE(s2, RCX);
-                               M_ILD(REG_ITMP2, REG_SP, s1 * 8);
+                               M_ILD(REG_ITMP2, REG_SP, s1);
                                emit_shiftl_reg(cd, shift_op, REG_ITMP2);
-                               M_IST(REG_ITMP2, REG_SP, d * 8);
+                               M_IST(REG_ITMP2, REG_SP, d);
                        }
 
                } else {
                        /* s1 may be equal to RCX */
-                       M_IST(s1, REG_SP, d * 8);
+                       M_IST(s1, REG_SP, d);
                        M_INTMOVE(s2, RCX);
-                       emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+                       emit_shiftl_membase(cd, shift_op, REG_SP, d);
                }
 
                M_INTMOVE(REG_ITMP1, RCX);                             /* restore RCX */
@@ -873,19 +873,19 @@ void emit_ishift(jitdata *jd, s4 shift_op, instruction *iptr)
                }
                                        
                if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
-                       M_ILD(RCX, REG_SP, s2 * 8);
-                       M_ILD(d, REG_SP, s1 * 8);
+                       M_ILD(RCX, REG_SP, s2);
+                       M_ILD(d, REG_SP, s1);
                        emit_shiftl_reg(cd, shift_op, d);
 
                } else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
                        /* s1 may be equal to RCX */
                        M_INTMOVE(s1, d);
-                       M_ILD(RCX, REG_SP, s2 * 8);
+                       M_ILD(RCX, REG_SP, s2);
                        emit_shiftl_reg(cd, shift_op, d);
 
                } else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
                        M_INTMOVE(s2, RCX);
-                       M_ILD(d, REG_SP, s1 * 8);
+                       M_ILD(d, REG_SP, s1);
                        emit_shiftl_reg(cd, shift_op, d);
 
                } else {
@@ -942,53 +942,53 @@ void emit_lshift(jitdata *jd, s4 shift_op, instruction *iptr)
        if (IS_INMEMORY(v_dst->flags)) {
                if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
                        if (s1 == d) {
-                               M_ILD(RCX, REG_SP, s2 * 8);
-                               emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+                               M_ILD(RCX, REG_SP, s2);
+                               emit_shift_membase(cd, shift_op, REG_SP, d);
 
                        } else {
-                               M_ILD(RCX, REG_SP, s2 * 8);
-                               M_LLD(REG_ITMP2, REG_SP, s1 * 8);
+                               M_ILD(RCX, REG_SP, s2);
+                               M_LLD(REG_ITMP2, REG_SP, s1);
                                emit_shift_reg(cd, shift_op, REG_ITMP2);
-                               M_LST(REG_ITMP2, REG_SP, d * 8);
+                               M_LST(REG_ITMP2, REG_SP, d);
                        }
 
                } else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
                        /* s1 may be equal to RCX */
                        if (s1 == RCX) {
                                if (s2 == d) {
-                                       M_ILD(REG_ITMP1, REG_SP, s2 * 8);
-                                       M_LST(s1, REG_SP, d * 8);
+                                       M_ILD(REG_ITMP1, REG_SP, s2);
+                                       M_LST(s1, REG_SP, d);
                                        M_INTMOVE(REG_ITMP1, RCX);
 
                                } else {
-                                       M_LST(s1, REG_SP, d * 8);
-                                       M_ILD(RCX, REG_SP, s2 * 8);
+                                       M_LST(s1, REG_SP, d);
+                                       M_ILD(RCX, REG_SP, s2);
                                }
 
                        } else {
-                               M_ILD(RCX, REG_SP, s2 * 8);
-                               M_LST(s1, REG_SP, d * 8);
+                               M_ILD(RCX, REG_SP, s2);
+                               M_LST(s1, REG_SP, d);
                        }
 
-                       emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+                       emit_shift_membase(cd, shift_op, REG_SP, d);
 
                } else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
                        if (s1 == d) {
                                M_INTMOVE(s2, RCX);
-                               emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+                               emit_shift_membase(cd, shift_op, REG_SP, d);
 
                        } else {
                                M_INTMOVE(s2, RCX);
-                               M_LLD(REG_ITMP2, REG_SP, s1 * 8);
+                               M_LLD(REG_ITMP2, REG_SP, s1);
                                emit_shift_reg(cd, shift_op, REG_ITMP2);
-                               M_LST(REG_ITMP2, REG_SP, d * 8);
+                               M_LST(REG_ITMP2, REG_SP, d);
                        }
 
                } else {
                        /* s1 may be equal to RCX */
-                       M_LST(s1, REG_SP, d * 8);
+                       M_LST(s1, REG_SP, d);
                        M_INTMOVE(s2, RCX);
-                       emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+                       emit_shift_membase(cd, shift_op, REG_SP, d);
                }
 
                M_INTMOVE(REG_ITMP1, RCX);                             /* restore RCX */
@@ -1000,19 +1000,19 @@ void emit_lshift(jitdata *jd, s4 shift_op, instruction *iptr)
                }
 
                if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
-                       M_ILD(RCX, REG_SP, s2 * 8);
-                       M_LLD(d, REG_SP, s1 * 8);
+                       M_ILD(RCX, REG_SP, s2);
+                       M_LLD(d, REG_SP, s1);
                        emit_shift_reg(cd, shift_op, d);
 
                } else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
                        /* s1 may be equal to RCX */
                        M_INTMOVE(s1, d);
-                       M_ILD(RCX, REG_SP, s2 * 8);
+                       M_ILD(RCX, REG_SP, s2);
                        emit_shift_reg(cd, shift_op, d);
 
                } else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
                        M_INTMOVE(s2, RCX);
-                       M_LLD(d, REG_SP, s1 * 8);
+                       M_LLD(d, REG_SP, s1);
                        emit_shift_reg(cd, shift_op, d);
 
                } else {
index 1e6c29c5c83283a97d7c9e06b812b7d818650176..c90e0c61dfb89a32914383e074366a1aa1dcf43b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.c 7723 2007-04-16 18:03:08Z michi $
+   $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -147,12 +147,14 @@ void md_param_alloc(methoddesc *md)
                case TYPE_LNG:
                        if (iarg < INT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index    = iarg;
                                pd->regoff   = abi_registers_integer_argument[iarg];
                                iarg++;
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->index    = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
@@ -161,12 +163,14 @@ void md_param_alloc(methoddesc *md)
                case TYPE_DBL:
                        if (farg < FLT_ARG_CNT) {
                                pd->inmemory = false;
+                               pd->index    = farg;
                                pd->regoff   = abi_registers_float_argument[farg];
                                farg++;
                        }
                        else {
                                pd->inmemory = true;
-                               pd->regoff   = stacksize;
+                               pd->index    = stacksize;
+                               pd->regoff   = stacksize * 8;
                                stacksize++;
                        }
                        break;
index 40ce6e8c193d3d9ca17ef31a6611c3efaaa445b9..f608af7383b480308209b58e2d5b7fdf306d56d4 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: resolve.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: resolve.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -38,6 +38,7 @@
 #include "vm/access.h"
 #include "vm/exceptions.h"
 #include "vm/global.h"
+#include "vm/resolve.h"
 
 #include "vm/jit/jit.h"
 #include "vm/jit/verify/typeinfo.h"
@@ -47,7 +48,7 @@
 #include "vmcore/linker.h"
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
 
 
 /******************************************************************************/
@@ -174,10 +175,18 @@ bool resolve_class_from_name(classinfo *referer,
 #endif
 
                /* load the class */
-               if (!cls) {
-                       if (!(cls = load_class_from_classloader(classname,
-                                                                                                       referer->classloader)))
-                               return false; /* exception */
+
+               if (cls == NULL) {
+                       cls = load_class_from_classloader(classname, referer->classloader);
+
+                       if (cls == NULL) {
+                               /* If the exception is a ClassNotFoundException,
+                                  convert it to a NoClassDefFoundError. */
+
+                               exceptions_classnotfoundexception_to_noclassdeffounderror();
+
+                               return false;
+                       }
                }
        }
 
@@ -448,12 +457,16 @@ bool resolve_class_from_typedesc(typedesc *d, bool checkaccess, bool link, class
        }
        else {
                /* a primitive type */
-               cls = primitivetype_table[d->decltype].class_primitive;
+
+               cls = primitive_class_get_by_type(d->decltype);
+
                assert(cls->state & CLASS_LOADED);
+
                if (!(cls->state & CLASS_LINKED))
                        if (!link_class(cls))
                                return false; /* exception */
        }
+
        assert(cls);
        assert(cls->state & CLASS_LOADED);
        assert(!link || (cls->state & CLASS_LINKED));
index 131d295e34b40627db82d986a4fc80c31c1205dc..6cea9bafb6cea52fd2d52945b67ef678e4ea7cee 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: string.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: string.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 #include "vm/builtin.h"
 #include "vm/exceptions.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 
 #include "vmcore/options.h"
+#include "vmcore/primitive.h"
 #include "vmcore/statistics.h"
 #include "vmcore/utf8.h"
 
@@ -110,13 +112,12 @@ void stringtable_update(void)
                s = hashtable_string.ptr[i];
                if (s) {
                        while (s) {
-                                                               
                                js = (java_lang_String *) s->string;
                                
-                               if (!js || !js->value) {
+                               if ((js == NULL) || (js->value == NULL)) {
                                        /* error in hashtable found */
-                                       log_text("invalid literalstring in hashtable");
-                                       assert(0);
+
+                                       vm_abort("stringtable_update: invalid literalstring in hashtable");
                                }
 
                                a = js->value;
@@ -127,7 +128,8 @@ void stringtable_update(void)
 
                                if (!a->header.objheader.vftbl) 
                                        /* vftbl of character-array is NULL */ 
-                                       a->header.objheader.vftbl = primitivetype_table[ARRAYTYPE_CHAR].arrayvftbl;
+                                       a->header.objheader.vftbl =
+                                               primitive_arrayclass_get_by_type(ARRAYTYPE_CHAR)->vftbl;
 
                                /* follow link in external hash chain */
                                s = s->hashlink;
@@ -505,7 +507,7 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
 {
     literalstring    *s;                /* hashtable element                  */
     java_lang_String *js;               /* u2-array wrapped in javastring     */
-    java_chararray   *stringdata;       /* copy of u2-array                   */
+    java_chararray   *ca;               /* copy of u2-array                   */
     u4                key;
     u4                slot;
     u2                i;
@@ -546,20 +548,20 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
     if (copymode) {
                /* create copy of u2-array for new javastring */
                u4 arraysize = sizeof(java_chararray) + sizeof(u2) * (length - 1) + 10;
-               stringdata = mem_alloc(arraysize);
-/*             memcpy(stringdata, a, arraysize); */
-               memcpy(&(stringdata->header), &(a->header), sizeof(java_arrayheader));
-               memcpy(&(stringdata->data), &(a->data) + offset, sizeof(u2) * (length - 1) + 10);
+               ca = mem_alloc(arraysize);
+/*             memcpy(ca, a, arraysize); */
+               memcpy(&(ca->header), &(a->header), sizeof(java_arrayheader));
+               memcpy(&(ca->data), &(a->data) + offset, sizeof(u2) * (length - 1) + 10);
 
     } else {
-               stringdata = a;
+               ca = a;
        }
 
     /* location in hashtable found, complete arrayheader */
 
-    stringdata->header.objheader.vftbl =
-               primitivetype_table[ARRAYTYPE_CHAR].arrayvftbl;
-    stringdata->header.size = length;
+    ca->header.objheader.vftbl =
+               primitive_arrayclass_get_by_type(ARRAYTYPE_CHAR)->vftbl;
+    ca->header.size            = length;
 
        assert(class_java_lang_String);
        assert(class_java_lang_String->state & CLASS_LOADED);
@@ -583,7 +585,7 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
 #endif
 
        js->header.vftbl = class_java_lang_String->vftbl;
-       js->value  = stringdata;
+       js->value  = ca;
        js->offset = 0;
        js->count  = length;
 
index cb604f80b3d12ca2ed8747f778ffbbd29a810449..9d8a4e599832c61994120edc06c7cc7d4524e65b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: vm.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: vm.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -31,6 +31,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <stdint.h>
 #include <stdlib.h>
 
 #if defined(WITH_JRE_LAYOUT)
 
 #include "vm/types.h"
 
+#include "arch.h"
+#include "md-abi.h"
+
+#include "vm/jit/abi-asm.h"
+
 #include "mm/gc-common.h"
 #include "mm/memory.h"
 
 #include "native/include/java_lang_String.h" /* required by java_lang_Class.h */
 #include "native/include/java_lang_Class.h"
 
+#include "native/include/java_lang_Byte.h"
+#include "native/include/java_lang_Character.h"
+#include "native/include/java_lang_Short.h"
+#include "native/include/java_lang_Integer.h"
+#include "native/include/java_lang_Boolean.h"
+#include "native/include/java_lang_Long.h"
+#include "native/include/java_lang_Float.h"
+#include "native/include/java_lang_Double.h"
+
 #include "threads/threads-common.h"
 
 #include "toolbox/logging.h"
@@ -74,6 +89,7 @@
 
 #include "vmcore/classcache.h"
 #include "vmcore/options.h"
+#include "vmcore/primitive.h"
 #include "vmcore/statistics.h"
 #include "vmcore/suck.h"
 
@@ -152,6 +168,9 @@ enum {
        OPT_X,
        OPT_XX,
 
+       OPT_EA,
+       OPT_DA,
+
        OPT_ESA,
        OPT_DSA,
 
@@ -286,7 +305,12 @@ opt_struct opts[] = {
        { "help",              false, OPT_HELP },
        { "?",                 false, OPT_HELP },
        { "X",                 false, OPT_X },
-       { "XX",                false, OPT_XX },
+       { "XX:",               true,  OPT_XX },
+
+       { "ea:",               true,  OPT_EA },
+       { "da:",               true,  OPT_DA },
+       { "ea",                false, OPT_EA },
+       { "da",                false, OPT_DA },
 
        { "esa",                     false, OPT_ESA },
        { "enablesystemassertions",  false, OPT_ESA },
@@ -440,6 +464,12 @@ void usage(void)
        puts("    -help, -?                print this help message");
        puts("    -X                       print help on non-standard Java options");
        puts("    -XX                      print help on CACAO options");
+    puts("    -ea[:<packagename>...|:<classname>]");
+    puts("    -enableassertions[:<packagename>...|:<classname>]");
+       puts("                             enable assertions with specified granularity");
+       puts("    -da[:<packagename>...|:<classname>]");
+       puts("    -disableassertions[:<packagename>...|:<classname>]");
+       puts("                             disable assertions with specified granularity");
        puts("    -esa | -enablesystemassertions");
        puts("                             enable system assertions");
        puts("    -dsa | -disablesystemassertions");
@@ -500,7 +530,7 @@ static void XXusage(void)
 {
        puts("    -v                       write state-information");
 #if !defined(NDEBUG)
-       puts("    -verbose[:call|exception|jit|memory|threads]");
+       puts("    -verbose[:call|jit|threads]");
        puts("                             enable specific verbose output");
        puts("    -debug-color             colored output for ANSI terms");
 #endif
@@ -1118,9 +1148,6 @@ bool vm_create(JavaVMInitArgs *vm_args)
                        else if (strcmp("call", opt_arg) == 0) {
                                opt_verbosecall = true;
                        }
-                       else if (strcmp("exception", opt_arg) == 0) {
-                               opt_verboseexception = true;
-                       }
                        else if (strcmp("jit", opt_arg) == 0) {
                                opt_verbose = true;
                                loadverbose = true;
@@ -1128,15 +1155,6 @@ bool vm_create(JavaVMInitArgs *vm_args)
                                initverbose = true;
                                compileverbose = true;
                        }
-                       else if (strcmp("memory", opt_arg) == 0) {
-                               opt_verbosememory = true;
-
-# if defined(ENABLE_STATISTICS)
-                               /* we also need statistics */
-
-                               opt_stat = true;
-# endif
-                       }
                        else if (strcmp("threads", opt_arg) == 0) {
                                opt_verbosethreads = true;
                        }
@@ -1345,7 +1363,15 @@ bool vm_create(JavaVMInitArgs *vm_args)
                        break;
 
                case OPT_XX:
-                       XXusage();
+                       options_xx(opt_arg);
+                       break;
+
+               case OPT_EA:
+                       /* currently ignored */
+                       break;
+
+               case OPT_DA:
+                       /* currently ignored */
                        break;
 
                case OPT_ESA:
@@ -1598,9 +1624,15 @@ bool vm_create(JavaVMInitArgs *vm_args)
        if (!loader_init())
                vm_abort("vm_create: loader_init failed");
 
+       /* Link some important VM classes. */
+       /* AFTER: utf8_init */
+
        if (!linker_init())
                vm_abort("vm_create: linker_init failed");
 
+       if (!primitive_init())
+               vm_abort("vm_create: primitive_init failed");
+
        /* Initialize the native subsystem. */
 
        if (!native_init())
@@ -1656,7 +1688,7 @@ bool vm_create(JavaVMInitArgs *vm_args)
 # if !defined(NDEBUG)
        /* start the memory profiling thread */
 
-       if (opt_verbosememory)
+       if (opt_ProfileMemoryUsage || opt_ProfileGCMemoryUsage)
                if (!memory_start_thread())
                        vm_abort("vm_create: memory_start_thread failed");
 # endif
@@ -1711,6 +1743,7 @@ void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args)
 {
        utf               *mainutf;
        classinfo         *mainclass;
+       java_objectheader *e;
        methodinfo        *m;
        java_objectarray  *oa; 
        s4                 oalength;
@@ -1761,7 +1794,10 @@ void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args)
 
        /* error loading class */
 
-       if ((exceptions_get_exception() != NULL) || (mainclass == NULL)) {
+       e = exceptions_get_and_clear_exception();
+
+       if ((e != NULL) || (mainclass == NULL)) {
+               exceptions_throw_noclassdeffounderror_cause(e);
                exceptions_print_stacktrace(); 
                vm_exit(1);
        }
@@ -2282,12 +2318,166 @@ static void vm_compile_method(void)
 #endif /* !defined(NDEBUG) */
 
 
+/* vm_array_store_int **********************************************************
+
+   Helper function to store an integer into the argument array, taking
+   care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_int(uint64_t *array, paramdesc *pd, int32_t value)
+{
+       int32_t index;
+
+       if (!pd->inmemory) {
+               index        = pd->index;
+               array[index] = (int64_t) value;
+       }
+       else {
+               index        = ARG_CNT + pd->index;
+#if SIZEOF_VOID_P == 8
+               array[index] = (int64_t) value;
+#else
+# if WORDS_BIGENDIAN == 1
+               array[index] = ((int64_t) value) << 32;
+# else
+               array[index] = (int64_t) value;
+# endif
+#endif
+       }
+}
+
+
+/* vm_array_store_lng **********************************************************
+
+   Helper function to store a long into the argument array, taking
+   care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_lng(uint64_t *array, paramdesc *pd, int64_t value)
+{
+       int32_t index;
+
+#if SIZEOF_VOID_P == 8
+       if (!pd->inmemory)
+               index = pd->index;
+       else
+               index = ARG_CNT + pd->index;
+
+       array[index] = value;
+#else
+       if (!pd->inmemory) {
+               /* move low and high 32-bits into it's own argument slot */
+
+               index        = GET_LOW_REG(pd->index);
+               array[index] = value & 0x00000000ffffffff;
+
+               index        = GET_HIGH_REG(pd->index);
+               array[index] = value >> 32;
+       }
+       else {
+               index        = ARG_CNT + pd->index;
+               array[index] = value;
+       }
+#endif
+}
+
+
+/* vm_array_store_flt **********************************************************
+
+   Helper function to store a float into the argument array, taking
+   care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_flt(uint64_t *array, paramdesc *pd, uint64_t value)
+{
+       int32_t index;
+
+       if (!pd->inmemory) {
+               index        = INT_ARG_CNT + pd->index;
+#if WORDS_BIGENDIAN == 1 && !defined(__POWERPC64__)
+               array[index] = value >> 32;
+#else
+               array[index] = value;
+#endif
+       }
+       else {
+               index        = ARG_CNT + pd->index;
+#if defined(__SPARC_64__)
+               array[index] = value >> 32;
+#else
+               array[index] = value;
+#endif
+       }
+}
+
+
+/* vm_array_store_dbl **********************************************************
+
+   Helper function to store a double into the argument array, taking
+   care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_dbl(uint64_t *array, paramdesc *pd, uint64_t value)
+{
+       int32_t index;
+
+       if (!pd->inmemory)
+               index = INT_ARG_CNT + pd->index;
+       else
+               index = ARG_CNT + pd->index;
+
+       array[index] = value;
+}
+
+
+/* vm_array_store_adr **********************************************************
+
+   Helper function to store an address into the argument array, taking
+   care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_adr(uint64_t *array, paramdesc *pd, void *value)
+{
+       int32_t index;
+
+       if (!pd->inmemory) {
+#if defined(HAS_ADDRESS_REGISTER_FILE)
+               /* When the architecture has address registers, place them
+                  after integer and float registers. */
+
+               index        = INT_ARG_CNT + FLT_ARG_CNT + pd->index;
+#else
+               index        = pd->index;
+#endif
+               array[index] = (uint64_t) (intptr_t) value;
+       }
+       else {
+               index        = ARG_CNT + pd->index;
+#if SIZEOF_VOID_P == 8
+               array[index] = (uint64_t) (intptr_t) value;
+#else
+# if WORDS_BIGENDIAN == 1 && !defined(__POWERPC64__)
+               array[index] = ((uint64_t) (intptr_t) value) << 32;
+# else
+               array[index] = (uint64_t) (intptr_t) value;
+# endif
+#endif
+       }
+}
+
+
 /* vm_vmargs_from_valist *******************************************************
 
    XXX
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
                                                                  vm_arg *vmargs, va_list ap)
 {
@@ -2310,23 +2500,18 @@ static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
        } 
 
        for (; i < m->parseddesc->paramcount; i++, paramtypes++) {
-               switch (paramtypes->decltype) {
-               /* primitive types */
-               case PRIMITIVETYPE_BOOLEAN: 
-               case PRIMITIVETYPE_BYTE:
-               case PRIMITIVETYPE_CHAR:
-               case PRIMITIVETYPE_SHORT: 
-               case PRIMITIVETYPE_INT:
+               switch (paramtypes->type) {
+               case TYPE_INT:
                        vmargs[i].type   = TYPE_INT;
                        vmargs[i].data.l = (s8) va_arg(ap, s4);
                        break;
 
-               case PRIMITIVETYPE_LONG:
+               case TYPE_LNG:
                        vmargs[i].type   = TYPE_LNG;
                        vmargs[i].data.l = (s8) va_arg(ap, s8);
                        break;
 
-               case PRIMITIVETYPE_FLOAT:
+               case TYPE_FLT:
                        vmargs[i].type   = TYPE_FLT;
 #if defined(__ALPHA__)
                        /* this keeps the assembler function much simpler */
@@ -2337,7 +2522,7 @@ static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
 #endif
                        break;
 
-               case PRIMITIVETYPE_DOUBLE:
+               case TYPE_DBL:
                        vmargs[i].type   = TYPE_DBL;
                        vmargs[i].data.d = (jdouble) va_arg(ap, jdouble);
                        break;
@@ -2349,6 +2534,77 @@ static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
                }
        }
 }
+#else
+uint64_t *vm_array_from_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       methoddesc *md;
+       paramdesc  *pd;
+       typedesc   *td;
+       uint64_t   *array;
+       int32_t     i;
+       imm_union   value;
+
+       /* get the descriptors */
+
+       md = m->parseddesc;
+       pd = md->params;
+       td = md->paramtypes;
+
+       /* allocate argument array */
+
+       array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + md->memuse);
+
+       /* if method is non-static fill first block and skip `this' pointer */
+
+       i = 0;
+
+       if (o != NULL) {
+               /* the `this' pointer */
+               vm_array_store_adr(array, pd, o);
+
+               pd++;
+               td++;
+               i++;
+       } 
+
+       for (; i < md->paramcount; i++, pd++, td++) {
+               switch (td->type) {
+               case TYPE_INT:
+                       value.i = va_arg(ap, int32_t);
+                       vm_array_store_int(array, pd, value.i);
+                       break;
+
+               case TYPE_LNG:
+                       value.l = va_arg(ap, int64_t);
+                       vm_array_store_lng(array, pd, value.l);
+                       break;
+
+               case TYPE_FLT:
+#if defined(__ALPHA__) || defined(__POWERPC64__)
+                       /* this keeps the assembler function much simpler */
+
+                       value.d = (double) va_arg(ap, double);
+#else
+                       value.f = (float) va_arg(ap, double);
+#endif
+                       vm_array_store_flt(array, pd, value.l);
+                       break;
+
+               case TYPE_DBL:
+                       value.d = va_arg(ap, double);
+                       vm_array_store_dbl(array, pd, value.l);
+                       break;
+
+               case TYPE_ADR: 
+                       value.a = va_arg(ap, void*);
+                       vm_array_store_adr(array, pd, value.a);
+                       break;
+               }
+       }
+
+       return array;
+}
+#endif
 
 
 /* vm_vmargs_from_jvalue *******************************************************
@@ -2357,6 +2613,7 @@ static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 static void vm_vmargs_from_jvalue(methodinfo *m, java_objectheader *o,
                                                                  vm_arg *vmargs, jvalue *args)
 {
@@ -2381,22 +2638,17 @@ static void vm_vmargs_from_jvalue(methodinfo *m, java_objectheader *o,
 
        for (j = 0; i < m->parseddesc->paramcount; i++, j++, paramtypes++) {
                switch (paramtypes->decltype) {
-               /* primitive types */
-               case PRIMITIVETYPE_BOOLEAN: 
-               case PRIMITIVETYPE_BYTE:
-               case PRIMITIVETYPE_CHAR:
-               case PRIMITIVETYPE_SHORT: 
-               case PRIMITIVETYPE_INT:
+               case TYPE_INT:
                        vmargs[i].type   = TYPE_INT;
                        vmargs[i].data.l = (s8) args[j].i;
                        break;
 
-               case PRIMITIVETYPE_LONG:
+               case TYPE_LNG:
                        vmargs[i].type   = TYPE_LNG;
                        vmargs[i].data.l = (s8) args[j].j;
                        break;
 
-               case PRIMITIVETYPE_FLOAT:
+               case TYPE_FLT:
                        vmargs[i].type = TYPE_FLT;
 #if defined(__ALPHA__)
                        /* this keeps the assembler function much simpler */
@@ -2407,7 +2659,7 @@ static void vm_vmargs_from_jvalue(methodinfo *m, java_objectheader *o,
 #endif
                        break;
 
-               case PRIMITIVETYPE_DOUBLE:
+               case TYPE_DBL:
                        vmargs[i].type   = TYPE_DBL;
                        vmargs[i].data.d = args[j].d;
                        break;
@@ -2419,121 +2671,613 @@ static void vm_vmargs_from_jvalue(methodinfo *m, java_objectheader *o,
                }
        }
 }
+#else
+static uint64_t *vm_array_from_jvalue(methodinfo *m, java_objectheader *o,
+                                                                         jvalue *args)
+{
+       methoddesc *md;
+       paramdesc  *pd;
+       typedesc   *td;
+       uint64_t   *array;
+       int32_t     i;
+       int32_t     j;
 
+       /* get the descriptors */
 
-/* vm_call_method **************************************************************
+       md = m->parseddesc;
+       pd = md->params;
+       td = md->paramtypes;
 
-   Calls a Java method with a variable number of arguments and returns
-   an address.
+       /* allocate argument array */
 
-*******************************************************************************/
+#if defined(HAS_ADDRESS_REGISTER_FILE)
+       array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + ADR_ARG_CNT + md->memuse);
+#else
+       array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + md->memuse);
+#endif
 
-java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
-{
-       va_list            ap;
-       java_objectheader *ro;
+       /* if method is non-static fill first block and skip `this' pointer */
 
-       va_start(ap, o);
-       ro = vm_call_method_valist(m, o, ap);
-       va_end(ap);
+       i = 0;
 
-       return ro;
-}
+       if (o != NULL) {
+               /* the `this' pointer */
+               vm_array_store_adr(array, pd, o);
 
+               pd++;
+               td++;
+               i++;
+       } 
 
-/* vm_call_method_valist *******************************************************
+       for (j = 0; i < md->paramcount; i++, j++, pd++, td++) {
+               switch (td->decltype) {
+               case TYPE_INT:
+                       vm_array_store_int(array, pd, args[j].i);
+                       break;
 
-   Calls a Java method with a variable number of arguments, passed via
-   a va_list, and returns an address.
+               case TYPE_LNG:
+                       vm_array_store_lng(array, pd, args[j].j);
+                       break;
 
-*******************************************************************************/
+               case TYPE_FLT:
+                       vm_array_store_flt(array, pd, args[j].j);
+                       break;
 
-java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
-                                                                                va_list ap)
-{
-       s4                 vmargscount;
-       vm_arg            *vmargs;
-       java_objectheader *ro;
-       s4                 dumpsize;
+               case TYPE_DBL:
+                       vm_array_store_dbl(array, pd, args[j].j);
+                       break;
 
-       /* mark start of dump memory area */
+               case TYPE_ADR: 
+                       vm_array_store_adr(array, pd, args[j].l);
+                       break;
+               }
+       }
 
-       dumpsize = dump_size();
+       return array;
+}
+#endif
 
-       /* get number of Java method arguments */
+/* vm_vmargs_from_objectarray **************************************************
 
-       vmargscount = m->parseddesc->paramcount;
+   XXX
 
-       /* allocate vm_arg array */
+*******************************************************************************/
 
-       vmargs = DMNEW(vm_arg, vmargscount);
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
+                                                               vm_arg *vmargs, java_objectarray *params)
+{
+       java_objectheader *param;
+       typedesc          *paramtypes;
+       classinfo         *c;
+       int32_t            i;
+       int32_t            j;
+       int64_t            value;
 
-       /* fill the vm_arg array from a va_list */
+       paramtypes = m->parseddesc->paramtypes;
 
-       vm_vmargs_from_valist(m, o, vmargs, ap);
+       /* if method is non-static fill first block and skip `this' pointer */
 
-       /* call the Java method */
+       i = 0;
 
-       ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+       if (o != NULL) {
+               /* this pointer */
+               vmargs[0].type   = TYPE_ADR;
+               vmargs[0].data.l = (uint64_t) (intptr_t) o;
 
-       /* release dump area */
+               paramtypes++;
+               i++;
+       }
 
-       dump_release(dumpsize);
+       for (j = 0; i < m->parseddesc->paramcount; i++, j++, paramtypes++) {
+               switch (paramtypes->type) {
+               /* primitive types */
+               case TYPE_INT:
+               case TYPE_LNG:
+               case TYPE_FLT:
+               case TYPE_DBL:
+                       param = params->data[j];
 
-       return ro;
-}
+                       if (param == NULL)
+                               goto illegal_arg;
 
+                       /* internally used data type */
+                       vmargs[i].type = paramtypes->type;
 
-/* vm_call_method_jvalue *******************************************************
+                       /* convert the value according to its declared type */
 
-   Calls a Java method with a variable number of arguments, passed via
-   a jvalue array, and returns an address.
+                       c = param->vftbl->class;
 
-*******************************************************************************/
+                       switch (paramtypes->decltype) {
+                       case PRIMITIVETYPE_BOOLEAN:
+                               if (c == class_java_lang_Boolean)
+                                       value = (int64_t) ((java_lang_Boolean *) param)->value;
+                               else
+                                       goto illegal_arg;
 
-java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
-                                                                                jvalue *args)
-{
-       s4                 vmargscount;
-       vm_arg            *vmargs;
-       java_objectheader *ro;
-       s4                 dumpsize;
+                               vmargs[i].data.l = value;
+                               break;
 
-       /* mark start of dump memory area */
+                       case PRIMITIVETYPE_BYTE:
+                               if (c == class_java_lang_Byte)
+                                       value = (int64_t) ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
 
-       dumpsize = dump_size();
+                               vmargs[i].data.l = value;
+                               break;
 
-       /* get number of Java method arguments */
+                       case PRIMITIVETYPE_CHAR:
+                               if (c == class_java_lang_Character)
+                                       value = (int64_t) ((java_lang_Character *) param)->value;
+                               else
+                                       goto illegal_arg;
 
-       vmargscount = m->parseddesc->paramcount;
+                               vmargs[i].data.l = value;
+                               break;
 
-       /* allocate vm_arg array */
+                       case PRIMITIVETYPE_SHORT:
+                               if (c == class_java_lang_Short)
+                                       value = (int64_t) ((java_lang_Short *) param)->value;
+                               else if (c == class_java_lang_Byte)
+                                       value = (int64_t) ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
+
+                               vmargs[i].data.l = value;
+                               break;
+
+                       case PRIMITIVETYPE_INT:
+                               if (c == class_java_lang_Integer)
+                                       value = (int64_t) ((java_lang_Integer *) param)->value;
+                               else if (c == class_java_lang_Short)
+                                       value = (int64_t) ((java_lang_Short *) param)->value;
+                               else if (c == class_java_lang_Byte)
+                                       value = (int64_t) ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
+
+                               vmargs[i].data.l = value;
+                               break;
+
+                       case PRIMITIVETYPE_LONG:
+                               if (c == class_java_lang_Long)
+                                       value = (int64_t) ((java_lang_Long *) param)->value;
+                               else if (c == class_java_lang_Integer)
+                                       value = (int64_t) ((java_lang_Integer *) param)->value;
+                               else if (c == class_java_lang_Short)
+                                       value = (int64_t) ((java_lang_Short *) param)->value;
+                               else if (c == class_java_lang_Byte)
+                                       value = (int64_t) ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
 
-       vmargs = DMNEW(vm_arg, vmargscount);
+                               vmargs[i].data.l = value;
+                               break;
 
-       /* fill the vm_arg array from a va_list */
+                       case PRIMITIVETYPE_FLOAT:
+                               if (c == class_java_lang_Float)
+                                       vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       case PRIMITIVETYPE_DOUBLE:
+                               if (c == class_java_lang_Double)
+                                       vmargs[i].data.d = (jdouble) ((java_lang_Double *) param)->value;
+                               else if (c == class_java_lang_Float)
+                                       vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
 
-       vm_vmargs_from_jvalue(m, o, vmargs, args);
+                       default:
+                               goto illegal_arg;
+                       }
+                       break;
+               
+               case TYPE_ADR:
+                       if (!resolve_class_from_typedesc(paramtypes, true, true, &c))
+                               return false;
+
+                       if (params->data[j] != 0) {
+                               if (paramtypes->arraydim > 0) {
+                                       if (!builtin_arrayinstanceof(params->data[j], c))
+                                               goto illegal_arg;
+
+                               } else {
+                                       if (!builtin_instanceof(params->data[j], c))
+                                               goto illegal_arg;
+                               }
+                       }
 
-       /* call the Java method */
+                       vmargs[i].type   = TYPE_ADR;
+                       vmargs[i].data.l = (u8) (ptrint) params->data[j];
+                       break;
 
-       ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+               default:
+                       goto illegal_arg;
+               }
+       }
 
-       /* release dump area */
+/*     if (rettype) */
+/*             *rettype = descr->returntype.decltype; */
 
-       dump_release(dumpsize);
+       return true;
 
-       return ro;
+illegal_arg:
+       exceptions_throw_illegalargumentexception();
+       return false;
+}
+#else
+uint64_t *vm_array_from_objectarray(methodinfo *m, java_objectheader *o,
+                                                                       java_objectarray *params)
+{
+       methoddesc        *md;
+       paramdesc         *pd;
+       typedesc          *td;
+       uint64_t          *array;
+       java_objectheader *param;
+       classinfo         *c;
+       int32_t            i;
+       int32_t            j;
+       imm_union          value;
+
+       /* get the descriptors */
+
+       md = m->parseddesc;
+       pd = md->params;
+       td = md->paramtypes;
+
+       /* allocate argument array */
+
+       array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + md->memuse);
+
+       /* if method is non-static fill first block and skip `this' pointer */
+
+       i = 0;
+
+       if (o != NULL) {
+               /* this pointer */
+               vm_array_store_adr(array, pd, o);
+
+               pd++;
+               td++;
+               i++;
+       }
+
+       for (j = 0; i < md->paramcount; i++, j++, pd++, td++) {
+               param = params->data[j];
+
+               switch (td->type) {
+               case TYPE_INT:
+                       if (param == NULL)
+                               goto illegal_arg;
+
+                       /* convert the value according to its declared type */
+
+                       c = param->vftbl->class;
+
+                       switch (td->decltype) {
+                       case PRIMITIVETYPE_BOOLEAN:
+                               if (c == class_java_lang_Boolean)
+                                       value.i = ((java_lang_Boolean *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       case PRIMITIVETYPE_BYTE:
+                               if (c == class_java_lang_Byte)
+                                       value.i = ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       case PRIMITIVETYPE_CHAR:
+                               if (c == class_java_lang_Character)
+                                       value.i = ((java_lang_Character *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       case PRIMITIVETYPE_SHORT:
+                               if (c == class_java_lang_Short)
+                                       value.i = ((java_lang_Short *) param)->value;
+                               else if (c == class_java_lang_Byte)
+                                       value.i = ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       case PRIMITIVETYPE_INT:
+                               if (c == class_java_lang_Integer)
+                                       value.i = ((java_lang_Integer *) param)->value;
+                               else if (c == class_java_lang_Short)
+                                       value.i = ((java_lang_Short *) param)->value;
+                               else if (c == class_java_lang_Byte)
+                                       value.i = ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       default:
+                               goto illegal_arg;
+                       }
+
+                       vm_array_store_int(array, pd, value.i);
+                       break;
+
+               case TYPE_LNG:
+                       if (param == NULL)
+                               goto illegal_arg;
+
+                       /* convert the value according to its declared type */
+
+                       c = param->vftbl->class;
+
+                       switch (td->decltype) {
+                       case PRIMITIVETYPE_LONG:
+                               if (c == class_java_lang_Long)
+                                       value.l = ((java_lang_Long *) param)->value;
+                               else if (c == class_java_lang_Integer)
+                                       value.l = (int64_t) ((java_lang_Integer *) param)->value;
+                               else if (c == class_java_lang_Short)
+                                       value.l = (int64_t) ((java_lang_Short *) param)->value;
+                               else if (c == class_java_lang_Byte)
+                                       value.l = (int64_t) ((java_lang_Byte *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       default:
+                               goto illegal_arg;
+                       }
+
+                       vm_array_store_lng(array, pd, value.l);
+                       break;
+
+               case TYPE_FLT:
+                       if (param == NULL)
+                               goto illegal_arg;
+
+                       /* convert the value according to its declared type */
+
+                       c = param->vftbl->class;
+
+                       switch (td->decltype) {
+                       case PRIMITIVETYPE_FLOAT:
+                               if (c == class_java_lang_Float)
+                                       value.f = ((java_lang_Float *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       default:
+                               goto illegal_arg;
+                       }
+
+                       vm_array_store_flt(array, pd, value.l);
+                       break;
+
+               case TYPE_DBL:
+                       if (param == NULL)
+                               goto illegal_arg;
+
+                       /* convert the value according to its declared type */
+
+                       c = param->vftbl->class;
+
+                       switch (td->decltype) {
+                       case PRIMITIVETYPE_DOUBLE:
+                               if (c == class_java_lang_Double)
+                                       value.d = ((java_lang_Double *) param)->value;
+                               else if (c == class_java_lang_Float)
+                                       value.f = ((java_lang_Float *) param)->value;
+                               else
+                                       goto illegal_arg;
+                               break;
+
+                       default:
+                               goto illegal_arg;
+                       }
+
+                       vm_array_store_dbl(array, pd, value.l);
+                       break;
+               
+               case TYPE_ADR:
+                       if (!resolve_class_from_typedesc(td, true, true, &c))
+                               return false;
+
+                       if (param != NULL) {
+                               if (td->arraydim > 0) {
+                                       if (!builtin_arrayinstanceof(param, c))
+                                               goto illegal_arg;
+                               }
+                               else {
+                                       if (!builtin_instanceof(param, c))
+                                               goto illegal_arg;
+                               }
+                       }
+
+                       vm_array_store_adr(array, pd, param);
+                       break;
+
+               default:
+                       goto illegal_arg;
+               }
+       }
+
+       return array;
+
+illegal_arg:
+       exceptions_throw_illegalargumentexception();
+       return NULL;
+}
+#endif
+
+
+/* vm_call_method **************************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
+{
+       va_list            ap;
+       java_objectheader *ro;
+
+       va_start(ap, o);
+       ro = vm_call_method_valist(m, o, ap);
+       va_end(ap);
+
+       return ro;
+}
+
+
+/* vm_call_method_valist *******************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a va_list, and returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
+                                                                                va_list ap)
+{
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+       s4                 vmargscount;
+       vm_arg            *vmargs;
+       java_objectheader *ro;
+       s4                 dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_valist(m, o, vmargs, ap);
+
+       /* call the Java method */
+
+       ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return ro;
+#else
+       java_objectheader *ro;
+       int32_t            dumpsize;
+       uint64_t          *array;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_valist(m, o, ap);
+
+       /* call the Java method */
+
+       ro = vm_call_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return ro;
+#endif
+}
+
+
+/* vm_call_method_jvalue *******************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a jvalue array, and returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
+                                                                                jvalue *args)
+{
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+       s4                 vmargscount;
+       vm_arg            *vmargs;
+       java_objectheader *ro;
+       s4                 dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_jvalue(m, o, vmargs, args);
+
+       /* call the Java method */
+
+       ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return ro;
+#else
+       java_objectheader *ro;
+       int32_t            dumpsize;
+       uint64_t          *array;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_jvalue(m, o, args);
+
+       /* call the Java method */
+
+       ro = vm_call_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return ro;
+#endif
 }
 
-
-/* vm_call_method_vmarg ********************************************************
-
+
+/* vm_call_array ***************************************************************
+
    Calls a Java method with a variable number of arguments, passed via
-   a vm_arg array, and returns an address.
+   an argument array, and returns an address.
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
                                                                                vm_arg *vmargs)
 {
@@ -2562,6 +3306,103 @@ java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
 
        return o;
 }
+#else
+java_objectheader *vm_call_array(methodinfo *m, uint64_t *array)
+{
+       methoddesc        *md;
+       java_objectheader *o;
+
+       md = m->parseddesc;
+
+       /* compile the method if not already done */
+
+       if (m->code == NULL)
+               if (!jit_compile(m))
+                       return NULL;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               o = intrp_asm_vm_call_method(m, vmargscount, vmargs);
+       else
+# endif
+               o = asm_vm_call_method(m->code->entrypoint, array, md->memuse);
+#else
+       o = intrp_asm_vm_call_method(m, vmargscount, vmargs);
+#endif
+
+       return o;
+}
+#endif
+
+
+/* vm_call_int_array ***********************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   an argument array, and returns an integer (int32_t).
+
+*******************************************************************************/
+
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+{
+       s4 i;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
+        THREADOBJECT->flags &= ~THREAD_FLAG_IN_NATIVE;
+#endif
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+       else
+# endif
+               i = asm_vm_call_method_int(m, vmargscount, vmargs);
+#else
+       i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+#endif
+
+#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
+        THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
+#endif
+
+       return i;
+}
+#else
+int32_t vm_call_int_array(methodinfo *m, uint64_t *array)
+{
+       methoddesc *md;
+       int32_t     i;
+
+       md = m->parseddesc;
+
+       /* compile the method if not already done */
+
+       if (m->code == NULL)
+               if (!jit_compile(m))
+                       return 0;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+       else
+# endif
+               i = asm_vm_call_method_int(m->code->entrypoint, array, md->memuse);
+#else
+       i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+#endif
+
+       return i;
+}
+#endif
 
 
 /* vm_call_method_int **********************************************************
@@ -2587,10 +3428,11 @@ s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...)
 /* vm_call_method_int_valist ***************************************************
 
    Calls a Java method with a variable number of arguments, passed via
-   a va_list, and returns an integer (s4).
+   a va_list, and returns an integer (int32_t).
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
 {
        s4      vmargscount;
@@ -2612,11 +3454,36 @@ s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
 
        /* fill the vm_arg array from a va_list */
 
-       vm_vmargs_from_valist(m, o, vmargs, ap);
+       vm_vmargs_from_valist(m, o, vmargs, ap);
+
+       /* call the Java method */
+
+       i = vm_call_method_int_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return i;
+}
+#else
+int32_t vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       int32_t   i;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_valist(m, o, ap);
 
        /* call the Java method */
 
-       i = vm_call_method_int_vmarg(m, vmargscount, vmargs);
+       i = vm_call_int_array(m, array);
 
        /* release dump area */
 
@@ -2624,6 +3491,7 @@ s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
 
        return i;
 }
+#endif
 
 
 /* vm_call_method_int_jvalue ***************************************************
@@ -2633,6 +3501,7 @@ s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
 {
        s4      vmargscount;
@@ -2666,18 +3535,45 @@ s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
 
        return i;
 }
+#else
+int32_t vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       int32_t   i;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_jvalue(m, o, args);
+
+       /* call the Java method */
+
+       i = vm_call_int_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return i;
+}
+#endif
 
 
-/* vm_call_method_int_vmarg ****************************************************
+/* vm_call_long_array **********************************************************
 
    Calls a Java method with a variable number of arguments, passed via
-   a vm_arg array, and returns an integer (s4).
+   an argument array, and returns a long (int64_t).
 
 *******************************************************************************/
 
-s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
-       s4 i;
+       s8 l;
 
        STATISTICS(count_calls_native_to_java++);
 
@@ -2688,20 +3584,50 @@ s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
        else
 # endif
-               i = asm_vm_call_method_int(m, vmargscount, vmargs);
+               l = asm_vm_call_method_long(m, vmargscount, vmargs);
 #else
-       i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
 #endif
 
 #if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
        THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
 #endif
 
-       return i;
+       return l;
+}
+#else
+int64_t vm_call_long_array(methodinfo *m, uint64_t *array)
+{
+       methoddesc *md;
+       int64_t     l;
+
+       md = m->parseddesc;
+
+       /* compile the method if not already done */
+
+       if (m->code == NULL)
+               if (!jit_compile(m))
+                       return 0;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+       else
+# endif
+               l = asm_vm_call_method_long(m->code->entrypoint, array, md->memuse);
+#else
+       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+#endif
+
+       return l;
 }
+#endif
 
 
 /* vm_call_method_long *********************************************************
@@ -2731,6 +3657,7 @@ s8 vm_call_method_long(methodinfo *m, java_objectheader *o, ...)
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
 {
        s4      vmargscount;
@@ -2764,6 +3691,32 @@ s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
 
        return l;
 }
+#else
+int64_t vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       int64_t   l;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_valist(m, o, ap);
+
+       /* call the Java method */
+
+       l = vm_call_long_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return l;
+}
+#endif
 
 
 /* vm_call_method_long_jvalue **************************************************
@@ -2773,6 +3726,7 @@ s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
 {
        s4      vmargscount;
@@ -2806,18 +3760,47 @@ s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
 
        return l;
 }
+#else
+int64_t vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       int64_t   l;
 
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
 
-/* vm_call_method_long_vmarg ***************************************************
+       /* fill the argument array from a va_list */
 
-   Calls a Java method with a variable number of arguments, passed via
-   a vm_arg array, and returns a long (s8).
+       array = vm_array_from_jvalue(m, o, args);
+
+       /* call the Java method */
+
+       l = vm_call_long_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return l;
+}
+#endif
+
+
+/* vm_call_float_array *********************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   an float.
 
 *******************************************************************************/
 
-s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
-       s8 l;
+       float f;
+
+       vm_abort("IMPLEMENT ME!");
 
        STATISTICS(count_calls_native_to_java++);
 
@@ -2828,21 +3811,50 @@ s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+               f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
        else
 # endif
-               l = asm_vm_call_method_long(m, vmargscount, vmargs);
+               f = asm_vm_call_method_float(m, vmargscount, vmargs);
 #else
-       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+       f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
 #endif
 
 #if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
        THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
 #endif
 
-       return l;
+       return f;
 }
+#else
+float vm_call_float_array(methodinfo *m, uint64_t *array)
+{
+       methoddesc *md;
+       float       f;
+
+       md = m->parseddesc;
 
+       /* compile the method if not already done */
+
+       if (m->code == NULL)
+               if (!jit_compile(m))
+                       return 0;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+       else
+# endif
+               f = asm_vm_call_method_float(m->code->entrypoint, array, md->memuse);
+#else
+       f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+#endif
+
+       return f;
+}
+#endif
 
 /* vm_call_method_float ********************************************************
 
@@ -2871,6 +3883,7 @@ float vm_call_method_float(methodinfo *m, java_objectheader *o, ...)
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
                                                                  va_list ap)
 {
@@ -2905,7 +3918,32 @@ float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
 
        return f;
 }
+#else
+float vm_call_method_float_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       float     f;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_valist(m, o, ap);
+
+       /* call the Java method */
+
+       f = vm_call_float_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
 
+       return f;
+}
+#endif
 
 /* vm_call_method_float_jvalue *************************************************
 
@@ -2914,6 +3952,7 @@ float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
                                                                  jvalue *args)
 {
@@ -2948,18 +3987,48 @@ float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
 
        return f;
 }
+#else
+float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       float     f;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_jvalue(m, o, args);
+
+       /* call the Java method */
+
+       f = vm_call_float_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return f;
+}
+#endif
 
 
-/* vm_call_method_float_vmarg **************************************************
+/* vm_call_double_array ********************************************************
 
    Calls a Java method with a variable number of arguments and returns
-   an float.
+   a double.
 
 *******************************************************************************/
 
-float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
+                                                                  vm_arg *vmargs)
 {
-       float f;
+       double d;
+
+       vm_abort("IMPLEMENT ME!");
 
        STATISTICS(count_calls_native_to_java++);
 
@@ -2970,20 +4039,50 @@ float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+               d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
        else
 # endif
-               f = asm_vm_call_method_float(m, vmargscount, vmargs);
+               d = asm_vm_call_method_double(m, vmargscount, vmargs);
 #else
-       f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+       d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
 #endif
 
 #if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
        THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
 #endif
 
-       return f;
+       return d;
+}
+#else
+double vm_call_double_array(methodinfo *m, uint64_t *array)
+{
+       methoddesc *md;
+       double      d;
+
+       md = m->parseddesc;
+
+       /* compile the method if not already done */
+
+       if (m->code == NULL)
+               if (!jit_compile(m))
+                       return 0;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
+       else
+# endif
+               d = asm_vm_call_method_double(m->code->entrypoint, array, md->memuse);
+#else
+       d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
+#endif
+
+       return d;
 }
+#endif
 
 
 /* vm_call_method_double *******************************************************
@@ -3013,6 +4112,7 @@ double vm_call_method_double(methodinfo *m, java_objectheader *o, ...)
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
                                                                        va_list ap)
 {
@@ -3047,6 +4147,32 @@ double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
 
        return d;
 }
+#else
+double vm_call_method_double_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       double    d;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_valist(m, o, ap);
+
+       /* call the Java method */
+
+       d = vm_call_double_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return d;
+}
+#endif
 
 
 /* vm_call_method_double_jvalue ************************************************
@@ -3056,6 +4182,7 @@ double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
                                                                        jvalue *args)
 {
@@ -3090,44 +4217,32 @@ double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
 
        return d;
 }
+#else
+double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       double    d;
 
+       /* mark start of dump memory area */
 
-/* vm_call_method_double_vmarg *************************************************
-
-   Calls a Java method with a variable number of arguments and returns
-   a double.
+       dumpsize = dump_size();
 
-*******************************************************************************/
+       /* fill the argument array from a va_list */
 
-double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
-                                                                  vm_arg *vmargs)
-{
-       double d;
+       array = vm_array_from_jvalue(m, o, args);
 
-       STATISTICS(count_calls_native_to_java++);
+       /* call the Java method */
 
-#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
-       THREADOBJECT->flags &= ~THREAD_FLAG_IN_NATIVE;
-#endif
+       d = vm_call_double_array(m, array);
 
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
-       if (opt_intrp)
-               d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
-       else
-# endif
-               d = asm_vm_call_method_double(m, vmargscount, vmargs);
-#else
-       d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
-#endif
+       /* release dump area */
 
-#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
-       THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
-#endif
+       dump_release(dumpsize);
 
        return d;
 }
-
+#endif
 
 /*
  * These are local overrides for various environment variables in Emacs.
index 5f55fe56a13daa1a6a363dc959593f529bd0d734..ef976a2dbfe591da469bca21fd362912dc5e9254 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/vm.h - basic JVM functions
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 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
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   Changes:
-
    $Id: finalizer.c 4357 2006-01-22 23:33:38Z twisti $
 
 */
 #define _VM_H
 
 #include "config.h"
+
+#include <stdarg.h>
+
 #include "vm/types.h"
 
 #include "native/jni.h"
+
 #include "vm/global.h"
 
+#include "vmcore/class.h"
+#include "vmcore/method.h"
+
 
 /* export global variables ****************************************************/
 
@@ -103,38 +104,54 @@ void vm_exit_handler(void);
 void vm_abort(const char *text, ...);
 
 /* Java method calling functions */
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
+                                                               vm_arg *vmargs, java_objectarray *params);
+#else
+uint64_t *vm_array_from_objectarray(methodinfo *m, java_objectheader *o,
+                                                                       java_objectarray *params);
+#endif
+
 java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...);
 java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
                                                                                 va_list ap);
 java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
                                                                                 jvalue *args);
+
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
 java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
                                                                                vm_arg *vmargs);
+s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+#else
+java_objectheader *vm_call_array(methodinfo *m, uint64_t *array);
+int32_t            vm_call_int_array(methodinfo *m, uint64_t *array);
+int64_t            vm_call_long_array(methodinfo *m, uint64_t *array);
+float              vm_call_float_array(methodinfo *m, uint64_t *array);
+double             vm_call_double_array(methodinfo *m, uint64_t *array);
+#endif
 
 s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...);
 s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap);
 s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
-s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 
 s8 vm_call_method_long(methodinfo *m, java_objectheader *o, ...);
 s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap);
 s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
-s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 
 float vm_call_method_float(methodinfo *m, java_objectheader *o, ...);
 float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
                                                                  va_list ap);
 float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
                                                                  jvalue *args);
-float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 
 double vm_call_method_double(methodinfo *m, java_objectheader *o, ...);
 double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
                                                                        va_list ap);
 double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
                                                                        jvalue *args);
-double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
-                                                                  vm_arg *vmargs);
 
 #endif /* _VM_H */
 
index a0349395b77a3161f48f66dc0d2a7ca5fe587f80..1d647a9efab27d66e2c0a9dbe4bd4f51d8082e78 100644 (file)
@@ -79,6 +79,8 @@ libvmcore_la_SOURCES = \
        method.h \
        options.c \
        options.h \
+       primitive.c \
+       primitive.h \
        references.h \
        $(RT_TIMING_SOURCES) \
        $(STACKMAP_SOURCES) \
index c2fc59726e5ad317b8b4730a3b4746ff98b9cae3..1a306f74a1a897a5ffb4bdf5f47dcf031b111f6d 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: class.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: class.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -837,10 +837,14 @@ static classinfo *get_array_class(utf *name,classloader *initloader,
 
 classinfo *class_array_of(classinfo *component, bool link)
 {
-    s4 namelen;
-    char *namebuf;
-       s4 dumpsize;
-       classinfo *c;
+       java_objectheader *cl;
+    s4                 namelen;
+    char              *namebuf;
+       utf               *u;
+       classinfo         *c;
+       s4                 dumpsize;
+
+       cl = component->classloader;
 
        dumpsize = dump_size();
 
@@ -853,8 +857,8 @@ classinfo *class_array_of(classinfo *component, bool link)
         namebuf[0] = '[';
         MCOPY(namebuf + 1, component->name->text, char, namelen);
         namelen++;
-
-    } else {
+    }
+       else {
         /* the component is a non-array class */
         namebuf = DMNEW(char, namelen + 3);
         namebuf[0] = '[';
@@ -864,10 +868,9 @@ classinfo *class_array_of(classinfo *component, bool link)
         namelen += 3;
     }
 
-       c = get_array_class(utf_new(namebuf, namelen),
-                                               component->classloader,
-                                               component->classloader,
-                                               link);
+       u = utf_new(namebuf, namelen);
+
+       c = get_array_class(u, cl, cl, link);
 
        dump_release(dumpsize);
 
@@ -1456,50 +1459,6 @@ fieldinfo *class_resolvefield(classinfo *c, utf *name, utf *desc,
 }
 
 
-/* class_is_primitive **********************************************************
-
-   Check if the given class is a primitive class.
-
-*******************************************************************************/
-
-bool class_is_primitive(classinfo *c)
-{
-       s4 i;
-
-       /* search table of primitive classes */
-
-       for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
-               if (primitivetype_table[i].class_primitive == c)
-                       return true;
-
-       return false;
-}
-
-
-/* class_primitive_get *********************************************************
-
-   Returns the primitive class of the given class name.
-
-*******************************************************************************/
-
-classinfo *class_primitive_get(utf *name)
-{
-       s4 i;
-
-       /* search table of primitive classes */
-
-       for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
-               if (primitivetype_table[i].name == name)
-                       return primitivetype_table[i].class_primitive;
-
-       vm_abort("class_primitive_get: unknown primitive type");
-
-       /* keep compiler happy */
-
-       return NULL;
-}
-
-
 /* class_issubclass ************************************************************
 
    Checks if sub is a descendant of super.
index e172d3a1c6af4ceba354a4f247d576fddc62dc2c..7dfaf675c69f875b7a0449952b05f28010f8134b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: class.h 8056 2007-06-10 14:49:57Z michi $
+   $Id: class.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -339,9 +339,6 @@ methodinfo *class_resolvemethod(classinfo *c, utf *name, utf *dest);
 methodinfo *class_resolveclassmethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool throwexception);
 methodinfo *class_resolveinterfacemethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool throwexception);
 
-classinfo *class_primitive_get(utf *name);
-bool       class_is_primitive(classinfo *c);
-
 bool class_issubclass(classinfo *sub, classinfo *super);
 bool class_isanysubclass(classinfo *sub, classinfo *super);
 
index 6bdf6da4262a68acc9cad1ca33f9c2de110f1e99..f27a95caba430053bc9b9386962e57047f664c5a 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: descriptor.c 7483 2007-03-08 13:17:40Z michi $
+   $Id: descriptor.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -42,6 +42,7 @@
 #include "vm/jit_interface.h"
 
 #include "vmcore/descriptor.h"
+#include "vmcore/primitive.h"
 #include "vmcore/options.h"
 
 
index 18097ec2cced593a8ab2135dc651915ef411846d..27d7e57ff4b5d370a15556bf3f59fec128489530 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: descriptor.h 7601 2007-03-28 23:02:50Z michi $
+   $Id: descriptor.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -39,6 +39,9 @@ typedef struct methoddesc      methoddesc;
 
 
 #include "config.h"
+
+#include <stdint.h>
+
 #include "vm/types.h"
 
 #include "toolbox/hashtable.h"
@@ -115,8 +118,9 @@ struct paramdesc {
 #if defined(__MIPS__)
        u1   type;                  /* TYPE_??? of the register allocated         */
 #endif
-       bool inmemory;              /* argument in register or on stack           */
-       s4   regoff;                /* register index or stack offset             */
+       bool     inmemory;          /* argument in register or on stack           */
+       uint32_t index;             /* index into argument register array         */
+       uint32_t regoff;            /* register index or stack offset             */
 };
 
 struct methoddesc {
index 20a8e746dd5b4c5a2782a3fad9d6e212a53f86ae..14841d39b8d29d4c26687996bf542daa8a870b97 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: linker.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: linker.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -52,6 +52,7 @@
 #include "vmcore/classcache.h"
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
+#include "vmcore/primitive.h"
 #include "vmcore/rt-timing.h"
 
 /* #include "vm/resolve.h" */
@@ -77,40 +78,8 @@ static s4 classvalue;
 java_objectheader *linker_classrenumber_lock;
 
 
-/* primitivetype_table *********************************************************
-
-   Structure for primitive classes: contains the class for wrapping
-   the primitive type, the primitive class, the name of the class for
-   wrapping, the one character type signature and the name of the
-   primitive class.
-   CAUTION: Don't change the order of the types. This table is indexed
-   by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
-
-*******************************************************************************/
-
-primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
-       { "int"     , NULL, NULL, NULL, "java/lang/Integer",   'I', "[I", NULL, NULL },
-       { "long"    , NULL, NULL, NULL, "java/lang/Long",      'J', "[J", NULL, NULL },
-       { "float"   , NULL, NULL, NULL, "java/lang/Float",     'F', "[F", NULL, NULL },
-       { "double"  , NULL, NULL, NULL, "java/lang/Double",    'D', "[D", NULL, NULL },
-       { NULL      , NULL, NULL, NULL, NULL,                   0 , NULL, NULL, NULL },
-       { "byte"    , NULL, NULL, NULL, "java/lang/Byte",      'B', "[B", NULL, NULL },
-       { "char"    , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL, NULL },
-       { "short"   , NULL, NULL, NULL, "java/lang/Short",     'S', "[S", NULL, NULL },
-       { "boolean" , NULL, NULL, NULL, "java/lang/Boolean",   'Z', "[Z", NULL, NULL },
-       { NULL      , NULL, NULL, NULL, NULL,                   0 , NULL, NULL, NULL },
-#if defined(ENABLE_JAVASE)
-       { "void"    , NULL, NULL, NULL, "java/lang/Void",      'V', NULL, NULL, NULL }
-#else
-       { NULL      , NULL, NULL, NULL, NULL,                   0 , NULL, NULL, NULL },
-#endif
-};
-
-
 /* private functions **********************************************************/
 
-static bool link_primitivetype_table(void);
 static classinfo *link_class_intern(classinfo *c);
 static arraydescriptor *link_array(classinfo *c);
 static void linker_compute_class_values(classinfo *c);
@@ -306,12 +275,6 @@ bool linker_init(void)
        if (!classcache_store_unique(pseudo_class_New))
                vm_abort("linker_init: could not cache pseudo_class_New");
 
-       /* create classes representing primitive types */
-
-       if (!link_primitivetype_table())
-               return false;
-
-
        /* Correct vftbl-entries (retarded loading and linking of class
           java/lang/String). */
 
@@ -321,90 +284,6 @@ bool linker_init(void)
 }
 
 
-/* link_primitivetype_table ****************************************************
-
-   Create classes representing primitive types.
-
-*******************************************************************************/
-
-static bool link_primitivetype_table(void)
-{  
-       utf       *name;
-       classinfo *c;
-       utf       *u;
-       s4         i;
-
-       for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
-               /* skip dummies */
-
-               if (primitivetype_table[i].cname == NULL)
-                       continue;
-
-               /* create UTF-8 name */
-
-               name = utf_new_char(primitivetype_table[i].cname);
-
-               primitivetype_table[i].name = name;
-
-               /* create primitive class */
-
-               c = class_create_classinfo(name);
-
-               /* primitive classes don't have a super class */
-
-               c->super.any = NULL;
-
-               /* set flags and mark it as primitive class */
-
-               c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT | ACC_CLASS_PRIMITIVE;
-               
-               /* prevent loader from loading primitive class */
-
-               c->state |= CLASS_LOADED;
-
-               /* INFO: don't put primitive classes into the classcache */
-
-               if (!link_class(c))
-                       return false;
-
-               primitivetype_table[i].class_primitive = c;
-
-               /* create class for wrapping the primitive type */
-
-               u = utf_new_char(primitivetype_table[i].wrapname);
-               c = load_class_bootstrap(u);
-
-               if (c == NULL)
-                       return false;
-
-               primitivetype_table[i].class_wrap = c;
-
-               /* create the primitive array class */
-
-               if (primitivetype_table[i].arrayname) {
-                       u = utf_new_char(primitivetype_table[i].arrayname);
-                       c = class_create_classinfo(u);
-                       c = load_newly_created_array(c, NULL);
-
-                       if (c == NULL)
-                               return false;
-
-                       primitivetype_table[i].arrayclass = c;
-
-                       assert(c->state & CLASS_LOADED);
-
-                       if (!(c->state & CLASS_LINKED))
-                               if (!link_class(c))
-                                       return false;
-
-                       primitivetype_table[i].arrayvftbl = c->vftbl;
-               }
-       }
-
-       return true;
-}
-
-
 /* link_class ******************************************************************
 
    Wrapper function for link_class_intern to ease monitor enter/exit
index 1035798f6107248036ddbb0d5a77d440b49624bc..44ba317be042a0d21b31da947ccc83fdec88e6c8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: linker.h 8056 2007-06-10 14:49:57Z michi $
+   $Id: linker.h 8123 2007-06-20 23:50:55Z michi $
 */
 
 
@@ -134,28 +134,8 @@ struct arraydescriptor {
 };
 
 
-/* primitivetypeinfo **********************************************************/
-
-struct primitivetypeinfo {
-       char      *cname;                    /* char name of primitive class      */
-       utf       *name;                     /* name of primitive class           */
-       classinfo *class_wrap;               /* class for wrapping primitive type */
-       classinfo *class_primitive;          /* primitive class                   */
-       char      *wrapname;                 /* name of class for wrapping        */
-       char       typesig;                  /* one character type signature      */
-       char      *arrayname;                /* name of primitive array class     */
-       classinfo *arrayclass;               /* primitive array class             */
-       vftbl_t   *arrayvftbl;               /* vftbl of primitive array class    */
-};
-
-
 /* global variables ***********************************************************/
 
-/* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_ constants   */
-/* (except ARRAYTYPE_OBJECT).                                                 */
-
-extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
-
 /* This lock must be taken while renumbering classes or while atomically      */
 /* accessing classes.                                                         */
 
index 4d547f5753c7608ab81d8ef0c371a36571709409..a0da4bd74ac5b0602ced587fbdcd3c9877685d88 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: loader.c 7921 2007-05-20 23:14:11Z michi $
+   $Id: loader.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -59,6 +59,7 @@
 #include "vmcore/linker.h"
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
+#include "vmcore/primitive.h"
 #include "vmcore/rt-timing.h"
 
 #if defined(ENABLE_STATISTICS)
@@ -1661,7 +1662,7 @@ classinfo *load_class_from_classloader(utf *name, classloader *cl)
                        case 'L':
                                /* check for cases like `[L;' or `[L[I;' or `[Ljava.lang.Object' */
                                if (namelen < 4 || text[2] == '[' || text[namelen - 1] != ';') {
-                                       exceptions_throw_noclassdeffounderror(name);
+                                       exceptions_throw_classnotfoundexception(name);
                                        return false;
                                }
 
@@ -1755,18 +1756,6 @@ classinfo *load_class_from_classloader(utf *name, classloader *cl)
                        }
 
                        c = tmpc;
-
-               } else {
-                       /* loadClass has thrown an exception.  We must convert
-                          ClassNotFoundException into
-                          NoClassDefFoundException. */
-
-                       /* XXX Maybe we should have a flag that avoids this
-                          conversion for calling load_class_from_classloader from
-                          Class.forName.  Currently we do a double conversion in
-                          these cases.  */
-
-                       classnotfoundexception_to_noclassdeffounderror();
                }
 
                RT_TIMING_GET_TIME(time_cache);
@@ -1833,8 +1822,9 @@ classinfo *load_class_bootstrap(utf *name)
 
        /* lookup if this class has already been loaded */
 
-       if ((r = classcache_lookup(NULL, name))) {
+       r = classcache_lookup(NULL, name);
 
+       if (r != NULL) {
                RT_TIMING_GET_TIME(time_lookup);
                RT_TIMING_TIME_DIFF(time_start,time_lookup,RT_TIMING_LOAD_BOOT_LOOKUP);
                
@@ -1852,8 +1842,10 @@ classinfo *load_class_bootstrap(utf *name)
 
        if (name->text[0] == '[') {
                c = load_newly_created_array(c, NULL);
+
                if (c == NULL)
                        return NULL;
+
                assert(c->state & CLASS_LOADED);
 
                RT_TIMING_GET_TIME(time_array);
@@ -1882,7 +1874,7 @@ classinfo *load_class_bootstrap(utf *name)
                if (name == utf_java_lang_Object)
                        vm_abort("java/lang/NoClassDefFoundError: java/lang/Object");
 
-               exceptions_throw_noclassdeffounderror(name);
+               exceptions_throw_classnotfoundexception(name);
 
                return NULL;
        }
@@ -2533,13 +2525,13 @@ classinfo *load_newly_created_array(classinfo *c, classloader *loader)
        s4                 namelen;
        utf               *u;
 
-       text = c->name->text;
+       text    = c->name->text;
        namelen = c->name->blength;
 
        /* Check array class name */
 
        if ((namelen < 2) || (text[0] != '[')) {
-               exceptions_throw_noclassdeffounderror(c->name);
+               exceptions_throw_classnotfoundexception(c->name);
                return NULL;
        }
 
@@ -2550,7 +2542,10 @@ classinfo *load_newly_created_array(classinfo *c, classloader *loader)
                /* c is an array of arrays. We have to create the component class. */
 
                u = utf_new(text + 1, namelen - 1);
-               if (!(comp = load_class_from_classloader(u, loader)))
+
+               comp = load_class_from_classloader(u, loader);
+
+               if (comp == NULL)
                        return NULL;
 
                assert(comp->state & CLASS_LOADED);
@@ -2569,7 +2564,7 @@ classinfo *load_newly_created_array(classinfo *c, classloader *loader)
 
                /* check for cases like `[L;' or `[L[I;' or `[Ljava.lang.Object' */
                if ((namelen < 4) || (text[2] == '[') || (text[namelen - 1] != ';')) {
-                       exceptions_throw_noclassdeffounderror(c->name);
+                       exceptions_throw_classnotfoundexception(c->name);
                        return NULL;
                }
 
@@ -2592,9 +2587,11 @@ classinfo *load_newly_created_array(classinfo *c, classloader *loader)
        default:
                /* c is an array of a primitive type */
 
-               /* check for cases like `[II' */
-               if (namelen > 2) {
-                       exceptions_throw_noclassdeffounderror(c->name);
+               /* check for cases like `[II' and whether the character is a
+                  valid primitive type */
+
+               if ((namelen > 2) || (primitive_class_get_by_char(text[1]) == NULL)) {
+                       exceptions_throw_classnotfoundexception(c->name);
                        return NULL;
                }
 
index bd8471555bd6546cc41b2ff5c87c46445d93c9e0..c03b30013b2a65beb13a628723182241f0136323 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: method.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: method.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -238,6 +238,26 @@ java_objectarray *method_get_exceptionarray(methodinfo *m)
 }
 
 
+/* method_returntype_get *******************************************************
+
+   Get the return type of the method.
+
+*******************************************************************************/
+
+classinfo *method_returntype_get(methodinfo *m)
+{
+       typedesc  *td;
+       classinfo *c;
+
+       td = &(m->parseddesc->returntype);
+
+       if (!resolve_class_from_typedesc(td, true, false, &c))
+               return NULL;
+
+       return c;
+}
+
+
 /* method_count_implementations ************************************************
 
    Count the implementations of a method in a class cone (a class and all its
index 986b99c57428beaaf90e39910254807015f856c3..19a50228d5d55e2b054f8fdba4b52d86194e1a09 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: method.h 8027 2007-06-07 10:30:33Z michi $
+   $Id: method.h 8123 2007-06-20 23:50:55Z michi $
 */
 
 
@@ -164,6 +164,7 @@ methodinfo *method_vftbl_lookup(vftbl_t *vftbl, methodinfo* m);
 
 java_objectarray *method_get_parametertypearray(methodinfo *m);
 java_objectarray *method_get_exceptionarray(methodinfo *m);
+classinfo        *method_returntype_get(methodinfo *m);
 
 void method_add_assumption_monomorphic(methodinfo *m, methodinfo *caller);
 void method_break_assumption_monomorphic(methodinfo *m, method_worklist **wl);
index d1047f01f63ce0681220dca51edf07757de49192..c143a0c61bc2409111fc71416040c21d9d5e0034 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: options.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: options.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
 #include "config.h"
 
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
 #if defined(HAVE_STRING_H)
 # include <string.h>
 #endif
 
 #include <limits.h>
 
-#include "vm/types.h"
-
 #include "mm/memory.h"
+
 #include "native/jni.h"
+
+#include "vm/vm.h"
+
 #include "vmcore/options.h"
 
 
@@ -77,8 +84,6 @@ bool opt_verboseclass     = false;
 bool opt_verbosegc        = false;
 bool opt_verbosejni       = false;
 bool opt_verbosecall      = false;      /* trace all method invocation        */
-bool opt_verboseexception = false;
-bool opt_verbosememory    = false;
 bool opt_verbosethreads   = false;
 
 bool showmethods = false;
@@ -169,6 +174,40 @@ const char *opt_filter_verbosecall_exclude = 0;
 const char *opt_filter_show_method = 0;
 #endif
 
+
+/* -XX options ****************************************************************/
+
+/* NOTE: For better readability keep these alpha-sorted. */
+
+int32_t  opt_ProfileGCMemoryUsage      = 0;
+int32_t  opt_ProfileMemoryUsage        = 0;
+FILE    *opt_ProfileMemoryUsageGNUPlot = NULL;
+int32_t  opt_TraceExceptions           = 0;
+#if defined(ENABLE_REPLACEMENT)
+int32_t  opt_TraceReplacement          = 0;
+#endif
+
+
+enum {
+       OPT_ProfileGCMemoryUsage,
+       OPT_ProfileMemoryUsage,
+       OPT_ProfileMemoryUsageGNUPlot,
+       OPT_TraceExceptions,
+       OPT_TraceReplacement
+};
+
+
+option_t options_XX[] = {
+       { "ProfileGCMemoryUsage",      OPT_ProfileGCMemoryUsage,      "" },
+       { "ProfileMemoryUsage",        OPT_ProfileMemoryUsage,        "" },
+       { "ProfileMemoryUsageGNUPlot", OPT_ProfileMemoryUsageGNUPlot, "" },
+       { "TraceExceptions",           OPT_TraceExceptions,           "" },
+#if defined(ENABLE_REPLACEMENT)
+       { "TraceReplacement",          OPT_TraceReplacement,          "" },
+#endif
+};
+
+
 /* options_get *****************************************************************
 
    DOCUMENT ME!!!
@@ -251,6 +290,106 @@ s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
 }
 
 
+/* options_xx ******************************************************************
+
+   Handle -XX: options.
+
+*******************************************************************************/
+
+void options_xx(const char *name)
+{
+       char    *end;
+       int32_t  length;
+       char    *value;
+       int32_t  option;
+       char    *filename;
+       FILE    *file;
+       int32_t  i;
+
+       log_println("name: %s", name);
+
+       /* Search for a ':' in the option name and get the option name
+          length and the value of the option. */
+
+       end = strchr(name, ':');
+
+       if (end == NULL) {
+               length = strlen(name);
+               value  = NULL;
+       }
+       else {
+               length = end - name;
+               value  = end + 1;
+       }
+
+       /* search the option in the option array */
+
+       option = OPT_ERROR;
+
+       for (i = 0; options_XX[i].name != NULL; i++) {
+               if (strncmp(options_XX[i].name, name, length) == 0) {
+                       option = options_XX[i].option;
+                       break;
+               }
+       }
+
+       /* process the option */
+
+       switch (option) {
+       case OPT_ProfileGCMemoryUsage:
+               if (value == NULL)
+                       opt_ProfileGCMemoryUsage = 5;
+               else
+                       opt_ProfileGCMemoryUsage = atoi(value);
+               break;
+
+       case OPT_ProfileMemoryUsage:
+               if (value == NULL)
+                       opt_ProfileMemoryUsage = 5;
+               else
+                       opt_ProfileMemoryUsage = atoi(value);
+
+# if defined(ENABLE_STATISTICS)
+               /* we also need statistics */
+
+               opt_stat = true;
+# endif
+               break;
+
+       case OPT_ProfileMemoryUsageGNUPlot:
+               if (value == NULL)
+                       filename = "profile.dat";
+               else
+                       filename = value;
+
+               file = fopen(filename, "w");
+
+               if (file == NULL)
+                       vm_abort("options_xx: fopen failed: %s", strerror(errno));
+
+               opt_ProfileMemoryUsageGNUPlot = file;
+               break;
+
+       case OPT_TraceExceptions:
+               opt_TraceExceptions = true;
+               break;
+
+#if defined(ENABLE_REPLACEMENT)
+       case OPT_TraceReplacement:
+               if (value == NULL)
+                       opt_TraceReplacement = 1;
+               else
+                       opt_TraceReplacement = atoi(value);
+               break;
+#endif
+
+       default:
+               printf("Unknown option: -XX:%s\n", name);
+               break;
+       }
+}
+
+
 /*
  * 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
index 13e561b551573ea9e8a93a96ac473ca8426288c2..c1ee4d381318b4ed171bba08707847d6fa144b1e 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: options.h 8027 2007-06-07 10:30:33Z michi $
+   $Id: options.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -32,6 +32,9 @@
 
 
 #include "config.h"
+
+#include <stdint.h>
+
 #include "vm/types.h"
 
 #include "native/jni.h"
@@ -57,6 +60,15 @@ struct opt_struct {
 };
 
 
+typedef struct option_t option_t;
+
+struct option_t {
+       char    *name;
+       int32_t  option;
+       char    *doc;
+};
+
+
 /* global variables ***********************************************************/
 
 extern s4    opt_index;
@@ -86,8 +98,6 @@ extern bool opt_verboseclass;
 extern bool opt_verbosegc;
 extern bool opt_verbosejni;
 extern bool opt_verbosecall;
-extern bool opt_verboseexception;
-extern bool opt_verbosememory;
 extern bool opt_verbosethreads;
 
 extern bool showmethods;
@@ -178,9 +188,24 @@ extern const char *opt_filter_verbosecall_exclude;
 extern const char *opt_filter_show_method;
 #endif
 
+
+/* -XX options ****************************************************************/
+
+/* NOTE: For better readability keep these alpha-sorted. */
+
+extern int32_t  opt_ProfileGCMemoryUsage;
+extern int32_t  opt_ProfileMemoryUsage;
+extern FILE    *opt_ProfileMemoryUsageGNUPlot;
+extern int32_t  opt_TraceExceptions;
+#if defined(ENABLE_REPLACEMENT)
+extern int32_t  opt_TraceReplacement;
+#endif
+
+
 /* function prototypes ********************************************************/
 
-s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args);
+s4   options_get(opt_struct *opts, JavaVMInitArgs *vm_args);
+void options_xx(const char *name);
 
 #endif /* _OPTIONS_H */
 
diff --git a/src/vmcore/primitive.c b/src/vmcore/primitive.c
new file mode 100644 (file)
index 0000000..ba2b3e2
--- /dev/null
@@ -0,0 +1,280 @@
+/* src/vmcore/primitive.c - primitive types
+
+   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: linker.c 8042 2007-06-07 17:43:29Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+
+#include "vm/types.h"
+
+#include "vm/global.h"
+
+#include "vmcore/class.h"
+#include "vmcore/primitive.h"
+#include "vmcore/utf8.h"
+
+
+/* primitivetype_table *********************************************************
+
+   Structure for primitive classes: contains the class for wrapping
+   the primitive type, the primitive class, the name of the class for
+   wrapping, the one character type signature and the name of the
+   primitive class.
+   CAUTION: Don't change the order of the types. This table is indexed
+   by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
+
+*******************************************************************************/
+
+primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
+       { "int"     , NULL, NULL, NULL, "java/lang/Integer",   'I', "[I", NULL },
+       { "long"    , NULL, NULL, NULL, "java/lang/Long",      'J', "[J", NULL },
+       { "float"   , NULL, NULL, NULL, "java/lang/Float",     'F', "[F", NULL },
+       { "double"  , NULL, NULL, NULL, "java/lang/Double",    'D', "[D", NULL },
+       { NULL      , NULL, NULL, NULL, NULL,                   0 , NULL, NULL },
+       { "byte"    , NULL, NULL, NULL, "java/lang/Byte",      'B', "[B", NULL },
+       { "char"    , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL },
+       { "short"   , NULL, NULL, NULL, "java/lang/Short",     'S', "[S", NULL },
+       { "boolean" , NULL, NULL, NULL, "java/lang/Boolean",   'Z', "[Z", NULL },
+       { NULL      , NULL, NULL, NULL, NULL,                   0 , NULL, NULL },
+#if defined(ENABLE_JAVASE)
+       { "void"    , NULL, NULL, NULL, "java/lang/Void",      'V', NULL, NULL }
+#else
+       { NULL      , NULL, NULL, NULL, NULL,                   0 , NULL, NULL },
+#endif
+};
+
+
+/* primitive_init **************************************************************
+
+   Create classes representing primitive types.
+
+*******************************************************************************/
+
+bool primitive_init(void)
+{  
+       utf       *name;
+       classinfo *c;
+       utf       *u;
+       s4         i;
+
+       for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
+               /* skip dummies */
+
+               if (primitivetype_table[i].cname == NULL)
+                       continue;
+
+               /* create UTF-8 name */
+
+               name = utf_new_char(primitivetype_table[i].cname);
+
+               primitivetype_table[i].name = name;
+
+               /* create primitive class */
+
+               c = class_create_classinfo(name);
+
+               /* primitive classes don't have a super class */
+
+               c->super.any = NULL;
+
+               /* set flags and mark it as primitive class */
+
+               c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT | ACC_CLASS_PRIMITIVE;
+               
+               /* prevent loader from loading primitive class */
+
+               c->state |= CLASS_LOADED;
+
+               /* INFO: don't put primitive classes into the classcache */
+
+               if (!link_class(c))
+                       return false;
+
+               primitivetype_table[i].class_primitive = c;
+
+               /* create class for wrapping the primitive type */
+
+               u = utf_new_char(primitivetype_table[i].wrapname);
+               c = load_class_bootstrap(u);
+
+               if (c == NULL)
+                       return false;
+
+               primitivetype_table[i].class_wrap = c;
+
+               /* create the primitive array class */
+
+               if (primitivetype_table[i].arrayname) {
+                       u = utf_new_char(primitivetype_table[i].arrayname);
+                       c = class_create_classinfo(u);
+                       c = load_newly_created_array(c, NULL);
+
+                       if (c == NULL)
+                               return false;
+
+                       primitivetype_table[i].arrayclass = c;
+
+                       assert(c->state & CLASS_LOADED);
+
+                       if (!(c->state & CLASS_LINKED))
+                               if (!link_class(c))
+                                       return false;
+               }
+       }
+
+       return true;
+}
+
+
+/* primitive_class_is_primitive ************************************************
+
+   Check if the given class is a primitive class.
+
+*******************************************************************************/
+
+bool primitive_class_is_primitive(classinfo *c)
+{
+       s4 i;
+
+       /* search table of primitive classes */
+
+       for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
+               if (primitivetype_table[i].class_primitive == c)
+                       return true;
+
+       return false;
+}
+
+
+/* primitive_class_get_by_name *************************************************
+
+   Returns the primitive class of the given class name.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_name(utf *name)
+{
+       s4 i;
+
+       /* search table of primitive classes */
+
+       for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
+               if (primitivetype_table[i].name == name)
+                       return primitivetype_table[i].class_primitive;
+
+       /* keep compiler happy */
+
+       return NULL;
+}
+
+
+/* primitive_class_get_by_type *************************************************
+
+   Returns the primitive class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_type(s4 type)
+{
+       return primitivetype_table[type].class_primitive;
+}
+
+
+/* primitive_class_get_by_char *************************************************
+
+   Returns the primitive class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_char(char ch)
+{
+       s4 index;
+
+       switch (ch) {
+       case 'I':
+               index = PRIMITIVETYPE_INT;
+               break;
+       case 'J':
+               index = PRIMITIVETYPE_LONG;
+               break;
+       case 'F':
+               index = PRIMITIVETYPE_FLOAT;
+               break;
+       case 'D':
+               index = PRIMITIVETYPE_DOUBLE;
+               break;
+       case 'B':
+               index = PRIMITIVETYPE_BYTE;
+               break;
+       case 'C':
+               index = PRIMITIVETYPE_CHAR;
+               break;
+       case 'S':
+               index = PRIMITIVETYPE_SHORT;
+               break;
+       case 'Z':
+               index = PRIMITIVETYPE_BOOLEAN;
+               break;
+       case 'V':
+               index = PRIMITIVETYPE_VOID;
+               break;
+       default:
+               return NULL;
+       }
+
+       return primitivetype_table[index].class_primitive;
+}
+
+
+/* primitive_arrayclass_get_by_type ********************************************
+
+   Returns the primitive array-class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_arrayclass_get_by_type(s4 type)
+{
+       return primitivetype_table[type].arrayclass;
+}
+
+
+/*
+ * 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:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
diff --git a/src/vmcore/primitive.h b/src/vmcore/primitive.h
new file mode 100644 (file)
index 0000000..eb04084
--- /dev/null
@@ -0,0 +1,127 @@
+/* src/vmcore/primitive.c - primitive types
+
+   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: linker.c 8042 2007-06-07 17:43:29Z twisti $
+
+*/
+
+
+#ifndef _PRIMITIVE_H
+#define _PRIMITIVE_H
+
+#include "config.h"
+
+#include "vm/global.h"
+
+#include "vmcore/class.h"
+#include "vmcore/linker.h"
+#include "vmcore/utf8.h"
+
+
+/* primitive data types *******************************************************/
+
+/* These values are used in parsed descriptors and in some other
+   places were the different types handled internally as TYPE_INT have
+   to be distinguished. */
+
+#define PRIMITIVETYPE_COUNT  11  /* number of primitive types (+ dummies)     */
+
+/* CAUTION: Don't change the numerical values! These constants are
+   used as indices into the primitive type table. */
+
+#define PRIMITIVETYPE_INT     TYPE_INT
+#define PRIMITIVETYPE_LONG    TYPE_LNG
+#define PRIMITIVETYPE_FLOAT   TYPE_FLT
+#define PRIMITIVETYPE_DOUBLE  TYPE_DBL
+#define PRIMITIVETYPE_DUMMY1  TYPE_ADR     /* not used! */
+#define PRIMITIVETYPE_BYTE    5
+#define PRIMITIVETYPE_CHAR    6
+#define PRIMITIVETYPE_SHORT   7
+#define PRIMITIVETYPE_BOOLEAN 8
+#define PRIMITIVETYPE_DUMMY2  9            /* not used! */
+#define PRIMITIVETYPE_VOID    TYPE_VOID
+
+
+/* CAUTION: Don't change the numerical values! These constants (with
+   the exception of ARRAYTYPE_OBJECT) are used as indices in the
+   primitive type table. */
+
+#define ARRAYTYPE_INT         PRIMITIVETYPE_INT
+#define ARRAYTYPE_LONG        PRIMITIVETYPE_LONG
+#define ARRAYTYPE_FLOAT       PRIMITIVETYPE_FLOAT
+#define ARRAYTYPE_DOUBLE      PRIMITIVETYPE_DOUBLE
+#define ARRAYTYPE_BYTE        PRIMITIVETYPE_BYTE
+#define ARRAYTYPE_CHAR        PRIMITIVETYPE_CHAR
+#define ARRAYTYPE_SHORT       PRIMITIVETYPE_SHORT
+#define ARRAYTYPE_BOOLEAN     PRIMITIVETYPE_BOOLEAN
+#define ARRAYTYPE_OBJECT      PRIMITIVETYPE_VOID     /* don't use as index! */
+
+
+/* primitivetypeinfo **********************************************************/
+
+struct primitivetypeinfo {
+       char      *cname;                    /* char name of primitive class      */
+       utf       *name;                     /* name of primitive class           */
+       classinfo *class_wrap;               /* class for wrapping primitive type */
+       classinfo *class_primitive;          /* primitive class                   */
+       char      *wrapname;                 /* name of class for wrapping        */
+       char       typesig;                  /* one character type signature      */
+       char      *arrayname;                /* name of primitive array class     */
+       classinfo *arrayclass;               /* primitive array class             */
+};
+
+
+/* global variables ***********************************************************/
+
+/* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
+   constants (except ARRAYTYPE_OBJECT). */
+
+extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
+
+
+/* function prototypes ********************************************************/
+
+bool       primitive_init(void);
+bool       primitive_class_is_primitive(classinfo *c);
+classinfo *primitive_class_get_by_name(utf *name);
+classinfo *primitive_class_get_by_type(s4 type);
+classinfo *primitive_class_get_by_char(char ch);
+classinfo *primitive_arrayclass_get_by_type(s4 type);
+
+#endif /* _PRIMITIVE_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:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index b363abd0f3599dc52b3be1eb4a42c1bc1728d3f3..75323a87f0106159773d25a78f79050026c61073 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: statistics.c 8027 2007-06-07 10:30:33Z michi $
+   $Id: statistics.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -140,8 +140,12 @@ int count_mov_mem_mem = 0;
 
 int count_jit_calls = 0;
 int count_methods = 0;
-int count_spills = 0;
-int count_spills_read = 0;
+int count_spills_read_ila = 0;
+int count_spills_read_flt = 0;
+int count_spills_read_dbl = 0;
+int count_spills_write_ila = 0;
+int count_spills_write_flt = 0;
+int count_spills_write_dbl = 0;
 int count_pcmd_activ = 0;
 int count_pcmd_drop = 0;
 int count_pcmd_zero = 0;
@@ -177,6 +181,12 @@ int count_cstub_len = 0;
 int count_max_new_stack = 0;
 int count_upper_bound_new_stack = 0;
 
+int count_emit_branch = 0;
+int count_emit_branch_8bit = 0;
+int count_emit_branch_16bit = 0;
+int count_emit_branch_32bit = 0;
+int count_emit_branch_64bit = 0;
+
 s4 count_branches_resolved   = 0;
 s4 count_branches_unresolved = 0;
 
@@ -405,8 +415,12 @@ void print_stats(void)
 
        dolog("Size of compiled Exception Tables:      %d", count_javaexcsize);
        dolog("Number of Machine-Instructions: %d", count_code_len >> 2);
-       dolog("Number of Spills (write to memory): %d", count_spills);
-       dolog("Number of Spills (read from memory): %d", count_spills_read);
+       dolog("Number of Spills (write to memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+               count_spills_write_ila + count_spills_write_flt + count_spills_write_dbl,
+               count_spills_write_ila, count_spills_write_flt, count_spills_write_dbl);
+       dolog("Number of Spills (read from memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+               count_spills_read_ila + count_spills_read_flt + count_spills_read_dbl,
+               count_spills_read_ila, count_spills_read_flt, count_spills_read_dbl);
        dolog("Number of Activ    Pseudocommands: %6d", count_pcmd_activ);
        dolog("Number of Drop     Pseudocommands: %6d", count_pcmd_drop);
        dolog("Number of Const    Pseudocommands: %6d (zero:%5d)",
@@ -431,6 +445,11 @@ void print_stats(void)
        dolog("Number of Null Pointer Checks:     %6d", count_check_null);
        dolog("Number of Array Bound Checks:      %6d", count_check_bound);
        dolog("Number of Try-Blocks: %d", count_tryblocks);
+
+       dolog("Number of branch_emit (total, 8bit/16bit/32bit/64bit offset): %d, %d/%d/%d/%d",
+               count_emit_branch,  count_emit_branch_8bit,  count_emit_branch_16bit, 
+                                                       count_emit_branch_32bit, count_emit_branch_64bit);
+
        dolog("Maximal count of stack elements:   %d", count_max_new_stack);
        dolog("Upper bound of max stack elements: %d", count_upper_bound_new_stack);
        dolog("Distribution of stack sizes at block boundary");
@@ -717,14 +736,44 @@ void statistics_print_memory_usage(void)
 
 void statistics_print_gc_memory_usage(void)
 {
-       log_println("GC memory usage -------------------");
-       log_println("");
-       log_println("max. heap size: %10lld", gc_get_max_heap_size());
-       log_println("");
-       log_println("heap size:      %10lld", gc_get_heap_size());
-       log_println("free:           %10lld", gc_get_free_bytes());
-       log_println("used:           %10lld", gc_get_total_bytes());
-       log_println("");
+       static int64_t count = 0;
+       int64_t max;
+       int64_t size;
+       int64_t free;
+       int64_t used;
+       int64_t total;
+
+       count++;
+
+       max   = gc_get_max_heap_size();
+       size  = gc_get_heap_size();
+       free  = gc_get_free_bytes();
+       used  = size - free;
+       total = gc_get_total_bytes();
+
+       if (opt_ProfileMemoryUsageGNUPlot) {
+               if (count == 1)
+                       fprintf(opt_ProfileMemoryUsageGNUPlot, "plot \"profile.dat\" using 1:2 with lines title \"max. Java heap size\", \"profile.dat\" using 1:3 with lines title \"Java heap size\", \"profile.dat\" using 1:4 with lines title \"used\", \"profile.dat\" using 1:5 with lines title \"free\"\n");
+
+#if SIZEOF_VOID_P == 8
+               fprintf(opt_ProfileMemoryUsageGNUPlot, "%ld %ld %ld %ld %ld\n", count, max, size, used, free);
+#else
+               fprintf(opt_ProfileMemoryUsageGNUPlot, "%lld %lld %lld %lld %lld\n", count, max, size, used, free);
+#endif
+
+               fflush(opt_ProfileMemoryUsageGNUPlot);
+       }
+       else {
+               log_println("GC memory usage -------------------");
+               log_println("");
+               log_println("max. Java heap size: %10lld", max);
+               log_println("");
+               log_println("Java heap size:      %10lld", size);
+               log_println("used:                %10lld", used);
+               log_println("free:                %10lld", free);
+               log_println("totally used:        %10lld", total);
+               log_println("");
+       }
 }
 
 
index e470c50fd6a21c62599437d6cff1a587b410cc9b..74b4d486fc6dc3a8de3f44a4453a70a2bc81dca5 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: statistics.h 8027 2007-06-07 10:30:33Z michi $
+   $Id: statistics.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -142,8 +142,12 @@ extern int count_mov_mem_mem;
 
 extern int count_jit_calls;
 extern int count_methods;
-extern int count_spills;
-extern int count_spills_read;
+extern int count_spills_read_ila;
+extern int count_spills_read_flt;
+extern int count_spills_read_dbl;
+extern int count_spills_write_ila;
+extern int count_spills_write_flt;
+extern int count_spills_write_dbl;
 extern int count_pcmd_activ;
 extern int count_pcmd_drop;
 extern int count_pcmd_zero;
@@ -179,6 +183,12 @@ extern int count_cstub_len;
 extern int count_max_new_stack;
 extern int count_upper_bound_new_stack;
 
+extern int count_emit_branch;
+extern int count_emit_branch_8bit;
+extern int count_emit_branch_16bit;
+extern int count_emit_branch_32bit;
+extern int count_emit_branch_64bit;
+
 extern s4 count_branches_resolved;
 extern s4 count_branches_unresolved;
 
index 4e045fdf361abc7b119ee14971c533ea76f0d2bc..4575dc2dcb62454acb7c1a1cab2fe24590921f67 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: utf8.c 8056 2007-06-10 14:49:57Z michi $
+   $Id: utf8.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -172,6 +172,7 @@ utf *utf_value;
 
 utf *utf_fillInStackTrace;
 utf *utf_getSystemClassLoader;
+utf *utf_initCause;
 utf *utf_loadClass;
 utf *utf_printStackTrace;
 
@@ -205,6 +206,7 @@ utf *utf_java_lang_String__void;        /* (Ljava/lang/String;)V              */
 utf *utf_java_lang_String__java_lang_Class;
 utf *utf_java_lang_Thread__V;           /* (Ljava/lang/Thread;)V              */
 utf *utf_java_lang_Throwable__void;     /* (Ljava/lang/Throwable;)V           */
+utf *utf_java_lang_Throwable__java_lang_Throwable;
 
 utf *utf_not_named_yet;                 /* special name for unnamed classes   */
 utf *utf_null;
@@ -409,6 +411,7 @@ bool utf8_init(void)
 
        utf_fillInStackTrace           = utf_new_char("fillInStackTrace");
        utf_getSystemClassLoader       = utf_new_char("getSystemClassLoader");
+       utf_initCause                  = utf_new_char("initCause");
        utf_loadClass                  = utf_new_char("loadClass");
        utf_printStackTrace            = utf_new_char("printStackTrace");
 
@@ -451,6 +454,9 @@ bool utf8_init(void)
        utf_java_lang_Thread__V        = utf_new_char("(Ljava/lang/Thread;)V");
        utf_java_lang_Throwable__void  = utf_new_char("(Ljava/lang/Throwable;)V");
 
+       utf_java_lang_Throwable__java_lang_Throwable =
+               utf_new_char("(Ljava/lang/Throwable;)Ljava/lang/Throwable;");
+
        utf_null                       = utf_new_char("null");
        utf_not_named_yet              = utf_new_char("\t<not_named_yet>");
        array_packagename              = utf_new_char("\t<the array package>");
index 83f990b0954a171d7cafcb5790a832433560bf23..da788d77450c9ef0194af2bc11a36f71a0c7de4a 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: utf8.h 8056 2007-06-10 14:49:57Z michi $
+   $Id: utf8.h 8123 2007-06-20 23:50:55Z michi $
 
 */
 
@@ -168,6 +168,7 @@ extern utf *utf_value;
 
 extern utf *utf_fillInStackTrace;
 extern utf *utf_getSystemClassLoader;
+extern utf *utf_initCause;
 extern utf *utf_loadClass;
 extern utf *utf_printStackTrace;
 
@@ -201,6 +202,7 @@ extern utf *utf_java_lang_String__void;
 extern utf *utf_java_lang_String__java_lang_Class;
 extern utf *utf_java_lang_Thread__V;
 extern utf *utf_java_lang_Throwable__void;
+extern utf *utf_java_lang_Throwable__java_lang_Throwable;
 
 extern utf *utf_not_named_yet;
 extern utf *utf_null;
index 6824b32fb5080478859e538cc75c3d742d2e496c..4d48aa093b3d0f32b16f1ade47003248ddfb7314 100644 (file)
@@ -1,6 +1,6 @@
 /* tests/regression/native/testarguments.c - tests argument passing
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 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,
    TU Wien
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   Changes:
-
-   $Id: testarguments.c 4893 2006-05-08 11:03:57Z twisti $
+   $Id: testarguments.c 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
+#include "config.h"
+
 #include <stdio.h>
 
-#include "config.h"
 #include "native/jni.h"
 
 
+JNIEXPORT jobject JNICALL Java_testarguments_adr(JNIEnv *env, jclass clazz, jint i)
+{
+  switch (i) {
+  case 1:
+    return (jobject) 0x11111111;
+  case 2:
+    return (jobject) 0x22222222;
+  case 3:
+    return (jobject) 0x33333333;
+  case 4:
+    return (jobject) 0x44444444;
+  case 5:
+    return (jobject) 0x55555555;
+  case 6:
+    return (jobject) 0x66666666;
+  case 7:
+    return (jobject) 0x77777777;
+  case 8:
+    return (jobject) 0x88888888;
+  case 9:
+    return (jobject) 0x99999999;
+  case 10:
+    return (jobject) 0xaaaaaaaa;
+  case 11:
+    return (jobject) 0xbbbbbbbb;
+  case 12:
+    return (jobject) 0xcccccccc;
+  case 13:
+    return (jobject) 0xdddddddd;
+  case 14:
+    return (jobject) 0xeeeeeeee;
+  case 15:
+    return (jobject) 0xffffffff;
+  }
+}
+
+
+JNIEXPORT void JNICALL Java_testarguments_np(JNIEnv *env, jclass clazz, jobject o)
+{
+#if SIZEOF_VOID_P == 8
+    printf(" 0x%lx", (long) o);
+#else
+    printf(" 0x%x", (int) o);
+#endif
+
+    fflush(stdout);
+}
+
+
 JNIEXPORT void JNICALL Java_testarguments_nisub(JNIEnv *env, jclass clazz, jint a, jint b, jint c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k, jint l, jint m, jint n, jint o)
 {
     jmethodID mid;
@@ -155,6 +199,29 @@ JNIEXPORT void JNICALL Java_testarguments_ndsub(JNIEnv *env, jclass clazz, jdoub
 }
 
 
+JNIEXPORT void JNICALL Java_testarguments_nasub(JNIEnv *env, jclass clazz, jobject a, jobject b, jobject c, jobject d, jobject e, jobject f, jobject g, jobject h, jobject i, jobject j, jobject k, jobject l, jobject m, jobject n, jobject o)
+{
+    jmethodID mid;
+
+#if SIZEOF_VOID_P == 8
+    printf("java-native: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", (long) a, (long) b, (long) c, (long) d, (long) e, (long) f, (long) g, (long) h, (long) i, (long) j, (long) k, (long) l, (long) m, (long) n, (long) o);
+#else
+    printf("java-native: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", (int) a, (int) b, (int) c, (int) d, (int) e, (int) f, (int) g, (int) h, (int) i, (int) j, (int) k, (int) l, (int) m, (int) n, (int) o);
+#endif
+
+    fflush(stdout);
+
+    mid = (*env)->GetStaticMethodID(env, clazz, "jasub", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V");
+
+    if (mid == 0) {
+        printf("native: couldn't find jasub\n");
+        return;
+    }
+
+    (*env)->CallStaticVoidMethod(env, clazz, mid, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
+}
+
+
 JNIEXPORT void JNICALL Java_testarguments_nmsub(JNIEnv *env, jclass clazz, jint a, jlong b, jfloat c, jdouble d, jint e, jlong f, jfloat g, jdouble h, jint i, jlong j, jfloat k, jdouble l, jint m, jlong n, jfloat o)
 {
     jmethodID mid;
index 35273450b03ee5c732bea99de795a4052c298ff4..366fce9b2369baa25ee6059ff7a061f435f88f97 100644 (file)
@@ -1,6 +1,6 @@
 /* tests/regressions/native/testarguments.java - tests argument passing
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 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,
    TU Wien
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   Changes:
-
-   $Id: testarguments.java 4893 2006-05-08 11:03:57Z twisti $
+   $Id: testarguments.java 8123 2007-06-20 23:50:55Z michi $
 
 */
 
 
 public class testarguments {
+    public static native Object adr(int i);
+    public static native void np(Object o);
+
     public static native void nisub(int a, int b, int c, int d, int e,
                                     int f, int g, int h, int i, int j,
                                     int k, int l, int m, int n, int o);
@@ -50,6 +47,10 @@ public class testarguments {
                                     double f, double g, double h, double i, double j,
                                     double k, double l, double m, double n, double o);
 
+    public static native void nasub(Object a, Object b, Object c, Object d, Object e,
+                                    Object f, Object g, Object h, Object i, Object j,
+                                    Object k, Object l, Object m, Object n, Object o);
+
     public static native void nmsub(int a, long b, float c, double d,
                                     int e, long f, float g, double h,
                                     int i, long j, float k, double l,
@@ -62,6 +63,7 @@ public class testarguments {
         ltest();
         ftest();
         dtest();
+        atest();
 
         mtest();
     }
@@ -115,6 +117,16 @@ public class testarguments {
         pln();
     }
 
+    static void atest() {
+        pln("testing address ----------------------------------------------");
+
+        asub(adr(1),  adr(2),  adr(3),  adr(4),  adr(5),
+             adr(6),  adr(7),  adr(8),  adr(9),  adr(10),
+             adr(11), adr(12), adr(13), adr(14), adr(15));
+
+        pln();
+    }
+
     static void mtest() {
         pln("testing mixed ------------------------------------------------");
 
@@ -187,6 +199,20 @@ public class testarguments {
         ndsub(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
     }
 
+    public static void asub(Object a, Object b, Object c, Object d, Object e,
+                            Object f, Object g, Object h, Object i, Object j,
+                            Object k, Object l, Object m, Object n, Object o) {
+        p("java-java  :");
+
+        p(a); p(b); p(c); p(d); p(e);
+        p(f); p(g); p(h); p(i); p(j);
+        p(k); p(l); p(m); p(n); p(o);
+
+        pln();
+
+        nasub(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
+    }
+
     public static void msub(int a, long b, float c, double d,
                             int e, long f, float g, double h,
                             int i, long j, float k, double l,
@@ -253,6 +279,18 @@ public class testarguments {
         pln();
     }
 
+    public static void jasub(Object a, Object b, Object c, Object d, Object e,
+                             Object f, Object g, Object h, Object i, Object j,
+                             Object k, Object l, Object m, Object n, Object o) {
+        p("native-java:");
+
+        p(a); p(b); p(c); p(d); p(e);
+        p(f); p(g); p(h); p(i); p(j);
+        p(k); p(l); p(m); p(n); p(o);
+
+        pln();
+    }
+
     public static void jmsub(int a, long b, float c, double d,
                              int e, long f, float g, double h,
                              int i, long j, float k, double l,
@@ -292,6 +330,10 @@ public class testarguments {
         p(Double.doubleToLongBits(d));
     }
 
+    static void p(Object o) {
+        np(o);
+    }
+
     static void pln() { System.out.println(); }
     static void pln(String s) { System.out.println(s); }
 }
index a8c179b5f477c70598088bb1e52ffb4db36b7987..0d34ac0fa598f0a44672d83e86dc0a56eed10a28 100644 (file)
@@ -18,6 +18,11 @@ java-java  : 0x1111111111111111 0x2222222222222222 0x3333333333333333 0x44444444
 java-native: 0x1111111111111111 0x2222222222222222 0x3333333333333333 0x4444444444444444 0x5555555555555555 0x6666666666666666 0x7777777777777777 0x8888888888888888 0x9999999999999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbbbbbbbbbb 0xcccccccccccccccc 0xdddddddddddddddd 0xeeeeeeeeeeeeeeee 0xffffffffffffffff
 native-java: 0x1111111111111111 0x2222222222222222 0x3333333333333333 0x4444444444444444 0x5555555555555555 0x6666666666666666 0x7777777777777777 0x8888888888888888 0x9999999999999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbbbbbbbbbb 0xcccccccccccccccc 0xdddddddddddddddd 0xeeeeeeeeeeeeeeee 0x7ff8000000000000
 
+testing address ----------------------------------------------
+java-java  : 0x11111111 0x22222222 0x33333333 0x44444444 0x55555555 0x66666666 0x77777777 0x88888888 0x99999999 0xaaaaaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee 0xffffffff
+java-native: 0x11111111 0x22222222 0x33333333 0x44444444 0x55555555 0x66666666 0x77777777 0x88888888 0x99999999 0xaaaaaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee 0xffffffff
+native-java: 0x11111111 0x22222222 0x33333333 0x44444444 0x55555555 0x66666666 0x77777777 0x88888888 0x99999999 0xaaaaaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee 0xffffffff
+
 testing mixed ------------------------------------------------
 java-java  : 0x11111111 0x2222222222222222 0x33333333 0x4444444444444444 0x55555555 0x6666666666666666 0x77777777 0x8888888888888888 0x99999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbb 0xcccccccccccccccc 0xdddddddd 0xeeeeeeeeeeeeeeee 0x7fc00000
 java-native: 0x11111111 0x2222222222222222 0x33333333 0x4444444444444444 0x55555555 0x6666666666666666 0x77777777 0x8888888888888888 0x99999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbb 0xcccccccccccccccc 0xdddddddd 0xeeeeeeeeeeeeeeee 0xffffffff