-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Brl.Reflection] Issues invoking Meth/Funcs with Float-params in debug builds #227
Comments
This also happens for ":double" SuperStrict
Framework Brl.StandardIO
Import Brl.Reflection
Type TTest
Method HelloDouble(d:Double)
Print "HelloDouble() " + d
End Method
Method HelloFloat(f:Float)
Print "HelloFloat() " + f
End Method
Method HelloLong(l:Long)
Print "HelloLong() " + l
End Method
Method HelloInt(i:Int)
Print "HelloInt() " + i
End Method
End Type
Local t:TTest = New TTest
Print "via direct:"
t.HelloDouble(1.2345:Float)
t.HelloFloat(1.2345:Float)
t.HelloLong(12345:Long)
t.HelloInt(12345:Int)
Print "via method invoke:"
TTypeId.ForObject(t).FindMethod("HelloDouble").Invoke(t, [String(1.2345:Double)])
TTypeId.ForObject(t).FindMethod("HelloFloat").Invoke(t, [String(1.2345:Float)])
TTypeId.ForObject(t).FindMethod("HelloLong").Invoke(t, [String(12345:Long)])
TTypeId.ForObject(t).FindMethod("HelloInt").Invoke(t, [String(12345:Int)]) Release:
Debug:
|
Seems it does not happen on with i386/32bit (with a recent BlitzMax tool chain (bmk, bcc, modules)) All (Mac, Windows and Linux) are running on bcc 0.133.
Example Screenshots for Windows and Mac: |
I added some "prints" to check what happens inside the reflection-code to invoke a function ... this broke it for "x64 release" too (so it no longer passed the right number to the function call) Simply adding this print there:
Replacing the print with an "Local x:Int = argTypes.length" and the function receives the correct number, but with print it becomes
Ok, so I checked what is needed to bork the result: 'No change
'Local x:Int = argTypes.length
'No change
'Local x:Long = Long(argTypes.length)
'borks result
'Local x:String = String(argTypes.length)
'borks result
'print "_CallFunction: " + argTypes.length So it works for casts to Long or Int - but when casting it to a String, it somehow affects the stuff behind that code. Dunno if that helps... and as said, this is only tested onr x64 linux |
What else changes that value?
with myprintf being added to reflection.c: void myprintf(int n) {
printf("%d\n", n);
fflush(stdout);
} And when replacing that with simply printing "hello", then I get a "0.000000" instead of a one like "9.14767638e-41" void myprintf(int n) {
printf("hello\n");
fflush(stdout);
} Some memory address/offsets borked? Edit:
Simply printing the memory address of the function will lead to the call returning a different value:
and without the print:
Edit: |
Release:
Debug:
so there seems some "offset" or so which interfers in the reflection code - might be connected to #204 and #205
The text was updated successfully, but these errors were encountered: