add support for the RuntimeVisibleParameterAnnotations attribute

This commit is contained in:
Joel Dice 2013-04-30 22:55:59 -06:00
parent b1840a297d
commit 529c7a17fb
3 changed files with 34 additions and 9 deletions

View File

@ -13,4 +13,5 @@ package avian;
public class MethodAddendum extends Addendum { public class MethodAddendum extends Addendum {
public Object exceptionTable; public Object exceptionTable;
public Object annotationDefault; public Object annotationDefault;
public Object parameterAnnotationTable;
} }

View File

@ -2261,6 +2261,7 @@ makeJmethod(Thread* t, object vmMethod, int index)
object signature; object signature;
object annotationTable; object annotationTable;
object parameterAnnotationTable;
object annotationDefault; object annotationDefault;
object addendum = methodAddendum(t, vmMethod); object addendum = methodAddendum(t, vmMethod);
if (addendum) { if (addendum) {
@ -2274,18 +2275,23 @@ makeJmethod(Thread* t, object vmMethod, int index)
annotationTable = addendumAnnotationTable(t, addendum); annotationTable = addendumAnnotationTable(t, addendum);
parameterAnnotationTable = methodAddendumParameterAnnotationTable
(t, addendum);
annotationDefault = methodAddendumAnnotationDefault(t, addendum); annotationDefault = methodAddendumAnnotationDefault(t, addendum);
} else { } else {
signature = 0; signature = 0;
annotationTable = 0; annotationTable = 0;
parameterAnnotationTable = 0;
annotationDefault = 0; annotationDefault = 0;
} }
PROTECT(t, signature); PROTECT(t, signature);
PROTECT(t, annotationTable); PROTECT(t, annotationTable);
PROTECT(t, parameterAnnotationTable);
PROTECT(t, annotationDefault); PROTECT(t, annotationDefault);
if (annotationTable or annotationDefault) { if (annotationTable or parameterAnnotationTable or annotationDefault) {
object runtimeData = getClassRuntimeData(t, methodClass(t, vmMethod)); object runtimeData = getClassRuntimeData(t, methodClass(t, vmMethod));
set(t, runtimeData, ClassRuntimeDataPool, set(t, runtimeData, ClassRuntimeDataPool,
@ -2309,7 +2315,7 @@ makeJmethod(Thread* t, object vmMethod, int index)
return makeJmethod return makeJmethod
(t, true, 0, jclass, index, name, returnType, parameterTypes, (t, true, 0, jclass, index, name, returnType, parameterTypes,
exceptionTypes, methodFlags(t, vmMethod), signature, 0, annotationTable, exceptionTypes, methodFlags(t, vmMethod), signature, 0, annotationTable,
0, annotationDefault, 0, 0, 0); parameterAnnotationTable, annotationDefault, 0, 0, 0);
} }
object object
@ -2331,6 +2337,7 @@ makeJconstructor(Thread* t, object vmMethod, int index)
object signature; object signature;
object annotationTable; object annotationTable;
object parameterAnnotationTable;
object addendum = methodAddendum(t, vmMethod); object addendum = methodAddendum(t, vmMethod);
if (addendum) { if (addendum) {
signature = addendumSignature(t, addendum); signature = addendumSignature(t, addendum);
@ -2342,15 +2349,19 @@ makeJconstructor(Thread* t, object vmMethod, int index)
} }
annotationTable = addendumAnnotationTable(t, addendum); annotationTable = addendumAnnotationTable(t, addendum);
parameterAnnotationTable = methodAddendumParameterAnnotationTable
(t, addendum);
} else { } else {
signature = 0; signature = 0;
annotationTable = 0; annotationTable = 0;
parameterAnnotationTable = 0;
} }
PROTECT(t, signature); PROTECT(t, signature);
PROTECT(t, annotationTable); PROTECT(t, annotationTable);
PROTECT(t, parameterAnnotationTable);
if (annotationTable) { if (annotationTable or parameterAnnotationTable) {
object runtimeData = getClassRuntimeData(t, methodClass(t, vmMethod)); object runtimeData = getClassRuntimeData(t, methodClass(t, vmMethod));
set(t, runtimeData, ClassRuntimeDataPool, set(t, runtimeData, ClassRuntimeDataPool,
@ -2373,7 +2384,8 @@ makeJconstructor(Thread* t, object vmMethod, int index)
return makeJconstructor return makeJconstructor
(t, true, 0, jclass, index, parameterTypes, exceptionTypes, methodFlags (t, true, 0, jclass, index, parameterTypes, exceptionTypes, methodFlags
(t, vmMethod), signature, 0, annotationTable, 0, 0, 0, 0); (t, vmMethod), signature, 0, annotationTable, parameterAnnotationTable,
0, 0, 0);
} }
object object

View File

@ -2009,7 +2009,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0); addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
} }
unsigned exceptionCount = s.read2(); unsigned exceptionCount = s.read2();
object body = makeShortArray(t, exceptionCount); object body = makeShortArray(t, exceptionCount);
@ -2022,7 +2022,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0); addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
} }
object body = makeByteArray(t, length); object body = makeByteArray(t, length);
@ -2034,7 +2034,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0); addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
} }
set(t, addendum, AddendumSignature, set(t, addendum, AddendumSignature,
@ -2044,7 +2044,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0); addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
} }
object body = makeByteArray(t, length); object body = makeByteArray(t, length);
@ -2052,6 +2052,19 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
length); length);
set(t, addendum, AddendumAnnotationTable, body); set(t, addendum, AddendumAnnotationTable, body);
} else if (vm::strcmp(reinterpret_cast<const int8_t*>
("RuntimeVisibleParameterAnnotations"),
&byteArrayBody(t, attributeName, 0)) == 0)
{
if (addendum == 0) {
addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
}
object body = makeByteArray(t, length);
s.read(reinterpret_cast<uint8_t*>(&byteArrayBody(t, body, 0)),
length);
set(t, addendum, MethodAddendumParameterAnnotationTable, body);
} else { } else {
s.skip(length); s.skip(length);
} }
@ -5243,7 +5256,6 @@ threadIsInterrupted(Thread* t, object thread, bool clear)
threadInterrupted(t, thread) = false; threadInterrupted(t, thread) = false;
} }
monitorRelease(t, interruptLock(t, thread)); monitorRelease(t, interruptLock(t, thread));
return v; return v;
} }