void updateParametersAndReturn() {

		if (params == null) {
			loadVariables();
			return;
		}

		if (hasCustomVariableStorage()) {
			autoParams = null;
			renumberParameterOrdinals();
			return;
		}

		DataType[] dataTypes = new DataType[params.size() + 1];

		for (int i = 0; i < params.size(); i++) {
			ParameterDB param = params.get(i);
			param.setDynamicStorage(VariableStorage.UNASSIGNED_STORAGE);
			dataTypes[i + 1] = param.getDataType();
		}

		dataTypes[0] = returnParam.getFormalDataType();
		returnParam.setDynamicStorage(
			VoidDataType.isVoidDataType(dataTypes[0]) ? VariableStorage.VOID_STORAGE
					: VariableStorage.UNASSIGNED_STORAGE);

		PrototypeModel callingConvention = getCallingConvention();
		if (callingConvention == null) {
			callingConvention = manager.getDefaultCallingConvention();
		}
		if (callingConvention == null) {
			return;
		}

		VariableStorage[] variableStorage =
			callingConvention.getStorageLocations(program, dataTypes, true);
		returnParam.setDynamicStorage(variableStorage[0]);

		int autoIndex = 0;
		int paramIndex = 0;

		autoParams = null;

		for (int i = 1; i < variableStorage.length; i++) {
			VariableStorage storage = variableStorage[i];
			if (storage.isAutoStorage()) {
				if (autoParams == null) {
					autoParams = new ArrayList<>();
				}
				DataType dt = VariableUtilities.getAutoDataType(this,
					returnParam.getFormalDataType(), storage);
				try {
					autoParams.add(new AutoParameterImpl(dt, autoIndex++, storage, this));
				}
				catch (InvalidInputException e) {
					Msg.error(this,
						"Unexpected error during dynamic storage assignment for function at " +
							getEntryPoint(),
						e);
					break;
				}
			}
			else {
				ParameterDB parameterDB = params.get(paramIndex++);
				parameterDB.setDynamicStorage(storage);
			}
		}

		renumberParameterOrdinals();
	}
Update parameter ordinals and re-assign dynamic parameter storage
NOTE: loadVariables must have been called first
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/function/FunctionDB.java