-
Notifications
You must be signed in to change notification settings - Fork 59
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
[Bounty $20] Two inline assignments in the same statement produce incorrect opencl code. #99
Comments
Upon investigating: the problem isn't really
the problem is
The statement |
It maybe is beneficial to just throw the concept of multi_assign out. In essence, it's just a simple assign and one (or more) inline assigns. |
Because declarations without assignment (e.g. int a;) are not saved in the byte code or local variable table, it is very hard to discover what the scope of a variable is. I suspect most decompilers will guess the broadest scope possible. I suggest rethinking how to work with variables. One possibility is to ignore the local variable table and have just variables like: i1, d2, a0... with i1 an int in variable with index 1, a0 would be the reference in variable with index 0 (in most cases 'this'). These names are closer to the bytecode and scope independent. Using this method will fix at least following issues: #97 #99 #147 A big disadvantage is that a lot of code should be revised, and most (all) of the codegen tests will have to be rewritten. |
The problem arrises from java statements like this:
which incorrectly generates this in opencl instead:
This bug is demonstrated in this unit test:
https://github.com/Syncleus/aparapi/blob/master/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2Test.java
when run it produces the following exception:
The text was updated successfully, but these errors were encountered: