ochafik/nativelibs4java — Issue #209: [ScalaCL]: Missing dereference of ArrayOps$ofRef
Author: frgomes
Created: 2011-12-12 15:46:57+00:00
State: open

Environment:
scalacl-compiler-plugin 0.3-SNAPSHOT
Scala 2.9.1
Debian 6.0.3
GeForce GTX460

Description:

I've found what seems to be a failure to call ArrayOps$ofRef.apply(), in the code generated by the compiler plugin.
If I turn off the compiler plugin, the code 'works' as expected, despite very slow.

A class cast exception happens like shown below because an ArrayOps$ofRef is passed, instead of the result of ArrayOps$ofRef.apply(), which should return an Array[Float].

java.lang.ClassCastException: scala.collection.mutable.ArrayOps$ofRef cannot be cast to [Lscalacl.CLArray;
at mytests.BulkStats.mean(BulkStats.scala:55)
at mytests.TestBulkStats.testMean(TestBulkStats.scala:32)

Relevant piece of code:

def $mean(av : Array[CLArray[Float]]) : Array[Float] = { ... }
55: def mean(av : Array[Array[Float]]) : Array[Float] = { $mean(av.map(v => { v.cl })) }