1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
Commit graph

4452 commits

Author SHA1 Message Date
Ian Price
d4ef33f6cf Add assignment js-type to (language javascript)
* module/language/javascript.scm
  (assign): new js-type
  (print-exp, unparse-js): Handle case.
* module/language/javascript/simplify.scm (flatten-blocks):  Handle case.
2017-08-27 22:18:40 +01:00
Ian Price
c5fa12f344 Implement variable-bound? builtin
* module/language/js-il/runtime.js(variable-bound?): Implement builtin
2017-08-17 00:06:12 +01:00
Ian Price
b84797947d pop-fluid uses field of frame not fluid
* module/language/js-il/runtime.js(pop-fluid): Fix primitive.
2017-08-17 00:06:12 +01:00
Ian Price
7e5d9d945e Argument to make-fluid is optional
* module/language/js-il/runtime.js(make-fluid): Supply default argument
2017-08-17 00:06:11 +01:00
Ian Price
fd2445fcf4 *features* is an empty list
* module/language/js-il/runtime.js(*features*): Stop stubbing
2017-08-17 00:06:11 +01:00
Ian Price
8321baee15 Implement list builtins
* module/language/js-il/runtime.js
  (cons, memq, member, delete!): Implement builtins
2017-08-17 00:06:11 +01:00
Ian Price
7ee8973df5 Implement Hook Builtins
* module/language/js-il/runtime.js:
  (scheme.Hook): new constructor
  (make-hook, run-hook): Implement builtins.
2017-08-17 00:06:11 +01:00
Ian Price
84aa3697cc Search for variables in imports.
* module/language/js-il/runtime.js:
  (scm_module_variable): Look in imports if not in obarray.
  (module_imported_variable): New procedure.
  (scm_module_index_obarray, scm_module_index_uses,
  scm_module_index_import_obarray): New variables.
2017-08-16 21:34:10 +01:00
Ian Price
d3dea512c9 Separate public / private module lookups
* module/language/js-il/runtime.js:
  (scm_public_variable, scm_module_public_interface,
  module_public_interface_var, scm_post_boot_init_modules):
  Implement Public Variable Lookup
  (scm_private_lookup, scm_private_variable): Implement Private Lookup
2017-08-16 21:30:28 +01:00
Ian Price
17e48e8641 scheme.HashTable uses ES6 Map objects
* module/language/js-il/runtime.js:
  (scheme.HashTable): Change object interface.
  (cached-module-box): Update primitive.
  (scm_module_ensure_local_variable, def_guile_val): Update helpers
  (scm_hash): Remove helper.
  (make-weak-key-hash-table, hash-clear!, hashq-remove! hashq-ref,
  hashq-set!, hash-for-each): Update builtins.
  (make-weak-value-hash-table, hash-map->list): New builtins.
2017-08-16 20:34:51 +01:00
Ian Price
e57f9bc06a Reimplement JS module system primitives.
* module/language/js-il/runtime.js
  (scm_hash, scheme.HashTable): moved for bootstrapping purposes.

  (define!, cached-toplevel-box, cached-module-box, current-module,
  resolve): Reimplement primitives.

  (define!, module-local-variable, module-variable,
  %get-pre-modules-obarray, set-current-module): Reimplement builtin
  procedures.

  (make-undefined-variable): New builtin procedure.

  (scm_pre_modules_obarray, the_root_module, scm_public_lookup,
  scm_public_variable, scm_private_lookup, scm_current_module,
  scm_lookup, scm_module_ensure_local_variable, scm_module_variable,
  scm_module_define, module_system_is_booted,
  module_make_local_var_x_var, the_module, k_ensure,
  resolve_module_var, scm_post_boot_init_modules): New helper
  variables and procedures, designed to resemble C versions.

  (scheme.call): New helper procedure

  (def_guile0, def_guile_val): Reimplement helper procedure.
2017-08-14 16:52:28 +01:00
Ian Price
166def2da0 Implement unboxed integer primitives.
* module/language/js-il/runtime.js (u64-=, u64->scm): New primitives.
2017-08-14 16:31:20 +01:00
Ian Price
3f9bc2dbb0 Implement basic `equal?' implementation
* module/language/js-il/runtime.js (equal?): Remove primitive.
  Implement as builtin procedure. This version Only handles pairs.
2017-08-14 16:26:39 +01:00
Ian Price
024bd93b0d modules should be passed current continuation
* module/language/js-il/runtime.js (primitive-load-path): modules
  should be passed the current continuation.
2017-08-11 14:02:13 +01:00
Ian Price
56439a88ae Add `guild jslink' to bundle JS programs
* module/Makefile.am (SOURCES): Install runtime.js and jslink.scm
* module/language/js-il/compile-javascript.scm (compile-exp):
  Compilation units take a continuation to facilitate linking.
* module/scripts/jslink.scm: New script.
2017-08-09 16:06:50 +01:00
Ian Price
7438a192f8 Unwind prompt frames
* module/language/js-il/runtime.js(unwind): Unwind prompts.
2017-08-03 00:26:02 +01:00
Ian Price
2da7a82d9d struct-set! primitive returns no values
* module/language/js-il/runtime.js (struct-set!): Don't return a value.
2017-08-03 00:23:45 +01:00
Ian Price
70c25b1290 Make child structs applicable.
* module/language/js-il/runtime.js (scheme.Struct): When certain flags
  are set, child structs should be marked as applicable.
2017-08-03 00:22:03 +01:00
Ian Price
46fa3b2fb8 Implement misc built-ins
* module/language/js-il/runtime.js
  (scm->u64): New primitive
  (integer?, char=?, make-fluid, read-hash-extend, make-hook,
  simple-format, scm-error): Implement built-ins.
  (syntax-session-id, macroexpand, %exception-handler,
  print-exception, *features*, %load-hook, current-reader): Stubbed
  variables.
2017-08-03 00:20:50 +01:00
Ian Price
3c62ab8185 Implement module built-ins.
* module/language/js-il/runtime.js
  (variable?): New Primitive.
  (primitive-load-path, module-local-variable, module-variable,
  %get-pre-modules-obarray, set-current-module): Implement built-ins.
2017-08-03 00:06:10 +01:00
Ian Price
3d29f2874f Implement procedure built-ins.
* module/language/js-il/runtime.js
  (procedure?, set-procedure-property!, make-procedure-with-setter): Implement.
2017-08-03 00:03:46 +01:00
Ian Price
bfaf07091a Implement hashtable built-ins
* module/language/js-il/runtime.js
  (scheme.HashTable): New Constructor.
  (make-hash-table, hash-clear!, hashq-remove!, hashq-ref, hashq-set!,
  hash-for-each): Implement built-ins.
2017-08-03 00:02:45 +01:00
Ian Price
30cc1e0751 scm_struct_init skips hidden fields.
* module/language/js-il/runtime.js (scm_struct_init): skip 'h' fields.
2017-08-02 22:55:00 +01:00
Ian Price
30dc57cb04 define! primitive only takes one argument.
* module/language/js-il/runtime.js (define!): Ignore argument.
2017-08-02 22:46:13 +01:00
Ian Price
ebe9d00153 Implement struct built-ins.
* module/language/js-il/runtime.js
  (struct?): New primitive.
  (<applicable-struct-vtable>, record-type-vtable,
  set-struct-vtable-name!, make-struct): Implement built-ins.
2017-08-02 22:44:27 +01:00
Ian Price
2273eb4d06 Implement built-in string procedures.
* module/language/js-il/runtime.js
  (string-append): Extend to more than 2 arguments.
  (string-join): New procedure.
2017-08-02 21:17:22 +01:00
Ian Price
2adebea5d0 Implement built-in symbol procedures.
* module/language/js-il/runtime.js
  (symbol->string, gensym): New procedures.
2017-08-02 21:14:57 +01:00
Ian Price
5d49a5be18 Implement built-in syntax procedures.
* module/language/js-il/runtime.js
  (syntax?, make-syntax, syntax-expression, syntax-wrap,
  syntax-module): New procedures.
2017-08-02 21:12:47 +01:00
Ian Price
2a3c43a5a9 Implement builtin list procedures.
* module/language/js-il/runtime.js
  (make-list, length, list?, reverse, append, memq, member, delete!):
  New procedures
2017-08-02 21:11:02 +01:00
Ian Price
0b9b08a28d Implement immediate version of vector primitives.
* module/language/js-il/runtime.js
  (make-vector/immediate, vector-set!/immediate,
  vector-ref/immediate): New Primitives.
2017-08-02 21:03:11 +01:00
Ian Price
cf1ddd466b Implement structs in runtime.js
* module/language/js-il/runtime.js:
  (scheme.Struct): new type.
  (allocate-struct/immediate, struct-vtable, struct-set!, struct-ref,
  struct-set!/immediate, struct-ref/immediate): Implement primitives.
  (def_guile_val): New helper.
  (string=?, string-append): Implement string functions.
  (standard-vtable-fields, <standard-vtable>, vtable-index-layout,
  vtable-index-printer, vtable-offset-user, make-struct/no-tail,
  make-vtable, struct-vtable?): Implement struct functions.
2017-06-28 17:15:57 +01:00
Ian Price
479294fc05 Implement Winding & Unwinding
* module/language/js-il/runtime.js
  (wind, unwind): Implement.
  (callcc): Wind when invoking continuation.
2017-06-28 15:03:03 +01:00
Ian Price
ff7fff920d Add macro type in runtime.js
* module/language/js-il/runtime.js
  (scheme.Macro): Add type.
  (make-syntax-transformer): Add guile procedure.
2017-06-28 10:38:00 +01:00
Ian Price
b3c0fcdb25 Implement cached-module-box
* module/language/js-il/runtime.js (scheme): Add module_cache field.
  (scheme.primitives) Add cached-module-box primitive.
  (def_guile0) Convenience for adding to (guile) module cache.
2017-06-22 16:59:02 +01:00
Ian Price
2204fb64f6 Add more variables to no-values-primitives
* module/language/js-il/inlining.scm (no-values-primitives):
  Add primitives
2017-06-20 23:12:09 +01:00
Ian Price
536d94feb3 Compile Syntax Objects to Javascript
* module/language/js-il/compile-javascript.scm (compile-const):
  Handle the new syntax object struct.
* module/language/js-il/runtime.js(scheme.Syntax): Add Syntax Object type
2017-06-20 22:50:06 +01:00
Ian Price
c2589b5c48 Rebuild nested scopes for js continuations
* module/language/cps/compile-js.scm (compile-cont, compile-clause):
  Rebuild nested scopes for $kargs, using dominator information.
  (compile-fun, compile-clauses): Pass down dominator information.
2017-06-20 19:05:59 +01:00
Ian Price
936050c657 Add some primitives to runtime.js
* module/language/js-il/runtime.js(add/immediate, sub/immediate,
  load-u64, u64-=-scm, handle-interrupts): Add primitives.
2017-06-16 21:48:27 +01:00
Ian Price
e771241020 JS-IL inliner has different count-calls for different clauses
* module/language/js-il/inlining.scm(inline-single-calls): Factor into
  another function inline-clause, so that count-calls is only called on
  the clause.
2017-06-16 17:42:49 +01:00
Ian Price
723fc850f6 Add #:js-inline? and #:js-flatten? debugging options
* module/language/js-il/compile-javascript.scm (compile-javascript):
  Check for #:js-inline? and #:js-flatten?, and turn off
  inline-single-calls and flatten-blocks respectively.
2017-06-15 22:34:39 +01:00
Ian Price
602bfb559d Update primitives in no-values-primitives
* module/language/js-il/inlining.scm (no-values-primitives): Update.
2017-06-15 20:25:24 +01:00
Ian Price
8777c20e94 Handle multiple conts in a function body
* module/language/cps/compile-js.scm (compile-clause, compile-clauses):
  Extract all conts in the function body, and bind in clauses.
  (extract-and-compile-conts): New Procedure
2017-06-15 20:21:47 +01:00
Ian Price
0e4fb0920f compile-js uses the new cps representation
* module/language/cps/compile-js.scm: Rewrite to use cps
2017-06-14 23:07:40 +01:00
Ian Price
23f829b175 Fix build of (language cps compile-js)
* module/language/cps/compile-js.scm (compile-js): Use lower-cps
  from (language cps compile-bytecode) rather than optimize, which is no
  longer there.
2017-06-14 21:27:05 +01:00
Ian Price
1b36a76ea4 Merge branch 'stable-2.2' into compile-to-js-2017 2017-06-14 21:13:10 +01:00
Andy Wingo
1f560bc4b7 Remove support for legacy syntax objects.
* module/ice-9/psyntax.scm: Remove support for legacy syntax objects.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/deprecated.scm (allow-legacy-syntax-objects?): New
  deprecation.
* module/ice-9/boot-9.scm: Don't define allow-legacy-syntax-objects?.
* doc/ref/api-macros.texi: Remove documentation for
  allow-legacy-syntax-objects?.
2017-05-22 15:37:43 +02:00
Andy Wingo
b2c0e01bb4 Update effective version to 3.0
* GUILE-VERSION: Bump version to 2.3.0, and effective version to 3.0.
* .gitignore:
* README:
* doc/guile.1:
* doc/ref/api-evaluation.texi:
* doc/ref/api-options.texi:
* doc/ref/guile-invoke.texi:
* doc/ref/libguile-foreign-objects.texi:
* doc/ref/libguile-parallel.texi:
* doc/ref/srfi-modules.texi: Update to 3.0.
* libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION):
(SCM_OBJCODE_MINIMUM_MINOR_VERSION, SCM_OBJCODE_MINOR_VERSION): Bump
bytecode version for fallback path.
* libguile/loader.c: Update to avoid loading version 2.2 bytecode
files.
* meta/guile-3.0-uninstalled.pc.in:
* meta/guile-3.0.pc.in: Rename.
* module/system/vm/assembler.scm (*bytecode-major-version*):
(*bytecode-minor-version*): Write the new bytecode version.
2017-05-22 14:15:40 +02:00
Andy Wingo
c248ea10be Remove all deprecated code
* module/ice-9/debug.scm:
* module/ice-9/mapping.scm:
* module/ice-9/syncase.scm: Delete these deprecated files.
* module/Makefile.am: Remove deleted files.
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/backtrace.c:
* libguile/goops.c:
* libguile/numbers.c:
* libguile/socket.c:
* libguile/srfi-13.c:
* module/ice-9/deprecated.scm:
* module/ice-9/format.scm:
* module/oop/goops.scm:
* module/statprof.scm:
* module/texinfo/reflection.scm:
* module/web/client.scm:
* module/web/uri.scm: Remove deprecated code.
2017-05-22 13:36:42 +02:00
Andy Wingo
7095a536f3 web: add support for URI-reference
Based on a patch by Daniel Hartwig <mandyke@gmail.com>.

* NEWS: Update.
* doc/ref/web.texi (URIs): Fragments are properly part of a URI, so
  remove the incorrect note.  Add documentation on URI subtypes.
* module/web/uri.scm (uri-reference?): New base type predicate.
  (uri?, relative-ref?): Specific predicates.
  (validate-uri-reference): Strict validation.
  (validate-uri, validate-relative-ref): Specific validators.
  (build-uri-reference, build-relative-ref): New constructors.
  (string->uri-reference): Rename from string->uri.
  (string->uri, string->relative-ref): Specific constructors.
  (uri->string): Add #:include-fragment? keyword argument.
* module/web/http.scm (parse-request-uri): Use `build-uri-reference',
  and result is a URI-reference, not URI, object.  No longer infer an
  absent `uri-scheme' is `http'.
  (write-uri): Just use `uri->string'.
  (declare-uri-header!): Remove unused function.
  (declare-uri-reference-header!): Update.  Rename from
  `declare-relative-uri-header!'.
* test-suite/tests/web-uri.test ("build-uri-reference"):
  ("string->uri-reference"): Add.
  ("uri->string"): Also tests for relative-refs.
* test-suite/tests/web-http.test ("read-request-line"):
  ("write-request-line"): Update for no scheme in some URIs.
  ("entity headers", "request headers"): Content-location, Referer, and
  Location should also parse relative-URIs.
* test-suite/tests/web-request.test ("example-1"): Expect URI-reference
  with no scheme.
2017-05-21 13:42:29 +02:00
Andy Wingo
0c102b56e9 Fix reading of HTTPS responses that are smaller than port buffer
* module/web/client.scm (tls-wrap): Use get-bytevector-some instead of
  get-bytevector-n, to prevent Guile from attempting to read more bytes
  than are available.  Normally trying to read data on a shut-down
  socket is fine, but but gnutls issues an error if you attempt to read
  data from a shut-down socket, and that appears to be a security
  property.  Fixes HTTPS requests whose responses are smaller than the
  port buffer.
2017-04-28 13:38:41 +02:00