diff --git a/include/avian/codegen/compiler.h b/include/avian/codegen/compiler.h index 4c3d2bcf1c..099ae15ca5 100644 --- a/include/avian/codegen/compiler.h +++ b/include/avian/codegen/compiler.h @@ -93,10 +93,9 @@ class Compiler { virtual void return_(ir::Value* value) = 0; virtual void return_() = 0; - virtual void initLocal(unsigned size, unsigned index, ir::Type type) = 0; + virtual void initLocal(unsigned index, ir::Type type) = 0; virtual void initLocalsFromLogicalIp(unsigned logicalIp) = 0; - virtual void storeLocal(ir::Value* src, unsigned index) - = 0; + virtual void storeLocal(ir::Value* src, unsigned index) = 0; virtual ir::Value* loadLocal(ir::Type type, unsigned index) = 0; virtual void saveLocals() = 0; diff --git a/src/codegen/compiler.cpp b/src/codegen/compiler.cpp index fa5ba3d78f..019c139eb6 100644 --- a/src/codegen/compiler.cpp +++ b/src/codegen/compiler.cpp @@ -2490,9 +2490,10 @@ class MyCompiler: public Compiler { v->home = frameIndex(&c, index); } - virtual void initLocal(unsigned footprint, unsigned index, ir::Type type) + virtual void initLocal(unsigned index, ir::Type type) { - assert(&c, footprint == typeFootprint(&c, type)); + unsigned footprint = typeFootprint(&c, type); + assert(&c, index + footprint <= c.localFootprint); Value* v = value(&c, type); diff --git a/src/compile.cpp b/src/compile.cpp index bf7c7fd759..37b0a5f4ec 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -7030,7 +7030,7 @@ compile(MyThread* t, Context* context) unsigned index = methodParameterFootprint(t, context->method); if ((methodFlags(t, context->method) & ACC_STATIC) == 0) { frame.set(--index, Frame::Object); - c->initLocal(1, index, frame.types.object); + c->initLocal(index, frame.types.object); } for (MethodSpecIterator it @@ -7042,29 +7042,29 @@ compile(MyThread* t, Context* context) case 'L': case '[': frame.set(--index, Frame::Object); - c->initLocal(1, index, frame.types.object); + c->initLocal(index, frame.types.object); break; case 'J': frame.set(--index, Frame::Long); frame.set(--index, Frame::Long); - c->initLocal(2, index, frame.types.i8); + c->initLocal(index, frame.types.i8); break; case 'D': frame.set(--index, Frame::Long); frame.set(--index, Frame::Long); - c->initLocal(2, index, frame.types.f8); + c->initLocal(index, frame.types.f8); break; case 'F': frame.set(--index, Frame::Integer); - c->initLocal(1, index, frame.types.f4); + c->initLocal(index, frame.types.f4); break; default: frame.set(--index, Frame::Integer); - c->initLocal(1, index, frame.types.i4); + c->initLocal(index, frame.types.i4); break; } }