[chuck-dev] fixed multi array accesses (PATCH)

Ge Wang ge at ccrma.Stanford.EDU
Tue Sep 4 21:35:37 EDT 2012


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
>


More information about the chuck-dev mailing list