This commit is contained in:
Dmitry Boulytchev 2021-09-28 03:02:05 +03:00
parent 11203f3a85
commit fa874b4a4c
11 changed files with 486 additions and 23 deletions

View file

@ -5,7 +5,7 @@ all: gc_runtime.o runtime.o
gc_runtime.o: gc_runtime.s
$(CC) -g -fstack-protector-all -m32 -c gc_runtime.s
runtime.o: runtime.c
runtime.o: runtime.c runtime.h
$(CC) -g -fstack-protector-all -m32 -c runtime.c
clean:

View file

@ -1,26 +1,14 @@
/* Runtime library */
#define _GNU_SOURCE 1
# define _GNU_SOURCE 1
# include <stdio.h>
# include <stdio.h>
# include <string.h>
# include <stdarg.h>
# include <stdlib.h>
# include <sys/mman.h>
# include <assert.h>
# include <errno.h>
# include <regex.h>
# include <time.h>
# include <limits.h>
# include "runtime.h"
# define __ENABLE_GC__
# ifndef __ENABLE_GC__
# define alloc malloc
# endif
# define WORD_SIZE (CHAR_BIT * sizeof(int))
/* # define DEBUG_PRINT 1 */
#ifdef DEBUG_PRINT
@ -144,7 +132,7 @@ static void vfailure (char *s, va_list args) {
exit (255);
}
static void failure (char *s, ...) {
void failure (char *s, ...) {
va_list args;
va_start (args, s);

20
runtime/runtime.h Normal file
View file

@ -0,0 +1,20 @@
# ifndef __LAMA_RUNTIME__
# define __LAMA_RUNTIME__
# include <stdio.h>
# include <stdio.h>
# include <string.h>
# include <stdarg.h>
# include <stdlib.h>
# include <sys/mman.h>
# include <assert.h>
# include <errno.h>
# include <regex.h>
# include <time.h>
# include <limits.h>
# define WORD_SIZE (CHAR_BIT * sizeof(int))
void failure (char *s, ...);
# endif