From: Guillermo J. Rozas Date: Tue, 13 Aug 1991 18:23:38 +0000 (+0000) Subject: Change hppa_utility_table to be allocated dynamically rather than X-Git-Tag: 20090517-FFI~10371 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2358c08be521ce8cfa30e85632aeeeb2e51802f5;p=mit-scheme.git Change hppa_utility_table to be allocated dynamically rather than statically. --- diff --git a/v7/src/microcode/cmpauxmd/hppa.m4 b/v7/src/microcode/cmpauxmd/hppa.m4 index f7c711b98..23511af59 100644 --- a/v7/src/microcode/cmpauxmd/hppa.m4 +++ b/v7/src/microcode/cmpauxmd/hppa.m4 @@ -1,6 +1,6 @@ changecom(`;');;; -*-Midas-*- ;;; -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpauxmd/hppa.m4,v 1.17 1991/08/13 06:46:08 jinx Exp $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpauxmd/hppa.m4,v 1.18 1991/08/13 18:23:38 jinx Exp $ ;;; ;;; Copyright (c) 1989-91 Massachusetts Institute of Technology ;;; @@ -181,9 +181,9 @@ trampoline_to_interface scheme_to_interface STW 2,8(0,4) ; Move val to interpreter reg ADDIL L'hppa_utility_table-$global$,27 - LDO R'hppa_utility_table-$global$(1),29 - LDWX,S 28(0,29),29 ; Find handler + LDW R'hppa_utility_table-$global$(1),29 ADDIL L'Ext_Stack_Pointer-$global$,27 + LDWX,S 28(0,29),29 ; Find handler STW 22,R'Ext_Stack_Pointer-$global$(1) ; Update stack pointer ADDIL L'Free-$global$,27 STW 21,R'Free-$global$(1) ; Update free diff --git a/v7/src/microcode/cmpintmd/hppa.h b/v7/src/microcode/cmpintmd/hppa.h index fa4ce9cff..f2b74f8a6 100644 --- a/v7/src/microcode/cmpintmd/hppa.h +++ b/v7/src/microcode/cmpintmd/hppa.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/hppa.h,v 1.23 1991/08/13 06:45:50 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/hppa.h,v 1.24 1991/08/13 18:23:23 jinx Exp $ Copyright (c) 1989-1991 Massachusetts Institute of Technology @@ -698,12 +698,6 @@ do { \ #ifdef IN_CMPINT_C -#define ASM_RESET_HOOK() \ -do { \ - hppa_reset_hook (((sizeof (utility_table)) / (sizeof (void *))), \ - &utility_table[0]); \ -} while (0) - long DEFUN (assemble_17, (inst), @@ -722,38 +716,24 @@ DEFUN (assemble_17, #include -/* This loads the cache information structure for use by flush_i_cache, - sets the floating point flags correctly, and accommodates the c - function pointer closure format problems for utilities for HP-UX >= 8.0 . - */ - -#define HPPA_TABLE_LENGTH 100 - -extern void *hppa_utility_table[]; -void *hppa_utility_table[HPPA_TABLE_LENGTH]; - -void -DEFUN (hppa_reset_hook, - (table_length, utility_table), +void ** +DEFUN (transform_procedure_table, + (table_length, old_table), long table_length AND - void **utility_table) + void **old_table) { + void **new_table; long counter; - extern void interface_initialize (); - void **hppa_table; - flush_i_cache_initialize (); - interface_initialize (); - - if (table_length > HPPA_TABLE_LENGTH) + new_table = ((void **) (malloc (table_length * (sizeof (void *))))); + if (new_table == ((void **) NULL)) { fprintf (stderr, - "hppa_reset_hook: HPPA_TABLE_LENGTH (%d) < %d\n", - HPPA_TABLE_LENGTH, table_length); + "transform_procedure_table: malloc (%d) failed.\n", + (table_length * (sizeof (void *)))); exit (1); } - hppa_table = &hppa_utility_table[0]; for (counter = 0; counter < table_length; counter++) { /* Test for HP-UX >= 8.0 */ @@ -762,18 +742,52 @@ DEFUN (hppa_reset_hook, char *C_closure, *blp; long offset; - C_closure = ((char *) utility_table[counter]); + C_closure = ((char *) (old_table[counter])); blp = (* ((char **) (C_closure - 2))); blp = ((char *) (((unsigned long) blp) & ~3)); offset = (assemble_17 (* ((union ble_inst *) blp))); - hppa_table[counter] = ((void *) ((blp + 8) + offset)); + new_table[counter] = ((void *) ((blp + 8) + offset)); #else - hppa_table[counter] = ((void *) utility_table[counter]); + new_table[counter] = ((void *) old_table[counter]); #endif } + return (new_table); +} + + +/* This loads the cache information structure for use by flush_i_cache, + sets the floating point flags correctly, and accommodates the c + function pointer closure format problems for utilities for HP-UX >= 8.0 . + */ + +extern void **hppa_utility_table; +void **hppa_utility_table; + +void +DEFUN (hppa_reset_hook, + (table_length, utility_table), + long table_length AND + void **utility_table) +{ + extern void interface_initialize (); + + flush_i_cache_initialize (); + interface_initialize (); + /* This can be done with the primitive table as well if we add + assembly-language primitive invocation code. + */ + hppa_utility_table = + (transform_procedure_table (table_length, utility_table)); + return; } +#define ASM_RESET_HOOK() \ +do { \ + hppa_reset_hook (((sizeof (utility_table)) / (sizeof (void *))), \ + &utility_table[0]); \ +} while (0) + #endif /* IN_CMPINT_C */ /* Derived parameters and macros. diff --git a/v8/src/microcode/cmpauxmd/hppa.m4 b/v8/src/microcode/cmpauxmd/hppa.m4 index 78339528c..ddf3cf532 100644 --- a/v8/src/microcode/cmpauxmd/hppa.m4 +++ b/v8/src/microcode/cmpauxmd/hppa.m4 @@ -1,6 +1,6 @@ changecom(`;');;; -*-Midas-*- ;;; -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpauxmd/hppa.m4,v 1.17 1991/08/13 06:46:08 jinx Exp $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpauxmd/hppa.m4,v 1.18 1991/08/13 18:23:38 jinx Exp $ ;;; ;;; Copyright (c) 1989-91 Massachusetts Institute of Technology ;;; @@ -181,9 +181,9 @@ trampoline_to_interface scheme_to_interface STW 2,8(0,4) ; Move val to interpreter reg ADDIL L'hppa_utility_table-$global$,27 - LDO R'hppa_utility_table-$global$(1),29 - LDWX,S 28(0,29),29 ; Find handler + LDW R'hppa_utility_table-$global$(1),29 ADDIL L'Ext_Stack_Pointer-$global$,27 + LDWX,S 28(0,29),29 ; Find handler STW 22,R'Ext_Stack_Pointer-$global$(1) ; Update stack pointer ADDIL L'Free-$global$,27 STW 21,R'Free-$global$(1) ; Update free diff --git a/v8/src/microcode/cmpintmd/hppa.h b/v8/src/microcode/cmpintmd/hppa.h index 1eb66475c..23778d19f 100644 --- a/v8/src/microcode/cmpintmd/hppa.h +++ b/v8/src/microcode/cmpintmd/hppa.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpintmd/hppa.h,v 1.23 1991/08/13 06:45:50 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpintmd/hppa.h,v 1.24 1991/08/13 18:23:23 jinx Exp $ Copyright (c) 1989-1991 Massachusetts Institute of Technology @@ -698,12 +698,6 @@ do { \ #ifdef IN_CMPINT_C -#define ASM_RESET_HOOK() \ -do { \ - hppa_reset_hook (((sizeof (utility_table)) / (sizeof (void *))), \ - &utility_table[0]); \ -} while (0) - long DEFUN (assemble_17, (inst), @@ -722,38 +716,24 @@ DEFUN (assemble_17, #include -/* This loads the cache information structure for use by flush_i_cache, - sets the floating point flags correctly, and accommodates the c - function pointer closure format problems for utilities for HP-UX >= 8.0 . - */ - -#define HPPA_TABLE_LENGTH 100 - -extern void *hppa_utility_table[]; -void *hppa_utility_table[HPPA_TABLE_LENGTH]; - -void -DEFUN (hppa_reset_hook, - (table_length, utility_table), +void ** +DEFUN (transform_procedure_table, + (table_length, old_table), long table_length AND - void **utility_table) + void **old_table) { + void **new_table; long counter; - extern void interface_initialize (); - void **hppa_table; - flush_i_cache_initialize (); - interface_initialize (); - - if (table_length > HPPA_TABLE_LENGTH) + new_table = ((void **) (malloc (table_length * (sizeof (void *))))); + if (new_table == ((void **) NULL)) { fprintf (stderr, - "hppa_reset_hook: HPPA_TABLE_LENGTH (%d) < %d\n", - HPPA_TABLE_LENGTH, table_length); + "transform_procedure_table: malloc (%d) failed.\n", + (table_length * (sizeof (void *)))); exit (1); } - hppa_table = &hppa_utility_table[0]; for (counter = 0; counter < table_length; counter++) { /* Test for HP-UX >= 8.0 */ @@ -762,18 +742,52 @@ DEFUN (hppa_reset_hook, char *C_closure, *blp; long offset; - C_closure = ((char *) utility_table[counter]); + C_closure = ((char *) (old_table[counter])); blp = (* ((char **) (C_closure - 2))); blp = ((char *) (((unsigned long) blp) & ~3)); offset = (assemble_17 (* ((union ble_inst *) blp))); - hppa_table[counter] = ((void *) ((blp + 8) + offset)); + new_table[counter] = ((void *) ((blp + 8) + offset)); #else - hppa_table[counter] = ((void *) utility_table[counter]); + new_table[counter] = ((void *) old_table[counter]); #endif } + return (new_table); +} + + +/* This loads the cache information structure for use by flush_i_cache, + sets the floating point flags correctly, and accommodates the c + function pointer closure format problems for utilities for HP-UX >= 8.0 . + */ + +extern void **hppa_utility_table; +void **hppa_utility_table; + +void +DEFUN (hppa_reset_hook, + (table_length, utility_table), + long table_length AND + void **utility_table) +{ + extern void interface_initialize (); + + flush_i_cache_initialize (); + interface_initialize (); + /* This can be done with the primitive table as well if we add + assembly-language primitive invocation code. + */ + hppa_utility_table = + (transform_procedure_table (table_length, utility_table)); + return; } +#define ASM_RESET_HOOK() \ +do { \ + hppa_reset_hook (((sizeof (utility_table)) / (sizeof (void *))), \ + &utility_table[0]); \ +} while (0) + #endif /* IN_CMPINT_C */ /* Derived parameters and macros.