[Mono-devel-list] [PATCH] Opcode decomposition

Paolo Molaro lupus at ximian.com
Tue Apr 6 07:28:55 EDT 2004


On 04/05/04 Ben Maurer wrote:
> On Mon, 2004-04-05 at 14:24, Paolo Molaro wrote:
> > > +#define NEW_LOAD_MEMBASE(cfg,dest,source,offset,op) do { \
> > > +		MonoInst* load_source; \
> > > +		if (offset != 0) { \
> > > +			MonoInst* offset_inst; \
> > > +			NEW_ICONST (cfg, offset_inst, offset); \
> > > +			MONO_INST_NEW (cfg, load_source, CEE_ADD); \
> > > +			load_source->cil_code = source->cil_code; \
> > > +			load_source->inst_left = source; \
> > > +			load_source->inst_right = offset_inst; \
> > > +			load_source->type = STACK_MP; \
> > 
> > STACK_MP is not always correct when you use the macro in this way.
> > In the new jit we try to maintain the info on managed/unmanaged
> > pointers, at least until burg is involved or going to a precise GC will
> > be even more difficult than it already is.
> 
> I copied this code over from CEE_LDFLD, I am not sure exactly what I
> should be doing here. And it should probably be fixed there too...

No, it's perfectly correct there: read the spec about managed pointers.
It's your code which is incorrect. When it's used to implement STRLEN
it's fine, since the length is stored in managed memory. When you use it
to access fields in unmanaged structures it's no longer correct.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list