|
From: Greg P. <gp...@us...> - 2005-02-14 22:40:02
|
Jeremy Fitzhardinge writes: > On Mon, 2005-02-14 at 11:18 +0000, Julian Seward wrote: > > On ppc32, and other architectures, which I'm sure we'll > > eventually get to, we can't implement pointercheck the way we > > do now anyway. > > PPC has its own interesting segmentation magic which might be usable. I don't think any of these are available on ppc-darwin; all the fun VM toys are reserved for the kernel's use. > > There are a couple of options for <handle failure now>, which need > > to be investigated for their impact on code size and the extent to > > which they inhibit IR optimisation. Either way, they can be expressed > > purely in IR, so no portability questions there either. > > Could we generate the <handle failure> code out of line (after or before > the BB's main generated code), and change it to > jnz,pn failure > > In either case, on ia32 we could use an interrupt instruction to raise a > fault (2 byte instruction). ppc's twi (trap word immediate) instruction is perfect for this purpose. It's basically a conditional interrupt instruction. Java null checks use this, with a signal handler in the JVM. On the plus side, twi would be in line with the rest of the test, so there would be no "handle failure" block. On the minus side, it's presumably not directly represented in the IR (although "conditional interrupt" is close enough in meaning and might be a reasonable thing to have). srlwi r0, rAddr, n // r0 = addr >> n addi r1, r0, table_offset lbzx r2, r1, rThread // r2 = thread->table[addr>>n] twnei r2, is_client // die if table byte != client's value OK: -- Greg Parker gp...@us... |