public XMethodExecutor(XMethodExecutor parent, XMethod method, XGenericClass[] generics, long[] params) {
this.parent = parent;
this.method = method;
if(XModifier.isNative(method.getModifier()))
throw new XRuntimeException("Can't run native method %s", method);
this.generics = generics;
if(generics==null){
if(method.getGenericParams()!=0)
throw new XRuntimeException("Can't create a generic method %s without generic params, need %s generic params", method, method.getGenericParams());
}else if(generics.length!=method.getGenericParams()){
throw new XRuntimeException("Can't create a generic method %s with %s generic params, need %s generic params", method, generics.length, method.getGenericParams());
}
int pl = params.length;
if(!XModifier.isStatic(method.getModifier())){
XObject _this = method.getDeclaringClass().getVirtualMachine().getObjectProvider().getObject(params[0]);
declaringClass = _this.getXClass();
pl--;
}
if(pl!=method.getParamCount()){
throw new XRuntimeException("Wrong number of arguments got %s but need %s", method.getParamCount(), pl);
}
stack = new long[method.getMaxStackSize()];
stackType = new byte[method.getMaxStackSize()];
local = new long[method.getMaxLocalSize()];
}