[Jprogramming] calling jj.dll

neitzel at gaertner.de neitzel at gaertner.de
Fri Jun 21 05:31:02 UTC 2013


Hi Raul,

>The underlying mechanism only makes sense when mixing structure
>elements which have different sizes.

I fail to understand this, probably because I lost track of the
original context.  (I.e., what is Greg trying to do?)

>Still, if you can find any examples, it would be great to hear about them.

In response to Greg's question "header size?", you pointed to

> https://github.com/openj/core/blob/master/jtype.h#L41 says:
> typedef struct {I k,flag,m,t,c,n,r,s[1];}* A;

Since Greg is somehow trying to cull J data from memory, I thought
it prudent to point out that the actual array data after the header
is not necessarily starting out directly after those SZ*I(7+r) bytes.
The relevant source is 30 lines down from the place you gave:

https://github.com/openj/core/blob/master/jtype.h#L70-77  says:

#if SY_64
#define AKX(x)          (SZI*(AH+AR(x)))
#define WP(t,n,r)       (AH+ r        +(1&&t&LAST0)+((t&NAME?sizeof(NM):0)+(n)*bp(t)+SZI-1)/SZI)
#else
#define AKX(x)          (SZI*(AH+AR(x)+!(1&AR(x))))
#define WP(t,n,r)       (AH+(r+!(1&r))+(1&&t&LAST0)+((t&NAME?sizeof(NM):0)+(n)*bp(t)+SZI-1)/SZI)
#endif
/* make sure array values are double-word aligned */

This could be translated into:

	On 32bit systems, some extra padding after odd-length shape vectors,
	pretty please.

Showing an example is not that easy:

3!:1 and 3!:3 won't dump these bytes.  Anyhow, Greg should aware that
they *are* there.  (Or, when assembling arrays: is must be put there.)

(On earlier J systems, the jtype.h did not discriminate on SY_64 but
on SY_DOUBLE.  You could always set that just to be on the safe side.)

								Martin


More information about the Programming mailing list