🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Seth C. Goldstein Sat, 21 Nov 1992 05:55
gcc 2.3.1 bug with pointer to function in c++
#1462
Author: Seth C. Goldstein
Date: Sat, 21 Nov 1992 05:55
201 lines
7131 bytes
Machine:	sparc
Version:	gcc version 2.3.1
OS:		SunOS Release 4.1.2
problem:	Assertion fails for type definition.

gcc-2.3.1 -DCM5 -gstabs -I. -I/usr/cm5/local/include -I/usr/cm5/include  -Dpe_obj -DPE_CODE -o bin-cm5/threads.o -c threads.C
threads.h: In method `void  Portal<int>::put (int)':
In file included from threads.C:25:
threads.h:148: warning: type specifier omitted for parameter
cp-class.c:4011: failed assertion `TREE_CODE (TREE_VALUE (rhs)) == FUNCTION_DECL'
gcc-2.3.1: Internal compiler error: program cc1plus got fatal signal 6


threads.h (upto through 148) is:

/*                                  tab:4
 *
 * threads.h - macros and class definitions for c+f
 *
 * Copyright (c) 1992 by Seth Copen Goldstein and 
 * Regents of the University of California
 *
 * Permission to use, copy, modify, and distribute this
 * software and its documentation for any purpose and without
 * fee is hereby granted, provided that the above copyright
 * notice appear in all copies.  Copyright holder(s) make no
 * representation about the suitability of this software for
 * any purpose. It is provided "as is" without express or
 * implied warranty.
 *
 * Author:          Seth Copen Goldstein
 * Version:         26
 * Creation Date:   Thu Nov 19 21:49:42 1992
 * Filename:        threads.h
 * History:
 */

#ifndef _THREADS_H_
#define _THREADS_H_

#include "cm5.h"

#ifdef DEBUG
extern "C" void doDebugPrint(char *s, ...);

# define trace(x)       //printf("%3d: %-20.20s: %x\n", MYPROC, x, this)
# define debugMsg(x)    doDebugPrint x
#else
# define trace(x)
# define debugMsg(x)    
#endif

#define on(x)                   if (MYPROC == x)
#define portalFor(p,i)          Portal<int> p(this, &i)
#define forkReturn(v)           {result.put(v);return;}

#define suspend(x)                                                            \
        if (counter)                                                          \
        {                                                                     \
            restart = x;                                                      \
            return;                                                           \
        }                                                                     \
     case x:

#define startFrame()                                                          \
        switch (restart)                                                      \
        {                                                                     \
        case 0:

#define endFrame()                                                            \
            break;                                                            \
        default:                                                              \
            printf("entered %x with %d.  unknown.\n", this, restart);         \
        }
                                                                              
class Frame;

typedef int Codeptr;
typedef void (Frame::*Codeblock)(void);

class Frame
{
protected:
    
    // every function that can suspend inherits from this class and get
    // the next three instance variables. 
    
    Codeblock   cb;
    Frame       *next;
    Codeptr     restart;
    int         counter;        // only one counter per frame for this
                                // implemenation
    
    // the ready que and other globals every Frame uses
    
    static Frame *readyQ;
    static volatile int notDone;
    static Frame *currentFrame;
    static Processor nextProcessor;
    
public:
    inline                  Frame(void);
    inline                  Frame(Codeblock function, int count);
    inline                  Frame(Codeblock function);
    
    inline void             incrCount(void);
    inline void             post(void);
    inline void             run(void);
    inline void             enQ(void);
    inline void             Frame::forceEnQ(void);
    inline int              Frame::isIdle(void);
    inline void             Frame::becomeIdle(void);
    
    static Frame *          deQ(void);
    static void             printQ(void);
    static void             terminate(void);
    static void             initialize(void);
};

//  How many counters do you really need for a frame?
//  right now, I am going to try for one per frame and see how it
//  works.  If this is changed change the portal class.

#define PINLINE

template <class T>
class Portal
{
    Frame *frame;               // frame that *value resides in
    T *value;                   // the address that this portal is for
    Processor proc;             // the processor that frame resides on
    
public:
    Portal(){}
    inline Portal(Frame *f, T *v)
    {
        frame = f;
        value = v;
        proc = MYPROC;
    }
    
    inline Portal(Processor p, Frame *f, T *v)
    {
        frame = f;
        value = v;
        proc = p;
    }

    inline Frame *getFrame(void)    { return frame; }
    inline T *getDest(void)         { return value; }
    inline Processor getProc(void)  { return proc; }

    inline void         put(T v)
    {
        trace("put");
        if (proc == MYPROC)
        {
            *value = v;
            frame->post();
        }
        else
        {
            void (*foo)(Frame *, T *, Y) = &RemotePost;
            
            debugMsg(("posting to %d!%x(%x) with %d\n", proc, frame,
                      value, v));
            am_rpc3(proc, foo, frame, value, v);
        }
    }

    static void         remotepost(Frame *f,
                                   int *adr,
                                   T v);
};

//									tab:4
//
// threads.C - basic runtime sytstem for c+f
//
// Copyright (c) 1992 by Seth Copen Goldstein and 
// Regents of the University of California
//
// Permission to use, copy, modify, and distribute this
// software and its documentation for any purpose and without
// fee is hereby granted, provided that the above copyright
// notice appear in all copies.  Copyright holder(s) make no
// representation about the suitability of this software for
// any purpose. It is provided "as is" without express or
// implied warranty.
//
// Author: 			Seth Copen Goldstein
// Version:			29
// Creation Date:	Thu Nov 19 21:47:56 1992
// Filename:		threads.C
// History:
//
static char _version_string_[] = "\nVersion:1:threads.C\0\n";

#include <stdio.h>
#include "threads.h"
////////////////////////////////////// EOF
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads