diff options
Diffstat (limited to 'lib/hipe/rtl/hipe_rtl_binary_construct.erl')
| -rw-r--r-- | lib/hipe/rtl/hipe_rtl_binary_construct.erl | 31 | 
1 files changed, 22 insertions, 9 deletions
| diff --git a/lib/hipe/rtl/hipe_rtl_binary_construct.erl b/lib/hipe/rtl/hipe_rtl_binary_construct.erl index 52ea5db382..5b89d4946a 100644 --- a/lib/hipe/rtl/hipe_rtl_binary_construct.erl +++ b/lib/hipe/rtl/hipe_rtl_binary_construct.erl @@ -195,8 +195,13 @@ gen_rtl(BsOP, Dst, Args, TrueLblName, FalseLblName, SystemLimitLblName, ConstTab  	  bs_validate_unicode ->  	    [_Arg] = Args, -	    [hipe_rtl:mk_call([], bs_validate_unicode, Args, -			      TrueLblName, FalseLblName, not_remote)]; +            [IsUnicode] = create_regs(1), +            RetLbl = hipe_rtl:mk_new_label(), +            [hipe_rtl:mk_call([IsUnicode], is_unicode, Args, +                              hipe_rtl:label_name(RetLbl), [], not_remote), +             RetLbl, +             hipe_rtl:mk_branch(IsUnicode, ne, hipe_rtl:mk_imm(0), +                                TrueLblName, FalseLblName, 0.99)];  	  bs_final ->  	    Zero = hipe_rtl:mk_imm(0), @@ -354,7 +359,8 @@ not_writable_code(Bin, SizeReg, Dst, Base, Offset, Unit,  allocate_writable(Dst, Base, UsedBytes, TotBytes, TotSize) ->    Zero = hipe_rtl:mk_imm(0),    [NextLbl] = create_lbls(1), -  [EndSubSize, EndSubBitSize, ProcBin] = create_regs(3), +  [EndSubSize, EndSubBitSize] = create_regs(2), +  [ProcBin] = create_unsafe_regs(1),    [hipe_rtl:mk_call([Base], bs_allocate, [UsedBytes],  		    hipe_rtl:label_name(NextLbl), [], not_remote),     NextLbl, @@ -581,12 +587,12 @@ const_init2(Size, Dst, Base, Offset, TrueLblName) ->      false ->        ByteSize = hipe_rtl:mk_new_reg(),        [hipe_rtl:mk_gctest(?PROC_BIN_WORDSIZE+?SUB_BIN_WORDSIZE), -       hipe_rtl:mk_move(Offset, hipe_rtl:mk_imm(0)),         hipe_rtl:mk_move(ByteSize, hipe_rtl:mk_imm(Size)),         hipe_rtl:mk_call([Base], bs_allocate, [ByteSize],  			hipe_rtl:label_name(NextLbl), [], not_remote),         NextLbl,         hipe_tagscheme:create_refc_binary(Base, ByteSize, Dst), +       hipe_rtl:mk_move(Offset, hipe_rtl:mk_imm(0)),         hipe_rtl:mk_goto(TrueLblName)]    end. @@ -629,13 +635,12 @@ var_init2(Size, Dst, Base, Offset, TrueLblName, SystemLimitLblName, FalseLblName    Log2WordSize = hipe_rtl_arch:log2_word_size(),    WordSize = hipe_rtl_arch:word_size(),    [ContLbl, HeapLbl, REFCLbl, NextLbl] = create_lbls(4), -  [USize, Tmp] = create_unsafe_regs(2), +  [USize, Tmp] = create_regs(2),    [get_word_integer(Size, USize, SystemLimitLblName, FalseLblName),     hipe_rtl:mk_branch(USize, leu, hipe_rtl:mk_imm(?MAX_BINSIZE),  		      hipe_rtl:label_name(ContLbl),  		      SystemLimitLblName),     ContLbl, -   hipe_rtl:mk_move(Offset, hipe_rtl:mk_imm(0)),     hipe_rtl:mk_branch(USize, leu, hipe_rtl:mk_imm(?MAX_HEAP_BIN_SIZE),  		      hipe_rtl:label_name(HeapLbl),  		      hipe_rtl:label_name(REFCLbl)), @@ -645,6 +650,7 @@ var_init2(Size, Dst, Base, Offset, TrueLblName, SystemLimitLblName, FalseLblName     hipe_rtl:mk_alu(Tmp, Tmp, add, hipe_rtl:mk_imm(?SUB_BIN_WORDSIZE)),     hipe_rtl:mk_gctest(Tmp),     hipe_tagscheme:create_heap_binary(Base, USize, Dst), +   hipe_rtl:mk_move(Offset, hipe_rtl:mk_imm(0)),     hipe_rtl:mk_goto(TrueLblName),     REFCLbl,     hipe_rtl:mk_gctest(?PROC_BIN_WORDSIZE+?SUB_BIN_WORDSIZE), @@ -652,6 +658,7 @@ var_init2(Size, Dst, Base, Offset, TrueLblName, SystemLimitLblName, FalseLblName  		    hipe_rtl:label_name(NextLbl), [], not_remote),     NextLbl,     hipe_tagscheme:create_refc_binary(Base, USize, Dst), +   hipe_rtl:mk_move(Offset, hipe_rtl:mk_imm(0)),     hipe_rtl:mk_goto(TrueLblName)].  var_init_bits(Size, Dst, Base, Offset, TrueLblName, SystemLimitLblName, FalseLblName) -> @@ -858,7 +865,7 @@ get_base_offset_size(Binary, SrcBase, SrcOffset, SrcSize, FLName) ->     JoinLbl,     hipe_tagscheme:test_heap_binary(Orig, HeapLblName, REFCLblName),     HeapLbl, -   hipe_rtl:mk_alu(SrcBase, Orig, add, hipe_rtl:mk_imm(?HEAP_BIN_DATA-2)), +   hipe_tagscheme:get_field_addr_from_term({heap_bin, {data, 0}}, Orig, SrcBase),     hipe_rtl:mk_goto(EndLblName),     REFCLbl,     hipe_tagscheme:get_field_from_term({proc_bin,bytes}, Orig, SrcBase), @@ -1205,6 +1212,12 @@ is_divisible(Dividend, Divisor, SuccLbl, FailLbl) ->        [hipe_rtl:mk_branch(Dividend, 'and', Mask, eq, SuccLbl, FailLbl, 0.99)];      false ->        %% We need division, fall back to a primop -      [hipe_rtl:mk_call([], is_divisible, [Dividend, hipe_rtl:mk_imm(Divisor)], -			SuccLbl, FailLbl, not_remote)] +      [Tmp] = create_regs(1), +      RetLbl = hipe_rtl:mk_new_label(), +      [hipe_rtl:mk_call([Tmp], is_divisible, +                        [Dividend, hipe_rtl:mk_imm(Divisor)], +                        hipe_rtl:label_name(RetLbl), [], not_remote), +       RetLbl, +       hipe_rtl:mk_branch(Tmp, ne, hipe_rtl:mk_imm(0), +                          SuccLbl, FailLbl, 0.99)]    end. | 
