private static void generateHashRowMethod(ClassDefinition classDefinition, CallSiteBinder callSiteBinder, List<Type> joinChannelTypes) { Parameter position = arg("position", int.class); Parameter page = arg("blocks", Page.class); MethodDefinition hashRowMethod = classDefinition.declareMethod(a(PUBLIC), "hashRow", type(long.class), position, page); Variable resultVariable = hashRowMethod.getScope().declareVariable(long.class, "result"); hashRowMethod.getBody().push(0L).putVariable(resultVariable); for (int index = 0; index < joinChannelTypes.size(); index++) { BytecodeExpression type = constantType(callSiteBinder, joinChannelTypes.get(index)); BytecodeExpression block = page.invoke("getBlock", Block.class, constantInt(index)); hashRowMethod .getBody() .getVariable(resultVariable) .push(31L) .append(OpCode.LMUL) .append(typeHashCode(type, block, position)) .append(OpCode.LADD) .putVariable(resultVariable); } hashRowMethod .getBody() .getVariable(resultVariable) .retLong(); }
.push(31L) .append(OpCode.LMUL) .append(typeHashCode(type, block, blockPosition)) .append(OpCode.LADD) .putVariable(resultVariable);
private static void generateHashRowMethod(ClassDefinition classDefinition, CallSiteBinder callSiteBinder, List<Type> joinChannelTypes) { Parameter position = arg("position", int.class); Parameter blocks = arg("blocks", Block[].class); MethodDefinition hashRowMethod = classDefinition.declareMethod(a(PUBLIC), "hashRow", type(int.class), position, blocks); Variable resultVariable = hashRowMethod.getScope().declareVariable(int.class, "result"); hashRowMethod.getBody().push(0).putVariable(resultVariable); for (int index = 0; index < joinChannelTypes.size(); index++) { BytecodeExpression type = constantType(callSiteBinder, joinChannelTypes.get(index)); // todo is the case needed BytecodeExpression block = blocks.getElement(index).cast(Block.class); hashRowMethod .getBody() .getVariable(resultVariable) .push(31) .append(OpCode.IMUL) .append(typeHashCode(type, block, position)) .append(OpCode.IADD) .putVariable(resultVariable); } hashRowMethod .getBody() .getVariable(resultVariable) .retInt(); }
.push(31) .append(OpCode.IMUL) .append(typeHashCode(type, block, blockPosition)) .append(OpCode.IADD) .putVariable(resultVariable);