mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
enable the PGF JIT compiler for Android
This commit is contained in:
@@ -48,7 +48,11 @@ pgf_jit_alloc_page(PgfJitState* state)
|
||||
|
||||
size_t page_size = getpagesize();
|
||||
|
||||
#ifndef ANDROID
|
||||
if (posix_memalign(&page, page_size, page_size) != 0) {
|
||||
#else
|
||||
if ((page = memalign(page_size, page_size)) == NULL) {
|
||||
#endif
|
||||
gu_fatal("Memory allocation failed");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
#include "expr.h"
|
||||
#include "literals.h"
|
||||
#include "reader.h"
|
||||
|
||||
#ifndef ANDROID
|
||||
#include "jit.h"
|
||||
#endif
|
||||
|
||||
#include <gu/defs.h>
|
||||
#include <gu/map.h>
|
||||
@@ -27,9 +24,7 @@ struct PgfReader {
|
||||
GuExn* err;
|
||||
GuPool* opool;
|
||||
GuPool* tmp_pool;
|
||||
#ifndef ANDROID
|
||||
PgfJitState* jit_state;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct PgfReadTagExn PgfReadTagExn;
|
||||
@@ -546,9 +541,7 @@ pgf_read_abscat(PgfReader* rdr, PgfAbstr* abstr, PgfCIdMap* abscats)
|
||||
gu_buf_push(functions, PgfAbsFun*, absfun);
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
pgf_jit_predicate(rdr->jit_state, abscats, abscat, functions);
|
||||
#endif
|
||||
|
||||
return abscat;
|
||||
}
|
||||
@@ -1212,16 +1205,12 @@ pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err)
|
||||
rdr->tmp_pool = tmp_pool;
|
||||
rdr->err = err;
|
||||
rdr->in = in;
|
||||
#ifndef ANDROID
|
||||
rdr->jit_state = pgf_jit_init(tmp_pool, rdr->opool);
|
||||
#endif
|
||||
return rdr;
|
||||
}
|
||||
|
||||
void
|
||||
pgf_reader_done(PgfReader* rdr, PgfPGF* pgf)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
pgf_jit_done(rdr->jit_state, &pgf->abstract);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ Java_org_grammaticalframework_pgf_PGF_readPGF__Ljava_io_InputStream_2(JNIEnv *en
|
||||
JInStream* jstream = gu_new(JInStream, tmp_pool);
|
||||
jstream->stream.begin_buffer = jpgf_jstream_begin_buffer;
|
||||
jstream->stream.end_buffer = jpgf_jstream_end_buffer;
|
||||
jstream->stream.input = NULL;;
|
||||
jstream->stream.input = NULL;
|
||||
jstream->java_stream = java_stream;
|
||||
jstream->env = env;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
jni_c_files := jpgf.c
|
||||
pgf_c_files := data.c expr.c graphviz.c lexer.c linearizer.c literals.c parser.c parseval.c pgf.c printer.c reader.c reasoner.c
|
||||
pgf_c_files := data.c expr.c graphviz.c lexer.c linearizer.c literals.c parser.c parseval.c pgf.c printer.c reader.c reasoner.c jit.c
|
||||
gu_c_files := assert.c choice.c exn.c fun.c in.c list.c map.c out.c str.c type.c utf8.c \
|
||||
bits.c defs.c enum.c file.c hash.c log.c mem.c prime.c seq.c string.c ucs.c variant.c
|
||||
|
||||
@@ -11,6 +11,19 @@ LOCAL_MODULE := jpgf
|
||||
LOCAL_SRC_FILES := $(addprefix ../../../runtime/java/, $(jni_c_files)) \
|
||||
$(addprefix ../../../runtime/c/pgf/, $(pgf_c_files)) \
|
||||
$(addprefix ../../../runtime/c/gu/, $(gu_c_files))
|
||||
LOCAL_C_INCLUDES := ../../../runtime/c
|
||||
LOCAL_C_INCLUDES := . ../../../runtime/c
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(realpath ../obj/local/armeabi/objs/jpgf/__/__/__/runtime/c/pgf/jit.o): lightning
|
||||
$(realpath ../obj/local/armeabi/objs-debug/jpgf/__/__/__/runtime/c/pgf/jit.o): lightning
|
||||
|
||||
lightning:
|
||||
mkdir lightning
|
||||
mkdir lightning/arm
|
||||
ln -s ../../../../runtime/c/pgf/lightning/arm/asm.h lightning/asm.h
|
||||
ln -s ../../../../runtime/c/pgf/lightning/arm/core.h lightning/core.h
|
||||
ln -s ../../../../runtime/c/pgf/lightning/arm/fp.h lightning/fp.h
|
||||
ln -s ../../../../../runtime/c/pgf/lightning/arm/fp-swf.h lightning/arm/fp-swf.h
|
||||
ln -s ../../../../../runtime/c/pgf/lightning/arm/fp-vfp.h lightning/arm/fp-vfp.h
|
||||
ln -s ../../../../runtime/c/pgf/lightning/arm/funcs.h lightning/funcs.h
|
||||
|
||||
Reference in New Issue
Block a user