]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Remove the last remaining C++ code from libjit.so so that
authorRhys Weatherley <rweather@southern-storm.com.au>
Fri, 21 May 2004 04:24:24 +0000 (04:24 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Fri, 21 May 2004 04:24:24 +0000 (04:24 +0000)
it is now a pure C library.

ChangeLog
configure.in
doc/Makefile.am
doc/libjit.texi
dpas/Makefile.am
jit/Makefile.am
jit/jit-except.c [moved from jit/jit-except.cpp with 89% similarity]
jit/jit-interp.c [moved from jit/jit-interp.cpp with 99% similarity]
jitdynamic/Makefile.am
tutorial/Makefile.am

index b47a1ebc97e1d5852885f4a29d061c258b9accb5..a2c03857584a89b5ce12d6ff14c7cb924bc21741 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index e11775266cd26c7a4c391b088b39ac10637d0fb1..d91559b0373891695747f9ccd4c87a28f207e613 100644 (file)
@@ -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.
index 475edb6ba77d08544e2addd321b38be478d728de..f37b4d69fe4a466e3072760f2f10865ab1ced561 100644 (file)
@@ -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
index b84043734d8bf3106d9e89618b8e258550ea19e0..0fcbd73721ddd551efe91d987a687d855c8f9ed5 100644 (file)
@@ -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}:
index 4afa20dbaad486eee92693fee996a81b89378e41..f354fe544a823c2a1fd07a853b1fe4cf30c0cbb0 100644 (file)
@@ -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
 
index 1b9915d7393ab76a150f8257e225bde86fffc0b2..a6234730fa234312ab5bafdd5be6419f443c8f8b 100644 (file)
@@ -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)
similarity index 89%
rename from jit/jit-except.cpp
rename to jit/jit-except.c
index 88cfece776bcdd304df7471394d4e5805a27c65b..e8c20b180e4470d9960caa2c7c757d9d14e26da8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jit-except.cpp - Exception handling functions.
+ * jit-except.c - Exception handling functions.
  *
  * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
  *
  * 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;
-       }
-}
similarity index 99%
rename from jit/jit-interp.cpp
rename to jit/jit-interp.c
index 132d50c2ec52319453d269d50df499c25484006a..6e5d5a283129bd6ffeedda9d13ffbbfd9d761e69 100644 (file)
@@ -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);
        }
 
index 0e797ec7a62c9027a8be1eef8216b5edb6e99dba..8d24f4011a04b7bb4f88dde99b2d6ae08a270c72 100644 (file)
@@ -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
index 692e46fdd5a58ab1960487969f130cde926537a8..33e244a27b688749ab1cb386ad9eb872d7ad1ad6 100644 (file)
@@ -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