Skip to content

Instantly share code, notes, and snippets.

View Robertorosmaninho's full-sized avatar
💻
Focusing

Roberto Rosmaninho Robertorosmaninho

💻
Focusing
View GitHub Profile
make -j `nproc`
Consolidate compiler generated dependencies of target proof2json
Consolidate compiler generated dependencies of target proof-generator-single-threaded
Consolidate compiler generated dependencies of target proof-generator-multi-threaded
[ 25%] Built target proof2json
[ 62%] Built target proof-generator-single-threaded
[ 75%] Building CXX object bin/proof-generator/CMakeFiles/proof-generator-multi-threaded.dir/src/main.cpp.o
In file included from /home/robertorosmaninho/rv/zk/proof-producer/libs/crypto3/libs/hash/include/nil/crypto3/hash/detail/keccak/keccak_functions.hpp:38,
from /home/robertorosmaninho/rv/zk/proof-producer/libs/crypto3/libs/hash/include/nil/crypto3/hash/keccak.hpp:32,
from /home/robertorosmaninho/rv/zk/proof-producer/bin/proof-generator/include/nil/proof-generator/arithmetization_params.hpp:24,
@Robertorosmaninho
Robertorosmaninho / Final Report - Swift Handling Error Model with C++.md
Last active January 13, 2023 18:34
Final Report for the project "Bridging Swift Error Handling Model to C++"

Hello Swift Community! This is the second time that I'm writing a post here. The first one was to introduce myself and show my interest in the project "Bridging Swift Error Handling Model to C++" meant to be part of Google Summer of Code 2022. This time, I'm writing to present the results I achieved during its development, even after not being selected to receive the GSOC scholarship, but still greatly mentored by Alex Lorenz!

The two main goals of this project was:

  • Extend the C++ interface generator for a Swift module to emit C++ interfaces for Swift functions that throw, and a C++ class that represents Swift’s Error type and throw it.
  • Create a C++ class that resembles the proposed std::expected class, to provide error handling for clients that don’t use C++ exceptions.

Let's consider this Division function that can thwors as an example:

@_expose(Cxx)
******************** TEST 'Swift(macosx-arm64) :: Interop/SwiftToCxx/functions/function-availability.swift' FAILED ********************
Script:
--
: 'RUN: at line 1'; rm -rf "/Users/robertorosmaninho/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/test-macosx-arm64/Interop/SwiftToCxx/functions/Output/function-availability.swift.tmp" && mkdir -p "/Users/robertorosmaninho/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/test-macosx-arm64/Interop/SwiftToCxx/functions/Output/function-availability.swift.tmp"
: 'RUN: at line 2'; /Users/robertorosmaninho/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/bin/swift-frontend -target arm64-apple-macosx10.9 -module-cache-path /Users/robertorosmaninho/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/swift-test-results/arm64-apple-macosx10.9/clang-module-cache -sdk '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk' -swift-version 4 -define-availabili
@Robertorosmaninho
Robertorosmaninho / swift-functions-errors-execution.ll
Created June 8, 2022 08:00
This is the LLVM IR generated to the target: arm64-apple-macosx12.0.0
; ModuleID = '<swift-imported-modules>'
source_filename = "<swift-imported-modules>"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-macosx12.0.0"
%swift.type = type { i64 }
%swift.full_type = type { i8**, %swift.type }
%swift.protocol = type { i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i32, i32, i32, i32, i32, i32 }
%swift.method_descriptor = type { i32, i32 }
%swift.protocol_requirement = type { i32, i32 }
@Robertorosmaninho
Robertorosmaninho / swift-functions-errors-execution.ll
Created June 8, 2022 07:27
This is the LLVM IR generated to the target: /i386-apple-watchos2.0-simulator
; ModuleID = '<swift-imported-modules>'
source_filename = "<swift-imported-modules>"
target datalayout = "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128"
target triple = "i386-apple-watchos2.0.0-simulator"
%swift.type = type { i32 }
%swift.full_type = type { i8**, %swift.type }
%swift.protocol = type { i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i32, i32, i32, i32, i32, i32 }
%swift.method_descriptor = type { i32, i32 }
%swift.protocol_requirement = type { i32, i32 }
@Robertorosmaninho
Robertorosmaninho / SwiftBuildingError.md
Last active March 23, 2022 02:53
Error building Swift with XCode on MBP 14" - MacOS 12.3

XCode Version:

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
version: 13.3.0.0.1.1645755326

CMake Version:

cmake --version
cmake version 3.22.3

GSOC Final Report

After ten weeks of hard work on the project "LLVM Back-end for the Tensor Algebra Compiler" for Google Summer of Code 2021 I was able to develop the following contributions:

  • Support for branch and loop operations (IfThenElse, While, For)
  • Support for binary and unary operations (Neg, Sub, Div, Rem, Min, Max, And, Or, BitOr, BitAnd)
  • Support for comparison operators (LTE, GTE, LT, GT, EQ, NEQ)
  • Support for other operations (Assign, Cast, Case, Indices property, Comment, BlankLine)
  • Support for booleans
  • Added new tests to assess the correctness of new operations
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int findPositionWord(char *word, char*text) {
int num_times = 0;
int position =0; //set position to 0 in each iteration
char *end_line;
char *token=strtok_r(text," ", &end_line); // search for space
while(token!=NULL){
This file has been truncated, but you can view the full file.
; LLVM CodeGen Visiting Function @assemble
; └──[1]LLVM CodeGen Visiting Scope
; │ └──[2]LLVM CodeGen Visiting Block
; │ │ └──[3]LLVM CodeGen Visiting Block
; │ │ │ └──[4]LLVM CodeGen Visiting Block
; │ │ │ │ └──[5]LLVM CodeGen Visiting Block
; │ │ │ │ │ └──[6]LLVM CodeGen Visiting Allocate
; │ │ │ │ │ └──[6]LLVM CodeGen Visiting Store
; │ │ │ │ │ │ └──[7]LLVM CodeGen Visiting Expr
; │ │ │ │ │ │ └──[7]LLVM CodeGen Visiting Expr
#ifndef TACO_C_HEADERS
#define TACO_C_HEADERS
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include <complex.h>
#include <string.h>
#if _OPENMP