Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
Signed-off-by: salaheldinsoliman <[email protected]>
  • Loading branch information
salaheldinsoliman committed Jul 14, 2024
2 parents e398828 + 06798cd commit fd5cdca
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ jobs:

mac-intel:
name: Mac Intel
# The Hyperledger self-hosted intel macs have the label macos-latest
# and run macos 12. We don't want to build llvm on macos 12, because
# then it can't be used on macos 11.
runs-on: macos-11
runs-on: macos-12
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:

mac-intel:
name: Mac Intel
runs-on: macos-11
runs-on: macos-12
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand All @@ -223,7 +223,7 @@ jobs:

mac-universal:
name: Mac Universal Binary
runs-on: macos-11
runs-on: macos-12
needs: [mac-arm, mac-intel]
steps:
- uses: actions/download-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "solang"
version = "0.3.3"
authors = ["Sean Young <[email protected]>", "Lucas Steuernagel <[email protected]>", "Cyrill Leutwiler <[email protected]>"]
homepage = "https://github.com/hyperledger/solang"
repository = "https://github.com/hyperledger/solang"
documentation = "https://solang.readthedocs.io/"
license = "Apache-2.0"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion solang-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "solang-parser"
version = "0.3.3"
authors = ["Sean Young <[email protected]>", "Lucas Steuernagel <[email protected]>", "Cyrill Leutwiler <[email protected]>"]
homepage = "https://github.com/hyperledger/solang"
repository = "https://github.com/hyperledger/solang"
documentation = "https://solang.readthedocs.io/"
license = "Apache-2.0"
build = "build.rs"
Expand Down
4 changes: 2 additions & 2 deletions solang-parser/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ impl<'input> fmt::Display for Token<'input> {
Token::CloseBracket => write!(f, "]"),
Token::BitwiseNot => write!(f, "~"),
Token::Question => write!(f, "?"),
Token::ShiftRightAssign => write!(f, "<<="),
Token::ShiftRight => write!(f, "<<"),
Token::ShiftRightAssign => write!(f, ">>="),
Token::ShiftRight => write!(f, ">>"),
Token::Less => write!(f, "<"),
Token::LessEqual => write!(f, "<="),
Token::Bool => write!(f, "bool"),
Expand Down
6 changes: 6 additions & 0 deletions src/codegen/dispatch/soroban.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ pub fn function_dispatch(

wrapper_cfg.add(&mut vartab, placeholder);

<<<<<<< HEAD

if value.len() == 1 {
=======
>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f
// set the msb 8 bits of the return value to 6, the return value is 64 bits.
// FIXME: this assumes that the solidity function always returns one value.
let shifted = Expression::ShiftLeft {
Expand Down Expand Up @@ -133,6 +136,7 @@ pub fn function_dispatch(
};

wrapper_cfg.add(&mut vartab, Instr::Return { value: vec![added] });
<<<<<<< HEAD
} else {

// return 2 as numberliteral
Expand All @@ -145,6 +149,8 @@ pub fn function_dispatch(
wrapper_cfg.add(&mut vartab, Instr::Return { value: vec![two] });
}

=======
>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f

vartab.finalize(ns, &mut wrapper_cfg);
cfg.public = false;
Expand Down
9 changes: 9 additions & 0 deletions src/emit/soroban/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ use std::sync;
const SOROBAN_ENV_INTERFACE_VERSION: u64 = 90194313216;
pub const PUT_CONTRACT_DATA: &str = "l._";
pub const GET_CONTRACT_DATA: &str = "l.1";
<<<<<<< HEAD
pub const LOG_FROM_LINEAR_MEMORY: &str = "x._";
=======
>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f

pub struct SorobanTarget;

Expand Down Expand Up @@ -232,21 +235,27 @@ impl SorobanTarget {
.i64_type()
.fn_type(&[ty.into(), ty.into()], false);

<<<<<<< HEAD
let log_function_ty = binary
.context
.i64_type()
.fn_type(&[ty.into(), ty.into(), ty.into(), ty.into()], false);

=======
>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f
binary
.module
.add_function(PUT_CONTRACT_DATA, function_ty_1, Some(Linkage::External));
binary
.module
.add_function(GET_CONTRACT_DATA, function_ty, Some(Linkage::External));
<<<<<<< HEAD

binary
.module
.add_function(LOG_FROM_LINEAR_MEMORY, log_function_ty, Some(Linkage::External));
=======
>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f
}

fn emit_initializer(binary: &mut Binary, _ns: &ast::Namespace) {
Expand Down
16 changes: 16 additions & 0 deletions src/emit/soroban/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

use crate::codegen::cfg::HashTy;
use crate::codegen::Expression;
<<<<<<< HEAD
use crate::emit::binary::{self, Binary};
use crate::emit::soroban::{SorobanTarget, GET_CONTRACT_DATA, LOG_FROM_LINEAR_MEMORY, PUT_CONTRACT_DATA};
=======
use crate::emit::binary::Binary;
use crate::emit::soroban::{SorobanTarget, GET_CONTRACT_DATA, PUT_CONTRACT_DATA};
>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f
use crate::emit::ContractArgs;
use crate::emit::{TargetRuntime, Variable};
use crate::emit_context;
Expand All @@ -13,10 +18,17 @@ use crate::sema::ast::{Function, Namespace, Type};

use inkwell::types::{BasicTypeEnum, IntType};
use inkwell::values::{
<<<<<<< HEAD
AnyValue, ArrayValue, AsValueRef, BasicMetadataValueEnum, BasicValue, BasicValueEnum, FunctionValue, IntValue, PointerValue
};

use inkwell::AddressSpace;
=======
ArrayValue, BasicMetadataValueEnum, BasicValue, BasicValueEnum, FunctionValue, IntValue,
PointerValue,
};

>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f
use solang_parser::pt::Loc;

use std::collections::HashMap;
Expand Down Expand Up @@ -236,6 +248,7 @@ impl<'a> TargetRuntime<'a> for SorobanTarget {

/// Prints a string
/// TODO: Implement this function, with a call to the `log` function in the Soroban runtime.
<<<<<<< HEAD
fn print(&self, bin: &Binary, string: PointerValue, length: IntValue) {


Expand Down Expand Up @@ -302,6 +315,9 @@ impl<'a> TargetRuntime<'a> for SorobanTarget {
).unwrap();

}
=======
fn print(&self, bin: &Binary, string: PointerValue, length: IntValue) {}
>>>>>>> 06798cdeac6fd62ee98f5ae7da38f3af4933dc0f

/// Return success without any result
fn return_empty_abi(&self, bin: &Binary) {
Expand Down

0 comments on commit fd5cdca

Please sign in to comment.