[m-rev.] For review: Java implementation of private_builtin library

James Goddard goddardjames at yahoo.com
Wed Jan 21 10:29:03 AEDT 2004


Estimated hours taken: 1
Branches: main

Implement some library procedures for the Java back-end.

library/private_builtin.m:
	Implement the following functions in Java:
		store_ticket/1
		reset_ticket_undo/1
		reset_ticket_commit/1
		reset_ticket_solve/1
		discard_ticket/1
		prune_ticket/1
		mark_ticket_stack/1
		prune_tickets_to/1
		gc_trace/1
		free_heap/1
		mark_hp/1
		restore_hp/1
		imp/0

Index: private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.132
diff -u -d -r1.132 private_builtin.m
--- private_builtin.m	1 Dec 2003 13:17:10 -0000	1.132
+++ private_builtin.m	20 Jan 2004 23:20:30 -0000
@@ -767,6 +767,64 @@
 #endif
 ").
 
+:- pragma foreign_proc("Java",
+	store_ticket(Ticket::out),
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+	Ticket = null;
+").
+
+:- pragma foreign_proc("Java",
+	reset_ticket_undo(_Ticket::in),
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+").
+
+:- pragma foreign_proc("Java",
+	reset_ticket_commit(_Ticket::in),
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+").
+
+:- pragma foreign_proc("Java",
+	reset_ticket_solve(_Ticket::in),
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+").
+
+:- pragma foreign_proc("Java",
+	discard_ticket,
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+").
+
+:- pragma foreign_proc("Java",
+	prune_ticket,
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+").
+
+:- pragma foreign_proc("Java",
+	mark_ticket_stack(TicketCounter::out),
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+	TicketCounter = null;
+").
+
+:- pragma foreign_proc("Java",
+	prune_tickets_to(_TicketCounter::in),
+	[will_not_call_mercury, thread_safe],
+"
+	/* XXX No trailing for the Java back-end, so take no action. */
+").
+
 trailed_nondet_pragma_foreign_code :-
 	Msg = string__append_list([
 		"Sorry, not implemented:\n",
@@ -915,6 +973,41 @@
 	/* We can't do heap reclamation on failure in the .NET back-end. */
 ").
 
+:- pragma foreign_proc("Java",
+	gc_trace(_Pointer::in),
+	[will_not_call_mercury, thread_safe],
+"
+	/*
+	** For the Java back-end, we use the Java garbage collector, so we
+	** take no action here.
+	*/
+").
+
+:- pragma foreign_proc("Java",
+	free_heap(_Val::di),
+	[will_not_call_mercury, promise_pure, thread_safe],
+"
+        /*
+        ** For the Java back-end, as for the .NET back-end, we don't define
+        ** our own heaps.  So take no action here.
+        */
+").
+
+:- pragma foreign_proc("Java",
+	mark_hp(SavedHeapPointer::out),
+	[will_not_call_mercury, thread_safe],
+"
+	/* We can't do heap reclamation on failure in the Java back-end. */
+	SavedHeapPointer = null;
+").
+
+:- pragma foreign_proc("Java",
+	restore_hp(_SavedHeapPointer::in),
+	[will_not_call_mercury, thread_safe],
+"
+	/* We can't do heap reclamation on failure in the Java back-end. */
+").
+
 reclaim_heap_nondet_pragma_foreign_code :-
 	Msg = string__append_list([
 		"Sorry, not implemented:\n",
@@ -1125,6 +1218,10 @@
 	[will_not_call_mercury, thread_safe],
 "").
 :- pragma foreign_proc(il,	
+	imp,
+	[will_not_call_mercury, thread_safe, max_stack_size(0)],
+"").
+:- pragma foreign_proc("Java",
 	imp,
 	[will_not_call_mercury, thread_safe, max_stack_size(0)],
 "").
--------------------------------------------------------------------------
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