]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Add more instances of JIT_NOTHROW to the headers; add some special
authorRhys Weatherley <rweather@southern-storm.com.au>
Sun, 2 May 2004 23:41:50 +0000 (23:41 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Sun, 2 May 2004 23:41:50 +0000 (23:41 +0000)
meta tags for types.

ChangeLog
include/jit/jit-block.h
include/jit/jit-context.h
include/jit/jit-dump.h
include/jit/jit-elf.h
include/jit/jit-init.h
include/jit/jit-meta.h
include/jit/jit-type.h
include/jit/jit-util.h
jit/jit-type.c
jit/jit-value.c

index 402abb99fc6df3678d8e2da4e5a3a0458abfddde..6718c91ca0acff1aa1bf81aeebc0368748a926aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,12 @@
 
        * tools/gen-apply.c: improve the maintainability of the apply macros.
 
+       * include/jit/jit-block.h, include/jit/jit-context.h,
+       include/jit/jit-dump.h, include/jit/jit-elf.h, include/jit/jit-init.h,
+       include/jit/jit-meta.h, include/jit/jit-type.h, include/jit/jit-util.h,
+       jit/jit-type.c, jit/jit-value.c: add more instances of JIT_NOTHROW
+       to the headers; add some special meta tags for types.
+
 2004-05-01  Rhys Weatherley  <rweather@southern-storm.com.au>
 
        * jit/jit-apply-x86.c, jit/jit-rules-x86.c, tools/gen-apply.c:
index 886ad52dd13697b7444988d728fb8c37809864e8..d51dcd3dbe2351d6492030764272e18d7c4d8de5 100644 (file)
 extern "C" {
 #endif
 
-jit_function_t jit_block_get_function(jit_block_t block);
-jit_context_t jit_block_get_context(jit_block_t block);
-jit_label_t jit_block_get_label(jit_block_t block);
-jit_block_t jit_block_next(jit_function_t func, jit_block_t previous);
-jit_block_t jit_block_previous(jit_function_t func, jit_block_t previous);
-jit_block_t jit_block_from_label(jit_function_t func, jit_label_t label);
+jit_function_t jit_block_get_function(jit_block_t block) JIT_NOTHROW;
+jit_context_t jit_block_get_context(jit_block_t block) JIT_NOTHROW;
+jit_label_t jit_block_get_label(jit_block_t block) JIT_NOTHROW;
+jit_block_t jit_block_next
+       (jit_function_t func, jit_block_t previous) JIT_NOTHROW;
+jit_block_t jit_block_previous
+       (jit_function_t func, jit_block_t previous) JIT_NOTHROW;
+jit_block_t jit_block_from_label
+       (jit_function_t func, jit_label_t label) JIT_NOTHROW;
 int jit_block_set_meta(jit_block_t block, int type, void *data,
-                                          jit_meta_free_func free_data);
-void *jit_block_get_meta(jit_block_t block, int type);
-void jit_block_free_meta(jit_block_t block, int type);
-int jit_block_is_reachable(jit_block_t block);
+                                          jit_meta_free_func free_data) JIT_NOTHROW;
+void *jit_block_get_meta(jit_block_t block, int type) JIT_NOTHROW;
+void jit_block_free_meta(jit_block_t block, int type) JIT_NOTHROW;
+int jit_block_is_reachable(jit_block_t block) JIT_NOTHROW;
 
 #ifdef __cplusplus
 };
index 6f52800c4ba059a3931ddfdea126c3c9544e4dd8..3acedeba673aaa0a810fbeda2f18cafe906dfe9b 100644 (file)
 extern "C" {
 #endif
 
-jit_context_t jit_context_create(void);
-void jit_context_destroy(jit_context_t context);
-int jit_context_supports_threads(jit_context_t context);
-void jit_context_build_start(jit_context_t context);
-void jit_context_build_end(jit_context_t context);
+jit_context_t jit_context_create(void) JIT_NOTHROW;
+void jit_context_destroy(jit_context_t context) JIT_NOTHROW;
+int jit_context_supports_threads(jit_context_t context) JIT_NOTHROW;
+void jit_context_build_start(jit_context_t context) JIT_NOTHROW;
+void jit_context_build_end(jit_context_t context) JIT_NOTHROW;
 int jit_context_set_meta
        (jit_context_t context, int type, void *data,
-        jit_meta_free_func free_data);
+        jit_meta_free_func free_data) JIT_NOTHROW;
 int jit_context_set_meta_numeric
-       (jit_context_t context, int type, jit_nuint data);
-void *jit_context_get_meta(jit_context_t context, int type);
-jit_nuint jit_context_get_meta_numeric(jit_context_t context, int type);
-void jit_context_free_meta(jit_context_t context, int type);
+       (jit_context_t context, int type, jit_nuint data) JIT_NOTHROW;
+void *jit_context_get_meta(jit_context_t context, int type) JIT_NOTHROW;
+jit_nuint jit_context_get_meta_numeric
+       (jit_context_t context, int type) JIT_NOTHROW;
+void jit_context_free_meta(jit_context_t context, int type) JIT_NOTHROW;
 
 /*
  * Standard meta values for builtin configurable options.
index d036f32fc08736ae78ded9ba7a4631494e31c0c4..ae6711e43b84331d9dcbce984cf7a0a5539e0529 100644 (file)
 extern "C" {
 #endif
 
-void jit_dump_type(FILE *stream, jit_type_t type);
-void jit_dump_value(FILE *stream, jit_function_t func,
-                                       jit_value_t value, const char *prefix);
-void jit_dump_insn(FILE *stream, jit_function_t func, jit_insn_t insn);
-void jit_dump_function(FILE *stream, jit_function_t func, const char *name);
+void jit_dump_type(FILE *stream, jit_type_t type) JIT_NOTHROW;
+void jit_dump_value
+       (FILE *stream, jit_function_t func,
+        jit_value_t value, const char *prefix) JIT_NOTHROW;
+void jit_dump_insn
+       (FILE *stream, jit_function_t func, jit_insn_t insn) JIT_NOTHROW;
+void jit_dump_function
+       (FILE *stream, jit_function_t func, const char *name) JIT_NOTHROW;
 
 #ifdef __cplusplus
 };
index eff30ed9006f9b3516ba7a84a4385398e106e015..84d78d405c889de4c6379f9cc11d85d282e1ff1a 100644 (file)
@@ -52,30 +52,38 @@ typedef struct jit_writeelf *jit_writeelf_t;
 /*
  * External function declarations.
  */
-int jit_readelf_open(jit_readelf_t *readelf, const char *filename, int flags);
-void jit_readelf_close(jit_readelf_t readelf);
-const char *jit_readelf_get_name(jit_readelf_t readelf);
-void *jit_readelf_get_symbol(jit_readelf_t readelf, const char *name);
+int jit_readelf_open
+       (jit_readelf_t *readelf, const char *filename, int flags) JIT_NOTHROW;
+void jit_readelf_close(jit_readelf_t readelf) JIT_NOTHROW;
+const char *jit_readelf_get_name(jit_readelf_t readelf) JIT_NOTHROW;
+void *jit_readelf_get_symbol
+       (jit_readelf_t readelf, const char *name) JIT_NOTHROW;
 void *jit_readelf_get_section
-       (jit_readelf_t readelf, const char *name, jit_nuint *size);
+       (jit_readelf_t readelf, const char *name, jit_nuint *size) JIT_NOTHROW;
 void *jit_readelf_get_section_by_type
-       (jit_readelf_t readelf, jit_int type, jit_nuint *size);
-void *jit_readelf_map_vaddr(jit_readelf_t readelf, jit_nuint vaddr);
-unsigned int jit_readelf_num_needed(jit_readelf_t readelf);
-const char *jit_readelf_get_needed(jit_readelf_t readelf, unsigned int index);
-void jit_readelf_add_to_context(jit_readelf_t readelf, jit_context_t context);
-int jit_readelf_resolve_all(jit_context_t context, int print_failures);
+       (jit_readelf_t readelf, jit_int type, jit_nuint *size) JIT_NOTHROW;
+void *jit_readelf_map_vaddr
+       (jit_readelf_t readelf, jit_nuint vaddr) JIT_NOTHROW;
+unsigned int jit_readelf_num_needed(jit_readelf_t readelf) JIT_NOTHROW;
+const char *jit_readelf_get_needed
+       (jit_readelf_t readelf, unsigned int index) JIT_NOTHROW;
+void jit_readelf_add_to_context
+       (jit_readelf_t readelf, jit_context_t context) JIT_NOTHROW;
+int jit_readelf_resolve_all
+       (jit_context_t context, int print_failures) JIT_NOTHROW;
 
-jit_writeelf_t jit_writeelf_create(const char *library_name);
-void jit_writeelf_destroy(jit_writeelf_t writeelf);
-int jit_writeelf_write(jit_writeelf_t writeelf, const char *filename);
+jit_writeelf_t jit_writeelf_create(const char *library_name) JIT_NOTHROW;
+void jit_writeelf_destroy(jit_writeelf_t writeelf) JIT_NOTHROW;
+int jit_writeelf_write
+       (jit_writeelf_t writeelf, const char *filename) JIT_NOTHROW;
 int jit_writeelf_add_function
-       (jit_writeelf_t writeelf, jit_function_t func, const char *name);
+       (jit_writeelf_t writeelf, jit_function_t func,
+        const char *name) JIT_NOTHROW;
 int jit_writeelf_add_needed
-       (jit_writeelf_t writeelf, const char *library_name);
+       (jit_writeelf_t writeelf, const char *library_name) JIT_NOTHROW;
 int jit_writeelf_write_section
        (jit_writeelf_t writeelf, const char *name, jit_int type,
-        const void *buf, unsigned int len, int discardable);
+        const void *buf, unsigned int len, int discardable) JIT_NOTHROW;
 
 #ifdef __cplusplus
 };
index e05215d1ae581b7c4afd0989de940e26f9638286..efe0601cc1839ce9703d5dc4aff0806589cc44d0 100644 (file)
 #ifndef        _JIT_INIT_H
 #define        _JIT_INIT_H
 
+#include <jit/jit-defs.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void jit_init(void);
-int jit_uses_interpreter(void);
+void jit_init(void) JIT_NOTHROW;
+int jit_uses_interpreter(void) JIT_NOTHROW;
 
 #ifdef __cplusplus
 };
index b113a79bef81ff4722f9622b407a2ed58229b14d..75c8732ca4f4a53108cff7a3713fd67296449677 100644 (file)
 #ifndef        _JIT_META_H
 #define        _JIT_META_H
 
+#include <jit/jit-defs.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 typedef struct _jit_meta *jit_meta_t;
 
-int jit_meta_set(jit_meta_t *list, int type, void *data,
-                                jit_meta_free_func free_data, jit_function_t pool_owner);
-void *jit_meta_get(jit_meta_t list, int type);
-void jit_meta_free(jit_meta_t *list, int type);
-void jit_meta_destroy(jit_meta_t *list);
+int jit_meta_set
+       (jit_meta_t *list, int type, void *data,
+        jit_meta_free_func free_data, jit_function_t pool_owner) JIT_NOTHROW;
+void *jit_meta_get(jit_meta_t list, int type) JIT_NOTHROW;
+void jit_meta_free(jit_meta_t *list, int type) JIT_NOTHROW;
+void jit_meta_destroy(jit_meta_t *list) JIT_NOTHROW;
 
 #ifdef __cplusplus
 };
index 324f14c1d00e3c685738850c487141d089e81bb3..12ecab21a0029c53dd10d283ec36c760ec756a54 100644 (file)
@@ -65,6 +65,16 @@ extern jit_type_t const jit_type_sys_float;
 extern jit_type_t const jit_type_sys_double;
 extern jit_type_t const jit_type_sys_long_double;
 
+/*
+ * Special tag types.
+ */
+#define        JIT_TYPETAG_NAME                        10000
+#define        JIT_TYPETAG_STRUCT_NAME         10001
+#define        JIT_TYPETAG_CONST                       10002
+#define        JIT_TYPETAG_VOLATILE            10003
+#define        JIT_TYPETAG_REFERENCE           10004
+#define        JIT_TYPETAG_OUTPUT                      10005
+
 /*
  * ABI types for function signatures.
  */
@@ -80,54 +90,60 @@ typedef enum
 /*
  * External function declarations.
  */
-jit_type_t jit_type_copy(jit_type_t type);
-void jit_type_free(jit_type_t type);
-jit_type_t jit_type_create_struct(jit_type_t *fields, unsigned int num_fields,
-                                  int incref);
-jit_type_t jit_type_create_union(jit_type_t *fields, unsigned int num_fields,
-                                  int incref);
-jit_type_t jit_type_create_signature(jit_abi_t abi, jit_type_t return_type,
-                                     jit_type_t *params,
-                                                                        unsigned int num_params, int incref);
-jit_type_t jit_type_create_pointer(jit_type_t type, int incref);
-jit_type_t jit_type_create_tagged(jit_type_t type, int kind, void *data,
-                                                                 jit_meta_free_func free_func, int incref);
-int jit_type_set_names(jit_type_t type, char **names, unsigned int num_names);
-void jit_type_set_size_and_alignment(jit_type_t type, jit_nint size,
-                                                                        jit_nint alignment);
-void jit_type_set_offset(jit_type_t type, unsigned int field_index,
-                                                jit_nuint offset);
-jit_nuint jit_type_get_size(jit_type_t type);
-jit_nuint jit_type_get_alignment(jit_type_t type);
-unsigned int jit_type_num_fields(jit_type_t type);
-jit_type_t jit_type_get_field(jit_type_t type, unsigned int field_index);
-jit_nuint jit_type_get_offset(jit_type_t type, unsigned int field_index);
-const char *jit_type_get_name(jit_type_t type, unsigned int index);
+jit_type_t jit_type_copy(jit_type_t type) JIT_NOTHROW;
+void jit_type_free(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_create_struct
+       (jit_type_t *fields, unsigned int num_fields, int incref) JIT_NOTHROW;
+jit_type_t jit_type_create_union
+       (jit_type_t *fields, unsigned int num_fields, int incref) JIT_NOTHROW;
+jit_type_t jit_type_create_signature
+       (jit_abi_t abi, jit_type_t return_type, jit_type_t *params,
+        unsigned int num_params, int incref) JIT_NOTHROW;
+jit_type_t jit_type_create_pointer(jit_type_t type, int incref) JIT_NOTHROW;
+jit_type_t jit_type_create_tagged
+       (jit_type_t type, int kind, void *data,
+        jit_meta_free_func free_func, int incref) JIT_NOTHROW;
+int jit_type_set_names
+       (jit_type_t type, char **names, unsigned int num_names) JIT_NOTHROW;
+void jit_type_set_size_and_alignment
+       (jit_type_t type, jit_nint size, jit_nint alignment) JIT_NOTHROW;
+void jit_type_set_offset
+       (jit_type_t type, unsigned int field_index, jit_nuint offset) JIT_NOTHROW;
+jit_nuint jit_type_get_size(jit_type_t type) JIT_NOTHROW;
+jit_nuint jit_type_get_alignment(jit_type_t type) JIT_NOTHROW;
+unsigned int jit_type_num_fields(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_get_field
+       (jit_type_t type, unsigned int field_index) JIT_NOTHROW;
+jit_nuint jit_type_get_offset
+       (jit_type_t type, unsigned int field_index) JIT_NOTHROW;
+const char *jit_type_get_name(jit_type_t type, unsigned int index) JIT_NOTHROW;
 #define        JIT_INVALID_NAME        (~((unsigned int)0))
-unsigned int jit_type_find_name(jit_type_t type, const char *name);
-unsigned int jit_type_num_params(jit_type_t type);
-jit_type_t jit_type_get_return(jit_type_t type);
-jit_type_t jit_type_get_param(jit_type_t type, unsigned int param_index);
-jit_abi_t jit_type_get_abi(jit_type_t type);
-jit_type_t jit_type_get_ref(jit_type_t type);
-jit_type_t jit_type_get_tagged_type(jit_type_t type);
-void jit_type_set_tagged_type(jit_type_t type, jit_type_t underlying,
-                              int incref);
-int jit_type_get_tagged_kind(jit_type_t type);
-void *jit_type_get_tagged_data(jit_type_t type);
-void jit_type_set_tagged_data(jit_type_t type, void *data,
-                              jit_meta_free_func free_func);
-int jit_type_is_primitive(jit_type_t type);
-int jit_type_is_struct(jit_type_t type);
-int jit_type_is_union(jit_type_t type);
-int jit_type_is_signature(jit_type_t type);
-int jit_type_is_pointer(jit_type_t type);
-int jit_type_is_tagged(jit_type_t type);
-jit_nuint jit_type_best_alignment(void);
-jit_type_t jit_type_normalize(jit_type_t type);
-jit_type_t jit_type_remove_tags(jit_type_t type);
-jit_type_t jit_type_promote_int(jit_type_t type);
-int jit_type_return_via_pointer(jit_type_t type);
+unsigned int jit_type_find_name(jit_type_t type, const char *name) JIT_NOTHROW;
+unsigned int jit_type_num_params(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_get_return(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_get_param
+       (jit_type_t type, unsigned int param_index) JIT_NOTHROW;
+jit_abi_t jit_type_get_abi(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_get_ref(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_get_tagged_type(jit_type_t type) JIT_NOTHROW;
+void jit_type_set_tagged_type
+       (jit_type_t type, jit_type_t underlying, int incref) JIT_NOTHROW;
+int jit_type_get_tagged_kind(jit_type_t type) JIT_NOTHROW;
+void *jit_type_get_tagged_data(jit_type_t type) JIT_NOTHROW;
+void jit_type_set_tagged_data
+       (jit_type_t type, void *data, jit_meta_free_func free_func) JIT_NOTHROW;
+int jit_type_is_primitive(jit_type_t type) JIT_NOTHROW;
+int jit_type_is_struct(jit_type_t type) JIT_NOTHROW;
+int jit_type_is_union(jit_type_t type) JIT_NOTHROW;
+int jit_type_is_signature(jit_type_t type) JIT_NOTHROW;
+int jit_type_is_pointer(jit_type_t type) JIT_NOTHROW;
+int jit_type_is_tagged(jit_type_t type) JIT_NOTHROW;
+jit_nuint jit_type_best_alignment(void) JIT_NOTHROW;
+jit_type_t jit_type_normalize(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_remove_tags(jit_type_t type) JIT_NOTHROW;
+jit_type_t jit_type_promote_int(jit_type_t type) JIT_NOTHROW;
+int jit_type_return_via_pointer(jit_type_t type) JIT_NOTHROW;
+int jit_type_has_tag(jit_type_t type, int kind) JIT_NOTHROW;
 
 #ifdef __cplusplus
 };
index ea9a056efd362ed1e7098823d3bfe6554d89bd10..167487d24b4afee7cad25f17cf7331b4f455dbf4 100644 (file)
@@ -30,58 +30,64 @@ extern      "C" {
 /*
  * Memory allocation routines.
  */
-void *jit_malloc(unsigned int size);
-void *jit_calloc(unsigned int num, unsigned int size);
-void *jit_realloc(void *ptr, unsigned int size);
-void jit_free(void *ptr);
-void *jit_malloc_exec(unsigned int size);
-void jit_free_exec(void *ptr, unsigned int size);
-void jit_flush_exec(void *ptr, unsigned int size);
-unsigned int jit_exec_page_size(void);
+void *jit_malloc(unsigned int size) JIT_NOTHROW;
+void *jit_calloc(unsigned int num, unsigned int size) JIT_NOTHROW;
+void *jit_realloc(void *ptr, unsigned int size) JIT_NOTHROW;
+void jit_free(void *ptr) JIT_NOTHROW;
+void *jit_malloc_exec(unsigned int size) JIT_NOTHROW;
+void jit_free_exec(void *ptr, unsigned int size) JIT_NOTHROW;
+void jit_flush_exec(void *ptr, unsigned int size) JIT_NOTHROW;
+unsigned int jit_exec_page_size(void) JIT_NOTHROW;
 #define        jit_new(type)           ((type *)jit_malloc(sizeof(type)))
 #define        jit_cnew(type)          ((type *)jit_calloc(1, sizeof(type)))
 
 /*
  * Memory set/copy/compare routines.
  */
-void *jit_memset(void *dest, int ch, unsigned int len);
-void *jit_memcpy(void *dest, const void *src, unsigned int len);
-void *jit_memmove(void *dest, const void *src, unsigned int len);
-int   jit_memcmp(const void *s1, const void *s2, unsigned int len);
-void *jit_memchr(const void *str, int ch, unsigned int len);
+void *jit_memset(void *dest, int ch, unsigned int len) JIT_NOTHROW;
+void *jit_memcpy(void *dest, const void *src, unsigned int len) JIT_NOTHROW;
+void *jit_memmove(void *dest, const void *src, unsigned int len) JIT_NOTHROW;
+int   jit_memcmp(const void *s1, const void *s2, unsigned int len) JIT_NOTHROW;
+void *jit_memchr(const void *str, int ch, unsigned int len) JIT_NOTHROW;
 
 /*
  * String routines.  Note: jit_stricmp uses fixed ASCII rules for case
  * comparison, whereas jit_stricoll uses localized rules.
  */
-unsigned int jit_strlen(const char *str);
-char *jit_strcpy(char *dest, const char *src);
-char *jit_strcat(char *dest, const char *src);
-char *jit_strncpy(char *dest, const char *src, unsigned int len);
-char *jit_strdup(const char *str);
-char *jit_strndup(const char *str, unsigned int len);
-int jit_strcmp(const char *str1, const char *str2);
-int jit_strncmp(const char *str1, const char *str2, unsigned int len);
-int jit_stricmp(const char *str1, const char *str2);
-int jit_strnicmp(const char *str1, const char *str2, unsigned int len);
-int jit_strcoll(const char *str1, const char *str2);
-int jit_strncoll(const char *str1, const char *str2, unsigned int len);
-int jit_stricoll(const char *str1, const char *str2);
-int jit_strnicoll(const char *str1, const char *str2, unsigned int len);
-char *jit_strchr(const char *str, int ch);
-char *jit_strrchr(const char *str, int ch);
-int jit_sprintf(char *str, const char *format, ...);
-int jit_snprintf(char *str, unsigned int len, const char *format, ...);
+unsigned int jit_strlen(const char *str) JIT_NOTHROW;
+char *jit_strcpy(char *dest, const char *src) JIT_NOTHROW;
+char *jit_strcat(char *dest, const char *src) JIT_NOTHROW;
+char *jit_strncpy(char *dest, const char *src, unsigned int len) JIT_NOTHROW;
+char *jit_strdup(const char *str) JIT_NOTHROW;
+char *jit_strndup(const char *str, unsigned int len) JIT_NOTHROW;
+int jit_strcmp(const char *str1, const char *str2) JIT_NOTHROW;
+int jit_strncmp
+       (const char *str1, const char *str2, unsigned int len) JIT_NOTHROW;
+int jit_stricmp(const char *str1, const char *str2) JIT_NOTHROW;
+int jit_strnicmp
+       (const char *str1, const char *str2, unsigned int len) JIT_NOTHROW;
+int jit_strcoll(const char *str1, const char *str2) JIT_NOTHROW;
+int jit_strncoll
+       (const char *str1, const char *str2, unsigned int len) JIT_NOTHROW;
+int jit_stricoll(const char *str1, const char *str2) JIT_NOTHROW;
+int jit_strnicoll
+       (const char *str1, const char *str2, unsigned int len) JIT_NOTHROW;
+char *jit_strchr(const char *str, int ch) JIT_NOTHROW;
+char *jit_strrchr(const char *str, int ch) JIT_NOTHROW;
+int jit_sprintf(char *str, const char *format, ...) JIT_NOTHROW;
+int jit_snprintf
+       (char *str, unsigned int len, const char *format, ...) JIT_NOTHROW;
 
 /*
  * Dynamic library routines.
  */
 typedef void *jit_dynlib_handle_t;
-jit_dynlib_handle_t jit_dynlib_open(const char *name);
-void jit_dynlib_close(jit_dynlib_handle_t handle);
-void *jit_dynlib_get_symbol(jit_dynlib_handle_t handle, const char *symbol);
-const char *jit_dynlib_get_suffix(void);
-void jit_dynlib_set_debug(int flag);
+jit_dynlib_handle_t jit_dynlib_open(const char *name) JIT_NOTHROW;
+void jit_dynlib_close(jit_dynlib_handle_t handle) JIT_NOTHROW;
+void *jit_dynlib_get_symbol
+       (jit_dynlib_handle_t handle, const char *symbol) JIT_NOTHROW;
+const char *jit_dynlib_get_suffix(void) JIT_NOTHROW;
+void jit_dynlib_set_debug(int flag) JIT_NOTHROW;
 
 #ifdef __cplusplus
 };
index 9a5554d0a23d31a2c44a36dc035c429d17fe7bcd..9c8b48921d439c914b55248cd91a253153ce2d78 100644 (file)
@@ -603,6 +603,46 @@ jit_type_t jit_type_create_pointer(jit_type_t type, int incref)
  * tag a type multiple times.  The order in which multiple tags are
  * applied is irrelevant to @code{libjit}, although it may be relevant
  * to the higher-level program.
+ *
+ * Tag kinds of 10000 or greater are reserved for @code{libjit} itself.
+ * The following special tag kinds are currently provided in the
+ * base implementation:
+ *
+ * @table @code
+ * @vindex JIT_TYPETAG_NAME
+ * @item JIT_TYPETAG_NAME
+ * The @code{data} pointer is a @code{char *} string indicating a friendly
+ * name to display for the type.
+ *
+ * @vindex JIT_TYPETAG_STRUCT_NAME
+ * @item JIT_TYPETAG_STRUCT_NAME
+ * The @code{data} pointer is a @code{char *} string indicating a friendly
+ * name to display for a @code{struct} or @code{union} type.  This is
+ * for languages like C that have separate naming scopes for typedef's and
+ * structures.
+ *
+ * @vindex JIT_TYPETAG_CONST
+ * @item JIT_TYPETAG_CONST
+ * The underlying value is assumed to have @code{const} semantics.
+ * The @code{libjit} library doesn't enforce such semantics: it is
+ * up to the front-end to only use constant values in appopriate contexts.
+ *
+ * @vindex JIT_TYPETAG_VOLATILE
+ * @item JIT_TYPETAG_VOLATILE
+ * The underlying value is assumed to be volatile.  The @code{libjit}
+ * library will automatically call @code{jit_value_set_volatile} when a
+ * value is constructed using this type.
+ *
+ * @vindex JIT_TYPETAG_REFERENCE
+ * @item JIT_TYPETAG_REFERENCE
+ * The underlying value is a pointer, but it is assumed to refer to a
+ * pass-by-reference parameter.
+ *
+ * @vindex JIT_TYPETAG_OUTPUT
+ * @item JIT_TYPETAG_OUTPUT
+ * This is similar to @code{JIT_TYPETAG_REFERENCE}, except that the
+ * underlying parameter is assumed to be output-only.
+ * @end table
  * @end deftypefun
 @*/
 jit_type_t jit_type_create_tagged(jit_type_t type, int kind, void *data,
@@ -1321,3 +1361,22 @@ int jit_type_return_via_pointer(jit_type_t type)
        }
        return 1;
 }
+
+/*@
+ * @deftypefun int jit_type_has_tag (jit_type_t type, int kind)
+ * Determine if @code{type} has a specific kind of tag.  This will
+ * resolve multiple levels of tagging.
+ * @end deftypefun
+@*/
+int jit_type_has_tag(jit_type_t type, int kind)
+{
+       while(type != 0 && type->kind >= JIT_TYPE_FIRST_TAGGED)
+       {
+               if(type->kind == (JIT_TYPE_FIRST_TAGGED + kind))
+               {
+                       return 1;
+               }
+               type = type->sub_type;
+       }
+       return 0;
+}
index 8bb72683d07d24c166b3e84087f111b135dc58d9..781c304722e174842d0aa36a9e30f2c30e69b5c5 100644 (file)
@@ -227,6 +227,10 @@ jit_value_t jit_value_create(jit_function_t func, jit_type_t type)
                return 0;
        }
        value->is_temporary = 1;
+       if(jit_type_has_tag(type, JIT_TYPETAG_VOLATILE))
+       {
+               value->is_volatile = 1;
+       }
        return value;
 }