fixed multi array accesses (PATCH)
Hi again, nice to see that ChucK development is moving on rapidly and will move to Github soon. Will send you pull requests then :-) Here's a patch that fixes multi array accesses involving map accesses. Previously a Chuck_Instr_Array_Access_Multi was emitted for every multi array access even though the instruction cannot handle map keys. Test case: string a[0][2]; new string[2] @=> a["foo"]; new string[2] @=> a["bar"]; "23" => a["foo"][0]; "24" => a["foo"][1]; "32" => a["bar"][0]; "42" => a["bar"][1]; for (0 => int i; i < 2; i++) <<< a["foo"][i], a["bar"][i] >>>; will die with an ArrayOutofBounds error. Workaround for version <= 1.3.0.2: string a[0][2]; new string[2] @=> a["foo"]; new string[2] @=> a["bar"]; "23" => (a["foo"])[0]; "24" => (a["foo"])[1]; "32" => (a["bar"])[0]; "42" => (a["bar"])[1]; for (0 => int i; i < 2; i++) <<< (a["foo"])[i], (a["bar"])[i] >>>; will result in both a map access and normal (int) access instruction. My patch revises the way access instructions are generated so the first test case works flawlessly. One can be applied on ChucK v1.3.0.2; the other one is an updated version of my 64-bit array patch (still using it until next release) and finally there's a version based on SVN trunk. Hope to contribute on a regular basis from now on. I do really want to use ChucK for my "music" project and I need it stable and a lot faster... Best regards, Robin
Hi Robin!
Hope to contribute on a regular basis from now on. I do really want to use ChucK for my "music" project and I need it stable and a lot faster...
Dude - you are rockin' out! Thanks for your initiative and contributions! This helps to encourage us to keep on chuckin' on the development as well. We will go through your latest patches immediately. We are just about ready to release 1.3.1.0, so they might not make it until 1.3.1.1. Thanks again and keep on ChucKin'! Ge! On Wed, 5 Sep 2012, Robin Haberkorn wrote:
Hi again,
nice to see that ChucK development is moving on rapidly and will move to Github soon. Will send you pull requests then :-)
Here's a patch that fixes multi array accesses involving map accesses. Previously a Chuck_Instr_Array_Access_Multi was emitted for every multi array access even though the instruction cannot handle map keys.
Test case:
string a[0][2];
new string[2] @=> a["foo"]; new string[2] @=> a["bar"];
"23" => a["foo"][0]; "24" => a["foo"][1]; "32" => a["bar"][0]; "42" => a["bar"][1];
for (0 => int i; i < 2; i++) <<< a["foo"][i], a["bar"][i] >>>;
will die with an ArrayOutofBounds error.
Workaround for version <= 1.3.0.2:
string a[0][2];
new string[2] @=> a["foo"]; new string[2] @=> a["bar"];
"23" => (a["foo"])[0]; "24" => (a["foo"])[1]; "32" => (a["bar"])[0]; "42" => (a["bar"])[1];
for (0 => int i; i < 2; i++) <<< (a["foo"])[i], (a["bar"])[i] >>>;
will result in both a map access and normal (int) access instruction.
My patch revises the way access instructions are generated so the first test case works flawlessly. One can be applied on ChucK v1.3.0.2; the other one is an updated version of my 64-bit array patch (still using it until next release) and finally there's a version based on SVN trunk.
Hope to contribute on a regular basis from now on. I do really want to use ChucK for my "music" project and I need it stable and a lot faster...
Best regards, Robin
Hi Robin! Based on your work and patch, we have a fix, and it should be make it into this impending release. Thank you *very* much. Based on your code, we took a slightly different approach -- the Array_Access_Multi instruction is now aware of the nature of each index. This change is perhaps more localized in the emitter (I am more confident as related to regression this close to release) and results in less instructions, though I believe your approach is more aligned with the spirit of Chuck VM instructions, and we may revisit this. In any case, this has been fixed, thanks to you -- really appreciate it. Also added examples/array/array_mmixed.ck based on your test code to help verify this. Thanks again! Ge! On Tue, 4 Sep 2012, Ge Wang wrote:
Hi Robin!
Hope to contribute on a regular basis from now on. I do really want to use ChucK for my "music" project and I need it stable and a lot faster...
Dude - you are rockin' out! Thanks for your initiative and contributions! This helps to encourage us to keep on chuckin' on the development as well. We will go through your latest patches immediately. We are just about ready to release 1.3.1.0, so they might not make it until 1.3.1.1.
Thanks again and keep on ChucKin'!
Ge!
On Wed, 5 Sep 2012, Robin Haberkorn wrote:
Hi again,
nice to see that ChucK development is moving on rapidly and will move to Github soon. Will send you pull requests then :-)
Here's a patch that fixes multi array accesses involving map accesses. Previously a Chuck_Instr_Array_Access_Multi was emitted for every multi array access even though the instruction cannot handle map keys.
Test case:
string a[0][2];
new string[2] @=> a["foo"]; new string[2] @=> a["bar"];
"23" => a["foo"][0]; "24" => a["foo"][1]; "32" => a["bar"][0]; "42" => a["bar"][1];
for (0 => int i; i < 2; i++) <<< a["foo"][i], a["bar"][i] >>>;
will die with an ArrayOutofBounds error.
Workaround for version <= 1.3.0.2:
string a[0][2];
new string[2] @=> a["foo"]; new string[2] @=> a["bar"];
"23" => (a["foo"])[0]; "24" => (a["foo"])[1]; "32" => (a["bar"])[0]; "42" => (a["bar"])[1];
for (0 => int i; i < 2; i++) <<< (a["foo"])[i], (a["bar"])[i] >>>;
will result in both a map access and normal (int) access instruction.
My patch revises the way access instructions are generated so the first test case works flawlessly. One can be applied on ChucK v1.3.0.2; the other one is an updated version of my 64-bit array patch (still using it until next release) and finally there's a version based on SVN trunk.
Hope to contribute on a regular basis from now on. I do really want to use ChucK for my "music" project and I need it stable and a lot faster...
Best regards, Robin
_______________________________________________ chuck-dev mailing list chuck-dev@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev
participants (2)
-
Ge Wang
-
Robin Haberkorn