*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* This file is for inline functions. On platforms that don't support
#include "libguile/pairs.h"
#include "libguile/gc.h"
#include "libguile/threads.h"
+#include "libguile/unif.h"
SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr);
SCM_API SCM scm_double_cell (scm_t_bits car, scm_t_bits cbr,
scm_t_bits ccr, scm_t_bits cdr);
+SCM_API SCM scm_array_handle_ref (scm_t_array_handle *h, ssize_t pos);
+SCM_API void scm_array_handle_set (scm_t_array_handle *h, ssize_t pos, SCM val);
#if defined SCM_C_INLINE || defined SCM_INLINE_C_INCLUDING_INLINE_H
scm_cell (scm_t_bits car, scm_t_bits cdr)
{
SCM z;
- /* We retrieve the SCM pointer only once since the call to
- SCM_FREELIST_LOC will be slightly expensive when we support
- preemptive multithreading. SCM_FREELIST_LOC will then retrieve
- the thread specific freelist.
-
- Until then, SCM_FREELIST_DOC expands to (&scm_i_freelist) and the
- following code will compile to the same as if we had worked
- directly on the scm_i_freelist variable.
- */
SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist);
- if (scm_gc_running_p)
- {
- abort();
- }
-
if (scm_is_null (*freelist))
z = scm_gc_for_newcell (&scm_i_master_freelist, freelist);
else
/* Initialize the type slot last so that the cell is ignored by the
GC until it is completely initialized. This is only relevant
- when the GC can actually run during this code, which it can't for
- cooperating threads, but it might be important when we get true
- preemptive threads.
+ when the GC can actually run during this code, which it can't
+ since the GC only runs when all other threads are stopped.
*/
SCM_GC_SET_CELL_WORD (z, 1, cdr);
SCM_GC_SET_CELL_WORD (z, 0, car);
-#if 0 /*fixme* Hmm... let's consider this later. */
-#if !defined(SCM_USE_COOP_THREADS) && !defined(SCM_USE_NULL_THREADS) && !defined(SCM_USE_COPT_THREADS)
- /* When we are using preemtive threads, we might need to make
- sure that the initial values for the slots are protected until
- the cell is completely initialized.
- */
-#error review me
- scm_remember_upto_here_1 (SCM_PACK (cdr));
-#endif
-#endif
-
#if (SCM_DEBUG_CELL_ACCESSES == 1)
if (scm_expensive_debug_cell_accesses_p )
scm_i_expensive_validation_check (z);
SCM z;
SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist2);
- if (scm_gc_running_p)
- {
- abort();
- }
-
if (scm_is_null (*freelist))
z = scm_gc_for_newcell (&scm_i_master_freelist2, freelist);
else
/* Initialize the type slot last so that the cell is ignored by the
GC until it is completely initialized. This is only relevant
- when the GC can actually run during this code, which it can't for
- cooperating threads, but it might be important when we get true
- preemptive threads.
+ when the GC can actually run during this code, which it can't
+ since the GC only runs when all other threads are stopped.
*/
SCM_GC_SET_CELL_WORD (z, 1, cbr);
SCM_GC_SET_CELL_WORD (z, 2, ccr);
SCM_GC_SET_CELL_WORD (z, 3, cdr);
SCM_GC_SET_CELL_WORD (z, 0, car);
-#if 0 /*fixme* Hmm... let's consider this later. */
-#if !defined(SCM_USE_COOP_THREADS) && !defined(SCM_USE_NULL_THREADS) && !defined(SCM_USE_COPT_THREADS)
- /* When we are using non-cooperating threads, we might need to make
- sure that the initial values for the slots are protected until
- the cell is completely initialized.
- */
-#error review me
- scm_remember_upto_here_3 (SCM_PACK (cbr), SCM_PACK (ccr), SCM_PACK (cdr));
-#endif
-#endif
-
-
#if (SCM_DEBUG_CELL_ACCESSES == 1)
if (scm_debug_cell_accesses_p)
{
reordering.
*/
#ifdef __GNUC__
- asm volatile ("" : : : "memory");
+ __asm__ volatile ("" : : : "memory");
#else
/* portable version, just in case any other compiler does the same
thing. */
return z;
}
+#if defined SCM_C_INLINE && ! defined SCM_INLINE_C_INCLUDING_INLINE_H
+/* definitely inlining */
+#ifdef __GNUC__
+extern
+#else
+static
+#endif
+SCM_C_INLINE
+#endif
+SCM
+scm_array_handle_ref (scm_t_array_handle *h, ssize_t p)
+{
+ return h->ref (h, p);
+}
+#if defined SCM_C_INLINE && ! defined SCM_INLINE_C_INCLUDING_INLINE_H
+/* definitely inlining */
+#ifdef __GNUC__
+extern
+#else
+static
+#endif
+SCM_C_INLINE
+#endif
+void
+scm_array_handle_set (scm_t_array_handle *h, ssize_t p, SCM v)
+{
+ h->set (h, p, v);
+}
#endif
#endif