[m-dev.] tech preview 1: webserver

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Aug 21 23:00:43 AEST 2000


On 21-Aug-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> I am pleased to announce my tech preview 1 (working with NT does this to
> you) for a mercury webserver.

That sounds fabulous!  I look forward to seeing the details.

BTW, have you decided on licensing conditions for this code?

> but don't forget to apply the attached patch!

It would be good if the relevant parts of this webserver tech preview
(e.g. this patch) could be merged into the main Mercury distribution.

> Index: compiler/ml_code_gen.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
> retrieving revision 1.57
> diff -u -r1.57 ml_code_gen.m
> --- compiler/ml_code_gen.m	2000/08/09 07:47:13	1.57
> +++ compiler/ml_code_gen.m	2000/08/21 08:42:59
> @@ -2097,7 +2097,7 @@
>  				Cast = ""
>  			)
>  		},
> -		{ string__format("\t%s = %s\n",
> +		{ string__format("\t%s = %s ",
>  			[s(ArgName), s(Cast)],
>  			AssignToArgName) },
>  		{ AssignInput = [
> @@ -2179,7 +2179,7 @@
>  		},
>  		{ string__format(" = %s%s;\n", [s(RHS_Cast), s(ArgName)],
>  			AssignFromArgName) },
> -		{ string__format("\t%s\n", [s(LHS_Cast)], AssignTo) },
> +		{ string__format("\t%s ", [s(LHS_Cast)], AssignTo) },
>  		{ AssignOutput = [
>  			raw_target_code(AssignTo),
>  			target_code_output(ArgLval),

Could you explain why that patch is needed?

I think that change will break things when --line-numbers is enabled,
since it fails to abide by the invariant for that data structure
documented in mlds.m that the string in a `raw_target_code'
must end in a newline.

> Index: runtime/Mmakefile
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
> retrieving revision 1.62
> diff -u -r1.62 Mmakefile
> --- runtime/Mmakefile	2000/08/17 05:31:09	1.62
> +++ runtime/Mmakefile	2000/08/21 08:43:12
> @@ -69,6 +69,7 @@
>  			mercury_reg_workarounds.h	\
>  			mercury_regorder.h	\
>  			mercury_regs.h		\
> +			mercury_semaphore.h	\
>  			mercury_signal.h	\
>  			mercury_std.h		\
>  			mercury_stack_layout.h	\

That change might make sense if there was a mercury_semaphore.h,
but currently there's not... perhaps adding a mercury_semaphore.h
should have been part of your patch?

> +++ runtime/mercury_wrapper.c	2000/08/21 08:43:17
> @@ -1329,9 +1329,12 @@
>  
>  	if (MR_profiling) MR_prof_finish();
>  
> -#ifdef	MR_THREAD_SAFE
> +#ifndef MR_HIGHLEVEL_CODE
> +  #ifdef MR_THREAD_SAFE
> +	/* XXX look into this */
>  	MR_exit_now = TRUE;
>  	pthread_cond_broadcast(MR_runqueue_cond);
> +  #endif
>  #endif
>  
>  	terminate_engine();
> 

That patch looks quite correct to me; with MR_HIGHLEVEL_CODE, there is no
distinction between Mercury threads (a.k.a. "contexts") and Posix
threads, no run queue in the Mercury runtime, no Posix threads waiting
around to run Mercury threads and hence no need to signal to these Posix
threads to exit at this point.  So, if the XXX comment was there because
you weren't sure if doing nothing was the right thing to do in the
MR_HIGHLEVEL_CODE case, then you can delete it.  If it was there for
some other reason, then maybe you could elaborate on that...

Cheers,
	Fergus.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list