🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Robert Collins Fri, 27 Oct 1989 21:37
inline blues
#556
Author: Robert Collins
Date: Fri, 27 Oct 1989 21:37
164 lines
3763 bytes
I am running on Sun4/330 machines, with SunOS 4.0.3.  Oct 17 version of g++.

The problem is that functions that I declare `inline' are not being
inlined.  Here is a pared down version of the kind of code I am dealing
with.  No warning (about not inlining) is issued.  G++ options are -O and
-S.

rob collins
rjc@cs.ucla.edu

------------------------------------------------------------------------------
extern "C" {
    typedef int CM_field_id_t;
    CM_field_id_t CM_allocate_heap_field(unsigned);
    void CM_deallocate_heap_field(CM_field_id_t);
    void CM_s_add_2_1L(CM_field_id_t d, CM_field_id_t s, unsigned l);
    void CM_s_add_3_3L(CM_field_id_t d, CM_field_id_t s1, CM_field_id_t s2,
		       unsigned dl, unsigned s1l, unsigned s2l);
};

class CM_int;

void CM_add(const CM_int& dest, const CM_int& source);

class CM_int {
  private:
    const CM_field_id_t the_field;
    const unsigned the_length;

  public:
    CM_int(unsigned l);
    ~CM_int(void);

    unsigned length(void) const;
    operator CM_field_id_t() const;
    void operator+=(const CM_int&);
};

inline CM_int::CM_int(unsigned l) : the_length(l),
    the_field(CM_allocate_heap_field(the_length))
{
}

inline CM_int::~CM_int(void)
{
    CM_deallocate_heap_field(the_field);
}

inline unsigned CM_int::length(void) const
{
    return the_length;
}

inline CM_int::operator CM_field_id_t() const
{
    return the_field;
}

inline void CM_int::operator+=(const CM_int& rhs)
{
    CM_add(*this, rhs);
}

inline void CM_add(const CM_int& dest, const CM_int& source)
{
    if (dest.length() == source.length()) {
	CM_s_add_2_1L(dest, source, dest.length());
    }
    else {
	CM_s_add_3_3L(dest, dest, source, dest.length(), dest.length(),
		      source.length());
    };
}

main()
{
    CM_int a(32), b(32);
    a += b;
    CM_int c(32), d(16);
    c += d;
}
------------------------------------------------------------------------------
gcc_compiled.:
.text
	.align 4
	.proc 1
_CM_add__FRC6CM_intT0:
	!#PROLOGUE# 0
	save %sp,-112,%sp
	!#PROLOGUE# 1
	mov %i0,%o2
	mov %i1,%o5
	ld [%o2+4],%o3
	ld [%o5+4],%o0
	cmp %o3,%o0
	bne L32
	nop
	ld [%o2],%o0
	ld [%o5],%o1
	call _CM_s_add_2_1L,0
	mov %o3,%o2
	b,a L31
L32:
	ld [%o2],%o1
	ld [%o2+4],%o4
	mov %o1,%o0
	ld [%o5],%o2
	mov %o4,%o3
	call _CM_s_add_3_3L,0
	ld [%o5+4],%o5
L31:
	ret
	restore
	.align 4
.global _main
	.proc 1
_main:
	!#PROLOGUE# 0
	save %sp,-144,%sp
	!#PROLOGUE# 1
	call ___main,0
	nop
	add %fp,-24,%l0
	mov 32,%o2
	st %o2,[%l0+4]
	call _CM_allocate_heap_field,0
	mov 32,%o0
	st %o0,[%l0]
	add %fp,-32,%l1
	mov 32,%o2
	st %o2,[%l1+4]
	call _CM_allocate_heap_field,0
	mov 32,%o0
	st %o0,[%l1]
	mov %l0,%o0
	call _CM_add__FRC6CM_intT0,0
	mov %l1,%o1
	add %fp,-40,%l2
	mov 32,%o2
	st %o2,[%l2+4]
	call _CM_allocate_heap_field,0
	mov 32,%o0
	st %o0,[%l2]
	add %fp,-48,%l3
	mov 16,%o2
	st %o2,[%l3+4]
	call _CM_allocate_heap_field,0
	mov 16,%o0
	st %o0,[%l3]
	mov %l2,%o0
	call _CM_add__FRC6CM_intT0,0
	mov %l3,%o1
	call _CM_deallocate_heap_field,0
	ld [%l3],%o0
	call _CM_deallocate_heap_field,0
	ld [%l2],%o0
	call _CM_deallocate_heap_field,0
	ld [%l1],%o0
	call _CM_deallocate_heap_field,0
	ld [%l0],%o0
	mov 0,%i0
	ret
	restore
------------------------------------------------------------------------------
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