test and fix the invoke method function
This commit is contained in:
parent
2d224448fc
commit
36b254c4f6
@ -841,38 +841,45 @@ void CJavaServer::InvokeMethod(void)
|
|||||||
|
|
||||||
switch (returnType)
|
switch (returnType)
|
||||||
{
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
jni->CallVoidMethodA(obj, methodid, args);
|
||||||
|
WriteQword(0); //tell it it's done
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
jboolean r=jni->CallBooleanMethodA(obj, methodid, args);
|
jboolean r=jni->CallBooleanMethodA(obj, methodid, args);
|
||||||
WriteByte(r);
|
WriteQword(r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
jbyte r=jni->CallByteMethodA(obj, methodid, args);
|
jbyte r=jni->CallByteMethodA(obj, methodid, args);
|
||||||
WriteByte(r);
|
WriteQword(r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
jchar r=jni->CallCharMethodA(obj, methodid, args);
|
jchar r=jni->CallCharMethodA(obj, methodid, args);
|
||||||
WriteWord(r);
|
WriteQword(r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
jshort r=jni->CallShortMethodA(obj, methodid, args);
|
jshort r=jni->CallShortMethodA(obj, methodid, args);
|
||||||
WriteWord(r);
|
WriteQword(r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
jint r=jni->CallIntMethodA(obj, methodid, args);
|
jint r=jni->CallIntMethodA(obj, methodid, args);
|
||||||
WriteDword(r);
|
WriteQword(r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,14 +893,14 @@ void CJavaServer::InvokeMethod(void)
|
|||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
jfloat r=jni->CallFloatMethodA(obj, methodid, args);
|
jfloat r=jni->CallFloatMethodA(obj, methodid, args);
|
||||||
Write(&r, sizeof(r));
|
WriteQword(*(DWORD *)&r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
jdouble r=jni->CallDoubleMethodA(obj, methodid, args);
|
jdouble r=jni->CallDoubleMethodA(obj, methodid, args);
|
||||||
Write(&r, sizeof(r));
|
WriteQword(*(UINT64 *)&r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -928,7 +935,8 @@ jint JNICALL FindClassObjects_heap_reference_callback(jlong class_tag, jlong siz
|
|||||||
if (class_tag==tagtofind)
|
if (class_tag==tagtofind)
|
||||||
*tag_ptr=tagtofind+1;
|
*tag_ptr=tagtofind+1;
|
||||||
|
|
||||||
return JVMTI_VISIT_OBJECTS;;
|
|
||||||
|
return JVMTI_VISIT_OBJECTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CJavaServer::FindClassObjects(void)
|
void CJavaServer::FindClassObjects(void)
|
||||||
|
@ -747,8 +747,9 @@ end
|
|||||||
|
|
||||||
function java_parseSignature_type(sig, i)
|
function java_parseSignature_type(sig, i)
|
||||||
local result=''
|
local result=''
|
||||||
|
local char=string.sub(sig,i,i)
|
||||||
|
|
||||||
if (char=='Z') or (char=='B') or (char=='C') or (char=='S') or (char=='I') or (char=='J') or (char=='F') or (char=='D') then
|
if (char=='V') or (char=='Z') or (char=='B') or (char=='C') or (char=='S') or (char=='I') or (char=='J') or (char=='F') or (char=='D') then
|
||||||
result=char
|
result=char
|
||||||
elseif char=='L' then
|
elseif char=='L' then
|
||||||
local classtype
|
local classtype
|
||||||
@ -767,7 +768,7 @@ function java_parseSignature_type(sig, i)
|
|||||||
result='['..result
|
result='['..result
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
return result,i
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -775,7 +776,7 @@ end
|
|||||||
function java_parseSignature_method(sig, i, result)
|
function java_parseSignature_method(sig, i, result)
|
||||||
result.parameters={}
|
result.parameters={}
|
||||||
|
|
||||||
while i<#sig do
|
while i<=#sig do
|
||||||
local parem
|
local parem
|
||||||
local char=string.sub(sig,i,i)
|
local char=string.sub(sig,i,i)
|
||||||
|
|
||||||
@ -799,7 +800,7 @@ function java_parseSignature(sig)
|
|||||||
--parse the given signature
|
--parse the given signature
|
||||||
local result={}
|
local result={}
|
||||||
local i=1
|
local i=1
|
||||||
while i<#sig do
|
while i<=#sig do
|
||||||
local char=string.sub(sig,i,i)
|
local char=string.sub(sig,i,i)
|
||||||
|
|
||||||
if char=='(' then
|
if char=='(' then
|
||||||
@ -818,6 +819,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
Java_TypeSigToIDConversion={}
|
Java_TypeSigToIDConversion={}
|
||||||
|
Java_TypeSigToIDConversion['V']=0 --void
|
||||||
Java_TypeSigToIDConversion['Z']=1 --boolean
|
Java_TypeSigToIDConversion['Z']=1 --boolean
|
||||||
Java_TypeSigToIDConversion['B']=2 --byte
|
Java_TypeSigToIDConversion['B']=2 --byte
|
||||||
Java_TypeSigToIDConversion['C']=3 --char
|
Java_TypeSigToIDConversion['C']=3 --char
|
||||||
@ -890,7 +892,7 @@ function java_invokeMethod_sendParameter(typeid, a, skiptypeid)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function java_invokeMethod(returntype, object, methodid, ...)
|
function java_invokeMethod(object, methodid, ...)
|
||||||
local argumentcount=#arg
|
local argumentcount=#arg
|
||||||
local name, sig, gen=java_getMethodName(methodid)
|
local name, sig, gen=java_getMethodName(methodid)
|
||||||
|
|
||||||
@ -923,7 +925,7 @@ function java_invokeMethod(returntype, object, methodid, ...)
|
|||||||
javapipe.writeByte(argumentcount)
|
javapipe.writeByte(argumentcount)
|
||||||
|
|
||||||
local i
|
local i
|
||||||
for i=1, #argumentcount do
|
for i=1, argumentcount do
|
||||||
local typeid
|
local typeid
|
||||||
typeid=Java_TypeSigToIDConversion[string.sub(parsedsignature.parameters[i],1,1)]
|
typeid=Java_TypeSigToIDConversion[string.sub(parsedsignature.parameters[i],1,1)]
|
||||||
if typeid==10 then
|
if typeid==10 then
|
||||||
@ -949,6 +951,21 @@ function java_invokeMethod(returntype, object, methodid, ...)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function java_findMethod(class, name, sig)
|
||||||
|
local cm=java_getClassMethods(class)
|
||||||
|
local i
|
||||||
|
for i=1,#cm do
|
||||||
|
if cm[i].name==name then
|
||||||
|
if (sig==nil) or (sig==cm[i].signature) then
|
||||||
|
return cm[i].jmethodid
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil --still here
|
||||||
|
end
|
||||||
|
|
||||||
function java_findClass(signature)
|
function java_findClass(signature)
|
||||||
local result=nil
|
local result=nil
|
||||||
javapipe.lock()
|
javapipe.lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user