aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-10-07 16:13:55 +0200
committerSverker Eriksson <[email protected]>2016-10-14 14:37:20 +0200
commitdeed6619dee9db9c0347b25987f3a91d51424079 (patch)
treec756c07aec4406d2213d3247bcb57d04d589826b /erts
parent6cd1469d0c8f9af602332b20772134c1241f6429 (diff)
downloadotp-deed6619dee9db9c0347b25987f3a91d51424079.tar.gz
otp-deed6619dee9db9c0347b25987f3a91d51424079.tar.bz2
otp-deed6619dee9db9c0347b25987f3a91d51424079.zip
erts: Let code:make_stub_module raise 'notsup'
if hipe is disabled. Makes the code simpler to just ifdef away a lot of hipe stuff.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/beam_bif_load.c10
-rw-r--r--erts/emulator/beam/beam_load.c29
2 files changed, 16 insertions, 23 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index f5d1ca7e54..0a4d89d51b 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -149,6 +149,9 @@ BIF_RETTYPE code_is_module_native_1(BIF_ALIST_1)
BIF_RETTYPE code_make_stub_module_3(BIF_ALIST_3)
{
+#if !defined(HIPE)
+ BIF_ERROR(BIF_P, EXC_NOTSUP);
+#else
Module* modp;
Eterm res, mod;
@@ -181,11 +184,9 @@ BIF_RETTYPE code_make_stub_module_3(BIF_ALIST_3)
if (res == mod) {
erts_end_staging_code_ix();
erts_commit_staging_code_ix();
-#ifdef HIPE
if (!modp)
modp = erts_get_module(mod, erts_active_code_ix());
hipe_redirect_to_module(modp);
-#endif
}
else {
erts_abort_staging_code_ix();
@@ -194,6 +195,7 @@ BIF_RETTYPE code_make_stub_module_3(BIF_ALIST_3)
erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
erts_release_code_write_permission();
return res;
+#endif
}
BIF_RETTYPE
@@ -1069,9 +1071,11 @@ check_process_code(Process* rp, Module* modp, int *redsp, int fcalls)
BeamInstr* start;
char* mod_start;
Uint mod_size;
+ Eterm* sp;
+#ifdef HIPE
void *nat_start = NULL;
Uint nat_size = 0;
- Eterm* sp;
+#endif
*redsp += 1;
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 813788f66c..4833bcc6e9 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -481,10 +481,12 @@ static void free_loader_state(Binary* magic);
static ErlHeapFragment* new_literal_fragment(Uint size);
static void free_literal_fragment(ErlHeapFragment*);
static void loader_state_dtor(Binary* magic);
+#ifdef HIPE
static Eterm stub_insert_new_code(Process *c_p, ErtsProcLocks c_p_locks,
Eterm group_leader, Eterm module,
BeamCodeHeader* code_hdr, Uint size,
HipeModule *hipe_code);
+#endif
static int init_iff_file(LoaderState* stp, byte* code, Uint size);
static int scan_iff_file(LoaderState* stp, Uint* chunk_types,
Uint num_types, Uint num_mandatory);
@@ -539,8 +541,6 @@ static Eterm compilation_info_for_module(Process* p, BeamCodeHeader*);
static Eterm md5_of_module(Process* p, BeamCodeHeader*);
static Eterm has_native(BeamCodeHeader*);
static Eterm native_addresses(Process* p, BeamCodeHeader*);
-int patch_funentries(Eterm Patchlist);
-int patch(Eterm Addresses, Uint fe);
static int safe_mul(UWord a, UWord b, UWord* resp);
static int must_swap_floats;
@@ -1098,6 +1098,7 @@ loader_state_dtor(Binary* magic)
ASSERT(stp->genop_blocks == 0);
}
+#ifdef HIPE
static Eterm
stub_insert_new_code(Process *c_p, ErtsProcLocks c_p_locks,
Eterm group_leader, Eterm module,
@@ -1125,11 +1126,9 @@ stub_insert_new_code(Process *c_p, ErtsProcLocks c_p_locks,
modp->curr.code_hdr = code_hdr;
modp->curr.code_length = size;
modp->curr.catches = BEAM_CATCHES_NIL; /* Will be filled in later. */
-#if defined(HIPE)
DBG_TRACE_MFA(make_atom(modp->module), 0, 0, "insert_new_code "
"first_hipe_ref = %p", hipe_code->first_hipe_ref);
modp->curr.hipe_code = hipe_code;
-#endif
/*
* Update ranges (used for finding a function from a PC value).
@@ -1138,6 +1137,7 @@ stub_insert_new_code(Process *c_p, ErtsProcLocks c_p_locks,
erts_update_ranges((BeamInstr*)modp->curr.code_hdr, size);
return NIL;
}
+#endif
static int
init_iff_file(LoaderState* stp, byte* code, Uint size)
@@ -5997,6 +5997,7 @@ code_module_md5_1(BIF_ALIST_1)
return res;
}
+#ifdef HIPE
#define WORDS_PER_FUNCTION 6
static BeamInstr*
@@ -6075,9 +6076,7 @@ stub_final_touch(LoaderState* stp, BeamInstr* fp)
Eterm mod = fp[2];
Eterm function = fp[3];
int arity = fp[4];
-#ifdef HIPE
Lambda* lp;
-#endif
if (is_bif(mod, function, arity)) {
fp[1] = 0;
@@ -6106,7 +6105,6 @@ stub_final_touch(LoaderState* stp, BeamInstr* fp)
* Search the lambda table to find out which.
*/
-#ifdef HIPE
n = stp->num_lambdas;
for (i = 0, lp = stp->lambdas; i < n; i++, lp++) {
ErlFunEntry* fe = stp->lambdas[i].fe;
@@ -6115,7 +6113,6 @@ stub_final_touch(LoaderState* stp, BeamInstr* fp)
fe->address = &(fp[5]);
}
}
-#endif
return;
}
@@ -6124,10 +6121,9 @@ stub_final_touch(LoaderState* stp, BeamInstr* fp)
[{Adr, Patchtyppe} | Addresses]
and the address of a fun_entry.
*/
-int
+static int
patch(Eterm Addresses, Uint fe)
{
-#ifdef HIPE
Eterm* listp;
Eterm tuple;
Eterm* tp;
@@ -6163,15 +6159,13 @@ patch(Eterm Addresses, Uint fe)
}
-#endif
return 1;
}
-int
+static int
patch_funentries(Eterm Patchlist)
{
-#ifdef HIPE
while (!is_nil(Patchlist)) {
Eterm Info;
Eterm MFA;
@@ -6260,18 +6254,15 @@ patch_funentries(Eterm Patchlist)
return 0;
}
-#endif
return 1; /* Signal that all went well */
}
-
/*
* Do a dummy load of a module. No threaded code will be loaded.
* Used for loading native code.
* Will also patch all references to fun_entries to point to
* the new fun_entries created.
*/
-
Eterm
erts_make_stub_module(Process* p, Eterm hipe_magic_bin, Eterm Beam, Eterm Info)
{
@@ -6444,11 +6435,7 @@ erts_make_stub_module(Process* p, Eterm hipe_magic_bin, Eterm Beam, Eterm Info)
* as the body until we know what kind of trap we should put there.
*/
code_hdr->functions[i] = fp;
-#ifdef HIPE
op = (Eterm) BeamOpCode(op_hipe_trap_call); /* Might be changed later. */
-#else
- op = (Eterm) BeamOpCode(op_move_return_n);
-#endif
fp = make_stub(fp, hipe_stp->module, func, arity, (Uint)native_address,
op);
}
@@ -6580,6 +6567,8 @@ int erts_commit_hipe_patch_load(Eterm hipe_magic_bin)
}
#undef WORDS_PER_FUNCTION
+#endif /* HIPE */
+
static int safe_mul(UWord a, UWord b, UWord* resp)
{