🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.transputer
Article #1872

Simulating procedure call

#1872
From: droux
Date: Thu, 07 Jan 1993 16:27
47 lines
2646 bytes
I am currently writing an occam program that uses a mathematical 
library. The functions provided by this library typically gets 
two-dimensional open arrays and vectors of real number, as well 
as atomic types and channels. 

The calculations that are involved can get very large matrices 
using megabytes of memory. As the size of these matrices is not 
known at compile time, I have opted for a "dynamical" allocation 
method where a memory pool is shared among various data. With 
this method, a vector can be allocated as follows:

  allocate.memory(memory.pool, size, vector.ptr) -- alloc size words
  [] REAL64 vector RETYPES [memory.pool FROM vector.ptr FOR size * 2] :
  
A problem is that the same method does not work with more than one 
dimensions, as only one dimension can be omitted, for example:

  [][] REAL64 matrix RETYPES [memory....         -- allowed
  [100][] REAL64 matrix RETYPES [memory...       -- not allowed
  
To bypass this problem, a solution is to define a "flat" matrix, 
stored as a one dimensional vector. The index of the elements in 
this vector are then calculated using the known dimensions of the 
matrix. For example:
  
  [] REAL64 flat.matrix RETYPES [memory.pool FROM matrix.ptr FOR
                                 size * size * 2] :
				 
This matrix should be then given as parameter to the calculation 
routine. Unfortunately, due to the strong type checking of occam, 
this is not possible simply by calling the function with flat.matrix 
as argument. As I have seen in the Inmos manuals, a two dimensional 
array is passed to a procedure as three values: a pointer to the 
array, the first dimension and the second dimension of the array. 

My idea would be to simulate a call to the procedure by passing 
these three information. A possibilty to do this should be the use 
of the ASM construct to build the workspace containing the correct 
parameters and calling the function. Unfortunately, I have no 
experience writing Transputer assembler and I don't know how the 
arguments are passed to a procedure. Does anybody can tell me if 
this solution is realistic, and how I can simulate a such call ?

Nicolas Droux, droux@cs.isbiel.ch
Engineering College of Biel, Switzerland
Computer Science Dpt.
Technical Details
Message-ID: <1993Jan7.182711.1@hei.unige.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!news.unige.ch!hei.unige.ch!droux

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.transputer
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!news.unige.ch!hei.unige.ch!droux
From: droux@hei.unige.ch
Subject: Simulating procedure call
Message-ID: <1993Jan7.182711.1@hei.unige.ch>
Lines: 47
Sender: usenet@news.unige.ch
Organization: University of Geneva, Switzerland
Date: Thu, 7 Jan 1993 16:27:11 GMT