aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/icode
AgeCommit message (Collapse)Author
2015-04-15Raise more descriptive error messages for failed map operationsBjörn Gustavsson
According to EEP-43 for maps, a 'badmap' exception should be generated when an attempt is made to update non-map term such as: <<>>#{a=>42} That was not implemented in the OTP 17. José Valim suggested that we should take the opportunity to improve the errors coming from map operations: http://erlang.org/pipermail/erlang-questions/2015-February/083588.html This commit implement better errors from map operations similar to his suggestion. When a map update operation (Map#{...}) or a BIF that expects a map is given a non-map term, the exception will be: {badmap,Term} This kind of exception is similar to the {badfun,Term} exception from operations that expect a fun. When a map operation requires a key that is not present in a map, the following exception will be raised: {badkey,Key} José Valim suggested that the exception should be {badkey,Key,Map}. We decided not to do that because the map could potentially be huge and cause problems if the error propagated through links to other processes. For BIFs, it could be argued that the exceptions could be simply 'badmap' and 'badkey', because the bad map and bad key can be found in the argument list for the BIF in the stack backtrace. However, for the map update operation (Map#{...}), the bad map or bad key will not be included in the stack backtrace, so that information must be included in the exception reason itself. For consistency, the BIFs should raise the same exceptions as update operation. If more than one key is missing, it is undefined which of keys that will be reported in the {badkey,Key} exception.
2014-04-29Translate the put_map_assoc and put_map_exact BEAM instructions to ICodeErik Norgren
2014-04-29Translate the has_map_fields and get_map_elements BEAM instructions to ICodeKostis Sagonas
2014-03-28Add support for the compilation of the is_map/1 guard to native codeKostis Sagonas
Namely, extend the HiPE tagging scheme info, properly handle the translation of the (is_)map type test to Icode and RTL and support handling of the map() type in the type system. While at it, also performed some clean up of things that needed small fixes.
2014-03-28Add 'map' to the set of icode_type_test()sKostis Sagonas
2014-03-28Support the translation of the is_map BEAM instruction to IcodeKostis Sagonas
2014-02-26Introduce and use a hipe_icode:icode() typeKostis Sagonas
2014-02-26Substitude uses of lists:reverse(L1) ++ L2 with lists:reverse(L1, L2)Kostis Sagonas
2014-02-23Deprecate pre-defined built-in typesHans Bolinder
The types array(), dict(), digraph(), gb_set(), gb_tree(), queue(), set(), and tid() have been deprecated. They will be removed in OTP 18.0. Instead the types array:array(), dict:dict(), digraph:graph(), gb_set:set(), gb_tree:tree(), queue:queue(), sets:set(), and ets:tid() can be used. (Note: it has always been necessary to use ets:tid().) It is allowed in OTP 17.0 to locally re-define the types array(), dict(), and so on. New types array:array/1, dict:dict/2, gb_sets:set/1, gb_trees:tree/2, queue:queue/1, and sets:set/1 have been added.
2014-01-10hipe: Fix compilation with 'no_remove_comments'Johannes Weißl
To reproduce the error: $ echo '-module(hello).' > hello.erl $ erl 1> c(hello, [native,{hipe,[no_remove_comments]}]). [...] <HiPE (v 3.10.2.1)> Error: [hipe:834]: ERROR: {{case_clause, {icode_comment,call_ext_only}}, [{hipe_icode,successors,1, [{file,"hipe_icode.erl"}, {line,1444}]}, [...]
2013-06-12Merge branch 'maint'Björn-Egil Dahlberg
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-04-19Remove the "coding: utf-8" comment from all Erlang source filesHans Bolinder
2013-04-11Merge branch 'ks/hipe-cleanup-escaping/OTP-11031' into maintFredrik Gustafsson
* ks/hipe-cleanup-escaping/OTP-11031: Loosen the assumptions of code that handles escaping functions
2013-03-12Loosen the assumptions of code that handles escaping functionsKostis Sagonas
The HiPE compiler implicitly relied on the assumption that a function will never appear as both exported and also used as function closure. This was true because the BEAM compiler prior to R16B created module local anonymous functions for each closure. A proposed change to the BEAM compiler invalidates this invariant, so in order to accommodate for this change there needs to be a change of how the set of possibly escaping functions is computed. While doing this, the code was simplified by taking out a boolean() tag that indicated whether a function is a closure or exported and also slightly cleaned up the affected modules.
2013-03-10Take out 'constant' type test and unnecessary type declarationKostis Sagonas
2013-03-10Take out 'constant' type test from left over commentsKostis Sagonas
2013-03-10Enable more warningsKostis Sagonas
2013-03-10Use remote type instead of relying on hipe_icode.hrlKostis Sagonas
2013-02-25Fix bug related to the handling of is_number/1 by the range analysisKostis Sagonas
The following module produced erroneous results when compiled with HiPE: -module(a). -export([foo/1]). foo(X) when is_number(X) -> is_integer(X). Running: 1> c(a). 2> a:foo(0). true 3> hipe:c(a). 4> a:foo(0). false % *** WRONG *** The problem was that the 'number' case for the `hipe_icode:type_test/1` was going to the default case where the argument was determined as being something other than an integer. Thanks to Sebastian Egner and Johannes Weißl for bringing the bug into attention. Fixed on the day it was reported.
2013-01-09Prepare OTP files for Unicode as default encodingHans Bolinder
2012-08-31Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: lib/diameter/autoconf/vxworks/sed.general xcomp/README.md
2012-08-31Update copyright yearsBjörn-Egil Dahlberg
2012-08-28Merge branch 'maint'Fredrik Gustafsson
2012-08-24Changes in comments and minor code cleanupsKostis Sagonas
2012-08-24Fix a typo and strengthen some type declarationsKostis Sagonas
2012-08-24Remove unused importsKostis Sagonas
2012-06-08Merge branch 'maint'Lukas Larsson
* maint: Update to work with space in include path Update to work with whitespace in exec path
2012-06-05Update to work with whitespace in exec pathLukas Larsson
OTP-10106 OTP-10107
2012-03-30Merge branch 'maint'Björn-Egil Dahlberg
2012-03-30Update copyright yearsBjörn-Egil Dahlberg
2012-02-28Merge branch 'maint'Patrik Nyblom
2012-02-28Make hipe hipe-compiled w/ --enable-native-libsPatrik Nyblom
2012-02-09hipe,erts: Debug support for native call traceSverker Eriksson
2012-01-26HiPE: Remove support for is_constant/1Björn Gustavsson
2012-01-05hipe: Remove warnings of missing types in recordsBjörn-Egil Dahlberg
2011-12-09Update copyright yearsBjörn-Egil Dahlberg
2011-11-30Fix Dialyzer's warnings in HiPEStavros Aronis
2011-11-28hipe: Remove single function compilationBjörn Gustavsson
Compiling single functions (as opposed to whole modules) to native code complicates code management in HiPE. It would also vastly complicate whole-module optimizations, such as returning multiple return values instead of tuples within a module. As a first step, remove the external interface for the single compilation feature. In the future, there are many things that could be restructured and simplified.
2011-11-10Remove exec bit from: erl, hrl, xml, html, asn, gif, xpmRicardo Catalinas Jiménez
2011-09-20Merge branch 'dev' into majorHenrik Nord
Conflicts: erts/aclocal.m4 erts/include/internal/ethread_header_config.h.in
2011-09-05Fix bug with binary pattern matching of floats of variable sizePaul Guyot
Pattern matching of floats with variable size (<<F:S/float>>) did always fail. Judging from similar code for ints, this bug is simply a typo.
2011-08-16Include location information for line instructions in BEAM filesBjörn Gustavsson
2011-08-16compiler, emulator: Introduce the line/1 instructionBjörn Gustavsson
Introduce the line/1 instruction in the compiler and the BEAM virtual machine. It will not yet be generated by the compiler and will not actually carry any information.
2011-03-11Update copyright yearsBjörn-Egil Dahlberg
2011-03-04Merge branch 'ks/hipe-icode-range-fix' into devNiclas Axelsson
* ks/hipe-icode-range-fix: Cleanup specs Fix bug in the simplification of inexact comparisons Various cleanups and cosmetic changes OTP-9101
2011-02-14Cleanup specsKostis Sagonas
2011-02-14Fix bug in the simplification of inexact comparisonsKostis Sagonas
On 31/1/2011 Paul Guyot reported a bug in the native code compilation of inexact equality/inequality tests between floats and integers. The relevant test was: f(X) -> Y = X / 2, Y == 0. and hipe erroneously evaluated the calls f(0) and f(0.0) to 'false'. The culprit was in the simplification code of the Icode range analysis which used an erroneous test (lists:any/1 instead of lists:all/1).
2011-02-14Various cleanups and cosmetic changesKostis Sagonas
2011-02-03Fix translation of bs_add's fail labelsKostis Sagonas