* Removed all Id tags.
[cacao.git] / src / vm / jit / asmpart.h
index 7e24ff6c6973a7c21caf6f330c849e94178a3691..e1ad0480786e0522c8f556df2769961a1db7a0ac 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/jit/asmpart.h - prototypes for machine specfic functions
 
-   Copyright (C) 1996-2005 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
+   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
 
    This file is part of CACAO.
 
 
    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., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
-
-   Contact: cacao@complang.tuwien.ac.at
-
-   Authors: Reinhard Grafl
-            Andreas Krall
-
-   Changes: Christian Thalinger
-
-   $Id: asmpart.h 2260 2005-04-11 09:46:24Z twisti $
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
 */
 
 #ifndef _ASMPART_H
 #define _ASMPART_H
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
-#endif
+#include "config.h"
 
-#include "vm/resolve.h"
-#include "vm/jit/stacktrace.h"
+#include <stdint.h>
 
+#include "vm/types.h"
 
-typedef struct castinfo castinfo;
+#if defined(ENABLE_THREADS)
+# include "threads/critical.h"
+#endif
 
-struct castinfo {
-       s4 super_baseval;
-       s4 super_diffval;
-       s4 sub_baseval;
-};
+#include "vm/global.h"
+#include "vm/vm.h"
 
+#include "vmcore/linker.h"
 
-#if defined(__ALPHA__)
-/* 
-   determines if the byte support instruction set (21164a and higher)
-   is available.
-*/
-int has_no_x_instr_set();
-#endif
 
+/* function prototypes ********************************************************/
+
+/* machine dependent initialization */
+s4   asm_md_init(void);
 
 /* 
    invokes the compiler for untranslated JavaVM methods.
    Register R0 contains a pointer to the method info structure
    (prepared by createcompilerstub).
 */
-void asm_call_jit_compiler();
+void asm_call_jit_compiler(void);
 
+#if defined(ENABLE_JIT)
+java_object_t *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);
 
-/* 
-   This function calls a Java-method (which possibly needs compilation)
-   with up to 4 parameters. This function calls a Java-method (which
-   possibly needs compilation) with up to 4 parameters.
-*/
-java_objectheader *asm_calljavafunction(methodinfo *m, void *arg1, void *arg2,
-                                        void *arg3, void *arg4);
-
-s4 asm_calljavafunction_int(methodinfo *m, void *arg1, void *arg2,
-                                                       void *arg3, void *arg4);
+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);
 
-
-/* 
-   This function calls a Java-method (which possibly needs compilation)
-   with up to 4 parameters. This function calls a Java-method (which
-   possibly needs compilation) with up to 4 parameters. 
-   also supports a return value
-*/
-java_objectheader *asm_calljavafunction2(methodinfo *m, u4 count, u4 size, void *callblock);
-s4 asm_calljavafunction2int(methodinfo *m, u4 count, u4 size, void *callblock);
-s8 asm_calljavafunction2long(methodinfo *m, u4 count, u4 size, void *callblock);
-float asm_calljavafunction2float(methodinfo *m, u4 count, u4 size, void *callblock);
-double asm_calljavafunction2double(methodinfo *m, u4 count, u4 size, void *callblock);
-
-/* We need these two labels in codegen.inc to add the asm_calljavafunction*'s
-   into the methodtable */
-#if defined(__I386__) || defined(__X86_64__)
-void calljava_xhandler();
-void calljava_xhandler2();
+void   asm_vm_call_method_exception_handler(void);
+void   asm_vm_call_method_end(void);
 #endif
 
-void asm_handle_exception();
-void asm_handle_nat_exception();
-void asm_handle_nullptr_exception();
-
-void asm_handle_builtin_exception(classinfo *);
-void asm_throw_and_handle_exception();
-#ifdef __ALPHA__
-void asm_throw_and_handle_nat_exception();
-void asm_refillin_and_handle_exception();
-void asm_throw_and_handle_arrayindexoutofbounds_exception();
+#if defined(ENABLE_INTRP)
+java_objectheader *intrp_asm_vm_call_method(methodinfo *m, s4 vmargscount,
+                                                                                       vm_arg *vmargs);
+
+s4     intrp_asm_vm_call_method_int(methodinfo *m, s4 vmargscount,
+                                                                       vm_arg *vmargs);
+s8     intrp_asm_vm_call_method_long(methodinfo *m, s4 vmargscount,
+                                                                        vm_arg *vmargs);
+float  intrp_asm_vm_call_method_float(methodinfo *m, s4 vmargscount,
+                                                                         vm_arg *vmargs);
+double intrp_asm_vm_call_method_double(methodinfo *m, s4 vmargscount,
+                                                                          vm_arg *vmargs);
 #endif
-void asm_throw_and_handle_hardware_arithmetic_exception();
-
-/* code patching functions */
-void asm_get_putstatic(void);
-void asm_get_putfield(void);
-void asm_builtin_new(unresolved_class *uc);
-
-void asm_builtin_newarray(unresolved_class *uc);
-#define asm_BUILTIN_newarray (functionptr) asm_builtin_newarray
 
-void asm_builtin_multianewarray(unresolved_class *uc);
-#define asm_BUILTIN_multianewarray (functionptr) asm_builtin_multianewarray
+/* exception handling functions */
 
-void asm_invokestatic_special(void);
-void asm_invokevirtual(void);
-void asm_invokeinterface(void);
-void asm_checkcast_interface(void);
-void asm_checkcast_class(void);
-void asm_check_clinit(void);
-
-
-stacktraceelement *asm_get_stackTrace();
+#if defined(ENABLE_JIT)
+void asm_handle_exception(void);
+void asm_handle_nat_exception(void);
+#endif
 
-void *asm_switchstackandcall(void *stack, void *func, void **stacktopsave, void * p);
+/* stub for throwing AbstractMethodError's */
+#if defined(ENABLE_JIT)
+void asm_abstractmethoderror(void);
+#endif
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
-extern threadcritnode asm_criticalsections;
+#if defined(ENABLE_INTRP)
+void intrp_asm_abstractmethoderror(void);
 #endif
 
-void asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out);
+/* wrapper for code patching functions */
+void asm_patcher_wrapper(void);
 
-void asm_prepare_native_stackinfo(void*ret,void*stackbegin);
-void asm_remove_native_stackinfo();
+long asm_compare_and_swap(volatile long *p, long oldval, long newval);
+void asm_memory_barrier(void);
 
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack(void *func, u1 *stack);
-#endif
+/* cache flush function */
+void asm_cacheflush(u1 *addr, s4 nbytes);
+
+u8 asm_get_cycle_count(void);
 
 #endif /* _ASMPART_H */
 
@@ -170,4 +123,5 @@ u1*  asm_initialize_thread_stack(void *func, u1 *stack);
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */