Skip to content

Instantly share code, notes, and snippets.

@splittingfield
Created December 5, 2011 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splittingfield/1434304 to your computer and use it in GitHub Desktop.
Save splittingfield/1434304 to your computer and use it in GitHub Desktop.
No boxing here.
import com.azavea.math.Numeric
import com.azavea.math.EasyImplicits._
class Blah {
def blah[@specialized T:Numeric:Manifest, @specialized W:Numeric:Manifest](f:Function1[T,W]):W = {
f(numeric[T].zero)
}
def blah2[T:Numeric:Manifest](f:Function[T,T]):T = {
f(numeric[T].zero)
}
}
javap -verbose Blah
public int blah$mIIc$sp(scala.Function1, com.azavea.math.Numeric, scala.reflect.Manifest, com.azavea.math.Numeric, scala.reflect.Manifest);
Code:
Stack=3, Locals=6, Args_size=6
0: aload_1
1: getstatic #12; //Field com/azavea/math/EasyImplicits$.MODULE$:Lcom/azavea/math/EasyImplicits$;
4: aload_2
5: invokevirtual #156; //Method com/azavea/math/EasyImplicits$.numeric$mIc$sp:(Lcom/azavea/math/Numeric;)Lcom/azavea/math/Numeric;
8: invokeinterface #160, 1; //InterfaceMethod com/azavea/math/Numeric.zero$mcI$sp:()I
13: invokeinterface #181, 2; //InterfaceMethod scala/Function1.apply$mcII$sp:(I)I
18: ireturn
LineNumberTable:
line 66: 0
LocalVariableTable:
Start Length Slot Name Signature
0 19 0 this Lmarc/junk/Blah;
0 19 1 f Lscala/Function1;
0 19 2 evidence$15 Lcom/azavea/math/Numeric;
0 19 3 evidence$16 Lscala/reflect/Manifest;
0 19 4 evidence$17 Lcom/azavea/math/Numeric;
0 19 5 evidence$18 Lscala/reflect/Manifest;
Signature: length = 0x2
00 77
public long blah$mIJc$sp(scala.Function1, com.azavea.math.Numeric, scala.reflect.Manifest, com.azavea.math.Numeric, scala.reflect.Manifest);
Code:
Stack=3, Locals=6, Args_size=6
0: aload_1
1: getstatic #12; //Field com/azavea/math/EasyImplicits$.MODULE$:Lcom/azavea/math/EasyImplicits$;
4: aload_2
5: invokevirtual #156; //Method com/azavea/math/EasyImplicits$.numeric$mIc$sp:(Lcom/azavea/math/Numeric;)Lcom/azavea/math/Numeric;
8: invokeinterface #160, 1; //InterfaceMethod com/azavea/math/Numeric.zero$mcI$sp:()I
13: invokeinterface #186, 2; //InterfaceMethod scala/Function1.apply$mcJI$sp:(I)J
18: lreturn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment