-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.in | 6 | ||||
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | doc/libjit.texi | 13 | ||||
-rw-r--r-- | dpas/Makefile.am | 2 | ||||
-rw-r--r-- | jit/Makefile.am | 7 | ||||
-rw-r--r-- | jit/jit-except.c (renamed from jit/jit-except.cpp) | 57 | ||||
-rw-r--r-- | jit/jit-interp.c (renamed from jit/jit-interp.cpp) | 16 | ||||
-rw-r--r-- | jitdynamic/Makefile.am | 2 | ||||
-rw-r--r-- | tutorial/Makefile.am | 2 |
@@ -9,6 +9,12 @@ jit/jit-interp.h, jit/jit-setjmp.h: redesign the exception handling mechanism to use "setjmp" rather than C++ exceptions. + * configure.in, doc/Makefile.am, doc/libjit.texi, dpas/Makefile.am, + jit/Makefile.am, jit/jit-except.c, jit/jit-except.cpp, + jit/jit-interp.c, jit/jit-interp.cpp, jitdynamic/Makefile.am: + remove the last remaining C++ code from libjit.so so that + it is now a pure C library. + 2004年05月20日 Rhys Weatherley <rweather@southern-storm.com.au> * include/jit/jit-value.h, jit/jit-insn.c, jit/jit-value.c: diff --git a/configure.in b/configure.in index e117752..d91559b 100644 --- a/configure.in +++ b/configure.in @@ -329,11 +329,11 @@ else JITTHROWIDIOM='' fi -dnl Determine if the C++ compiler understands the "-fno-gcse" option. +dnl Determine if the C compiler understands the "-fno-gcse" option. dnl We will get better code in the interpreter if we use this option. AC_CACHE_CHECK(for -fno-gcse option, ac_cv_prog_no_gcse, [echo 'int main(int argc, char **argv){ return 0;}' > conftest.c -if test -z "`${CXX-c++} -fno-gcse -o conftest conftest.c 2>&1`"; then +if test -z "`${CC-cc} -fno-gcse -o conftest conftest.c 2>&1`"; then ac_cv_prog_no_gcse=yes else ac_cv_prog_no_gcse=no @@ -341,7 +341,7 @@ fi rm -f conftest* ]) if test "x$ac_cv_prog_no_gcse" = "xyes" ; then - CXXFLAGS="-fno-gcse $CXXFLAGS" + CFLAGS="-fno-gcse $CFLAGS" fi dnl Determine if the C++ compiler understands the "-lstdc++" option. diff --git a/doc/Makefile.am b/doc/Makefile.am index 475edb6..f37b4d6 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -46,7 +46,7 @@ $(srcdir)/libjitext-dynlib.texi: $(top_srcdir)/jitdynamic/jit-dynlib.c $(srcdir)/libjitext-elf-read.texi: $(top_srcdir)/jit/jit-elf-read.c $(SHELL) $(srcdir)/extract-docs.sh $< >$@ -$(srcdir)/libjitext-except.texi: $(top_srcdir)/jit/jit-except.cpp +$(srcdir)/libjitext-except.texi: $(top_srcdir)/jit/jit-except.c $(SHELL) $(srcdir)/extract-docs.sh $< >$@ $(srcdir)/libjitext-function.texi: $(top_srcdir)/jit/jit-function.c diff --git a/doc/libjit.texi b/doc/libjit.texi index b840437..0fcbd73 100644 --- a/doc/libjit.texi +++ b/doc/libjit.texi @@ -236,17 +236,8 @@ All of the header files are placed into the @code{jit} sub-directory, to separate them out from regular system headers. When @code{libjit} is installed, you will typically find these headers in @code{/usr/local/include/jit} or @code{/usr/include/jit}, depending upon -how your system is configured. - -You should also link with the @code{-ljit} option and use a C++ linker, -not a C linker (because @code{libjit} contains a small amount of C++ code). -If you are using Autotools, then you can force the use of a C++ linker -by adding @code{AC_PROG_CXX} to @code{configure.in} and adding the -following line to your @code{Makefile.am}: - -@example -CCLD = $(CXX) -@end example +how your system is configured. You should also link with the +@code{-ljit} option. @noindent Every program that uses @code{libjit} needs to call @code{jit_context_create}: diff --git a/dpas/Makefile.am b/dpas/Makefile.am index 4afa20d..f354fe5 100644 --- a/dpas/Makefile.am +++ b/dpas/Makefile.am @@ -15,8 +15,6 @@ dpas_SOURCES = \ AM_YFLAGS = -d -CCLD = $(CXX) - dpas_LDADD = $(top_builddir)/jit/libjit.la dpas_DEPENDENCIES = $(top_builddir)/jit/libjit.la diff --git a/jit/Makefile.am b/jit/Makefile.am index 1b9915d..a623473 100644 --- a/jit/Makefile.am +++ b/jit/Makefile.am @@ -16,7 +16,7 @@ libjit_la_SOURCES = \ jit-elf-defs.h \ jit-elf-read.c \ jit-elf-write.c \ - jit-except.cpp \ + jit-except.c \ jit-function.c \ jit-gen-arm.h \ jit-gen-arm.c \ @@ -24,7 +24,7 @@ libjit_la_SOURCES = \ jit-insn.c \ jit-init.c \ jit-internal.h \ - jit-interp.cpp \ + jit-interp.c \ jit-intrinsic.c \ jit-live.c \ jit-memory.c \ @@ -50,6 +50,5 @@ libjit_la_SOURCES = \ jit-walk.c AM_CFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I. -I$(srcdir) -AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I. -I$(srcdir) -libjit_la_LDFLAGS = -version-info $(LIBJIT_VERSION) $(LIB_STDCPP) +libjit_la_LDFLAGS = -version-info $(LIBJIT_VERSION) diff --git a/jit/jit-except.cpp b/jit/jit-except.c index 88cfece..e8c20b1 100644 --- a/jit/jit-except.cpp +++ b/jit/jit-except.c @@ -1,5 +1,5 @@ /* - * jit-except.cpp - Exception handling functions. + * jit-except.c - Exception handling functions. * * Copyright (C) 2004 Southern Storm Software, Pty Ltd. * @@ -18,14 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - -This file must be compiled with a C++ compiler, because it uses -C++ exceptions to manage JIT exception throws. It is otherwise -straight vanilla ANSI C. - -*/ - #include "jit-internal.h" #include "jit-rules.h" #include <config.h> @@ -52,7 +44,7 @@ straight vanilla ANSI C. * data at the pointer is determined by the front end. * @end deftypefun @*/ -extern "C" void *jit_exception_get_last(void) +void *jit_exception_get_last(void) { jit_thread_control_t control = _jit_thread_get_control(); if(control) @@ -72,7 +64,7 @@ extern "C" void *jit_exception_get_last(void) * both @code{jit_exception_get_last} and @code{jit_exception_clear_last}. * @end deftypefun @*/ -extern "C" void *jit_exception_get_last_and_clear(void) +void *jit_exception_get_last_and_clear(void) { jit_thread_control_t control = _jit_thread_get_control(); if(control) @@ -95,7 +87,7 @@ extern "C" void *jit_exception_get_last_and_clear(void) * exception object before returning to regular code. * @end deftypefun @*/ -extern "C" void jit_exception_set_last(void *object) +void jit_exception_set_last(void *object) { jit_thread_control_t control = _jit_thread_get_control(); if(control) @@ -111,7 +103,7 @@ extern "C" void jit_exception_set_last(void *object) * with a parameter of NULL. * @end deftypefun @*/ -extern "C" void jit_exception_clear_last(void) +void jit_exception_clear_last(void) { jit_exception_set_last(0); } @@ -130,7 +122,7 @@ extern "C" void jit_exception_clear_last(void) * copied back into a location that is visible to the collector once more. * @end deftypefun @*/ -extern "C" void jit_exception_throw(void *object) +void jit_exception_throw(void *object) { jit_thread_control_t control = _jit_thread_get_control(); if(control) @@ -204,7 +196,7 @@ extern "C" void jit_exception_throw(void *object) * @end table * @end deftypefun @*/ -extern "C" void jit_exception_builtin(int exception_type) +void jit_exception_builtin(int exception_type) { jit_exception_func handler; void *object; @@ -256,7 +248,7 @@ extern "C" void jit_exception_builtin(int exception_type) * Returns the previous exception handler. * @end deftypefun @*/ -extern "C" jit_exception_func jit_exception_set_handler +jit_exception_func jit_exception_set_handler (jit_exception_func handler) { jit_exception_func previous; @@ -278,7 +270,7 @@ extern "C" jit_exception_func jit_exception_set_handler * Get the builtin exception handler for the current thread. * @end deftypefun @*/ -extern "C" jit_exception_func jit_exception_get_handler(void) +jit_exception_func jit_exception_get_handler(void) { jit_thread_control_t control = _jit_thread_get_control(); if(control) @@ -308,7 +300,7 @@ struct jit_stack_trace * insufficient memory to create it. * @end deftypefun @*/ -extern "C" jit_stack_trace_t jit_exception_get_stack_trace(void) +jit_stack_trace_t jit_exception_get_stack_trace(void) { jit_thread_control_t control; jit_backtrace_t top; @@ -358,7 +350,7 @@ extern "C" jit_stack_trace_t jit_exception_get_stack_trace(void) * Get the size of a stack trace. * @end deftypefun @*/ -extern "C" unsigned int jit_stack_trace_get_size(jit_stack_trace_t trace) +unsigned int jit_stack_trace_get_size(jit_stack_trace_t trace) { if(trace) { @@ -378,7 +370,7 @@ extern "C" unsigned int jit_stack_trace_get_size(jit_stack_trace_t trace) * @code{posn} within the stack trace. * @end deftypefun @*/ -extern "C" jit_function_t jit_stack_trace_get_function +jit_function_t jit_stack_trace_get_function (jit_context_t context, jit_stack_trace_t trace, unsigned int posn) { if(trace && posn < trace->size) @@ -400,7 +392,7 @@ extern "C" jit_function_t jit_stack_trace_get_function * where execution had reached at the time of the trace. * @end deftypefun @*/ -extern "C" void *jit_stack_trace_get_pc +void *jit_stack_trace_get_pc (jit_stack_trace_t trace, unsigned int posn) { if(trace && posn < trace->size) @@ -420,7 +412,7 @@ extern "C" void *jit_stack_trace_get_pc * is no bytecode offset associated with @code{posn}. * @end deftypefun @*/ -extern "C" unsigned int jit_stack_trace_get_offset +unsigned int jit_stack_trace_get_offset (jit_context_t context, jit_stack_trace_t trace, unsigned int posn) { /* TODO */ @@ -432,7 +424,7 @@ extern "C" unsigned int jit_stack_trace_get_offset * Free the memory associated with a stack trace. * @end deftypefun @*/ -extern "C" void jit_stack_trace_free(jit_stack_trace_t trace) +void jit_stack_trace_free(jit_stack_trace_t trace) { if(trace) { @@ -440,7 +432,7 @@ extern "C" void jit_stack_trace_free(jit_stack_trace_t trace) } } -extern "C" void _jit_backtrace_push +void _jit_backtrace_push (jit_backtrace_t trace, void *pc, void *catch_pc, void *sp) { jit_thread_control_t control = _jit_thread_get_control(); @@ -465,7 +457,7 @@ extern "C" void _jit_backtrace_push } } -extern "C" void _jit_backtrace_pop(void) +void _jit_backtrace_pop(void) { jit_thread_control_t control = _jit_thread_get_control(); jit_backtrace_t trace; @@ -483,7 +475,7 @@ extern "C" void _jit_backtrace_pop(void) } } -extern "C" void _jit_backtrace_set(jit_backtrace_t trace) +void _jit_backtrace_set(jit_backtrace_t trace) { jit_thread_control_t control = _jit_thread_get_control(); if(control) @@ -492,7 +484,7 @@ extern "C" void _jit_backtrace_set(jit_backtrace_t trace) } } -extern "C" void _jit_unwind_push_setjmp(jit_jmp_buf *jbuf) +void _jit_unwind_push_setjmp(jit_jmp_buf *jbuf) { jit_thread_control_t control = _jit_thread_get_control(); if(control) @@ -503,7 +495,7 @@ extern "C" void _jit_unwind_push_setjmp(jit_jmp_buf *jbuf) } } -extern "C" void _jit_unwind_pop_setjmp(void) +void _jit_unwind_pop_setjmp(void) { jit_thread_control_t control = _jit_thread_get_control(); if(control && control->setjmp_head) @@ -512,12 +504,3 @@ extern "C" void _jit_unwind_pop_setjmp(void) control->setjmp_head = control->setjmp_head->parent; } } - -extern "C" void _jit_unwind_fix_setjmp(void) -{ - jit_thread_control_t control = _jit_thread_get_control(); - if(control && control->setjmp_head) - { - control->backtrace_head = control->setjmp_head->trace; - } -} diff --git a/jit/jit-interp.cpp b/jit/jit-interp.c index 132d50c..6e5d5a2 100644 --- a/jit/jit-interp.cpp +++ b/jit/jit-interp.c @@ -1,5 +1,5 @@ /* - * jit-interp.cpp - Fallback interpreter implementation. + * jit-interp.c - Fallback interpreter implementation. * * Copyright (C) 2004 Southern Storm Software, Pty Ltd. * @@ -226,7 +226,7 @@ static void apply_from_interpreter jit_apply(signature, func, apply_args, num_fixed_args, return_area); } -void _jit_run_function(jit_function_interp *func, jit_item *args, +void _jit_run_function(jit_function_interp_t func, jit_item *args, jit_item *return_area) { jit_item *frame; @@ -4463,7 +4463,7 @@ handle_builtin: ; jit_exception_builtin(builtin_exception); } -extern "C" int jit_function_apply +int jit_function_apply (jit_function_t func, void **args, void *return_area) { if(func) @@ -4478,14 +4478,14 @@ extern "C" int jit_function_apply } /* Imported from "jit-rules-interp.c" */ -extern "C" unsigned int _jit_interp_calculate_arg_size +unsigned int _jit_interp_calculate_arg_size (jit_function_t func, jit_type_t signature); -extern "C" int jit_function_apply_vararg +int jit_function_apply_vararg (jit_function_t func, jit_type_t signature, void **args, void *return_area) { struct jit_backtrace call_trace; - jit_function_interp *entry; + jit_function_interp_t entry; jit_item interp_return_area; jit_item *arg_buffer; jit_item *temp_arg; @@ -4519,11 +4519,11 @@ extern "C" int jit_function_apply_vararg /* Make sure that the function is compiled */ if(func->is_compiled) { - entry = (jit_function_interp *)(func->entry_point); + entry = (jit_function_interp_t)(func->entry_point); } else { - entry = (jit_function_interp *) + entry = (jit_function_interp_t) _jit_function_compile_on_demand(func); } diff --git a/jitdynamic/Makefile.am b/jitdynamic/Makefile.am index 0e797ec..8d24f40 100644 --- a/jitdynamic/Makefile.am +++ b/jitdynamic/Makefile.am @@ -10,5 +10,5 @@ AM_CFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include \ libjitdynamic_la_LDFLAGS = \ -version-info $(LIBJIT_VERSION) \ - -L$(top_builddir)/jit -L$(top_builddir)/jit/.libs -ljit $(LIB_STDCPP) + -L$(top_builddir)/jit -L$(top_builddir)/jit/.libs -ljit libjitdynamic_la_DEPENDENCIES = $(top_builddir)/jit/libjit.la diff --git a/tutorial/Makefile.am b/tutorial/Makefile.am index 692e46f..33e244a 100644 --- a/tutorial/Makefile.am +++ b/tutorial/Makefile.am @@ -1,8 +1,6 @@ noinst_PROGRAMS = t1 t2 t3 t4 -CCLD = $(CXX) - t1_SOURCES = t1.c t1_LDADD = $(top_builddir)/jit/libjit.la t1_DEPENDENCIES = $(top_builddir)/jit/libjit.la |