Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ STD = src/std/array.o src/std/buffer.o src/std/bytes.o src/std/cast.o src/std/da
src/std/socket.o src/std/string.o src/std/sys.o src/std/types.o src/std/ucs2.o src/std/thread.o src/std/process.o \
src/std/track.o

HL = src/code.o src/jit.o src/main.o src/module.o src/debugger.o src/profile.o
HL_COMMON = src/code.o src/jit.o src/module.o src/debugger.o src/profile.o

HL = src/main.o $(HL_COMMON)

LIBHL_JIT = $(HL_COMMON)

FMT = libs/fmt/fmt.o libs/fmt/sha1.o include/mikktspace/mikktspace.o libs/fmt/mikkt.o libs/fmt/dxt.o

Expand Down Expand Up @@ -133,6 +137,9 @@ libs: $(LIBS)
libhl: ${LIB}
${CC} -o libhl.$(LIBEXT) -m${MARCH} ${LIBFLAGS} -shared ${LIB} -lpthread -lm

libhl-jit: ${LIBHL_JIT} libhl
${CC} -o libhl-jit.$(LIBEXT) -m${MARCH} ${LIBFLAGS} -shared ${LIBHL_JIT} ${LFLAGS} ${HLFLAGS}

hlc: ${BOOT}
${CC} ${CFLAGS} -o hlc ${BOOT} ${LFLAGS} ${EXTRA_LFLAGS}

Expand Down Expand Up @@ -224,9 +231,9 @@ codesign_osx:
${CC} ${CFLAGS} -o $@ -c $<

clean_o:
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${HL_DEBUG}
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${LIBHL_JIT} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${HL_DEBUG}

clean: clean_o
rm -f hl hl.exe libhl.$(LIBEXT) *.hdll
rm -f hl hl.exe libhl-jit.$(LIBEXT) libhl.$(LIBEXT) *.hdll

.PHONY: libhl hl hlc fmt sdl libs release
.PHONY: libhl libhl-jit hl hlc fmt sdl libs release
9 changes: 9 additions & 0 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ HL_API void hl_unregister_thread() {
hl_mutex_release(gc_threads.global_lock);
}

/**
* When the calling language doesn't have a C-style stack
* that is scannable for GC references, this method can be called to
* reset the GC thread top to something C can understand.
*/
HL_API void hl_enter_thread_stack( int dummy ) {
current_thread->stack_top = &dummy;
}

HL_API void *hl_gc_threads_info() {
return &gc_threads;
}
Expand Down
3 changes: 3 additions & 0 deletions src/hl.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,8 @@ HL_API char *hl_to_utf8( const uchar *bytes );
HL_API uchar *hl_to_utf16( const char *str );
HL_API vdynamic *hl_virtual_make_value( vvirtual *v );
HL_API hl_obj_field *hl_obj_field_fetch( hl_type *t, int fid );
HL_API hl_field_lookup *hl_obj_resolve_field( hl_type_obj *o, int hfield );
HL_API void *hl_obj_lookup( vdynamic *d, int hfield, hl_type **t );

HL_API int hl_hash( vbyte *name );
HL_API int hl_hash_utf8( const char *str ); // no cache
Expand Down Expand Up @@ -681,6 +683,7 @@ HL_API hl_thread *hl_thread_current( void );
HL_API void hl_thread_yield(void);
HL_API void hl_register_thread( void *stack_top );
HL_API void hl_unregister_thread( void );
HL_API void hl_enter_thread_stack( int dummy );

HL_API hl_mutex *hl_mutex_alloc( bool gc_thread );
HL_API void hl_mutex_acquire( hl_mutex *l );
Expand Down
6 changes: 5 additions & 1 deletion src/std/obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ static hl_field_lookup *obj_resolve_field( hl_type_obj *o, int hfield ) {
return NULL;
}

HL_PRIM hl_field_lookup *hl_obj_resolve_field( hl_type_obj *o, int hfield ) {
return obj_resolve_field(o, hfield);
}

static int hl_cache_count = 0;
static int hl_cache_size = 0;
static hl_mutex *hl_cache_lock = NULL;
Expand Down Expand Up @@ -739,7 +743,7 @@ static hl_field_lookup *hl_dynobj_add_field( vdynobj *o, int hfield, hl_type *t

// -------------------- DYNAMIC GET ------------------------------------

static void *hl_obj_lookup( vdynamic *d, int hfield, hl_type **t ) {
HL_API void *hl_obj_lookup( vdynamic *d, int hfield, hl_type **t ) {
switch( d->t->kind ) {
case HDYNOBJ:
{
Expand Down