1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

7322 commits

Author SHA1 Message Date
Andy Wingo
4f1ce27a36 remove SCM_I_LLONG and SCM_I_ULLONG limit defines
* test-suite/standalone/test-num2integral.c (test_long_long):
  (test_ulong_long): Replace SCM_I_LLONG and SCM_I_ULLONG defines with
  their counterparts from limits.h.

* libguile/__scm.h: Remove SCM_I_LLONG and SCM_I_ULLONG limit defines.
2011-05-15 15:34:15 +02:00
Andy Wingo
871054f08e remove SCM_I_SIZE limits defines
* libguile/__scm.h: Remove defines for SCM_I_SIZE_MAX, SCM_I_SSIZE_MIN,
  and SCM_I_SSIZE_MAX, as there is no longer a scm_t_size / scm_size_t
  type.
* libguile/bytevectors.c (make_bytevector): Replace a use of
  SCM_I_SIZE_MAX with ((size_t) -1).
2011-05-15 15:34:15 +02:00
Andy Wingo
7b34720346 remove SCM_CHAR_CODE_LIMIT define
* libguile/__scm.h: Remove SCM_CHAR_CODE_LIMIT define.
* libguile/feature.c (scm_init_feature): Remove char-code-limit define,
  which was sure to be 256: a bogus value.
2011-05-15 15:34:15 +02:00
Andy Wingo
e0c332ed41 remove more unused __scm.h options
* libguile/__scm.h: Remove unused SCM_DEBUG_MARKING_API,
  SCM_DEBUG_INTERRUPTS, and SCM_DEBUG_DEBUGGING_SUPPORT defines.
2011-05-15 15:34:15 +02:00
Andy Wingo
b2f38e4f45 remove mention of GUILE_DEBUG_FREELIST
* libguile/__scm.h: Remove commented-out GUILE_DEBUG_FREELIST define.
* libguile/gen-scmconfig.c: Remove mention of GUILE_DEBUG_FREELIST.
2011-05-15 15:34:15 +02:00
Andy Wingo
b9b9a02804 remove #define STACK_CHECKING from __scm.h.
* libguile/__scm.h: Remove #define STACK_CHECKING and #undef
  NO_CEVAL_STACK_CHECKING.

* libguile/debug.c (scm_debug_options)
* libguile/init.c (scm_i_init_guile):
* libguile/stackchk.c (scm_report_stack_overflow):
* libguile/stackchk.h: Always enable stack checking.
2011-05-15 15:34:15 +02:00
Andy Wingo
2572c80673 remove SICP from __scm.h
* libguile/__scm.h: Remove #undef SICP.
* libguile/feature.c (scm_init_feature): Never add the sicp feature.
2011-05-15 15:34:15 +02:00
Andy Wingo
412ccea6c9 remove ENGNOT from __scm.h
* libguile/__scm.h: Remove #undef ENGNOT.
* libguile/numbers.c (idbl2str): Remove #ifdef ENGNOT sections.
2011-05-15 15:34:15 +02:00
Andy Wingo
80125469ef SCM is either a union or scm_t_bits
* libguile/tags.h: Elide the SCM_DEBUG_TYPING_STRICTNESS==1 case.
  Instead just have a flag, SCM_USING_PREHISTORIC_COMPILER, which if set
  uses what was SCM_DEBUG_TYPING_STRICTNESS==0.

* libguile/__scm.h: Remove SCM_DEBUG_TYPING_STRICTNESS block.
2011-05-15 15:34:15 +02:00
Andy Wingo
8787d7a170 SCM is a union
* libguile/tags.h (SCM): Change to simply be a union containing
  scm_t_bits.
  (SCM_PACK, SCM_UNPACK): Adapt accordingly.
2011-05-15 15:34:15 +02:00
Andy Wingo
931b4a6ddc Bump default typing strictness to 2.
* libguile/__scm.h (SCM_DEBUG_TYPING_STRICTNESS): Bump the default to
  2.
2011-05-13 15:46:21 +02:00
Andy Wingo
86fb1eb631 merge strictness branch from 2.0 2011-05-13 15:45:43 +02:00
Andy Wingo
2002f1f847 refactor do_thread_exit cleanup handler invocation
* libguile/threads.c (do_thread_exit): Redo cleanup handler call so as
  not to shove a SCM into a pointer.
2011-05-13 15:33:51 +02:00
Andy Wingo
4d40bea6c2 i18n error return type fix
* libguile/i18n.c (chr_to_case, str_to_case): Return #f in error case
  instead of 0.
2011-05-13 15:33:48 +02:00
Andy Wingo
a3069bace8 PTR2SCM and SCM2PTR in inline.h
* libguile/inline.h (scm_cell, scm_immutable_cell):
  (scm_double_cell, scm_immutable_double_cell):
  (scm_words): Be more consistent in use of PTR2SCM and SCM2PTR.
2011-05-13 15:31:15 +02:00
Andy Wingo
6ef437665c compile-time assertion in net_db uses constant expressions
* libguile/net_db.c: Use constant expressions for EAI_BADFLAGS and
  AI_ALL representations.
2011-05-13 15:31:13 +02:00
Andy Wingo
3429770095 ports.c uninitialized static SCM values are #f, not 0
* libguile/ports.c: (scm_current_input_port, scm_current_output_port)
  (scm_current_error_port): Use #f as the uninitialized value instead of
  0.
2011-05-13 15:31:09 +02:00
Andy Wingo
1b3daef033 scm_port_for_each fix
* libguile/ports.c (scm_port_for_each): Inline the call to
  scm_c_port_for_each, to avoid type errors.
2011-05-13 15:31:05 +02:00
Andy Wingo
6bb2c00a76 weak_bucket_assoc tweak
* libguile/hashtab.c (weak_bucket_assoc): Change assertion to be a check
  and abort, and so that only calls GC_is_visible if the check fails.
2011-05-13 15:31:02 +02:00
Andy Wingo
0b0ac740fc vm_make_boot_program initializer fix
* libguile/vm.c (vm_make_boot_program): Use #f as the "I don't have a
  program" value.
2011-05-13 15:29:30 +02:00
Andy Wingo
d3464bb6e2 correct use of SCM2PTR in SCM_I_REGISTER_DISAPPEARING_LINK forms
* libguile/hashtab.c (set_weak_cdr):
* libguile/vectors.c (scm_c_vector_set_x):
* libguile/weaks.c (scm_weak_car_pair, scm_weak_cdr_pair):
  (scm_doubly_weak_pair): Use SCM2PTR for the target of
  SCM_I_REGISTER_DISAPPEARING_LINK calls.
2011-05-13 15:29:26 +02:00
Andy Wingo
393baa8a44 scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etc
* libguile/deprecation.c (scm_issue_deprecation_warning)
* libguile/eval.c (CAPTURE_ENV):
* libguile/goops.c (make_dispatch_procedure, make_class_from_symbol):
  (create_smob_classes):
* libguile/guardians.c (finalize_guarded, scm_i_get_one_zombie):
* libguile/hashtab.c (scm_fixup_weak_alist, scm_internal_hash_fold):
* libguile/i18n.c (scm_nl_langinfo)
* libguile/load.c (scm_primitive_load)
* libguile/posix.c (scm_setrlimit)
* libguile/socket.c (scm_to_sockaddr):
* libguile/srcprop.c (scm_make_srcprops): Use scm_is_false / scm_is_true
  / scm_is_null instead of comparing against SCM_BOOL_F et al.
2011-05-13 15:28:41 +02:00
Andy Wingo
b2b33168b1 more care regarding SCM_PACK and SCM_UNPACK
* libguile/control.c (reify_partial_continuation):
* libguile/eval.c (RETURN_BOOT_CLOSURE):
* libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref)
  (scm_frame_local_set_x)
* libguile/frames.h (SCM_FRAME_SET_RETURN_ADDRESS):
  (SCM_FRAME_SET_MV_RETURN_ADDRESS, SCM_FRAME_SET_DYNAMIC_LINK):
* libguile/goops.c (scm_class_of, scm_primitive_generic_generic)
  (scm_c_extend_primitive_generic, compute_getters_n_setters)
  (scm_sys_initialize_object):
* libguile/guardians.c (finalize_guarded):
* libguile/list.c (SCM_I_CONS):
* libguile/macros.c (scm_i_make_primitive_macro)
  (scm_make_syntax_transformer):
* libguile/memoize.c (MAKMEMO, SCM_MAKE_MEMOIZER)
  (SCM_MAKE_REST_MEMOIZER):
* libguile/modules.c (scm_module_reverse_lookup)
* libguile/print.c (iprin1):
* libguile/promises.c (scm_make_promise)
* libguile/srcprop.c (scm_make_srcprops):
* libguile/vectors.c (scm_c_vector_ref):
* libguile/vm-engine.c (vm_engine)
* libguile/vm-i-scheme.c (REL, add1, sub1):
* libguile/vm-i-system.c (new_frame, call_cc)
* libguile/weaks.h (SCM_WEAK_PAIR_WORD_DELETED_P): Be more careful about
  SCM_PACK / SCM_UNPACK.
2011-05-13 15:28:08 +02:00
Andy Wingo
d223c3fcdd scm_is_eq for SCM vals, not == or !=
* libguile/bytevectors.c (scm_make_bytevector, STRING_TO_UTF)
  (UTF_TO_STRING):
* libguile/continuations.c (scm_i_check_continuation):
* libguile/expand.h (SCM_EXPANDED_P):
* libguile/fluids.c (scm_i_make_with_fluids):
* libguile/generalized-vectors.c (scm_make_generalized_vector):
* libguile/goops.c (SCM_GOOPS_UNBOUNDP, slot_definition_using_name):
  (scm_c_extend_primitive_generic, more_specificp, scm_make)
* libguile/i18n.c (SCM_VALIDATE_OPTIONAL_LOCALE_COPY):
  (scm_locale_string_to_integer)
* libguile/modules.c (resolve_duplicate_binding):
  (scm_module_reverse_lookup)
* libguile/posix.c (scm_to_resource):
* libguile/r6rs-ports.c (scm_put_bytevector):
* libguile/socket.c (scm_connect, scm_bind, scm_sendto
* libguile/stacks.c (find_prompt):
* libguile/variable.c (scm_variable_ref, scm_variable_bound_p):
* libguile/vm-engine.h (ASSERT_BOUND_VARIABLE, ASSERT_BOUND)
* libguile/vm-i-system.c (VARIABLE_BOUNDP, local_bound)
  (long_local_bound, fluid_ref): Use scm_is_eq to compare, not == / !=.
2011-05-13 13:49:32 +02:00
Andy Wingo
b2feee6bc0 deprecate scm_internal_dynamic_wind
* libguile/dynwind.c:
* libguile/dynwind.h:

* libguile/deprecated.h (scm_t_inner):
* libguile/deprecated.c (scm_internal_dynamic_wind): Deprecate, as the
  scm_dynwind API is better, and this API encourages users to stuff SCM
  values into pointers.
2011-05-13 13:49:30 +02:00
Andy Wingo
b5df9cda41 excise scm_internal_dynamic_wind from goops.c
* libguile/goops.c (go_to_hell, go_to_heaven, purgatory):
  (scm_change_object_class): Rewrite to use scm_dynwind_begin instead of
  scm_dynamic_wind.
2011-05-13 13:48:08 +02:00
Andy Wingo
c98ce8f599 async.c refactor
* libguile/async.c (increase_block, decrease_block): Write more
  clearly.
  (scm_dynwind_block_asyncs, scm_dynwind_unblock_asyncs): Move
  definitions up.
  (scm_call_with_blocked_asyncs, scm_c_call_with_blocked_asyncs)
  (scm_call_with_unblocked_asyncs, scm_c_call_with_unblocked_asyncs):
  Implement in terms of scm_dynwind_{un,}block_asyncs, so that we don't
  stuff SCM values into pointers.
2011-05-13 13:48:07 +02:00
Andy Wingo
2e16a342f2 fix type errors
* libguile/numbers.c (scm_logand): Fix a type error (comparing a SCM
  against an int, when we really wanted to compare the unpacked
  fixnum).

* libguile/ports.c (scm_i_set_conversion_strategy_x): Check
  scm_conversion_strategy_init, not scm_conversion_strategy.

* libguile/read.c (recsexpr): Fix loops to avoid strange test of SCM
  values.
2011-05-13 13:48:07 +02:00
Andy Wingo
210c0325d3 allow iflags to be constant expressions with typing-strictness==2
* libguile/tags.h (SCM_MAKE_ITAG8_BITS): New helper, produces a
  scm_t_bits instead of a SCM, because SCM_UNPACK is not a constant
  expression with SCM_DEBUG_TYPING_STRICTNESS==2.
  (SCM_MAKIFLAG_BITS): Remove SCM_MAKIFLAG, and replace with this, which
  returns bits.
  (SCM_BOOL_F_BITS, SCM_ELISP_NIL_BITS, SCM_EOL_BITS, SCM_BOOL_T_BITS):
  (SCM_UNSPECIFIED_BITS, SCM_UNDEFINED_BITS, SCM_EOF_VAL_BITS):
  (SCM_UNBOUND_BITS): New definitions.  Defined SCM_BOOL_F, etc in terms
  of them.
  (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0):
  (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_1):
  (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_2):
  (SCM_XXX_ANOTHER_LISP_FALSE_DONT_USE): Be bits instead of SCM values.
  (SCM_BITS_DIFFER_IN_EXACTLY_ONE_BIT_POSITION):
  (SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS): Rename from
  SCM_VALUES_DIFFER_..., and take unpacked bits as the args.

* libguile/boolean.c: Update verify block to use
  SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS et al.

* libguile/debug.c (scm_debug_opts):
* libguile/print.c (scm_print_opts):
* libguile/read.c (scm_read_opts): Use iflags bits for initializers.

* libguile/hash.c (scm_hasher): Use _BITS for iflags as case labels.

* libguile/pairs.c: Nil/null compile-time check uses
  SCM_ELISP_NIL_BITS.
2011-05-13 13:48:07 +02:00
Andy Wingo
544a29de14 fix static allocation with debug_typing_strictness==2
* libguile/tags.h (SCM): For SCM_DEBUG_TYPING_STRICTNESS==2, give the
  union a tag, and use C99 compound literals to construct the value.
  This allows SCM_PACK to be a constant expression.

* libguile/snarf.h: Allow SCM_SUPPORT_STATIC_ALLOCATION for
  SCM_DEBUG_TYPING_STRICTNESS==2.
  (SCM_IMMUTABLE_STRING): Properly parenthesize the string length.
  (SCM_STATIC_PROGRAM): Fix for SCM_DEBUG_TYPING_STRICTNESS==2.
2011-05-13 13:48:07 +02:00
Andy Wingo
fc7bd367ab remove all deprecated code
* libguile/async.c:
* libguile/async.h:
* libguile/debug.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/evalext.h:
* libguile/gc-malloc.c:
* libguile/gc.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/ports.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/read.c:
* libguile/socket.c:
* libguile/srfi-4.h:
* libguile/strings.c:
* libguile/strings.h:
* libguile/tags.h:
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm: Remove all deprecated code.  CPP defines
  that were not previously issuing warnings were changed so that their
  expansions would indicate the replacement forms to use,
  e.g. scm_sizet__GONE__REPLACE_WITH__size_t.

  The two exceptions were SCM_LISTN, which did not produce warnings
  before, and the string-filter argument order stuff.

  Drops the initial dirty memory usage of Guile down to 2.8 MB on my
  machine, from 4.4 MB.
2011-05-12 14:01:26 +02:00
Andy Wingo
b5070556c5 add missing SCM_DEPRECATED annotation
* libguile/deprecated.h: Use SCM_DEPRECATED instead of SCM_API for the
  asinh, acosh, atanh, and atan2 wrappers.
2011-05-12 13:37:57 +02:00
Andy Wingo
e690a3cbf2 Merge remote-tracking branch 'origin/stable-2.0' 2011-05-09 00:13:04 +02:00
Ludovic Courtès
012062a0d6 Fix small integer return value packing on big endian machines.
* libguile/foreign.c (pack): Add `return_value_p' parameter.  Update
  callers.
  When RETURN_VALUE_P is true, assume LOC points to an `ffi_arg', and
  cast its results to the relevant type.  This fixes packing of integer
  return values smaller than `int' on SPARC64 and PowerPC64.  Reported
  by Nelson H. F. Beebe <beebe@math.utah.edu>.
2011-05-08 17:24:24 +02:00
Ludovic Courtès
d7fcaec392 Make the definition of `scm_read_shebang' match its declaration.
* libguile/read.c (scm_read_shebang): Remove the `inline' keyword.
2011-05-08 17:24:24 +02:00
Andy Wingo
10483f9e64 fix `hash' for inf and nan
* libguile/hash.c (scm_hasher): Fix to work on inf and nan.
* test-suite/tests/hash.test ("hash"): Add tests.
2011-05-08 16:07:10 +02:00
Ludovic Courtès
7be1705dbd Fix `get_utf8_codepoint' to not consume valid starting bytes.
Thanks to Mark H. Weaver for pointing this out.

* libguile/ports.c (CONSUME_PEEKED_BYTE): New macro.
  (get_utf8_codepoint): New variable `pt'.  Use
  `scm_peek_byte_or_eof'/`CONSUME_PEEKED_BYTE' pairs instead of
  `scm_get_byte_or_eof'.

* test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42, #xe0 #xa0
  #x41 #x42, #xf0 #x88 #x88 #x88]: Fix to conform to Unicode 6.0.0.
  [#xe0 #x88 #x88]: Remove test.
  [#xf0 #x80 #x80 #x41]: New test.
2011-05-07 22:47:49 +02:00
Ludovic Courtès
452c5ad912 Add `scm_peek_byte_or_eof'.
* libguile/inline.h (scm_get_byte_or_eof): Add `SCM_UNLIKELY' for EOF.
  (scm_peek_byte_or_eof): New function.

* libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_peek_byte_or_eof'.
2011-05-07 22:47:49 +02:00
Andy Wingo
059a588fed bytevectors have internal parent field
* libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Bump, giving
  bytevectors another word: a parent pointer.  Will allow for
  sub-bytevectors and efficient mmap bindings.

* libguile/bytevectors.c (make_bytevector):
  (make_bytevector_from_buffer): Init parent to #f.
  (scm_c_take_bytevector, scm_c_take_typed_bytevector): Another
  argument, the parent, which gets set in the bytevector.

* libguile/foreign.c (scm_pointer_to_bytevector): Use the parent field
  instead of registering a weak reference from bytevector to foreign
  pointer.

* libguile/objcodes.c (scm_objcode_to_bytecode): Use the parent field to
  avoid copying the objcode.

* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS):
* libguile/strings.c (scm_from_stringn):
* libguile/vm.c (really_make_boot_program):
* libguile/r6rs-ports.c (scm_get_bytevector_some)
  (scm_get_bytevector_all, bytevector_output_port_procedure): Set the
  parent to #f.
2011-05-07 14:57:15 +02:00
Ludovic Courtès
7b292a9d34 Special-case UTF-8 ports to bypass `iconv' entirely.
* libguile/ports.c (update_port_lf): Handle EOF.
  (get_utf8_codepoint, get_iconv_codepoint): New functions.
  (get_codepoint): Use them.
  (scm_i_set_port_encoding_x): Don't open conversion descriptors when
  ENCODING is "UTF-8".

* libguile/print.c (display_string_as_utf8, display_string_using_iconv):
  New functions.
  (display_string): Use them.

* test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42]: Add a
  note that this is not the wrong behavior per Unicode 6.0.0.
2011-05-06 17:54:09 +02:00
Andy Wingo
a2a6c0e319 avoid tls gets when handling interrupts in the vm
* libguile/__scm.h (SCM_ASYNC_TICK_WITH_CODE): Redefine to take a
  scm_i_thread* as well.  OK to do because it's within a
  BUILDING_LIBGUILE block.

* libguile/vm-engine.c (vm_engine): Cache the scm_i_thread* instead of
  the dynstate, so we can use the thread for ticks.

* libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): Tick with the
  scm_i_thread* local var, to avoid excessive tls calls.

* libguile/vm-i-system.c: Fix dynstate users to use
  current_thread->dynamic_state.
2011-05-06 00:17:35 +02:00
Andy Wingo
a2230b653b map and for-each in scheme
* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead
  of C.  There are boot versions before `cond' is defined.
  (map-in-order): Define this alias here instead of in evalext.h.

* libguile/eval.c: Stub out the map and for-each definitions to just
  call into Scheme.

* libguile/evalext.c: Remove map-in-order definition.

* module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map.
  (map, for-each): Define implementations here, in Scheme, instead of in
  C.

* test-suite/tests/eval.test (exception:wrong-length, "map"): Update the
  expected exception for mapping over lists of different lengths.

* libguile/srfi-1.h:
* libguile/srfi-1.c: Remove map and for-each definitions.  Remove the
  bit that extended the core `map' primitive with another method: the
  right way to do that is with modules.
2011-05-05 23:07:37 +02:00
Andy Wingo
3b7f4ba37b scm_mem[qv] optimization
* libguile/list.c (scm_memq, scm_memv): Inline the tortoise/hare check
  that scm_ilength does, via SCM_VALIDATE_LIST, into the memq/memv
  bodies.  Avoids traversing these lists twice.
2011-05-05 23:07:37 +02:00
Andy Wingo
eae2438d2b VM tweaks
* libguile/vm-engine.c (VM_CHECK_OBJECT, VM_CHECK_FREE_VARIABLES): Set
  to 0 for both engines.  These are really internal debugging variables,
  which don't affect user-visible features, provided that the compiler
  is correct of course.
  (VM_CHECK_UNDERFLOW): New var, also off by default: whether to check
  for stack underflow when popping values.
  (vm_engine): Don't declare object_count if we are not checking object
  table accesses.

* libguile/vm-engine.h (CACHE_PROGRAM): Don't muck with object_count
  if we are not checking object table accesses.
  (CHECK_UNDERFLOW, PRE_CHECK_UNDERFLOW): Nop out if we are not checking
  underflow.
  (POP2, POP3): New macros which check for underflow before popping more
  than one value.

* libguile/vm-i-loader.c (load_array):
* libguile/vm-i-scheme.c (set_car, set_cdr, vector_set, slot_set)
  (BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET, BV_INT_SET)
  (BV_FLOAT_SET):
* libguile/vm-i-system.c (partial_cont_call, fix_closure, prompt)
  (fluid_set): Use POP2 / POP3.
  (local_set, long_local_set): Pop to locals instead of using values on
  the stack then dropping; allows for underflow to be checked before the
  value is accessed.
  (BR): Don't NULLSTACK or DROP after the operation.
  (br_if, br_if_not, br_if_eq, br_if_not_eq, br_if_null)
  (br_if_not_null): Pop to locals before doing the compare and jump.
2011-05-05 14:04:23 +02:00
Andy Wingo
9e775af3bf srfi-1 `member' in scheme, inlines to memq / memv in some cases
* libguile/srfi-1.c:
* libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme.

* module/srfi/srfi-1.scm (member): Implement here, with the inlining
  cases for eq? and eqv?.  Speeds up a compiled bootstrap of
  psyntax.scm, because lset-adjoin inlines to the memq case.
  (lset<=): Reindent.

  (lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass
  it through to `member', so we inline to memq / memv.  Use something
  closer to the reference implementations.
2011-05-05 12:59:07 +02:00
Andy Wingo
00b6ef23f3 measure time spent in gc
* libguile/gc.c (scm_gc_stats): Set the gc-time-taken entry to our
  recorded value.
  (start_gc_timer, accumulate_gc_timer, scm_init_gc): Arrange to record
  a conservative estimate of time spent in GC.
2011-05-04 20:19:52 +02:00
Andy Wingo
4a42658f6a scm_c_get_internal_run_time is more precise
* libguile/stime.h (SCM_TIME_UNITS_PER_SECOND): Redefine to point to a C
  variable instead of being a pure preprocessor thing.  This has the
  possibility to break existing compiled C extensions' interpretation of
  the internal-time-units-per-second, but hopefully there's no too much
  of that code out there, and in the worst case they can just
  recompile.  Scheme code will get it right without the need to
  recompile.

* libguile/stime.c (TIME_UNITS_PER_SECOND): New local define, and
  increase to nanosecond resolution if we are on a system in which this
  is useful and practical.
  (time_from_seconds_and_nanoseconds): New helper.
  (get_internal_real_time, get_internal_run_time): New global vars:
  function pointers.
  (get_internal_real_time_posix_timer):
  (get_internal_run_time_posix_timer):
  (get_internal_real_time_gettimeofday):
  (get_internal_run_time_times):
  (get_internal_real_time_fallback): Various implementations.
  (scm_get_internal_real_time): Return the get_internal_real_time()
  result.
  (scm_c_get_internal_run_time): Likewise.
  (scm_gettimeofday): No need for a critical section, and remove
  obsolete ftime block.
  (scm_init_stime): Init all of the new time bases, and decide on
  implementations of real time and run time accessors.
2011-05-04 20:19:11 +02:00
Andy Wingo
e3b8bce8f4 build support for detecting clock_gettime, with -lrt if needed
* acinclude.m4 (gl_CLOCK_TIME):
* configure.ac: Locally include gl_CLOCK_TIME.  To be fixed properly
  when gnulib updates their license to reflect the actual BSD state of
  things.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS):
  Add -lrt for clock_gettime, if needed.
* meta/guile-2.0-uninstalled.pc.in:
* meta/guile-2.0.pc.in: Likewise, in Libs.private.
2011-05-04 20:19:11 +02:00
Andy Wingo
f3c6a02c88 deprecate scm_struct_table
* libguile/goops.h:
* libguile/goops.c (scm_i_define_class_for_vtable): New internal helper,
  defines a class for a vtable, relying on the name slot being set
  correctly.
  (scm_class_of, create_struct_classes): Use the local vtable-to-class
  map instead of scm_struct_table.

* libguile/struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME)
  (SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS, scm_struct_table)
  (scm_struct_create_handle): Deprecate these internals of the map
  between structs and classes.

* libguile/deprecated.h:
* libguile/deprecated.c (scm_struct_create_handle): Deprecated code over
  here now.
2011-05-01 23:01:14 +02:00
Andy Wingo
1d9c2e6271 disallow get-handle / create-handle! of weak hash tables
* libguile/hashtab.c (scm_hashq_get_handle, scm_hashq_create_handle_x)
  (scm_hashv_get_handle, scm_hashv_create_handle_x)
  (scm_hash_get_handle, scm_hash_create_handle_x)
  (scm_hashx_get_handle, scm_hashx_create_handle_x): Don't allow these
  functions to be called on weak hash tables, as we have no idea when
  the GC will null out fields of the handle, and set-cdr! won't register
  disappearing links, and set-car! would never work of course.
2011-05-01 23:01:14 +02:00