Skip to content

Commit c447fca

Browse files
authored
Merge pull request #2860 from swamishiju/sync
LIBASR Sync
2 parents f1304ee + 11b1b77 commit c447fca

File tree

171 files changed

+972
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+972
-171
lines changed

integration_tests/CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ RUN(NAME exit_02b FAIL LABELS cpython llvm llvm_jit c wasm wasm_x86 wasm_x
459459
RUN(NAME exit_02c FAIL LABELS cpython llvm llvm_jit c)
460460

461461
# Test all four backends
462-
# RUN(NAME print_01 LABELS cpython llvm llvm_jit wasm) # renable c, wasm not yet supports sep and end keywords
462+
RUN(NAME print_01 LABELS cpython llvm llvm_jit) # renable c, wasm not yet supports sep and end keywords, wasm does not handle DescriptorString
463463
RUN(NAME print_03 LABELS x86 c wasm wasm_x86 wasm_x64) # simple test case specifically for x86, wasm_x86 and wasm_x64
464464
RUN(NAME print_04 LABELS cpython llvm llvm_jit c)
465465
RUN(NAME print_06 LABELS cpython llvm llvm_jit) # renable c
@@ -534,14 +534,14 @@ RUN(NAME test_types_02 LABELS cpython llvm llvm_jit c wasm)
534534
# RUN(NAME test_str_05 LABELS cpython llvm llvm_jit c)
535535
# RUN(NAME test_str_06 LABELS cpython llvm llvm_jit c)
536536
RUN(NAME test_string_01 LABELS cpython llvm llvm_jit) # renable c
537-
# RUN(NAME test_list_01 LABELS cpython llvm llvm_jit c)
537+
RUN(NAME test_list_01 LABELS cpython llvm llvm_jit c)
538538
# RUN(NAME test_list_02 LABELS cpython llvm llvm_jit c)
539539
# RUN(NAME test_list_03 LABELS cpython llvm llvm_jit c NOFAST)
540540
# RUN(NAME test_list_04 LABELS cpython llvm llvm_jit c NOFAST)
541541
# RUN(NAME test_list_05 LABELS cpython llvm llvm_jit c NOFAST)
542542
RUN(NAME test_list_06 LABELS cpython llvm llvm_jit c)
543-
# RUN(NAME test_list_07 LABELS cpython llvm llvm_jit c NOFAST)
544-
# RUN(NAME test_list_08 LABELS cpython llvm llvm_jit c NOFAST)
543+
RUN(NAME test_list_07 LABELS cpython llvm llvm_jit c NOFAST)
544+
RUN(NAME test_list_08 LABELS cpython llvm llvm_jit c NOFAST)
545545
# RUN(NAME test_list_09 LABELS cpython llvm llvm_jit c NOFAST)
546546
# RUN(NAME test_list_10 LABELS cpython llvm llvm_jit c NOFAST)
547547
# RUN(NAME test_list_11 LABELS cpython llvm llvm_jit c)
@@ -554,7 +554,7 @@ RUN(NAME test_list_06 LABELS cpython llvm llvm_jit c)
554554
# RUN(NAME test_list_repeat2 LABELS cpython llvm llvm_jit c NOFAST)
555555
# RUN(NAME test_list_reverse LABELS cpython llvm llvm_jit) # post sync
556556
# RUN(NAME test_list_pop LABELS cpython llvm llvm_jit NOFAST) # TODO: Remove NOFAST from here.
557-
# RUN(NAME test_list_pop2 LABELS cpython llvm llvm_jit NOFAST) # TODO: Remove NOFAST from here.
557+
RUN(NAME test_list_pop2 LABELS cpython llvm llvm_jit NOFAST) # TODO: Remove NOFAST from here.
558558
RUN(NAME test_list_pop3 LABELS cpython llvm llvm_jit)
559559
# RUN(NAME test_list_compare LABELS cpython llvm llvm_jit) # post sync
560560
RUN(NAME test_list_compare2 LABELS cpython llvm llvm_jit)
@@ -570,15 +570,15 @@ RUN(NAME test_const_access LABELS cpython llvm llvm_jit) # post sync
570570
# RUN(NAME test_tuple_nested LABELS cpython llvm llvm_jit) # post sync
571571
# RUN(NAME test_const_dict LABELS cpython llvm llvm_jit) # post sync
572572
# RUN(NAME test_params LABELS cpython llvm llvm_jit NOFAST)
573-
# RUN(NAME test_dict_01 LABELS cpython llvm llvm_jit c) # post sync
573+
RUN(NAME test_dict_01 LABELS cpython llvm llvm_jit c) # post sync
574574
RUN(NAME test_dict_02 LABELS cpython llvm llvm_jit c NOFAST)
575575
# RUN(NAME test_dict_03 LABELS cpython llvm llvm_jit NOFAST)
576576
# RUN(NAME test_dict_04 LABELS cpython llvm llvm_jit NOFAST)
577577
RUN(NAME test_dict_05 LABELS cpython llvm llvm_jit c)
578-
# RUN(NAME test_dict_06 LABELS cpython llvm llvm_jit c)
578+
RUN(NAME test_dict_06 LABELS cpython llvm llvm_jit c)
579579
# RUN(NAME test_dict_07 LABELS cpython llvm llvm_jit c)
580-
# RUN(NAME test_dict_08 LABELS cpython llvm llvm_jit c)
581-
# RUN(NAME test_dict_09 LABELS cpython llvm llvm_jit c)
580+
RUN(NAME test_dict_08 LABELS cpython llvm llvm_jit c)
581+
RUN(NAME test_dict_09 LABELS cpython llvm llvm_jit c)
582582
# RUN(NAME test_dict_10 LABELS cpython llvm llvm_jit) # renable c # post sync
583583
# RUN(NAME test_dict_11 LABELS cpython llvm llvm_jit c) # post sync
584584
# RUN(NAME test_dict_12 LABELS cpython llvm llvm_jit) # renable c # post sync
@@ -632,7 +632,7 @@ RUN(NAME test_random_02 LABELS cpython llvm llvm_jit NOFAST)
632632
# RUN(NAME test_builtin LABELS cpython llvm llvm_jit) # renable c # post sync
633633
RUN(NAME test_builtin_abs LABELS cpython llvm llvm_jit c)
634634
# RUN(NAME test_builtin_bool LABELS cpython llvm llvm_jit c)
635-
# RUN(NAME test_builtin_pow LABELS cpython llvm llvm_jit c EXTRA_ARGS --no-warnings)
635+
RUN(NAME test_builtin_pow LABELS cpython llvm llvm_jit c EXTRA_ARGS --no-warnings)
636636
# RUN(NAME test_builtin_int LABELS cpython llvm llvm_jit c)
637637
# RUN(NAME test_builtin_len LABELS cpython llvm llvm_jit c)
638638
# RUN(NAME test_builtin_str LABELS cpython llvm llvm_jit c)
@@ -670,7 +670,7 @@ RUN(NAME test_c_interop_03 LABELS cpython llvm c
670670
# RUN(NAME bindpy_05 LABELS llvm_py c_py EXTRA_ARGS --enable-cpython COPY_TO_BIN bindpy_05_module.py REQ_PY_VER 3.10)
671671
# RUN(NAME bindpy_06 LABELS cpython llvm_py EXTRA_ARGS --enable-cpython NOFAST COPY_TO_BIN bindpy_06_module.py REQ_PY_VER 3.10)
672672
# RUN(NAME test_generics_01 LABELS cpython llvm llvm_jit NOFAST) # renable c # post sync
673-
# RUN(NAME test_cmath LABELS cpython llvm llvm_jit c NOFAST)
673+
RUN(NAME test_cmath LABELS cpython llvm llvm_jit c NOFAST)
674674
RUN(NAME test_complex_01 LABELS cpython llvm llvm_jit c wasm wasm_x64)
675675
RUN(NAME test_complex_02 LABELS cpython llvm llvm_jit c)
676676
RUN(NAME test_ConstantEllipsis LABLES cpython llvm llvm_jit c)

integration_tests/test_cmath.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from cmath import (exp, log, sqrt, acos, asin, atan, cos, sin, tan,
2-
acosh, asinh, atanh, cosh, sinh, tanh,
3-
phase, polar, rect)
4-
from lpython import c64, c32, f64
1+
from cmath import (acos, acosh, asin, asinh, atan, atanh, cos, cosh, exp, log,
2+
phase, polar, rect, sin, sinh, sqrt, tan, tanh)
3+
4+
from lpython import c32, c64, f64
5+
56

67
def test_power_logarithmic():
78
x: c64
@@ -73,4 +74,4 @@ def test_polar():
7374
test_power_logarithmic()
7475
test_trigonometric()
7576
test_hyperbolic()
76-
test_polar()
77+
test_polar()

libasr

Submodule libasr updated 1225 files

src/bin/lpython.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,7 @@ int main(int argc, char *argv[])
20762076
lpython_pass_manager.use_default_passes();
20772077
compiler_options.po.disable_main = true;
20782078
compiler_options.emit_debug_line_column = false;
2079-
compiler_options.generate_object_code = false;
2079+
compiler_options.separate_compilation = false;
20802080
return interactive_python_repl(lpython_pass_manager, compiler_options, arg_v);
20812081
#else
20822082
std::cerr << "Interactive prompt requires the LLVM backend to be enabled. Recompile with `WITH_LLVM=yes`." << std::endl;
@@ -2216,7 +2216,7 @@ int main(int argc, char *argv[])
22162216
}
22172217
compiler_options.emit_debug_info = false;
22182218
compiler_options.emit_debug_line_column = false;
2219-
compiler_options.generate_object_code = false;
2219+
compiler_options.separate_compilation = false;
22202220
return compile_python_using_llvm(arg_file, "", runtime_library_dir,
22212221
lpython_pass_manager, compiler_options, time_report, false, true);
22222222
#else

src/lpython/python_kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace LCompilers::LPython {
8080
e.compiler_options.interactive = true;
8181
e.compiler_options.po.disable_main = true;
8282
e.compiler_options.emit_debug_line_column = false;
83-
e.compiler_options.generate_object_code = false;
83+
e.compiler_options.separate_compilation = false;
8484
}
8585
virtual ~custom_interpreter() = default;
8686

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,8 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
10801080
variable_dependencies_vec.size(), ASR::intentType::Local,
10811081
nullptr, nullptr, ASR::storage_typeType::Default,
10821082
type, nullptr, ASR::abiType::Source, ASR::accessType::Public,
1083-
ASR::presenceType::Required, false, false, false, nullptr, false);
1083+
ASR::presenceType::Required, false, false, false, nullptr,
1084+
false,false);
10841085
ASR::symbol_t* variable_sym = ASR::down_cast<ASR::symbol_t>(variable_asr);
10851086
current_scope->add_symbol(dummy_ret_name, variable_sym);
10861087
ASR::expr_t* variable_var = ASRUtils::EXPR(ASR::make_Var_t(al, expr->base.loc, variable_sym));
@@ -2759,7 +2760,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
27592760
variable_dependencies_vec.size(),
27602761
s_intent, nullptr, nullptr, storage_type, type,
27612762
nullptr, current_procedure_abi_type, s_access,
2762-
s_presence, value_attr, false, false, nullptr, false);
2763+
s_presence, value_attr, false, false, nullptr, false, false);
27632764
ASR::symbol_t* v_sym = ASR::down_cast<ASR::symbol_t>(v);
27642765
current_scope->add_or_overwrite_symbol(var_name, v_sym);
27652766
}
@@ -2916,7 +2917,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
29162917
variable_dependencies_vec.size(), ASRUtils::intent_unspecified,
29172918
nullptr, nullptr, ASR::storage_typeType::Default, fn_type->m_arg_types[i],
29182919
nullptr, ASR::abiType::Source, ASR::Public, ASR::presenceType::Required,
2919-
false, false, false, nullptr, false));
2920+
false, false, false, nullptr, false, false));
29202921
current_scope->add_symbol(arg_name, v);
29212922
LCOMPILERS_ASSERT(v != nullptr)
29222923
args.push_back(al, ASRUtils::EXPR(ASR::make_Var_t(al, x.m_args.m_args[i].loc, v)));
@@ -3515,7 +3516,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
35153516
s2c(al, var_name), variable_dependencies_vec.p,
35163517
variable_dependencies_vec.size(), s_intent, init_expr,
35173518
value, storage_type, type, nullptr, current_procedure_abi_type,
3518-
s_access, s_presence, value_attr, false, false, nullptr, false);
3519+
s_access, s_presence, value_attr, false, false, nullptr, false, false);
35193520
current_scope->add_symbol(var_name, ASR::down_cast<ASR::symbol_t>(v));
35203521
}
35213522

@@ -3545,7 +3546,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
35453546
variable_dependencies_vec.size(),
35463547
s_intent, init_expr, value, storage_type, type, nullptr,
35473548
current_procedure_abi_type, s_access, s_presence,
3548-
value_attr, false, false, nullptr, false);
3549+
value_attr, false, false, nullptr, false, false);
35493550
current_scope->add_symbol(var_name, ASR::down_cast<ASR::symbol_t>(v));
35503551
}
35513552

@@ -4418,6 +4419,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
44184419
/* a_name */ s2c(al, module_name),
44194420
nullptr,
44204421
0,
4422+
nullptr,
44214423
false, false);
44224424
module_sym = ASR::down_cast<ASR::Module_t>(ASR::down_cast<ASR::symbol_t>(tmp1));
44234425
parent_scope->add_symbol(module_name, ASR::down_cast<ASR::symbol_t>(tmp1));
@@ -4467,7 +4469,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
44674469
variable_dependencies_vec.size(), ASRUtils::intent_unspecified,
44684470
nullptr, nullptr, ASR::storage_typeType::Default, func->m_arg_types[i],
44694471
nullptr, ASR::abiType::Source, ASR::Public, ASR::presenceType::Required,
4470-
false, false, false, nullptr, false));
4472+
false, false, false, nullptr, false, false));
44714473
current_scope->add_symbol(arg_name, v);
44724474
LCOMPILERS_ASSERT(v != nullptr)
44734475
args.push_back(al, ASRUtils::EXPR(ASR::make_Var_t(al, loc,
@@ -4486,7 +4488,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
44864488
variable_dependencies_vec.size(), ASRUtils::intent_return_var,
44874489
nullptr, nullptr, ASR::storage_typeType::Default, func->m_return_var_type,
44884490
nullptr, ASR::abiType::Source, ASR::Public, ASR::presenceType::Required,
4489-
false, false, false, nullptr, false);
4491+
false, false, false, nullptr, false, false);
44904492
current_scope->add_symbol(return_var_name, ASR::down_cast<ASR::symbol_t>(return_var));
44914493
to_return = ASRUtils::EXPR(ASR::make_Var_t(al, loc,
44924494
ASR::down_cast<ASR::symbol_t>(return_var)));
@@ -4684,6 +4686,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
46844686
alloc_arg.n_dims = 0;
46854687
alloc_arg.m_type = nullptr;
46864688
alloc_arg.m_len_expr = nullptr;
4689+
alloc_arg.m_sym_subclass = nullptr;
46874690
alloc_args.push_back(al, alloc_arg);
46884691
init_expr = ASRUtils::EXPR(ASR::make_Allocate_t(al, loc, alloc_args.p, 1, nullptr, nullptr, nullptr));
46894692

@@ -4726,7 +4729,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
47264729
variable_dependencies_vec.size(),
47274730
s_intent, init_expr, value, storage_type, arg_type,
47284731
nullptr, current_procedure_abi_type, s_access, s_presence,
4729-
value_attr, false, false, nullptr, false);
4732+
value_attr, false, false, nullptr, false, false);
47304733
v = ASR::down_cast<ASR::symbol_t>(_tmp);
47314734

47324735
}
@@ -4770,7 +4773,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
47704773
current_scope, s2c(al, return_var_name), variable_dependencies_vec.p,
47714774
variable_dependencies_vec.size(), ASRUtils::intent_return_var,
47724775
nullptr, nullptr, storage_type, type, nullptr, current_procedure_abi_type, ASR::Public,
4773-
ASR::presenceType::Required, false, false, false, nullptr, false);
4776+
ASR::presenceType::Required, false, false, false, nullptr, false, false);
47744777
LCOMPILERS_ASSERT(current_scope->get_scope().find(return_var_name) == current_scope->get_scope().end())
47754778
current_scope->add_symbol(return_var_name,
47764779
ASR::down_cast<ASR::symbol_t>(return_var));
@@ -5108,7 +5111,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
51085111
ASR::asr_t *v = ASR::make_Variable_t(al, x.base.base.loc, current_scope,
51095112
s2c(al, tvar_name), variable_dependencies_vec.p, variable_dependencies_vec.size(),
51105113
s_intent, init_expr, value, storage_type, type, nullptr, current_procedure_abi_type,
5111-
s_access, s_presence, value_attr, false, false, nullptr, false);
5114+
s_access, s_presence, value_attr, false, false, nullptr, false, false);
51125115
current_scope->add_symbol(tvar_name, ASR::down_cast<ASR::symbol_t>(v));
51135116

51145117
tmp = nullptr;
@@ -5868,7 +5871,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
58685871
variable_dependencies_vec.p, variable_dependencies_vec.size(),
58695872
ASR::intentType::Local, nullptr, nullptr, storage_type,
58705873
int_type, nullptr, ASR::abiType::Source, ASR::accessType::Public,
5871-
ASR::presenceType::Required, false, false, false, nullptr, false
5874+
ASR::presenceType::Required, false, false, false, nullptr, false, false
58725875
);
58735876
current_scope->add_symbol(explicit_iter_name,
58745877
ASR::down_cast<ASR::symbol_t>(explicit_iter_variable));
@@ -6075,7 +6078,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
60756078
s2c(al, tmp_assign_name), variable_dependencies_vec.p, variable_dependencies_vec.size(),
60766079
ASR::intentType::Local, nullptr, nullptr, ASR::storage_typeType::Default,
60776080
loop_src_var_ttype, nullptr, ASR::abiType::Source, ASR::accessType::Public,
6078-
ASR::presenceType::Required, false, false, false, nullptr, false
6081+
ASR::presenceType::Required, false, false, false, nullptr, false, false
60796082
);
60806083
ASR::symbol_t *tmp_assign_variable_sym = ASR::down_cast<ASR::symbol_t>(tmp_assign_variable);
60816084
current_scope->add_symbol(tmp_assign_name, tmp_assign_variable_sym);
@@ -6113,7 +6116,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
61136116
s2c(al, tmp_assign_name), variable_dependencies_vec.p, variable_dependencies_vec.size(),
61146117
ASR::intentType::Local, nullptr, nullptr, ASR::storage_typeType::Default,
61156118
loop_src_var_ttype, nullptr, ASR::abiType::Source, ASR::accessType::Public,
6116-
ASR::presenceType::Required, false, false, false, nullptr, false
6119+
ASR::presenceType::Required, false, false, false, nullptr, false, false
61176120
);
61186121
ASR::symbol_t *tmp_assign_variable_sym = ASR::down_cast<ASR::symbol_t>(tmp_assign_variable);
61196122
current_scope->add_symbol(tmp_assign_name, tmp_assign_variable_sym);
@@ -8791,6 +8794,7 @@ we will have to use something else.
87918794
new_arg.m_dims = dims.p;
87928795
new_arg.n_dims = dims.size();
87938796
new_arg.m_a = assign_asr_target;
8797+
new_arg.m_sym_subclass = nullptr;
87948798
alloc_args_vec.push_back(al, new_arg);
87958799
tmp = ASR::make_Allocate_t(al, loc,
87968800
alloc_args_vec.p, alloc_args_vec.size(),

0 commit comments

Comments
 (0)