Skip to content

Commit

Permalink
Merge pull request #371 from jespa007/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jespa007 authored Jan 24, 2024
2 parents 76558d4 + 1afcf65 commit 8830e18
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/vm/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "vm_scope.h"


#define ZS_VM_STACK_MAX 150
#define ZS_VM_STACK_MAX 250
#define ZS_VM_FUNCTION_CALL_MAX 100

namespace zetscript{
Expand Down
6 changes: 3 additions & 3 deletions src/vm/vm_call_metamethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,19 @@ namespace zetscript{
,error_found.toConstChar()
);
}else{
String tip=". The operation is incompatible or its metamethod is not defined properly";
String tip=".";//. The operation is incompatible or its metamethod is not defined properly";
if(((stk_result_op2!=NULL) && STACK_ELEMENT_IS_MEMBER_PROPERTY(stk_result_op2)) || STACK_ELEMENT_IS_MEMBER_PROPERTY(stk_result_op1)){
tip=". Check whether any of the member property involved in the operation has defined the getter (i.e _get) properly";
}

if(stk_result_op2 != NULL){
ZS_VM_ERROR("Operator '%s' (aka %s) cannot be performed as operation with types '(%s) %s (%s)' %s%s%s"
ZS_VM_ERROR("Operator '%s' (aka %s) cannot be performed as operation with types '(%s) %s (%s)'%s%s%s"
,MetamethodHelper::getMetamethodOperatorName(_metamethod)
,MetamethodHelper::getMetamethodSymbolName(_metamethod)
,data->script_engine->stackElementTypeToString(stk_result_op1).toConstChar()
,MetamethodHelper::getMetamethodOperatorName(_metamethod)
,data->script_engine->stackElementTypeToString(stk_result_op2).toConstChar()
,error_found.isEmpty()?"":":"
,error_found.isEmpty()?"":" : "
,error_found.toConstChar()
,tip.toConstChar()
);
Expand Down
2 changes: 1 addition & 1 deletion src/vm/vm_script_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace zetscript{

if(((stk_start-data->vm_stack)+_script_function->min_code_stack_needed)>=ZS_VM_STACK_MAX){
data->vm_error_max_stack_reached=true;
ZS_VM_STOP_EXECUTEF("Error MAXIMUM stack size reached");
ZS_VM_STOP_EXECUTEF("Not enough Stack memory");
}

#ifdef __DEBUG__
Expand Down
12 changes: 12 additions & 0 deletions test/language/benchmark/fib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import time

def fib(n):
if n <= 2:
return 1
else:
return fib(n - 1) + fib(n - 2)


for x in range(1,10):
start_time = time.time()
print("fib: %s time: %s s" % (fib(34),time.time() - start_time))

0 comments on commit 8830e18

Please sign in to comment.