diff --git a/repl/main.c b/repl/main.c index cffd394..3413edd 100644 --- a/repl/main.c +++ b/repl/main.c @@ -210,7 +210,7 @@ int main(int argc, const char* argv[]) { //run the setup Toy_VM vm; - Toy_bindVM(&vm, bc.ptr, bc.capacity); + Toy_bindVM(&vm, bc.ptr); //run Toy_runVM(&vm); diff --git a/source/toy_vm.c b/source/toy_vm.c index 10c5403..af019b5 100644 --- a/source/toy_vm.c +++ b/source/toy_vm.c @@ -289,7 +289,7 @@ static void process(Toy_VM* vm) { } //exposed functions -void Toy_bindVM(Toy_VM* vm, unsigned char* bytecode, unsigned int bytecodeSize) { +void Toy_bindVM(Toy_VM* vm, unsigned char* bytecode) { if (bytecode[0] != TOY_VERSION_MAJOR || bytecode[1] > TOY_VERSION_MINOR) { fprintf(stderr, TOY_CC_ERROR "ERROR: Wrong bytecode version found: expected %d.%d.%d found %d.%d.%d, exiting\n" TOY_CC_RESET, TOY_VERSION_MAJOR, TOY_VERSION_MINOR, TOY_VERSION_PATCH, bytecode[0], bytecode[1], bytecode[2]); exit(-1); @@ -314,7 +314,6 @@ void Toy_bindVM(Toy_VM* vm, unsigned char* bytecode, unsigned int bytecodeSize) //cache these vm->bc = bytecode; - vm->bcSize = bytecodeSize; } void Toy_bindVMToRoutine(Toy_VM* vm, unsigned char* routine) { @@ -376,7 +375,6 @@ void Toy_freeVM(Toy_VM* vm) { void Toy_resetVM(Toy_VM* vm) { vm->bc = NULL; - vm->bcSize = 0; vm->routine = NULL; vm->routineSize = 0; diff --git a/source/toy_vm.h b/source/toy_vm.h index 6fec6e3..628bb7e 100644 --- a/source/toy_vm.h +++ b/source/toy_vm.h @@ -7,7 +7,6 @@ typedef struct Toy_VM { //hold the raw bytecode unsigned char* bc; - unsigned int bcSize; //raw instructions to be executed unsigned char* routine; @@ -33,7 +32,7 @@ typedef struct Toy_VM { Toy_Stack* stack; } Toy_VM; -TOY_API void Toy_bindVM(Toy_VM* vm, unsigned char* bytecode, unsigned int bytecodeSize); //process the version data +TOY_API void Toy_bindVM(Toy_VM* vm, unsigned char* bytecode); //process the version data TOY_API void Toy_bindVMToRoutine(Toy_VM* vm, unsigned char* routine); //process the routine only TOY_API void Toy_runVM(Toy_VM* vm); diff --git a/tests/cases/test_vm.c b/tests/cases/test_vm.c index 6d95b95..a64b580 100644 --- a/tests/cases/test_vm.c +++ b/tests/cases/test_vm.c @@ -41,7 +41,7 @@ int test_setup_and_teardown(Toy_Bucket** bucketHandle) { //run the setup Toy_VM vm; - Toy_bindVM(&vm, bc.ptr, bc.capacity); + Toy_bindVM(&vm, bc.ptr); //check the header size int headerSize = 3 + strlen(TOY_VERSION_BUILD) + 1; @@ -91,7 +91,7 @@ int test_simple_execution(Toy_Bucket** bucketHandle) { //run the setup Toy_VM vm; - Toy_bindVM(&vm, bc.ptr, bc.capacity); + Toy_bindVM(&vm, bc.ptr); //run Toy_runVM(&vm); @@ -135,7 +135,7 @@ int test_opcode_not_equal(Toy_Bucket** bucketHandle) { //run the setup Toy_VM vm; - Toy_bindVM(&vm, bc.ptr, bc.capacity); + Toy_bindVM(&vm, bc.ptr); //run Toy_runVM(&vm);