On 2012-09-12, at 6:18 PM, Mark Roos <mr...@roos.com> wrote: > Nice to see progress. > > I was just thinking about the use model for these in my app and found > three obvious uses: > To hold the temps on the stack frame ( TaggedArray of TaggedArrays + > primitives )
Or a tagged array for the stack, passing an index for each of SP (and FP.) It would also be possible to trampoline stacks to allow for dynamic growth. > To hold the instance vars of a class Yes. > To collect arguments for a method send ( and probably use one as a > return as well) Not necessary if you use a tagged array stack. > At the extreme each of my objects would be represented as a TaggedArray where > the > first location could be the Class identifier. > > It seems that these will add at least one level on indirection for every > access > along with whatever overhead the access adds. The hope is that Hotspot sees > the > primitives within a method and across a dynamic send so I end up with > primitive > performance. At least eliminating the performance hit of boxed ints. I am > still not > sure how to use this to reduce the number of Integers generated. The builtin tagged array (TaggedArrayNativeImpl) has no levels of indirection, the simple and optimized forms are fall backs. So the performance is similar to Java arrays. And yes the code that Rickard submitted here is for native performance. One would assume your math operations would assume tagged integers. So there so there should only be ints and BigIntegers (rare). Naive Ex: TaggedArray stack = TaggedArrays.allocate(512 * 1024); int SP = 0; SP = add(stack, SP); int add(TaggedArray stack, int SP) { try { long x = stack.getValue(SP--); // simple array indexing with tag detection long y = stack.getValue(SP--); // simple array indexing with tag detection long z = x + y - 1; // simple integer addition, accounting for the tag bit isOverflow(z); // Throws exception for overflow stack.setValue(++SP); // simple array indexing with tag detection return SP; } catch ( ) { // slow case for arithmetic overflow, BigIntegers and stack overflow exceptions. } So most of the time you will be using straight ints. Tag detection is a bit test and branch. > Are my thoughts following a reasonable path? As is this the intent of > TaggedArrays? Yes. > > Thanks > mark > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev@openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
_______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev