I rule this software but there's a lot of bugs in the way

thats why I need to always drink and write
This commit is contained in:
2026-07-05 15:21:42 +02:00
parent 9eae8e8fd2
commit cb862520de
5 changed files with 22 additions and 8 deletions

View File

@@ -1,25 +1,36 @@
CC=gcc
CXX=g++
AR=ar
CFLAGS=-Wall -Wextra
LD_FLAGS=
TARGET=libcarbon.so
BASE_PATH=./src/main/org/neoflock/NeoNucleus
JAVA_HOME=/usr/lib/jvm/java-25-openjdk/
BASE_NPATH=./src/native/
BASE_NPATH=./src/native
JAVA_SRCS = $(wildcard ./src/main/org/neoflock/NeoNucleus/*.java)
JAVA_CLASSES = $(wildcard ./src/main/org/neoflock/NeoNucleus/*.class)
TLA_PATH=./src/tla-static
NN_PATH=NeoNucleus/src
NN_FLAGS=-std=gnu11 -O2 -fPIC -I$(TLA_PATH)/foreign/lua54
NN_SRC=$(NN_PATH)/neonucleus.c $(NN_PATH)/ncomplib.c $(NN_PATH)/luaarch.c
NN_OBJS=neonucleus.o ncomplib.o luaarch.o
CPP_SRCS = $(wildcard ${BASE_NPATH}/*.cpp)
OBJS = $(CPP_SRCS:.cpp=.o)
NATIVE_NAME=main
all: java $(TARGET)
$(TARGET): $(OBJS)
src/native/libneonucleus.a: $(NN_SRC)
$(CC) -c $(NN_SRC) $(NN_FLAGS)
$(AR) rcs src/native/libneonucleus.a $(NN_OBJS)
$(TARGET): $(OBJS) src/native/libneonucleus.a
$(CXX) -shared -o ${BASE_NPATH}/$(TARGET) \
$(OBJS) ${BASE_NPATH}/libneonucleus.a $(TLA_PATH)/libtla.a $(TLA_PATH)/foreign/lua54/liblua.a -lc $(LD_FLAGS)
$(OBJS) src/native/libneonucleus.a $(TLA_PATH)/foreign/lua54/liblua.a -lc $(LD_FLAGS)
%.o: %.cpp
$(CXX) -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux $(CFLAGS) \
$< -o $@
@@ -31,6 +42,7 @@ run: all
cd src/main && java -cp . -Djava.library.path=${PWD}/${BASE_NPATH} -Xcheck:jni org.neoflock.NeoNucleus.NativeBindings
clean:
rm nn.o
rm ${JAVA_CLASSES}
rm $(OBJS) $(BASE_NPATH)/$(TARGET)

View File

@@ -22,7 +22,7 @@ public class NativeBindings {
eeprom.allocate();
nn_Component eepromCard = ncl_createEEPROM(universe, UUID.randomUUID().toString(), eeprom, "error('amog us')", false);
eeprom.free();
nn_Computer computer = nn_createComputer(universe, UUID.randomUUID().toString(), 4096, 100, 100);
nn_Computer computer = nn_createComputer(universe, UUID.randomUUID().toString(), 1048576, 100, 100);
nn_setCallBudget(computer, 0);
System.out.println("Arch: " + arch.name);
nn_setArchitecture(computer, arch);

View File

@@ -62,6 +62,7 @@ JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1create
NULLPTR_CHECK(nnCtx, nn_Context);
nn_Universe* universe = nn_createUniverse(nnCtx, NULL);
printf("created universe %p\n", universe);
/*jclass clazz = env->FindClass("org/neoflock/NeoNucleus/nn_Universe");
jmethodID creator = env->GetStaticMethodID(clazz, "createFromPointer", "(J)Lorg/neoflock/NeoNucleus/Universe;");
return env->CallStaticObjectMethod(clazz, creator, (jlong) universe);*/
@@ -235,7 +236,8 @@ JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1tick
(JNIEnv * env, jclass, jobject computer) {
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
NULLPTR_CHECK(nnPC, nn_Computer);
return Carbon::Map::To_nn_Exit(env, nn_tick(nnPC));
nn_Exit e = nn_tick(nnPC);
return Carbon::Map::To_nn_Exit(env, e);
}
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1tickSynchronized