[m-rev.] diff: improvement for semidet foreign_procs

Ralph Becket rafe at cs.mu.OZ.AU
Fri Jun 10 17:27:06 AEST 2005


Zoltan Somogyi, Friday, 10 June 2005:
> compiler/pragma_c_gen.m:
> 	Generate somewhat faster code for semidet foreign_procs. Instead of
> 	storing the success indication into r1, which may require moving some
> 	data out of r1, stored it in a local C variable. Provide backward
> 	compatibility with existing semidet foreign_procs by #defining
> 	SUCCESS_INDICATOR to stand for this local variable in the foreign code.
> @@ -542,15 +511,34 @@
>  	C_Code_Comp = pragma_c_user_code(Context, C_Code),
>  
>  	%
> -	% <for semidet code, check of r1>
> +	% <for semidet code, check of SUCCESS_INDICATOR>
>  	%
> -	( ( CodeModel = model_semi, Detism \= failure ) ->
> +	goal_info_get_determinism(GoalInfo, Detism),
> +	( CodeModel = model_semi ->
> +		( Detism = failure ->
> +			CheckSuccess_Comp = pragma_c_noop,
> +			MaybeFailLabel = no
> +		;
>  		code_info__get_next_label(FailLabel, !CI),
> -		CheckR1_Comp = pragma_c_fail_to(FailLabel),
> +			CheckSuccess_Comp = pragma_c_fail_to(FailLabel),
>  		MaybeFailLabel = yes(FailLabel)
> +		),
> +		DefSuccessComp = pragma_c_raw_code(
> +			"\tMR_bool " ++ pragma_succ_ind_name ++ ";\n" ++
> +			"#undef SUCCESS_INDICATOR\n" ++
> +			"#define SUCCESS_INDICATOR MercurySuccessIndicator\n",

I think that last line should be

	"#define SUCCESS_INDICATOR " ++ pragma_succ_ind_name ++ "\n",

-- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list