222223224225226227228229230231232
} if (beanVar != null) { b.loadLocal(beanVar); b.checkCast(TypeDesc.forClass(beanType)); b.storeLocal(beanVar); } if (properties.length > 0) { int[] cases = new int[hashCapacity(properties.length)]; int caseCount = cases.length;
402403404405406407408409410411412
CodeBuilder b = new CodeBuilder(mi); LocalVariable beanVar = b.getParameter(0); b.loadLocal(beanVar); b.checkCast(TypeDesc.forClass(beanType)); b.storeLocal(beanVar); LocalVariable valueVar = b.getParameter(1); // If search value is null, only check properties which might be null. b.loadLocal(valueVar);
591592593594595596597598599600601
builder.loadConstant(0); builder.loadFromArray(TypeDesc.forClass(Comparator.class)); builder.loadLocal(obj1); builder.loadLocal(obj2); builder.invoke(compareMethod); builder.storeLocal(result); builder.loadLocal(result); label = builder.createLabel(); builder.ifZeroComparisonBranch(label, "=="); builder.loadLocal(result); builder.returnValue(TypeDesc.INT);
605606607608609610611612613614615
// Cast bean parameters to correct types so that properties may be // accessed. TypeDesc type = TypeDesc.forClass(bc.mBeanClass); builder.loadLocal(obj1); builder.checkCast(type); builder.storeLocal(obj1); builder.loadLocal(obj2); builder.checkCast(type); builder.storeLocal(obj2); // Generate code to perform comparisons against each property.
608609610611612613614615616617618
builder.loadLocal(obj1); builder.checkCast(type); builder.storeLocal(obj1); builder.loadLocal(obj2); builder.checkCast(type); builder.storeLocal(obj2); // Generate code to perform comparisons against each property. for (int i=1; i<ruleParts.length; i++) { bc = ruleParts[i];
626627628629630631632633634635636
LocalVariable p2 = builder.createLocalVariable("p2", propertyType); // Access properties and store in local variables. builder.loadLocal(obj1); builder.invoke(prop.getReadMethod()); builder.storeLocal(p1); builder.loadLocal(obj2); builder.invoke(prop.getReadMethod()); builder.storeLocal(p2); if ((bc.mFlags & 0x01) != 0) {
629630631632633634635636637638639
builder.loadLocal(obj1); builder.invoke(prop.getReadMethod()); builder.storeLocal(p1); builder.loadLocal(obj2); builder.invoke(prop.getReadMethod()); builder.storeLocal(p2); if ((bc.mFlags & 0x01) != 0) { // Reverse properties. LocalVariable temp = p1; p1 = p2;
726727728729730731732733734735736
null, nextLabel, p1, p2); } } if (i < (ruleParts.length - 1)) { builder.storeLocal(result); builder.loadLocal(result); builder.ifZeroComparisonBranch(nextLabel, "=="); builder.loadLocal(result); } builder.returnValue(TypeDesc.INT);